Skip to content

Commit

Permalink
Fixed for compatibility with php 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeho committed Feb 24, 2010
1 parent e72f257 commit 960220c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions includes/qcodo/qform/EmailTextBox.class.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ class EmailTextBox extends QTextBox {
////////// //////////
public function Validate() { public function Validate() {
if (parent::Validate()) { if (parent::Validate()) {
if ($this->strText != "") { if (strlen(trim($this->strText))) {
// RegExp taken from php.net // RegExp taken from php.net
if ( !eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@([a-z0-9]+([\.-][a-z0-9]{1,})+)*$", $this->strText) ) { $this->strText = trim($this->strText);
$strEmailAddressArray = QEmailServer::GetEmailAddresses($this->strText);
if ((count($strEmailAddressArray) != 1) ||
(strtolower($strEmailAddressArray[0]) != strtolower($this->strText))) {
$this->strValidationError = "Invalid e-mail address"; $this->strValidationError = "Invalid e-mail address";
return false; return false;
} }
Expand Down

0 comments on commit 960220c

Please sign in to comment.