X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Fuser_functions.php;h=f1d1f1c5e2638f79bf1a142e2a4f1d15098ece93;hp=838c8db00f5cd1fd4f62f09b2c4eebb63373706d;hb=330dbb3e2b34450cd1665497506455e195a0a166;hpb=03486c08011d4c233e2455c8e5335ecc0818333f diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 838c8db00f..f1d1f1c5e2 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -103,7 +103,7 @@ function addSortLinks ($letter, $sortby, $colspan, $return=false) { // Prepare array with all possible sorters $list = array( - 'userid' => '{--_UID--}', + 'userid' => '{--_USERID--}', 'family' => '{--FAMILY--}', 'email' => '{--EMAIL--}', 'REMOTE_ADDR' => '{--REMOTE_IP--}' @@ -329,18 +329,25 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p // No login bonus by default $GLOBALS['bonus_payed'] = false; - // Probe for last online timemark - $probe = time() - getUserData('last_online'); - if (getUserData('last_login') > 0) $probe = time() - getUserData('last_login'); + // Is bonus up-to-date? + if (isExtensionInstalledAndNewer('bonus', '0.2.2')) { + // Probe for last online timemark + $probe = time() - getUserData('last_online'); + if (getUserData('last_login') > 0) { + // Use timestamp from last login + $probe = time() - getUserData('last_login'); + } // END - if - if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && ($probe >= getConfig('login_timeout'))) { - // Add login bonus to user's account - $add = ', `login_bonus`=`login_bonus`+{?login_bonus?}'; - $GLOBALS['bonus_payed'] = true; + // Is the timeout reached? + if ($probe >= getConfig('login_timeout')) { + // Add login bonus to user's account + $add = ', `login_bonus`=`login_bonus`+{?login_bonus?}'; + $GLOBALS['bonus_payed'] = true; - // Subtract login bonus from userid's account or jackpot - if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD')) { - handleBonusPoints('login_bonus'); + // Subtract login bonus from userid's account or jackpot + if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD')) { + handleBonusPoints('login_bonus'); + } // END - if } // END - if } // END - if @@ -379,7 +386,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p $errorCode = getCode('COOKIES_DISABLED'); } } elseif (isExtensionInstalledAndNewer('sql_patches', '0.6.1')) { - // Update failture counter + // Update failure counter SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `login_failures`=`login_failures`+1,`last_failure`=NOW() WHERE `userid`=%s LIMIT 1", array($userid), __FUNCTION__, __LINE__); @@ -406,7 +413,9 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p $url = $errorUrl . $errorCode; // Extension set? Then add it as well. - if (!empty($ext)) $url .= '&ext=' . $ext; + if (!empty($ext)) { + $url .= '&ext=' . $ext; + } // END - if } // END - if // Return URL @@ -451,7 +460,7 @@ function doNewUserPassword ($email, $userid) { array(generateHash($NEW_PASS), $userid), __FUNCTION__, __LINE__); // Prepare data and message for email - $message = loadEmailTemplate('new-pass', array('new_pass' => $NEW_PASS, 'nickname' => $userid), $userid); + $message = loadEmailTemplate('guest_new_password', array('new_pass' => $NEW_PASS, 'nickname' => $userid), $userid); // ... and send it away sendEmail($userid, '{--GUEST_NEW_PASSWORD--}', $message); @@ -485,7 +494,7 @@ function getEpocheTimeFromUserStats ($statsType, $statsData, $userid = '0') { } // END - if // Is the extension installed and updated? - if ((!isExtensionActive('sql_patches')) || (isExtensionOlder('sql_patches', '0.5.6'))) { + if ((!isExtensionActive('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.6'))) { // Return zero here return $data['inserted']; } // END - if @@ -522,7 +531,7 @@ LIMIT 1", // Inserts user stats function insertUserStatsRecord ($userid, $statsType, $statsData) { // Is the extension installed and updated? - if ((!isExtensionActive('sql_patches')) || (isExtensionOlder('sql_patches', '0.5.6'))) { + if ((!isExtensionActive('sql_patches')) || (isExtensionInstalledAndOlder('sql_patches', '0.5.6'))) { // Return zero here return false; } // END - if @@ -585,7 +594,7 @@ LIMIT 1", // Was it updated? if (!SQL_HASZEROAFFECTED()) { // Send email if updated - $message = loadEmailTemplate('confirm-member', $content, bigintval($userid)); + $message = loadEmailTemplate('guest_user_confirmed', $content, bigintval($userid)); // And send him right away the confirmation mail sendEmail($email, '{--GUEST_THANX_CONFIRM--}', $message); @@ -680,7 +689,7 @@ function doResendUserConfirmationLink ($email) { // This is different to translateUserStatus() in text messages. function getConfirmationMessageFromUserStatus ($status) { // Default is 'UNKNOWN' - $message = getMaskedMessage('GUEST_LOGIN_ID_UNKNOWN_STATUS', $status); + $message = '{%message,GUEST_LOGIN_ID_UNKNOWN_STATUS=' . $status . '%}'; // Which status is it? switch ($status) {