From: Tony M. <cl...@us...> - 2004-04-02 02:41:01
|
Update of /cvsroot/phpwebsite-comm/modules/mailto/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6730/mailto/class Modified Files: Mailto.php Log Message: Fixed problems with email validation. Some typos. Index: Mailto.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/mailto/class/Mailto.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Mailto.php 29 Mar 2004 21:08:04 -0000 1.2 --- Mailto.php 2 Apr 2004 02:28:57 -0000 1.3 *************** *** 46,50 **** if($_SESSION['OBJ_user']->allow_access("mailto", "view")) { $form = new EZForm("mailto_view"); ! $form->add("MT_URL", "text", "<a href=\"index.php?module=mailto&PHPWS_MAN_ITEMS[]=".$this->getID()."&MT_MAN_OP=mail\">Link text</a>"); $form->setSize("MT_URL", 80); $form->add("module", "hidden", "mailto"); --- 46,50 ---- if($_SESSION['OBJ_user']->allow_access("mailto", "view")) { $form = new EZForm("mailto_view"); ! $form->add("MT_URL", "text", "<a href=\"index.php?module=mailto&PHPWS_MAN_ITEMS[]=".$this->getID()."&MT_MAN_OP=mail\">Link text</a>"); $form->setSize("MT_URL", 80); $form->add("module", "hidden", "mailto"); *************** *** 169,178 **** if($this->_reqlogin == 0) { if(isset($_SESSION['OBJ_user']->username)) { ! $form->add("MT_FROM", "text", $_SESSION['OBJ_user']->username." <".$_SESSION['OBJ_user']->email.">"); } else { $form->add("MT_FROM", "text", $this->_from); } } else { ! $form->add("MT_FROM", "hidden", $_SESSION['OBJ_user']->username." <".$_SESSION['OBJ_user']->email.">"); } $form->setSize("MT_FROM", 30); --- 169,180 ---- if($this->_reqlogin == 0) { if(isset($_SESSION['OBJ_user']->username)) { ! //$form->add("MT_FROM", "text", $_SESSION['OBJ_user']->username." <".$_SESSION['OBJ_user']->email.">"); ! $form->add("MT_FROM", "text", $_SESSION['OBJ_user']->email); } else { $form->add("MT_FROM", "text", $this->_from); } } else { ! //$form->add("MT_FROM", "hidden", $_SESSION['OBJ_user']->username." <".$_SESSION['OBJ_user']->email.">"); ! $form->add("MT_FROM", "text", $_SESSION['OBJ_user']->email); } $form->setSize("MT_FROM", 30); *************** *** 200,204 **** if($this->_reqlogin <> 0) { ! $tags["MT_FROM"] = $_SESSION['OBJ_user']->username." <".$_SESSION['OBJ_user']->email.">"; } --- 202,207 ---- if($this->_reqlogin <> 0) { ! //$tags["MT_FROM"] = $_SESSION['OBJ_user']->username." <".$_SESSION['OBJ_user']->email.">"; ! $tags["MT_FROM"] = $_SESSION['OBJ_user']->email; } *************** *** 314,318 **** if(is_string($address)) { if(strlen($address) > 0) { ! $this->_address = PHPWS_Text::parseOutput($address); return TRUE; } else { --- 317,322 ---- if(is_string($address)) { if(strlen($address) > 0) { ! //$this->_address = PHPWS_Text::parseOutput($address); ! $this->_address; return TRUE; } else { *************** *** 348,352 **** function getAddress() { if(isset($this->_address) && strlen($this->_address) > 0) { ! return PHPWS_Text::parseOutput($this->_address); } else { return NULL; --- 352,357 ---- function getAddress() { if(isset($this->_address) && strlen($this->_address) > 0) { ! // return PHPWS_Text::parseOutput($this->_address); ! return $this->_address; } else { return NULL; *************** *** 355,372 **** function setFrom($from) { ! if (strstr("<", $from) && !strstr(">", $from)) $from .= ">"; ! if (!(list($name, $email) = split("<", $from, 2))) $email = $from; ! $email = str_replace(">", "", $email); ! if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2}[mtgvu]?$", $email, $check)) { ! if ( getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) ) { $this->_from = $from; return true; } else { ! $message = $_SESSION["translate"]->it("E-mail address does not appear to be set up properly"); return new PHPWS_Error("mailto", "PHPWS_Mailto::mailit", $message); // echo 'MX record not found for email: '.$email; } } else { ! $message = $_SESSION["translate"]->it("E-mail address is badly formed. It must be either of the form <i>Your Name <yo...@na...></i> or <i>yo...@na...</i>. Please correct it and try again."); return new PHPWS_Error("mailto", "PHPWS_Mailto::mailit", $message); } --- 360,375 ---- function setFrom($from) { ! if (PHPWS_Text::isValidInput($from, "email")){ ! if ( $from == $_SESSION["from"] && getmxrr(substr(strstr($from, '@'), 1), $validate_email_temp) ) { $this->_from = $from; return true; } else { ! $_SESSION["from"] = $from; ! $message = $_SESSION["translate"]->it("E-mail address does not appear to be set up properly. If you are sure this is a valid e-mail address, press [Mail it!], otherwise, correct it and try again."); return new PHPWS_Error("mailto", "PHPWS_Mailto::mailit", $message); // echo 'MX record not found for email: '.$email; } } else { ! $message = $_SESSION["translate"]->it("E-mail address is badly formed. It must be of the form <em>you...@do...</em>. Please correct it and try again."); return new PHPWS_Error("mailto", "PHPWS_Mailto::mailit", $message); } *************** *** 375,379 **** function getFrom() { if(isset($this->_from) && strlen($this->_from) > 0) { ! return PHPWS_Text::parseOutput($this->_from); } else { return NULL; --- 378,383 ---- function getFrom() { if(isset($this->_from) && strlen($this->_from) > 0) { ! //return PHPWS_Text::parseOutput($this->_from); ! return $this->_from; } else { return NULL; |