- Timestamp:
- Jun 12, 2012, 1:27:14 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Subscribe_to_comments/include/functions.inc.php
r15641 r15648 157 157 158 158 // check email 159 if ( !empty($email) and !is_valid_email($email) ) 160 { 161 array_push($page['errors'], l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)')); 162 return false; 163 } 159 164 if ( ( is_a_guest() or empty($user['email']) ) and empty($email) ) 160 165 { … … 679 684 680 685 /** 686 * check if mail adress is valid 687 * @param: string email 688 * @return: bool 689 */ 690 function is_valid_email($mail_address) 691 { 692 if (version_compare(PHP_VERSION, '5.2.0') >= 0) 693 { 694 return filter_var($mail_address, FILTER_VALIDATE_EMAIL)!==false; 695 } 696 else 697 { 698 $atom = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]'; // before arobase 699 $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name 700 $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; 701 702 if (!preg_match($regex, $mail_address)) return false; 703 return true; 704 } 705 } 706 707 708 /** 681 709 * crypt a string using mcrypt extension or 682 710 * http://stackoverflow.com/questions/800922/how-to-encrypt-string-without-mcrypt-library-in-php/802957#802957
Note: See TracChangeset
for help on using the changeset viewer.