* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
* Copyright (c) 2009 - 2011 by Mailer Developer Team *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
* Copyright (c) 2009 - 2011 by Mailer Developer Team *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
-function alpha ($sortby, $colspan, $return=false) {
- if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', 0);
- $add = '&page=' . getRequestParameter('page').'&offset=' . getRequestParameter('offset');
- if (isGetRequestParameterSet('mode')) $add .= '&mode=' . getRequestParameter('mode');
+function alpha ($sortby) {
+ $add = '';
+ foreach (array('page','offset','mode','status') as $param) {
+ if (isGetRequestElementSet($param)) {
+ $add .= '&' . $param . '=' . getRequestElement($param);
+ } // END - if
+ } // END - foreach
/* Creates the list of letters and makes them a link. */
$alphabet = explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,');
$num = count($alphabet) - 1;
$OUT = '';
while (list($counter, $ltr) = each($alphabet)) {
/* Creates the list of letters and makes them a link. */
$alphabet = explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,');
$num = count($alphabet) - 1;
$OUT = '';
while (list($counter, $ltr) = each($alphabet)) {
- $OUT .= '<a href="{%url=modules.php?module=admin&what=' . getWhat();
- if (isGetRequestParameterSet('mode')) $OUT .= '&mode=' . getRequestParameter('mode');
- $OUT .= '&letter=' . $ltr . '&sortby=' . $sortby . $add . '%}">' . $ltr . '</a>';
+ $OUT .= '<a href="{%url=modules.php?module=admin&what=' . getWhat() . '&letter=' . $ltr . '&sortby=' . $sortby . $add . '%}">' . $ltr . '</a>';
'alpha_selection' => $OUT
);
// Load template
$OUT = loadTemplate('admin_list_user_alpha', true, $content);
'alpha_selection' => $OUT
);
// Load template
$OUT = loadTemplate('admin_list_user_alpha', true, $content);
- if (!isGetRequestParameterSet('offset')) setGetRequestParameter('offset', 0);
- if (!isGetRequestParameterSet('page')) setGetRequestParameter('page' , 0);
+ if (!isGetRequestElementSet('offset')) setGetRequestElement('offset', 0);
+ if (!isGetRequestElementSet('page')) setGetRequestElement('page' , 0);
- // Add status or mode
- if (isGetRequestParameterSet('status')) $add .= '&mode=' . getRequestParameter('status');
- elseif (isGetRequestParameterSet('mode')) $add .= '&mode=' . getRequestParameter('mode');
+ // Add status/ mode
+ foreach (array('mode','status') as $param) {
+ if (isGetRequestElementSet($param)) {
+ $add .= '&' . $param . '=' . getRequestElement($param);
+ } // END - if
+ } // END - foreach
-function addPageNavigation ($numPages, $offset, $showForm, $colspan, $return=false) {
- // @TODO These two constants are no longer used, maybe we reactivate this code?
- //if ($showForm === true) {
- // // Load form for changing number of lines
- // define('__FORM_HEADER', loadTemplate('admin_list_user_sort_form', true));
- // define('__FORM_FOOTER', '<tr><td colspan="'.$colspan.'" class="seperator bottom"> </td></tr>');
- //} else {
- // // Empty row
- // define('__FORM_HEADER', '<tr><td colspan="' . $colspan . '" class="seperator"> </td></tr>');
- // define('__FORM_FOOTER', '<tr><td colspan="' . $colspan . '" class="seperator bottom"> </td></tr>');
- //}
-
+function addPageNavigation ($numPages) {
+ // Start with empty content
- for ($page = 1; $page <= $numPages; $page++) {
- if (($page == getRequestParameter('page')) || ((!isGetRequestParameterSet('page')) && ($page == 1))) {
- $OUT .= '<strong>-';
- } else {
- if (!isGetRequestParameterSet('letter')) setGetRequestParameter('letter', '');
- if (!isGetRequestParameterSet('sortby')) setGetRequestParameter('sortby', 'userid');
- // Base link
- $OUT .= '<a href="{%url=modules.php?module=admin&what=' . getWhat();
+ // Create only the navigation if page count > 1
+ if ($numPages > 1) {
+ // Create navigation links for every page
+ for ($page = 1; $page <= $numPages; $page++) {
+ if (($page == getRequestElement('page')) || ((!isGetRequestElementSet('page')) && ($page == 1))) {
+ $OUT .= '<strong>-';
+ } else {
+ if (!isGetRequestElementSet('letter')) setGetRequestElement('letter', '');
+ if (!isGetRequestElementSet('sortby')) setGetRequestElement('sortby', 'userid');
- // Letter and so on
- $OUT .= '&letter=' . getRequestParameter('letter') . '&sortby=' . getRequestParameter('sortby') . '&page=' . $page . '&offset=' . $offset . '%}">';
- }
+ // Add status/mode
+ foreach (array('mode','status') as $param) {
+ if (isGetRequestElementSet($param)) {
+ $OUT .= '&' . $param . '=' . getRequestElement($param);
+ } // END - if
+ } // END - foreach
- // Load template
- $OUT = loadTemplate('admin_list_user_pagenav', true, $content);
- if ($return === true) {
- // Return code
- return $OUT;
- } else {
- // Output code
- outputHtml($OUT);
- }
+ // Add list output
+ $content['list'] = $OUT;
+
+ // Load template
+ $OUT = loadTemplate('admin_list_user_pagenav', true, $content);
+ } // END - if
+
+ // Return code
+ return $OUT;
// Is the extension version fine?
if (isExtensionInstalledAndNewer('user', '0.3.4')) {
// Is the extension version fine?
if (isExtensionInstalledAndNewer('user', '0.3.4')) {
-
- // 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__);
// Is the timeout reached?
if ($probe >= getConfig('login_timeout')) {
// Add login bonus to user's account
// Is the timeout reached?
if ($probe >= getConfig('login_timeout')) {
// Add login bonus to user's account
$GLOBALS['bonus_payed'] = true;
// Subtract login bonus from userid's account or jackpot
if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD')) {
$GLOBALS['bonus_payed'] = true;
// Subtract login bonus from userid's account or jackpot
if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getBonusMode() != 'ADD')) {
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`, `stats_type`, `stats_data`) VALUES (%s,'%s','%s')",
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')",
} elseif (is_array($statsData)) {
// Invalid data!
logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',type=' . $statsType . ',data=' . gettype($statsData) . ': Invalid statistics data type!');
}
} elseif (is_array($statsData)) {
// Invalid data!
logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',type=' . $statsType . ',data=' . gettype($statsData) . ': Invalid statistics data type!');
}
- $result = SQL_QUERY_ESC("SELECT `userid`, `refid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `userid`,`refid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `user_hash`='%s' AND (`status`='UNCONFIRMED' OR `status`='CONFIRMED') LIMIT 1",
array($hash), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Ok, he want's to confirm now so we load some data
array($hash), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Ok, he want's to confirm now so we load some data
// And send him right away the confirmation mail
sendEmail($userid, '{--GUEST_THANX_CONFIRM--}', $message);
// And send him right away the confirmation mail
sendEmail($userid, '{--GUEST_THANX_CONFIRM--}', $message);
- // Maybe he got "referaled"?
- if (($refid > 0) && ($refid != $userid)) {
- // Select the referal userid
+ // Maybe he got "referraled"?
+ if ((isValidUserId($refid)) && ($refid != $userid)) {
+ // Select the referral userid
// If version matches add ref bonus to refid's account
if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) {
// If version matches add ref bonus to refid's account
if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) {
array(bigintval($refid)), __FILE__, __LINE__);
// Subtract points from system
array(bigintval($refid)), __FILE__, __LINE__);
// Subtract points from system
- // Add one-time referal bonus over referal system or directly
- initReferalSystem();
- addPointsThroughReferalSystem('referal_bonus', $refid, getPointsRef(), bigintval($userid));
+ // Add one-time referral bonus over referral system or directly
+ initReferralSystem();
+ addPointsThroughReferralSystem('referral_bonus', $refid, getPointsRef(), bigintval($userid));
// User-related data, so is there a userid?
if (!empty($data['matches'][4][$data['key']])) {
// Do we have a userid or $userid?
// User-related data, so is there a userid?
if (!empty($data['matches'][4][$data['key']])) {
// Do we have a userid or $userid?
- $functionName = "getFetchedUserData('userid', \$userid, '" . $data['callback'] . "')";
+ $functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')";
+ // Do we have a number or a dollar sign in front of it?
+ if (preg_replace('/[^0123456789]/', '', $data['matches'][4][$data['key']]) != $data['matches'][4][$data['key']]) {
+ // Possible database column, so get it again
+ $data['matches'][4][$data['key']] = "getFetchedUserData('userid', getMemberId(), '" . $data['matches'][4][$data['key']] . "')";
+ } // END - if
+
+ // Fix all together
$functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')";
}
} elseif ((!empty($data['callback'])) && (isUserDataValid())) {
$functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')";
}
} elseif ((!empty($data['callback'])) && (isUserDataValid())) {
// Surround the original function call with it
$functionName = $data['extra_func'] . '(' . $functionName . ')';
} // END - if
// Surround the original function call with it
$functionName = $data['extra_func'] . '(' . $functionName . ')';
} // END - if
// Init title with "all accounts"
$code = '{--ADMIN_LIST_ALL_ACCOUNTS--}';
// Do we have a 'status' or 'mode' set?
// Init title with "all accounts"
$code = '{--ADMIN_LIST_ALL_ACCOUNTS--}';
// Do we have a 'status' or 'mode' set?
- $code = sprintf("{--ADMIN_LIST_STATUS_%s_ACCOUNTS--}", strtoupper(getRequestParameter('status')));
- } elseif (isGetRequestParameterSet('mode')) {
+ $code = sprintf("{--ADMIN_LIST_STATUS_%s_ACCOUNTS--}", strtoupper(getRequestElement('status')));
+ } elseif (isGetRequestElementSet('mode')) {
+// Template call-back function for displaying "username"
+function doTemplateDisplayUsername ($template, $clear = false, $userid = NULL) {
+ // Is a userid set?
+ if (!isValidUserId($userid)) {
+ // Please don't call this without a valid userid
+ debug_report_bug(__FUNCTION__, __LINE__, 'template=' . $template . ',clear=' . intval($clear) . ',userid[' . gettype($userid) . ']=' . intval($userid) . ' - Invalid userid provided.');
+ } // END - if
+
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__][$userid])) {
+ // Generate code
+ $GLOBALS[__FUNCTION__][$userid] = $userid . ' ({%user,nickname,fixEmptyContentToDashes=' . $userid . '%})';
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__][$userid];
+}
+