| 1 |
<?php
|
| 2 |
// $Id: email_verify.module,v 1.7.2.1 2007/06/11 16:34:41 augustin Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Verifies thoroughly that email addresses are correctly entered
|
| 6 |
* Copyright: Daniel Bonniot <bonniot@users.sourceforge.net>
|
| 7 |
* License: GNU GPL v2 or later
|
| 8 |
*/
|
| 9 |
|
| 10 |
/**
|
| 11 |
* Implementation of hook_help().
|
| 12 |
* @return
|
| 13 |
* Help text for section.
|
| 14 |
*/
|
| 15 |
function email_verify_help($path, $arg) {
|
| 16 |
if ($path == 'admin/help#email_verify') {
|
| 17 |
$txt = 'This module verifies that email addresses are valid during account registration or edit.';
|
| 18 |
return '<p>'. t($txt) .'</p>';
|
| 19 |
}
|
| 20 |
}
|
| 21 |
|
| 22 |
/**
|
| 23 |
* Implementation of hook_user().
|
| 24 |
*/
|
| 25 |
function email_verify_user($op, &$edit, &$account, $category = NULL) {
|
| 26 |
if ($op == 'validate' && $category == 'account') {
|
| 27 |
return email_verify_edit_validate(arg(1), $edit);
|
| 28 |
}
|
| 29 |
}
|
| 30 |
|
| 31 |
function email_verify_edit_validate($uid, &$edit) {
|
| 32 |
// Validate the e-mail address:
|
| 33 |
if ($error = email_verify_check($edit['mail'])) {
|
| 34 |
form_set_error('mail', $error);
|
| 35 |
}
|
| 36 |
return $edit;
|
| 37 |
}
|
| 38 |
|
| 39 |
/**
|
| 40 |
* Verifies whether the given mail address exists.
|
| 41 |
* @param $mail
|
| 42 |
* Email address to verify.
|
| 43 |
* @return
|
| 44 |
* NULL if the address exists, or an error message if we found a problem with the address.
|
| 45 |
*/
|
| 46 |
function email_verify_check($mail) {
|
| 47 |
include_once dirname(__FILE__) .'/email_verify.inc.php';
|
| 48 |
return _email_verify_check($mail);
|
| 49 |
}
|
| 50 |
|
| 51 |
/**
|
| 52 |
* Implementation of hook_menu().
|
| 53 |
*/
|
| 54 |
function email_verify_menu() {
|
| 55 |
$items['email_verify'] = array(
|
| 56 |
'title' => 'Verify user emails',
|
| 57 |
'page callback' => 'email_verify_checkall',
|
| 58 |
'access arguments' => array('access content'),
|
| 59 |
'type' => MENU_CALLBACK,
|
| 60 |
'file' => 'email_verify.check.inc',
|
| 61 |
);
|
| 62 |
return $items;
|
| 63 |
}
|
| 64 |
|
| 65 |
// Local Variables:
|
| 66 |
// mode: php
|
| 67 |
// End:
|