X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Fuser_functions.php;h=7c23a241634c11b1cb00b19d74a796893f0c2913;hp=fa1dbf233623e934d7bca76d7f95dff60c2dcdec;hb=f89ab3d6301df13ebaf61a079d86a7f5047df915;hpb=db0c6702086eea2c44d0aae1702dc2e77a0afc4e diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index fa1dbf2336..7c23a24163 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); @@ -475,7 +484,7 @@ function doNewUserPassword ($email, $userid) { } // Get timestamp for given stats type and data -function getTimestampFromUserStats ($statsType, $statsData, $userid = '0') { +function getEpocheTimeFromUserStats ($statsType, $statsData, $userid = '0') { // Default timestamp is zero $data['inserted'] = '0'; @@ -485,7 +494,7 @@ function getTimestampFromUserStats ($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,13 +531,13 @@ 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 // Does it exist? - if ((!getTimestampFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) { + if ((!getEpocheTimeFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) { // Then insert it! SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')", array( @@ -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); @@ -742,5 +751,23 @@ function doExpressionUser ($data) { return $code; } +// Template call-back function for list_user admin function +function doTemplateAdminListUserTitle ($template, $dummy = false) { + // Init title with "all accounts" + $code = '{--ADMIN_LIST_ALL_ACCOUNTS--}'; + + // Do we have a 'status' or 'mode' set? + if (isGetRequestParameterSet('status')) { + // Set title according to the 'status' + $code = sprintf("{--ADMIN_LIST_STATUS_%s_ACCOUNTS--}", strtoupper(getRequestParameter('status'))); + } elseif (isGetRequestParameterSet('mode')) { + // Set title according to the "mode" + $code = sprintf("{--ADMIN_LIST_MODE_%s_ACCOUNTS--}", strtoupper(getRequestParameter('mode'))); + } + + // Return the code + return $code; +} + // [EOF] ?>