| version 1.1, 2005/06/05 12:14:29 |
version 1.2, 2005/11/07 20:37:48 |
| Line 177 class Mail_RFC822 { |
|
| Line 177 class Mail_RFC822 { |
|
| $this->error = null; |
$this->error = null; |
| $this->index = null; |
$this->index = null; |
| |
|
| while ($this->address = $this->_splitAddresses($this->address)) { |
// Unfold any long lines in $this->address. |
| continue; |
$this->address = preg_replace('/\r?\n/', "\r\n", $this->address); |
| } |
$this->address = preg_replace('/\r\n(\t| )+/', ' ', $this->address); |
| |
|
| |
while ($this->address = $this->_splitAddresses($this->address)); |
| |
|
| if ($this->address === false || isset($this->error)) { |
if ($this->address === false || isset($this->error)) { |
| require_once 'PEAR.php'; |
require_once 'PEAR.php'; |
| Line 472 class Mail_RFC822 { |
|
| Line 474 class Mail_RFC822 { |
|
| for ($i = 0; $i < count($addresses); $i++) { |
for ($i = 0; $i < count($addresses); $i++) { |
| if (!$this->validateMailbox($addresses[$i])) { |
if (!$this->validateMailbox($addresses[$i])) { |
| if (empty($this->error)) { |
if (empty($this->error)) { |
| $this->error = 'Validation failed for "' . $addresses[$i] . '"'; |
$this->error = 'Validation failed for: ' . $addresses[$i]; |
| } |
} |
| return false; |
return false; |
| } |
} |
| Line 584 class Mail_RFC822 { |
|
| Line 586 class Mail_RFC822 { |
|
| // Leading and trailing " |
// Leading and trailing " |
| $qstring = substr($qstring, 1, -1); |
$qstring = substr($qstring, 1, -1); |
| |
|
| // Perform check. |
// Perform check, removing quoted characters first. |
| return !(preg_match('/(.)[\x0D\\\\"]/', $qstring, $matches) && $matches[1] != '\\'); |
return !preg_match('/[\x0D\\\\"]/', preg_replace('/\\\\./', '', $qstring)); |
| } |
} |
| |
|
| /** |
/** |
| Line 910 class Mail_RFC822 { |
|
| Line 912 class Mail_RFC822 { |
|
| */ |
*/ |
| function isValidInetAddress($data, $strict = false) |
function isValidInetAddress($data, $strict = false) |
| { |
{ |
| $regex = $strict ? '/^([.0-9a-z_-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i' : '/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i'; |
$regex = $strict ? '/^([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i' : '/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,4})$/i'; |
| if (preg_match($regex, trim($data), $matches)) { |
if (preg_match($regex, trim($data), $matches)) { |
| return array($matches[1], $matches[2]); |
return array($matches[1], $matches[2]); |
| } else { |
} else { |