]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-list_user.php
Some more wrappers added, code cleanups:
[mailer.git] / inc / modules / admin / what-list_user.php
index 3697eb485fe093da2b6bba0916c5a6d49fb68550..53e8a7c6579596445c0874cd80a63d755c7f0100 100644 (file)
@@ -86,9 +86,9 @@ if (isExtensionActive('country')) {
 }
 
 // Init unset data
-if (!isGetRequestParameterSet('letter')) { setGetRequestParameter('letter', '{--_ALL2--}'); }
-if (!isGetRequestParameterSet('sortby')) { setGetRequestParameter('sortby', 'userid');            }
-if (!isGetRequestParameterSet('page'))   { setGetRequestParameter('page'  , 1);                 }
+if (!isGetRequestParameterSet('letter')) { setGetRequestParameter('letter', '');       }
+if (!isGetRequestParameterSet('sortby')) { setGetRequestParameter('sortby', 'userid'); }
+if (!isGetRequestParameterSet('page'))   { setGetRequestParameter('page'  , 1);        }
 
 // Set base URL
 $base = '[<a href="{%url=modules.php?module=admin';
@@ -99,7 +99,7 @@ if (isGetRequestParameterSet('userid')) {
 
        // Does the account exists?
        $result_user = SQL_QUERY_ESC("SELECT
-       `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`, `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."
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
@@ -180,13 +180,13 @@ LIMIT 1",
        SQL_FREERESULT($result_user);
 } else {
        $whereStatement = '';
-       if ((getRequestParameter('letter') != getMessage('_ALL2')) && (getRequestParameter('letter') != getMessage('_OTHERS')) && (isGetRequestParameterSet('letter'))) {
+       if (isGetRequestParameterSet('letter')) {
                // List only persons w
-               $whereStatement = " WHERE `family` LIKE '".getRequestParameter('letter') . "%'";
+               $whereStatement = " WHERE `family` LIKE '".getRequestParameter('letter') . "%%'";
        } // END - if
 
        // Parse the status or mode parameter
-       if (isGetRequestParameterSet(('status'))) {
+       if (isGetRequestParameterSet('status')) {
                // Is a WHERE statement already there?
                if (!empty($whereStatement)) {
                        // Then append the status column
@@ -239,7 +239,7 @@ LIMIT 1",
        $result = SQL_QUERY($sql, __FILE__, __LINE__);
 
        // Are there some entries?
-       if (SQL_NUMROWS($result_master) > 0) {
+       if (!SQL_HASZERONUMS($result_master)) {
                // We have some (new?) registrations!
                $templateContent['colspan2']   = ($colspan + 2);
                $templateContent['user_count'] = getTotalConfirmedUser();
@@ -262,7 +262,7 @@ LIMIT 1",
                } // END - if
 
                // Load all users
-               $OUT = ''; $SW = 2;
+               $OUT = '';
                while ($content = SQL_FETCHARRAY($result)) {
                        // Merge more data in
                        $content = merge_array($content, $templateContent);
@@ -279,7 +279,7 @@ LIMIT 1",
                        if (isExtensionInstalled('nickname')) $content['nickname'] = getNickname($content['userid']);
 
                        // Calculate total points
-                       $content['points'] = countSumTotalData($content['userid'], 'user_points', 'points')  - countSumTotalData($content['userid'], 'user_data', 'used_points');
+                       $content['points'] = getTotalPoints($content['userid']);
 
                        // Clickrate
                        $content['rate'] = '0';
@@ -288,7 +288,6 @@ LIMIT 1",
                        } // END - if
 
                        // Transfer data to array
-                       $content['sw']             = $SW;
                        $content['email']          = '[<a href="' . generateEmailLink($content['email'], 'user_data') . '">' . $content['email'] . '</a>]';
                        $content['lock_timestamp'] = generateDateTime($content['lock_timestamp'], 2);
                        $content['refs']           = countSumTotalData($content['userid'], 'user_refs', 'id', 'userid', true);
@@ -309,7 +308,6 @@ LIMIT 1",
 
                        // Load row template and switch colors
                        $OUT .= loadTemplate('admin_list_user_row', true, $content);
-                       $SW = 3 - $SW;
                } // END - while
 
                // Free memory
@@ -323,12 +321,12 @@ LIMIT 1",
 
                // Init title with "all accounts"
                $content['title'] = '{--ADMIN_ALL_ACCOUNTS--}';
-               if (isGetRequestParameterSet(('status'))) {
+               if (isGetRequestParameterSet('status')) {
                        // Set title according to the 'status'
-                       $content['title'] = getMessage(sprintf("ADMIN_LIST_STATUS_%s_ACCOUNTS", strtoupper(getRequestParameter(('status')))));
+                       $content['title'] = sprintf("{--ADMIN_LIST_STATUS_%s_ACCOUNTS--}", strtoupper(getRequestParameter('status')));
                } elseif (isGetRequestParameterSet('mode')) {
                        // Set title according to the "mode"
-                       $content['title'] = getMessage(sprintf("ADMIN_LIST_MODE_%s_ACCOUNTS", strtoupper(getRequestParameter('mode'))));
+                       $content['title'] = sprintf("{--ADMIN_LIST_MODE_%s_ACCOUNTS--}", strtoupper(getRequestParameter('mode')));
                }
 
                // Merge more data again