mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-21475 weblib: Simplify validate_email() to use existing function.
This commit is contained in:
parent
124999563a
commit
4b71e99564
2 changed files with 140 additions and 16 deletions
|
@ -1104,13 +1104,10 @@ function page_get_doc_link_path(moodle_page $page) {
|
|||
* @return boolean
|
||||
*/
|
||||
function validate_email($address) {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir.'/phpmailer/moodle_phpmailer.php');
|
||||
|
||||
return (bool)preg_match('#^[-!\#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+'.
|
||||
'(\.[-!\#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+)*'.
|
||||
'@'.
|
||||
'[-!\#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
|
||||
'[-!\#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$#',
|
||||
$address);
|
||||
return moodle_phpmailer::validateAddress($address);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue