From b8674260cbcf3b92179a45d29919868051c66b8d Mon Sep 17 00:00:00 2001 From: quix0r Date: Sat, 9 Jul 2011 13:50:42 +0000 Subject: [PATCH] More fixes, random refid accounts displayed in front panel --- inc/language/de.php | 2 +- inc/language/task_de.php | 1 + inc/libs/task_functions.php | 11 +++++- inc/modules/admin/what-list_user.php | 31 ++++++++------- inc/mysql-manager.php | 32 ++++++++++++---- inc/wrapper-functions.php | 16 ++++++++ .../de/html/admin/admin_list_user_row.tpl | 18 ++++----- .../de/html/admin/admin_overview_task.tpl | 10 ++++- .../de/html/admin/admin_user_details.tpl | 38 +++++++++---------- 9 files changed, 105 insertions(+), 54 deletions(-) diff --git a/inc/language/de.php b/inc/language/de.php index 71842d505b..51adea1f6e 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1025,7 +1025,6 @@ addMessages(array( 'MEMBER_ORDER_TEST_STARTED' => "Framekiller-Test startet...", 'MEMBER_ORDER_PLEASE_WAIT_1' => "Ihre Seite wird auf Framekiller getestet. Bitte noch ", 'MEMBER_ORDER_PLEASE_WAIT_2' => " Sekunden warten.", - 'ADMIN_LIST_NOREFS_ACCOUNTS' => "Auflistung aller Accounts ohne Werber", 'ADMIN_NO_REFERAL_LEVELS' => "In Ihrem {?mt_word?} sind keine Referal-Ebenen eingerichtet! Ihre Mitglieder erhalten keine {?POINTS?} gutgeschrieben. Richten Sie mindestens Referal-Ebene 0 mit 100% Vergütung ein.", 'ADMIN_SESSION_SAVE_PATH_INVALID' => "Pfad für Sitzungsdateien ungütig.", 'ADMIN_CONFIG_SESSION_TITLE' => "Einstellungen zum Sitzungsmanagement", @@ -1113,6 +1112,7 @@ addMessages(array( 'ADMIN_LIST_STATUS_UNCONFIRMED_ACCOUNTS' => "Alle unbestätigten Mitglieder-Accounts auflisten", 'ADMIN_LIST_MODE_CONFIRMED_ACCOUNTS' => "Alle bestätigten Mitglieder-Accounts auflisten", 'ADMIN_LIST_MODE_NOREFS_ACCOUNTS' => "Alle Mitglieder-Accounts ohne Referals auflisten", + 'ADMIN_LIST_MODE_RANDOM_REFID_ACCOUNTS' => "Alle Mitglieder-Accounts für Zufallsreferal auflisten", // Admin task lines 'ADMIN_TASK_TYPE_MEMBER_SUPPORT' => "Support-Anfrage eines Mitgliedes", diff --git a/inc/language/task_de.php b/inc/language/task_de.php index 870387318d..beee6894ba 100644 --- a/inc/language/task_de.php +++ b/inc/language/task_de.php @@ -50,6 +50,7 @@ addMessages(array( 'ADMIN_TASK_CONFIRMED' => "Bestätigt", 'ADMIN_TASK_UNCONFIRMED' => "Unbestätigt", 'ADMIN_TASK_LOCKED' => "Gesperrt", + 'ADMIN_TASK_RANDOM_REFID' => "Zufallsreferal", 'ADMIN_TASK_NEW_TASKS' => "Ohne Zuweisung", 'ADMIN_TASK_CLOSED_TASKS' => "Geschlossen", 'ADMIN_TASK_YOUR_TASKS' => "Ihre Aufgaben", diff --git a/inc/libs/task_functions.php b/inc/libs/task_functions.php index b81f425a94..13ddfd2bb3 100644 --- a/inc/libs/task_functions.php +++ b/inc/libs/task_functions.php @@ -67,7 +67,7 @@ function outputAdvancedOverview (&$result_main) { foreach ( array( // Member accounts - 'confirmed_members','unconfirmed_members','locked_members', + 'confirmed_members','unconfirmed_members','locked_members','random_refid', // Tasks 'update_tasks','new_tasks','closed_tasks','your_tasks','deleted_tasks','solved_tasks', // Mail orders @@ -105,13 +105,20 @@ function outputAdvancedOverview (&$result_main) { $content['unconfirmed_members'] = '' . $value . ''; } // END - if - // And locked accounts $value = getTotalLockedUser(); if ($value > 0) { $content['locked_members'] = '' . $value . ''; } // END - if + if (isExtensionInstalledAndNewer('user', '0.3.4')) { + // And random refid + $value = getTotalRandomRefidUser(); + if ($value > 0) { + $content['random_refid'] = '' . $value . ''; + } // END - if + } // END - if + // // Unassigned tasks // diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index 9e38373de1..4295891afb 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -47,16 +47,10 @@ addYouAreHereLink('admin', __FILE__); $MORE = ''; $colspan = 4; -// Add random confirmed if extension version matches -if (isExtensionInstalledAndNewer('user', '0.3.4')) { - // Add it... - $MORE .= ", `rand_confirmed`"; - - // Add lock reason? - if (isExtensionInstalledAndNewer('user', '0.3.5')) { - // Add them... - $MORE .= ", `lock_reason`, UNIX_TIMESTAMP(`lock_timestamp`) AS `lock_timestamp`"; - } // END - if +// Add lock reason? +if (isExtensionInstalledAndNewer('user', '0.3.5')) { + // Add them... + $MORE .= ", UNIX_TIMESTAMP(`lock_timestamp`) AS `lock_timestamp`"; } // END - if // Is the extension 'country' installed? @@ -82,7 +76,7 @@ if (isGetRequestParameterSet('userid')) { // Does the account exists? $result_user = SQL_QUERY_ESC("SELECT - `userid`, `gender`, `surname`, `family`, `street_nr`, `zip`, `city`, `country`, `email`, `birth_day`, `birth_month`, `birth_year`, `max_mails`, `receive_mails`, `refid`, `status`, `REMOTE_ADDR`, `last_online`, `last_module`, `ref_clicks`, `total_logins`, `used_points`, `emails_sent`, `joined`, `last_update`, `last_profile_sent`, `notified`, `ref_payout`, `emails_received`, `mails_confirmed`".$MORE." + `userid`, `country`, `email`, `birth_day`, `birth_month`, `birth_year`, `last_online`, `used_points`, `emails_sent`, `joined`, `last_update`, `last_profile_sent`, `notified`, `emails_received`, `mails_confirmed`".$MORE." FROM `{?_MYSQL_PREFIX?}_user_data` WHERE @@ -102,7 +96,6 @@ LIMIT 1", // Add links to the numbers if ($content['links'] > 0) $content['links'] = $base . '&what=list_links&userid=' . $userid . '%}">' . $content['links'] . ']'; - if (isValidUserId($content['refid'])) $content['refid'] = $base . '&what=list_user&userid=' . $content['refid'] . '%}">'.$content['refid'] . ']'; if ($content['refs'] > 0) $content['refs'] = $base . '&what=list_refs&userid=' . $userid . '%}">{%pipe,translateComma=' . $content['refs'] . '%}]'; if ($content['cats'] > 0) $content['cats'] = $base . '&what=list_cats&userid=' . $userid . '%}">{%pipe,translateComma=' . $content['cats'] . '%}]'; @@ -202,14 +195,24 @@ LIMIT 1", } break; + case 'random_refid': // Users available for random referal id + if (!empty($whereStatement)) { + // Add AND statement + $whereStatement .= " AND `rand_confirmed` >= {?user_min_confirmed?}"; + } else { + // Add WHERE statement + $whereStatement = " WHERE `rand_confirmed` >= {?user_min_confirmed?}"; + } + break; + default: // Invalid list mode - logDebugMessage(__FILE__, __LINE__, sprintf("Invalid list mode %s detected.", getRequestParameter('mode'))); + debug_report_bug(__FILE__, __LINE__, sprintf("Invalid list mode %s detected.", getRequestParameter('mode'))); break; } // END - switch } // END - if // Generate master query string - $sql = sprintf("SELECT `userid`, `gender`, `surname`, `family`, `email`, `REMOTE_ADDR`, `refid`, `status`, `emails_sent`, `mails_confirmed`, `emails_received`" . $MORE . " FROM `{?_MYSQL_PREFIX?}_user_data`" . $whereStatement . " ORDER BY `%s` ASC", + $sql = sprintf("SELECT `userid`, `email`, `emails_sent`, `mails_confirmed`, `emails_received`" . $MORE . " FROM `{?_MYSQL_PREFIX?}_user_data`" . $whereStatement . " ORDER BY `%s` ASC", getRequestParameter('sortby') ); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index e80d559b85..424ac96caf 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -924,7 +924,7 @@ function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = 0, $i } // Calculate sum (default) or count records of given criteria -function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatement = 'userid', $countRows = false, $add = '') { +function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatement = 'userid', $countRows = false, $add = '', $mode = '=') { // Init count/sum $data['res'] = '0'; @@ -934,22 +934,40 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen if ($countRows === true) { // Count whole table $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s`".$add, - array($lookFor, $tableName), __FUNCTION__, __LINE__); + array( + $lookFor, + $tableName + ), __FUNCTION__, __LINE__); } else { // Sum whole table $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s`".$add, - array($lookFor, $tableName), __FUNCTION__, __LINE__); + array( + $lookFor, + $tableName + ), __FUNCTION__, __LINE__); } } elseif (($countRows === true) || ($lookFor == 'userid')) { // Count rows //* DEBUG: */ debugOutput('COUNT!'); - $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add, - array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__); + $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`%s'%s'".$add, + array( + $lookFor, + $tableName, + $whereStatement, + $mode, + $search + ), __FUNCTION__, __LINE__); } else { // Add all rows //* DEBUG: */ debugOutput('SUM!'); - $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add, - array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__); + $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`%s'%s'".$add, + array( + $lookFor, + $tableName, + $whereStatement, + $mode, + $search + ), __FUNCTION__, __LINE__); } // Load row diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 79de7cc685..564ee853e3 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1218,6 +1218,22 @@ function getTotalLockedUser () { return $GLOBALS[__FUNCTION__]; } +// "Getter" for total locked user accounts +function getTotalRandomRefidUser () { + // Is it cached? + if (!isset($GLOBALS[__FUNCTION__])) { + // Then do it + if (isExtensionInstalledAndNewer('user', '0.3.4')) { + $GLOBALS[__FUNCTION__] = countSumTotalData('{?user_min_confirmed?}', 'user_data', 'userid', 'rand_confirmed', true, '', '>='); + } else { + $GLOBALS[__FUNCTION__] = 0; + } + } // END - if + + // Return cached value + return $GLOBALS[__FUNCTION__]; +} + // Is given userid valid? function isValidUserId ($userid) { // Do we have cache? diff --git a/templates/de/html/admin/admin_list_user_row.tpl b/templates/de/html/admin/admin_list_user_row.tpl index 669ab0baa9..f76f79190b 100644 --- a/templates/de/html/admin/admin_list_user_row.tpl +++ b/templates/de/html/admin/admin_list_user_row.tpl @@ -7,9 +7,9 @@ {%pipe,generateUserProfileLink=$content[userid]%} - {%pipe,translateGender=$content[gender]%} - $content[surname] - $content[family] + {%user,gender,translateGender=$content[userid]%} + {%user,surname=$content[userid]%} + {%user,family=$content[userid]%} {%user,nickname,fixEmptyContentToDashes=$content[userid]%} @@ -21,9 +21,9 @@ $content[email] - $content[REMOTE_ADDR] - {%pipe,generateUserProfileLink=$content[refid]%} - {%pipe,translateUserStatus=$content[status]%} + {%user,REMOTE_ADDR=$content[userid]%} + {%user,refid,generateUserProfileLink=$content[userid]%} + {%user,status,translateUserStatus=$content[userid]%} $content[links] @@ -44,14 +44,14 @@ {--LOCK_REASON--}: {--LOCK_TIMESTAMP--}: {--OWN_POINTS--}: - {--_UNUSED--}: + {--RAND_CONFIRMED--}: {--_UNUSED--}: - {%pipe,fixEmptyContentToDashes=$content[lock_reason]%} + {%user,lock_reason,fixEmptyContentToDashes=$content[userid]%} $content[lock_timestamp] {%pipe,translateComma=$content[own_points]%} - --- + {%user,rand_confirmed,translateComma=$content[userid]%} --- diff --git a/templates/de/html/admin/admin_overview_task.tpl b/templates/de/html/admin/admin_overview_task.tpl index 65f9f25676..bc723f0301 100644 --- a/templates/de/html/admin/admin_overview_task.tpl +++ b/templates/de/html/admin/admin_overview_task.tpl @@ -118,11 +118,17 @@ - {--ADMIN_TASK_LOCKED--}: - + {--ADMIN_TASK_LOCKED--}: + $content[locked_members] + + {--ADMIN_TASK_RANDOM_REFID--}: + + $content[random_refid] + + diff --git a/templates/de/html/admin/admin_user_details.tpl b/templates/de/html/admin/admin_user_details.tpl index d2a61d817b..4dfd3aea8c 100644 --- a/templates/de/html/admin/admin_user_details.tpl +++ b/templates/de/html/admin/admin_user_details.tpl @@ -8,19 +8,19 @@ {--GENDER--}:
- {%pipe,translateGender=$content[gender]%} + {%user,gender,translateGender=$content[userid]%} {--SURNAME--}:
- $content[surname] + {%user,surname=$content[userid]%} {--FAMILY--}:
- $content[family] + {%user,family=$content[userid]%} {--STREET_NR--}:
- $content[street_nr] + {%user,street_nr=$content[userid]%} @@ -34,11 +34,11 @@ {--ZIP--}:
- $content[zip] + {%user,zip,bigintval=$content[userid]%} {--CITY--}:
- $content[city] + {%user,city=$content[userid]%} @@ -48,33 +48,33 @@ {--ACCOUNT_STATUS--}:
- {%pipe,translateUserStatus=$content[status]%} + {%user,status,translateUserStatus=$content[userid]%} {--RECEIVE_MAILS--}:
- $content[receive_mails] + {%user,receive_mails,translateComma=$content[userid]%} {--MAX_PER_DAY--}:
- $content[max_mails] + {%user,max_mails,translateComma=$content[userid]%} {--REFERAL_USERID--}:
- $content[refid] + {%user,refid,generateUserProfileLink=$content[userid]%} {--REFERAL_CLICKS--}:
- $content[ref_clicks] + {%user,ref_clicks,translateComma=$content[userid]%} {--TOTAL_LOGINS--}:
- $content[total_logins] + {%user,total_logins,translateComma=$content[userid]%} {--REMOTE_IP--}:
- $content[REMOTE_ADDR] + {%user,REMOTE_ADDR=$content[userid]%} @@ -84,7 +84,7 @@ {--ADMIN_LAST_MODULE--}:
- {%pipe,fixEmptyContentToDashes=$content[last_module]%} + {%user,last_module,fixEmptyContentToDashes=$content[userid]%} {--HAS_JOINED--}:
@@ -120,7 +120,7 @@ {--RAND_CONFIRMED--}:
- {%pipe,translateComma=$content[rand_confirmed]%} + {%user,rand_confirmed,translateComma=$content[userid]%} {--LOCK_TIMESTAMP--}:
@@ -128,7 +128,7 @@ {--LOCK_REASON--}:
- {%pipe,fixEmptyContentToDashes=$content[lock_reason]%} + {%user,lock_reason,fixEmptyContentToDashes=$content[userid]%} @@ -152,7 +152,7 @@ {--ADMIN_USER_REFERAL_PAYOUT--}:
- $content[ref_payout] + {%user,ref_payout,translateComma=$content[userid]%} {--USER_NICKNAME--}:
@@ -164,13 +164,13 @@ {--EMAILS_RECEIVED--}:
- {%pipe,translateComma=$content[emails_received]%} + {%user,emails_received,translateComma=$content[userid]%} {--MAILS_CONFIRMED--}:
- {%pipe,translateComma=$content[mails_confirmed]%} + {%user,mails_confirmed,translateComma=$content[userid]%} {--_UNUSED--}:
-- 2.39.2