From 3ef0c43348c8f735bab740e4a9b7bf8df26fbb00 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 22 Apr 2009 12:49:48 +0000 Subject: Get rid of ereg/split, replaced by preg equivalents --- it_mail.class | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'it_mail.class') diff --git a/it_mail.class b/it_mail.class index 9ab04bd..db3d9ea 100644 --- a/it_mail.class +++ b/it_mail.class @@ -197,7 +197,7 @@ function send() /* Automatically add doctype if none given */ - if ($this->body[IT_MAIL_HTML] && !eregi('^body[IT_MAIL_HTML])) + if ($this->body[IT_MAIL_HTML] && !preg_match('/^body[IT_MAIL_HTML])) { $this->body[IT_MAIL_HTML] = '' . "\n" . $this->body[IT_MAIL_HTML]; } @@ -344,7 +344,7 @@ function send_smtp_cmd($fp, $cmd, &$answer, $timeoutok = false, $failcode = 300) if (!$cmd || (!feof($fp) && fwrite($fp, "$cmd\r\n"))) { - while (!feof($fp) && ereg('^(...)(.?)(.*)$', fgets($fp, 1024), $regs)) + while (!feof($fp) && preg_match('/^(...)(.?)(.*)[\r\n]*$/', fgets($fp, 1024), $regs)) { $answer .= $regs[0]; $resultcode = intval($regs[1]); @@ -383,7 +383,7 @@ function check_email($email, $checkmailbox = true) $result = IT_MAIL_CHECKEMAIL_INVALID; /* Check if username starts with www. or not well-formed => reject */ - if (!ereg('^www\.', $email) && eregi('^[a-z0-9&_+.-]+@([a-z0-9.-]+\.[a-z]+)$', $email, $regs)) + if (!preg_match('/^www\./', $email) && preg_match('/^[a-z0-9&_+.-]+@([a-z0-9.-]+\.[a-z]+)$/i', $email, $regs)) { $domain = $regs[1]; @@ -423,7 +423,7 @@ function check_email($email, $checkmailbox = true) } } - if (eregi('@([a-z0-9.-]+\.[a-z]+)$', $from, $regs)) + if (preg_match('/@([a-z0-9.-]+\.[a-z]+)$/i', $from, $regs)) $fromdomain = $regs[1]; else $fromdomain = 'gna.ch'; @@ -452,7 +452,7 @@ function check_email($email, $checkmailbox = true) if (it_mail::send_smtp_cmd($fp, "RCPT TO: <$email>", $answer, $timeoutok, 500)) # 450 is often used for Greylisting $result = IT_MAIL_CHECKEMAIL_OK; - else if (eregi('quota|full|exceeded storage', $answer)) + else if (preg_match('/quota|full|exceeded storage/i', $answer)) $result = IT_MAIL_CHECKEMAIL_MAILBOXFULL; /* Do not try other MX if we got this far */ -- cgit v1.2.3