From 1b855e9de70a27ff0341d738f3d488c22894af7c Mon Sep 17 00:00:00 2001 From: dimka3210 Date: Mon, 6 Feb 2012 13:10:44 +0000 Subject: [PATCH] r359 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit При проверке мыла, если своё же, не возвращаем ошибку. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@359 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/config.php | 2 +- upload/includes/functions_validate.php | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/upload/config.php b/upload/config.php index 54f472b0a..bf6f45947 100644 --- a/upload/config.php +++ b/upload/config.php @@ -53,7 +53,7 @@ $bb_cfg = $tr_cfg = $page_cfg = array(); // Increase number of revision after update $bb_cfg['tp_version'] = '2.4 (beta)'; -$bb_cfg['tp_release_state'] = 'R358'; +$bb_cfg['tp_release_state'] = 'R359'; $bb_cfg['tp_release_date'] = '06-02-2012'; // Database diff --git a/upload/includes/functions_validate.php b/upload/includes/functions_validate.php index bb4d60e4d..1bb041202 100644 --- a/upload/includes/functions_validate.php +++ b/upload/includes/functions_validate.php @@ -68,7 +68,7 @@ function validate_username ($username, $check_ban_and_taken = true) // Check to see if email address is banned or already present in the DB function validate_email ($email, $check_ban_and_taken = true) { - global $lang; + global $lang, $userdata; if (!$email || !preg_match('#^([_a-z\d])[a-z\d\.\-_]+@[a-z\d\-]+\.([a-z\d\-]+\.)*?[a-z]{2,4}$#i', $email)) { @@ -97,9 +97,12 @@ function validate_email ($email, $check_ban_and_taken = true) $email_sql = DB()->escape($email); - if (DB()->fetch_row("SELECT 1 FROM ". BB_USERS ." WHERE user_email = '$email_sql' LIMIT 1")) - { - return $lang['EMAIL_TAKEN']; + if ($row = DB()->fetch_row("SELECT `user_email` FROM ". BB_USERS ." WHERE user_email = '$email_sql' LIMIT 1")) + { + if($row['user_email'] == $userdata['user_email']) + return false; + else + return $lang['EMAIL_TAKEN']; } }