* $Date:: $ *
* $Tag:: 0.2.1-FINAL $ *
* $Author:: $ *
- * Needs to be in all Files and every File needs "svn propset *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* 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 *
} // END - foreach
// Add list and colspan
- $content['list'] = substr($OUT, 0, -13);
+ $content['list'] = substr($OUT, 0, -1);
$content['colspan2'] = $colspan;
// Load template
// @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')) {
// 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
$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));
// 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
// 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
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);
}
} else {
// id or email is wrong
- loadTemplate('admin_settings_saved', false, '<span class="guest_failed">{--GUEST_WRONG_ID_EMAIL--}</span>');
+ displayMessage('<span class="notice">{--GUEST_WRONG_ID_EMAIL--}</span>');
}
// Return the error code
}
// 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';
} // 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(
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));
}
// Load template
- loadTemplate('admin_settings_saved', false, $content['message']);
+ displayMessage($content['message']);
}
// Does resend the user's confirmation link for given email address
function doResendUserConfirmationLink ($email) {
+ // Email address not registered is default message
+ $message = '{--EMAIL_404--}';
+
// Confirmation link requested
if (fetchUserData($email, 'email')) {
// Email address found
$content = getUserDataArray();
- // Detect status
- switch ($content['status']) {
- case 'UNCONFIRMED': // Account not confirmed
- // Load email template
- $message = loadEmailTemplate('guest_request_confirm', array('hash' => $content['user_hash']), $content['userid']);
+ // Is the account unconfirmed?
+ if ($content['status'] == 'UNCONFIRMED') {
+ // Load email template
+ $message = loadEmailTemplate('guest_request_confirm', array('hash' => $content['user_hash']), $content['userid']);
- // Send email
- sendEmail($email, '{--REQUEST_CONFIRM_LINK_SUBJECT--}', $message);
+ // Send email
+ sendEmail($email, '{--GUEST_REQUEST_CONFIRM_LINK_SUBJECT--}', $message);
+ } // END - if
- // And set message
- $content['message'] = '{--CONFIRM_LINK_SENT--}';
- break;
+ // Create message based on the status
+ $message = getConfirmationMessageFromUserStatus($content['status']);
+ } // END - if
- case 'CONFIRMED': // Account already confirmed
- $content['message'] = '{--LOGIN_ID_CONFIRMED--}';
- break;
+ // Output message
+ displayMessage($message);
+}
- case 'LOCKED': // Account is locked
- $content['message'] = '{--LOGIN_ID_LOCKED--}';
- break;
- } // END - switch
- } else {
- // Email address not registered
- $content['message'] = '{--EMAIL_404--}';
- }
+// Get a message (somewhat translation) from user status for confirmation link.
+// This is different to translateUserStatus() in text messages.
+function getConfirmationMessageFromUserStatus ($status) {
+ // Default is 'UNKNOWN'
+ $message = getMaskedMessage('GUEST_LOGIN_ID_UNKNOWN_STATUS', $status);
+
+ // Which status is it?
+ switch ($status) {
+ case 'UNCONFIRMED': // Account is unconfirmed
+ // And set message
+ $message = '{--GUEST_CONFIRM_LINK_SENT--}';
+ break;
+
+ case 'CONFIRMED': // Account already confirmed
+ $message = '{--GUEST_LOGIN_ID_CONFIRMED--}';
+ break;
+
+ case 'LOCKED': // Account is locked
+ $message = '{--GUEST_LOGIN_ID_LOCKED--}';
+ break;
+
+ default: // This should not happen
+ debug_report_bug(__FUNCTION__, __LINE__, 'Unknown user status ' . $status . ' detected.');
+ break;
+ } // END - switch
+
+ // Return message
+ return $message;
}
// Expression call-back function for fetching user 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]
?>