X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Flibs%2Fuser_functions.php;h=fa1dbf233623e934d7bca76d7f95dff60c2dcdec;hb=db0c6702086eea2c44d0aae1702dc2e77a0afc4e;hp=38b1ae248e0a050f1d8549dbcf723959ff5df5da;hpb=5bb45d38458106175065810aaf993fd15af1d8e4;p=mailer.git diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 38b1ae248e..fa1dbf2336 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * Copyright (c) 2009 - 2011 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -232,7 +232,7 @@ LIMIT 1", // @TODO Double-check configuration entry here function determineRandomReferalId () { // Default is zero refid - $refid = '0'; + $refid = null; // Is the extension version fine? if (isExtensionInstalledAndNewer('user', '0.3.4')) { @@ -253,8 +253,8 @@ function determineRandomReferalId () { // Use that userid as new referal id list($refid) = SQL_FETCHROW($result); - // Reset this user's counter - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0 WHERE `userid`=%s LIMIT 1", + // Reset all users, this makes this random referal id more challenging + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `rand_confirmed`=0", array($refid), __FUNCTION__, __LINE__); } // END - if @@ -339,7 +339,9 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p $GLOBALS['bonus_payed'] = true; // Subtract login bonus from userid's account or jackpot - if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getConfig('bonus_mode') != 'ADD')) handleBonusPoints('login_bonus'); + if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD')) { + handleBonusPoints('login_bonus'); + } // END - if } // END - if // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON)); @@ -353,7 +355,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p // Update database records SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `total_logins`=`total_logins`+1" . $add . " WHERE `userid`=%s LIMIT 1", array($userid), __FUNCTION__, __LINE__); - if (SQL_AFFECTEDROWS() == 1) { + if (!SQL_HASZEROAFFECTED()) { // Is a success URL set? if (empty($successUrl)) { // Procedure to checking for login data @@ -391,7 +393,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p // Set userid in session setSession('current_userid', getUserData('userid')); } elseif (!isUserDataValid()) { - // User id not found! + // User id not found $errorCode = getCode('WRONG_ID'); } else { // Unknown error @@ -455,7 +457,7 @@ function doNewUserPassword ($email, $userid) { sendEmail($userid, '{--GUEST_NEW_PASSWORD--}', $message); // Output note to user - loadTemplate('admin_settings_saved', false, '{--GUEST_NEW_PASSWORD_SEND--}'); + displayMessage('{--GUEST_NEW_PASSWORD_SEND--}'); } else { // Account is locked or unconfirmed $errorCode = generateErrorCodeFromUserStatus($status); @@ -465,7 +467,7 @@ function doNewUserPassword ($email, $userid) { } } else { // id or email is wrong - loadTemplate('admin_settings_saved', false, '{--GUEST_WRONG_ID_EMAIL--}'); + displayMessage('{--GUEST_WRONG_ID_EMAIL--}'); } // Return the error code @@ -581,7 +583,7 @@ LIMIT 1", array($hash), __FILE__, __LINE__); // Was it updated? - if (SQL_AFFECTEDROWS() == 1) { + if (!SQL_HASZEROAFFECTED()) { // Send email if updated $message = loadEmailTemplate('confirm-member', $content, bigintval($userid)); @@ -644,7 +646,7 @@ LIMIT 1", } // Load template - loadTemplate('admin_settings_saved', false, $content['message']); + displayMessage($content['message']); } // Does resend the user's confirmation link for given email address @@ -671,7 +673,7 @@ function doResendUserConfirmationLink ($email) { } // END - if // Output message - loadTemplate('admin_settings_saved', false, $message); + displayMessage($message); } // Get a message (somewhat translation) from user status for confirmation link.