From: Roland Häder Date: Fri, 29 Jul 2011 10:00:13 +0000 (+0000) Subject: Search for email with regular expression X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6989412ec2be23ffb4febbba8924db25ce1ac113;p=mailer.git Search for email with regular expression --- diff --git a/inc/filters.php b/inc/filters.php index c24ca0c736..2737ceca3b 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -1150,7 +1150,7 @@ function FILTER_ADD_HISTORY_ENTRY ($filterData) { __FUNCTION__, __LINE__); // Remember insert id for other filters - $filterData['history_id'] = SQL_INSERT_ID(); + $filterData['history_id'] = SQL_INSERTID(); // Return data return $filterData; diff --git a/inc/functions.php b/inc/functions.php index 0f96686c20..a452aab357 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -92,7 +92,7 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' } // END - if // Set from header - if ((!isInStringIgnoreCase('@', $toEmail)) && ($toEmail > 0)) { + if ((!isInStringIgnoreCase('@', str_replace('{AT}', '@', $toEmail))) && ($toEmail > 0)) { // Does the user exist? if ((isExtensionActive('user')) && (fetchUserData($toEmail))) { // Get the email diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 2b7c2de652..5338cbdf59 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -138,13 +138,13 @@ function isAdminsAllowedByAcl ($action, $what) { // Create email link to admins's account function generateAdminEmailLink ($email, $mod = 'admin') { // Is it an email? - if (strpos($email, '@') !== false) { + if (strpos(str_replace('{AT}', '@', $email), '@') !== false) { // Create email link $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins` WHERE - `email`='%s' + '%s' REGEXP `email` LIMIT 1", array($email), __FUNCTION__, __LINE__); diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index 77e0654db9..48fabe24ea 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -535,7 +535,8 @@ function generateSponsorEmailLink ($email, $mod = 'admin') { FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE - `email`='%s'" . $locked." + '%s' REGEXP `email` + " . $locked . " LIMIT 1", array($email), __FUNCTION__, __LINE__); if (SQL_NUMROWS($result) == 1) { @@ -565,7 +566,7 @@ function doProcessSponsorFormRequest ($messageArray = array()) { switch ($status) { case 'added': // Sponsor successfully added with account status = UNCONFIRMED! // Check for his id number - $result = SQL_QUERY_ESC("SELECT `id`,`hash` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `email`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id`,`hash` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE '%s' REGEXP `email` LIMIT 1", array(postRequestParameter('email')), __FUNCTION__, __LINE__); if (SQL_NUMROWS($result) == 1) { // id found so let's load it for the confirmation email diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 33fa5067ce..e4cd9e48b4 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -192,16 +192,22 @@ function generateUserEmailLink ($email, $mod = 'admin') { $locked = " AND `status`='CONFIRMED'"; // But admins shall always see it - if (isAdmin()) $locked = ''; + if (isAdmin()) { + $locked = ''; + } // END - if + // Search for the email address $result = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE - `email`='%s'" . $locked." + '%s' REGEXP `email` + " . $locked . " LIMIT 1", array($email), __FUNCTION__, __LINE__); + + // Do we have an entry? if (SQL_NUMROWS($result) == 1) { // Load userid list($userid) = SQL_FETCHROW($result); diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 9cba381f1d..308939d9b8 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -1410,7 +1410,7 @@ function sendAdminPasswordResetLink ($email) { $OUT = ''; // Look up administator login - $result = SQL_QUERY_ESC("SELECT `id`,`login`,`password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `email`='%s' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `id`,`login`,`password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE '%s' REGEXP `email` LIMIT 1", array($email), __FUNCTION__, __LINE__); // Is there an account? diff --git a/inc/modules/guest/what-sponsor_login.php b/inc/modules/guest/what-sponsor_login.php index fe65aaf38e..d58af71f6e 100644 --- a/inc/modules/guest/what-sponsor_login.php +++ b/inc/modules/guest/what-sponsor_login.php @@ -161,7 +161,7 @@ LIMIT 1", FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE - `email`='%s' AND + '%s' REGEXP `email` AND (`status`='UNCONFIRMED' OR `status`='EMAIL') LIMIT 1", array(postRequestParameter('email')), __FILE__, __LINE__); @@ -212,7 +212,7 @@ LIMIT 1", FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE - `email`='%s' AND + '%s' REGEXP `email` AND `id`=%s AND `status`='CONFIRMED' LIMIT 1",