From 0da4efca52cd97ed8b385d81ae03125698f55e93 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 9 Nov 2009 03:05:04 +0000 Subject: [PATCH] isNicknameUsed() does no longer check for ext-nickname --- inc/functions.php | 4 ++-- inc/libs/user_functions.php | 17 ++++++++++------- inc/modules/guest/what-login.php | 2 +- inc/reset/reset_beg.php | 4 +--- inc/wrapper-functions.php | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 5ebcaebce1..fc03e66c9f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -439,7 +439,7 @@ function loadEmailTemplate ($template, $content = array(), $UID = '0') { //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):UID={$UID},template={$template},content[]=".gettype($content).'
'); if (($UID > 0) && (is_array($content))) { // If nickname extension is installed, fetch nickname as well - if (isNicknameUsed($UID)) { + if ((isExtensionActive('nickname')) && (isNicknameUsed($UID))) { //* DEBUG: */ outputHtml(__FUNCTION__."(".__LINE__."):NICKNAME!
"); // Load by nickname fetchUserData($UID, 'nickname'); @@ -3181,7 +3181,7 @@ function determineReferalId () { $found = false; // Do we have nickname or userid set? - if (isNicknameUsed($GLOBALS['refid'])) { + if ((isExtensionActive('nickname')) && (isNicknameUsed($GLOBALS['refid']))) { // Nickname in URL, so load the id $found = fetchUserData($GLOBALS['refid'], 'nickname'); } elseif ($GLOBALS['refid'] > 0) { diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 3fd3570e6c..e967ca4cf2 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -281,20 +281,23 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p ); // Check login data - if ((isExtensionActive('nickname')) && (isNicknameOrUserid($userid))) { + if ((isExtensionActive('nickname')) && (isNicknameUsed($userid))) { // Nickname entered fetchUserData($userid, 'nickname'); + } elseif (isNicknameUsed($userid)) { + // No nickname installed + $errorCode = getCode('EXTENSION_PROBLEM'); } else { // Direct userid entered fetchUserData($userid); } - // Load entry - $content = getUserDataArray(); - if (!empty($content['userid'])) $userid = bigintval($content['userid']); - // Is there an entry? - if ((isUserDataValid()) && (getUserData('status') == 'CONFIRMED') && ((isNicknameUsed($content['userid'] === true) && (!empty($content['userid']))) || ($content['userid'] == $userid))) { + if (((isUserDataValid()) && (getUserData('status') == 'CONFIRMED') && (!empty($content['userid']))) || ($content['userid'] == $userid)) { + // Load entry + $content = getUserDataArray(); + if (!empty($content['userid'])) $userid = bigintval($content['userid']); + // Check for old MD5 passwords if ((strlen($content['password']) == 32) && (md5($passwd) == $content['password'])) { // Just set the hash to the password from DB... :) @@ -372,7 +375,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p // Wrong password! $errorCode = getCode('WRONG_PASS'); } - } elseif (((isNicknameUsed($content['userid'])) && (!empty($content['userid']))) || ($content['userid'] == $userid)) { + } elseif (((isExtensionActive('nickname')) && (isNicknameUsed($content['userid'])) && (!empty($content['userid']))) || ($content['userid'] == $userid)) { // Other account status? if (fetchUserData($userid)) { // Create an error code from given status diff --git a/inc/modules/guest/what-login.php b/inc/modules/guest/what-login.php index 8fca859c58..4db7500c07 100644 --- a/inc/modules/guest/what-login.php +++ b/inc/modules/guest/what-login.php @@ -63,7 +63,7 @@ if ((isMemberIdSet()) && (isSessionVariableSet('u_hash'))) { $userid = getMemberId(); } elseif ((isPostRequestElementSet('id')) && (isPostRequestElementSet('password')) && (isFormSent())) { // Set userid and crypt password when login data was submitted - if (isNicknameUsed(postRequestElement('id'))) { + if ((isExtensionActive('nickname')) && (isNicknameUsed(postRequestElement('id')))) { // Nickname entered $userid = SQL_ESCAPE(postRequestElement('id')); } else { diff --git a/inc/reset/reset_beg.php b/inc/reset/reset_beg.php index cc6dac75e4..3d73e431de 100644 --- a/inc/reset/reset_beg.php +++ b/inc/reset/reset_beg.php @@ -47,9 +47,7 @@ if (!defined('__SECURITY')) { if ((getOutputMode() != 0) || (!isResetModeEnabled()) || (getConfig('beg_rallye') == 'Y')) return; //* DEBUG: */ outputHtml(basename(__FILE__)."
"); -// Reset accounts -$result = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `beg_points`=0.00000 WHERE `beg_points` > 0", - __FILE__, __LINE__); +// @TODO This should be converted in a daily beg rallye // [EOF] ?> diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index bac74d3755..1ecde45134 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -440,7 +440,7 @@ function isNicknameUsed ($userid) { $isUsed = $GLOBALS['is_nickname_used'][$userid]; } else { // Determine it - $isUsed = ((isExtensionActive('nickname')) && (('' . round($userid) . '') != $userid)); + $isUsed = (('' . round($userid) . '') != $userid); // And write it to the cache $GLOBALS['is_nickname_used'][$userid] = $isUsed; -- 2.30.2