More fixes, random refid accounts displayed in front panel
authorRoland Häder <roland@mxchange.org>
Sat, 9 Jul 2011 13:50:42 +0000 (13:50 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 9 Jul 2011 13:50:42 +0000 (13:50 +0000)
inc/language/de.php
inc/language/task_de.php
inc/libs/task_functions.php
inc/modules/admin/what-list_user.php
inc/mysql-manager.php
inc/wrapper-functions.php
templates/de/html/admin/admin_list_user_row.tpl
templates/de/html/admin/admin_overview_task.tpl
templates/de/html/admin/admin_user_details.tpl

index 71842d505bd29df2ee17ed600ab6e577c177f4fb..51adea1f6ea54e5163beb5edc2a91052d44bb3be 100644 (file)
@@ -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 <u>keine</u> {?POINTS?} gutgeschrieben. Richten Sie mindestens Referal-Ebene 0 mit 100% Verg&uuml;tung ein.",
        'ADMIN_SESSION_SAVE_PATH_INVALID' => "Pfad f&uuml;r Sitzungsdateien ung&uuml;tig.",
        'ADMIN_CONFIG_SESSION_TITLE' => "Einstellungen zum Sitzungsmanagement",
@@ -1113,6 +1112,7 @@ addMessages(array(
        'ADMIN_LIST_STATUS_UNCONFIRMED_ACCOUNTS' => "Alle unbest&auml;tigten Mitglieder-Accounts auflisten",
        'ADMIN_LIST_MODE_CONFIRMED_ACCOUNTS' => "Alle best&auml;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&uuml;r Zufallsreferal auflisten",
 
        // Admin task lines
        'ADMIN_TASK_TYPE_MEMBER_SUPPORT' => "Support-Anfrage eines Mitgliedes",
index 870387318de8abfc7b92d594cab13d9bef6a45fa..beee6894ba0decb46f3b8e8a77d5f0d1997a0e19 100644 (file)
@@ -50,6 +50,7 @@ addMessages(array(
        'ADMIN_TASK_CONFIRMED' => "Best&auml;tigt",
        'ADMIN_TASK_UNCONFIRMED' => "Unbest&auml;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",
index b81f425a94f5b14836ea9316341f54f36e660832..13ddfd2bb38022c063f19ae8acd7ee3c47466791 100644 (file)
@@ -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'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;status=UNCONFIRMED%}">' . $value . '</a>';
        } // END - if
 
-
        // And locked accounts
        $value = getTotalLockedUser();
        if ($value > 0) {
                $content['locked_members'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;status=locked%}">' . $value . '</a>';
        } // END - if
 
+       if (isExtensionInstalledAndNewer('user', '0.3.4')) {
+               // And random refid
+               $value = getTotalRandomRefidUser();
+               if ($value > 0) {
+                       $content['random_refid'] = '<a href="{%url=modules.php?module=admin&amp;what=list_user&amp;mode=random_refid%}">' . $value . '</a>';
+               } // END - if
+       } // END - if
+
        //
        // Unassigned tasks
        //
index 9e38373de1b887172608821bacfd07b2abbb8125..4295891afb21f3dfefd8a48a6f3eb24dc2909d97 100644 (file)
@@ -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 . '&amp;what=list_links&amp;userid=' . $userid . '%}">' . $content['links'] . '</a>]';
-               if (isValidUserId($content['refid'])) $content['refid'] = $base . '&amp;what=list_user&amp;userid=' . $content['refid'] . '%}">'.$content['refid'] . '</a>]';
                if ($content['refs']  > 0) $content['refs']  = $base . '&amp;what=list_refs&amp;userid=' . $userid . '%}">{%pipe,translateComma=' . $content['refs'] . '%}</a>]';
                if ($content['cats']  > 0) $content['cats']  = $base . '&amp;what=list_cats&amp;userid=' . $userid . '%}">{%pipe,translateComma=' . $content['cats'] . '%}</a>]';
 
@@ -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')
        );
 
index e80d559b852d2729fdf36634d34c7b387038764c..424ac96cafa0ba4ac1697a1dbae7280ce867233d 100644 (file)
@@ -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
index 79de7cc685243746d32e20e3c09d934255e066b7..564ee853e3dbe4ce6d0d11215ecfbb7eb16f62b2 100644 (file)
@@ -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?
index 669ab0baa960cbfe2a25e012086e5aba31b18cd4..f76f79190b92972f77338a1539caef285d1f551f 100644 (file)
@@ -7,9 +7,9 @@
 </tr>
 <tr>
        <td align="center" class="bottom right {%template,ColorSwitch%}">{%pipe,generateUserProfileLink=$content[userid]%}</td>
-       <td align="center" class="bottom right {%template,ColorSwitch%}">{%pipe,translateGender=$content[gender]%}</td>
-       <td align="center" class="bottom right {%template,ColorSwitch%}">$content[surname]</td>
-       <td align="center" class="bottom right {%template,ColorSwitch%}">$content[family]</td>
+       <td align="center" class="bottom right {%template,ColorSwitch%}">{%user,gender,translateGender=$content[userid]%}</td>
+       <td align="center" class="bottom right {%template,ColorSwitch%}">{%user,surname=$content[userid]%}</td>
+       <td align="center" class="bottom right {%template,ColorSwitch%}">{%user,family=$content[userid]%}</td>
        <td align="center" class="bottom {%template,ColorSwitch%}">{%user,nickname,fixEmptyContentToDashes=$content[userid]%}</td>
 </tr>
 <tr>
@@ -21,9 +21,9 @@
 </tr>
 <tr>
        <td align="center" class="right {%template,ColorSwitch%} bottom">$content[email]</td>
-       <td align="center" class="right {%template,ColorSwitch%} bottom">$content[REMOTE_ADDR]</td>
-       <td align="center" class="right {%template,ColorSwitch%} bottom">{%pipe,generateUserProfileLink=$content[refid]%}</td>
-       <td align="center" class="right {%template,ColorSwitch%} bottom">{%pipe,translateUserStatus=$content[status]%}</td>
+       <td align="center" class="right {%template,ColorSwitch%} bottom">{%user,REMOTE_ADDR=$content[userid]%}</td>
+       <td align="center" class="right {%template,ColorSwitch%} bottom">{%user,refid,generateUserProfileLink=$content[userid]%}</td>
+       <td align="center" class="right {%template,ColorSwitch%} bottom">{%user,status,translateUserStatus=$content[userid]%}</td>
        <td align="center" class="{%template,ColorSwitch%} bottom">$content[links]</td>
 </tr>
 <tr>
        <td align="center" class="right {%template,ColorSwitch%}"><strong>{--LOCK_REASON--}:</strong></td>
        <td align="center" class="right {%template,ColorSwitch%}"><strong>{--LOCK_TIMESTAMP--}:</strong></td>
        <td align="center" class="right {%template,ColorSwitch%}"><strong>{--OWN_POINTS--}:</strong></td>
-       <td align="center" class="right {%template,ColorSwitch%}"><strong>{--_UNUSED--}:</strong></td>
+       <td align="center" class="right {%template,ColorSwitch%}"><strong>{--RAND_CONFIRMED--}:</strong></td>
        <td align="center" class="{%template,ColorSwitch%}"><strong>{--_UNUSED--}:</strong></td>
 </tr>
 <tr>
-       <td align="center" class="right {%template,ColorSwitch%} bottom">{%pipe,fixEmptyContentToDashes=$content[lock_reason]%}</td>
+       <td align="center" class="right {%template,ColorSwitch%} bottom">{%user,lock_reason,fixEmptyContentToDashes=$content[userid]%}</td>
        <td align="center" class="right {%template,ColorSwitch%} bottom">$content[lock_timestamp]</td>
        <td align="center" class="right {%template,ColorSwitch%} bottom">{%pipe,translateComma=$content[own_points]%}</td>
-       <td align="center" class="right {%template,ColorSwitch%} bottom">---</td>
+       <td align="center" class="right {%template,ColorSwitch%} bottom">{%user,rand_confirmed,translateComma=$content[userid]%}</td>
        <td align="center" class="{%template,ColorSwitch%} bottom">---</td>
 </tr>
 <tr>
index 65f9f25676bd0f262cac6b6199513a75becb91c1..bc723f03015d2adb4a76f387a1a26ae5f4ba0770 100644 (file)
                                </td>
                        </tr>
                        <tr>
-                               <td align="right" class="admin_task_left switch_sw2">{--ADMIN_TASK_LOCKED--}:</td>
-                               <td align="center" class="admin_task_right switch_sw2">
+                               <td align="right" class="admin_task_left switch_sw2 bottom">{--ADMIN_TASK_LOCKED--}:</td>
+                               <td align="center" class="admin_task_right switch_sw2 bottom">
                                        <strong>$content[locked_members]</strong>
                                </td>
                        </tr>
+                       <tr>
+                               <td align="right" class="admin_task_left switch_sw1">{--ADMIN_TASK_RANDOM_REFID--}:</td>
+                               <td align="center" class="admin_task_right switch_sw1">
+                                       <strong>$content[random_refid]</strong>
+                               </td>
+                       </tr>
                </table>
                </td>
                <td align="center" valign="top">
index d2a61d817b2b284585884124c806f974f6916f57..4dfd3aea8cf407725a0d7430c655f002c4f8faa2 100644 (file)
@@ -8,19 +8,19 @@
        <tr>
                <td align="center" width="25%" class="top right">
                        {--GENDER--}:<br />
-                       <strong>{%pipe,translateGender=$content[gender]%}</strong>
+                       <strong>{%user,gender,translateGender=$content[userid]%}</strong>
                </td>
                <td align="center" width="25%" class="top right">
                        {--SURNAME--}:<br />
-                       <strong>$content[surname]</strong>
+                       <strong>{%user,surname=$content[userid]%}</strong>
                </td>
                <td align="center" width="25%" class="top right">
                        {--FAMILY--}:<br />
-                       <strong>$content[family]</strong>
+                       <strong>{%user,family=$content[userid]%}</strong>
                </td>
                <td align="center" width="25%" class="top">
                        {--STREET_NR--}:<br />
-                       <strong>$content[street_nr]</strong>
+                       <strong>{%user,street_nr=$content[userid]%}</strong>
                </td>
        </tr>
        <tr>
                </td>
                <td align="center" class="top right">
                        {--ZIP--}:<br />
-                       <strong>$content[zip]</strong>
+                       <strong>{%user,zip,bigintval=$content[userid]%}</strong>
                </td>
                <td align="center" class="top">
                        {--CITY--}:<br />
-                       <strong>$content[city]</strong>
+                       <strong>{%user,city=$content[userid]%}</strong>
                </td>
        </tr>
        <tr>
                </td>
                <td align="center" class="top right">
                        {--ACCOUNT_STATUS--}:<br />
-                       <strong>{%pipe,translateUserStatus=$content[status]%}</strong>
+                       <strong>{%user,status,translateUserStatus=$content[userid]%}</strong>
                </td>
                <td align="center" class="top right">
                        {--RECEIVE_MAILS--}:<br />
-                       <strong>$content[receive_mails]</strong>
+                       <strong>{%user,receive_mails,translateComma=$content[userid]%}</strong>
                </td>
                <td align="center" class="top">
                        {--MAX_PER_DAY--}:<br />
-                       <strong>$content[max_mails]</strong>
+                       <strong>{%user,max_mails,translateComma=$content[userid]%}</strong>
                </td>
        </tr>
        <tr>
                <td align="center" class="top right">
                        {--REFERAL_USERID--}:<br />
-                       <strong>$content[refid]</strong>
+                       <strong>{%user,refid,generateUserProfileLink=$content[userid]%}</strong>
                </td>
                <td align="center" class="top right">
                        {--REFERAL_CLICKS--}:<br />
-                       <strong>$content[ref_clicks]</strong>
+                       <strong>{%user,ref_clicks,translateComma=$content[userid]%}</strong>
                </td>
                <td align="center" class="top right">
                        {--TOTAL_LOGINS--}:<br />
-                       <strong>$content[total_logins]</strong>
+                       <strong>{%user,total_logins,translateComma=$content[userid]%}</strong>
                </td>
                <td align="center" class="top">
                        {--REMOTE_IP--}:<br />
-                       <strong>$content[REMOTE_ADDR]</strong>
+                       <strong>{%user,REMOTE_ADDR=$content[userid]%}</strong>
                </td>
        </tr>
        <tr>
@@ -84,7 +84,7 @@
                </td>
                <td align="center" class="top right">
                        {--ADMIN_LAST_MODULE--}:<br />
-                       <strong>{%pipe,fixEmptyContentToDashes=$content[last_module]%}</strong>
+                       <strong>{%user,last_module,fixEmptyContentToDashes=$content[userid]%}</strong>
                </td>
                <td align="center" class="top right">
                        {--HAS_JOINED--}:<br />
                </td>
                <td align="center" class="top right">
                        {--RAND_CONFIRMED--}:<br />
-                       <strong>{%pipe,translateComma=$content[rand_confirmed]%}</strong>
+                       <strong>{%user,rand_confirmed,translateComma=$content[userid]%}</strong>
                </td>
                <td align="center" class="top right">
                        {--LOCK_TIMESTAMP--}:<br />
                </td>
                <td align="center" class="top">
                        {--LOCK_REASON--}:<br />
-                       <strong>{%pipe,fixEmptyContentToDashes=$content[lock_reason]%}</strong>
+                       <strong>{%user,lock_reason,fixEmptyContentToDashes=$content[userid]%}</strong>
                </td>
        </tr>
        <tr>
        <tr>
                <td align="center" class="top right">
                        {--ADMIN_USER_REFERAL_PAYOUT--}:<br />
-                       <strong>$content[ref_payout]</strong>
+                       <strong>{%user,ref_payout,translateComma=$content[userid]%}</strong>
                </td>
                <td align="center" class="top right">
                        {--USER_NICKNAME--}:<br />
                </td>
                <td align="center" class="top">
                        {--EMAILS_RECEIVED--}:<br />
-                       <strong>{%pipe,translateComma=$content[emails_received]%}</strong>
+                       <strong>{%user,emails_received,translateComma=$content[userid]%}</strong>
                </td>
        </tr>
        <tr>
                <td align="center" class="top right">
                        {--MAILS_CONFIRMED--}:<br />
-                       <strong>{%pipe,translateComma=$content[mails_confirmed]%}</strong>
+                       <strong>{%user,mails_confirmed,translateComma=$content[userid]%}</strong>
                </td>
                <td align="center" class="top right">
                        {--_UNUSED--}:<br />