X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Flibs%2Fuser_functions.php;h=7c23a241634c11b1cb00b19d74a796893f0c2913;hb=f89ab3d6301df13ebaf61a079d86a7f5047df915;hp=4f68201ea3d445d7a8c571341cdf1b8a15e1133f;hpb=c3b4eaf29946349ff058691db2dcb615a5379bb2;p=mailer.git
diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php
index 4f68201ea3..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__);
@@ -393,7 +400,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
@@ -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,13 +460,13 @@ 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);
// 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);
@@ -467,7 +476,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
@@ -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);
@@ -646,7 +655,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
@@ -673,7 +682,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.
@@ -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]
?>