Syntax errors fixed, naming convention applied, wrappers used:
authorRoland Häder <roland@mxchange.org>
Fri, 16 Jul 2010 15:34:57 +0000 (15:34 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 16 Jul 2010 15:34:57 +0000 (15:34 +0000)
- Some syntax errors fixed (were added with last commit)
- Naming convention applied on variables $max ($numMenus) and some more
- Wraper countSumTotalData() further used
- overview-inc.php contained a query which can be converted into a wrapper call,
  function isExtensionInstalled() could be used instead
- TODOs.txt updated

16 files changed:
DOCS/TODOs.txt
DOCS/lint.sh
inc/functions.php
inc/language/de.php
inc/libs/admins_functions.php
inc/libs/bonus_functions.php
inc/libs/rallye_functions.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-adminedit.php
inc/modules/admin/what-guestedit.php
inc/modules/admin/what-memedit.php
inc/modules/admin/what-send_bonus.php
inc/modules/member/what-categories.php
inc/modules/member/what-points.php
inc/mysql-manager.php
templates/de/html/show_bonus_yr.tpl

index 8f8e799ec7beae503f004932c84d331fefd3a736..d414a4a53092ef81699031ae68130009de5dcd1e 100644 (file)
 ./inc/extensions-functions.php:424:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
 ./inc/extensions-functions.php:548:            // @TODO Extension is loaded, what next?
 ./inc/functions.php:115:               // @TODO Extension 'msg' does not exist
 ./inc/extensions-functions.php:424:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
 ./inc/extensions-functions.php:548:            // @TODO Extension is loaded, what next?
 ./inc/functions.php:115:               // @TODO Extension 'msg' does not exist
-./inc/functions.php:1484:                      // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
-./inc/functions.php:1507:                      // @TODO Rewrite this old lost code to a template
-./inc/functions.php:1575:                      // @TODO Are these convertions still required?
-./inc/functions.php:1593:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:1486:                      // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
+./inc/functions.php:1509:                      // @TODO Rewrite this old lost code to a template
+./inc/functions.php:1577:                      // @TODO Are these convertions still required?
+./inc/functions.php:1595:// @TODO Rewrite this function to use readFromFile() and writeToFile()
 ./inc/functions.php:178:// @TODO Rewrite this to an extension 'smtp'
 ./inc/functions.php:178:// @TODO Rewrite this to an extension 'smtp'
-./inc/functions.php:2246:      // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2248:      // @TODO This is still very static, rewrite it somehow
 ./inc/gen_sql_patches.php:96:// @TODO Rewrite this to a filter
 ./inc/install-functions.php:63:        // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
 ./inc/language/de.php:1129:// @TODO Rewrite these two constants
 ./inc/gen_sql_patches.php:96:// @TODO Rewrite this to a filter
 ./inc/install-functions.php:63:        // @TODO DEACTIVATED: changeDataInFile(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
 ./inc/language/de.php:1129:// @TODO Rewrite these two constants
 ./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings             *
 ./inc/language/refback_de.php:46:// @TODO Rewrite these constants to one
 ./inc/language/sponsor_de.php:119:// @TODO Rewrite these four constants to one and use sprintf()
 ./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings             *
 ./inc/language/refback_de.php:46:// @TODO Rewrite these constants to one
 ./inc/language/sponsor_de.php:119:// @TODO Rewrite these four constants to one and use sprintf()
-./inc/libs/admins_functions.php:434:           // @TODO This can be, somehow, rewritten
+./inc/libs/admins_functions.php:435:           // @TODO This can be, somehow, rewritten
 ./inc/libs/beg_functions.php:58:               // @TODO Try to rewrite the following unset()
 ./inc/libs/beg_functions.php:58:               // @TODO Try to rewrite the following unset()
-./inc/libs/bonus_functions.php:206:            // @TODO Move this HTML to a template
-./inc/libs/bonus_functions.php:290:            // @TODO This query isn't right, it will only update if the user was for a longer time away!
+./inc/libs/bonus_functions.php:204:            // @TODO Move this HTML to a template
+./inc/libs/bonus_functions.php:288:            // @TODO This query isn't right, it will only update if the user was for a longer time away!
 ./inc/libs/doubler_functions.php:46:// @TODO Lame description
 ./inc/libs/doubler_functions.php:94:                   // @TODO Can't this be moved into EL?
 ./inc/libs/mailid_functions.php:49:            // @TODO Rewrite this to a dynamic include or so
 ./inc/libs/rallye_functions.php:700:// @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId()
 ./inc/libs/doubler_functions.php:46:// @TODO Lame description
 ./inc/libs/doubler_functions.php:94:                   // @TODO Can't this be moved into EL?
 ./inc/libs/mailid_functions.php:49:            // @TODO Rewrite this to a dynamic include or so
 ./inc/libs/rallye_functions.php:700:// @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId()
-./inc/libs/rallye_functions.php:768:   $EXPIRE = 3; // @TODO The hard-coded value...
-./inc/libs/rallye_functions.php:854:// @TODO Please document this function
-./inc/libs/rallye_functions.php:910:           // Load count @TODO Can't we rewrite this to our API?
+./inc/libs/rallye_functions.php:765:   $EXPIRE = 3; // @TODO The hard-coded value...
+./inc/libs/rallye_functions.php:851:// @TODO Please document this function
+./inc/libs/rallye_functions.php:907:           // Load count @TODO Can't we rewrite this to our API?
 ./inc/libs/refback_functions.php:61:           // @TODO Try to rewrite the following unset()
 ./inc/libs/register_functions.php:292: // @TODO Rewrite these all to a single filter
 ./inc/libs/register_functions.php:365: // @TODO Rewrite this to a filter
 ./inc/libs/refback_functions.php:61:           // @TODO Try to rewrite the following unset()
 ./inc/libs/register_functions.php:292: // @TODO Rewrite these all to a single filter
 ./inc/libs/register_functions.php:365: // @TODO Rewrite this to a filter
@@ -96,9 +96,9 @@
 ./inc/modules/admin/admin-inc.php:438:// @TODO Try to rewrite this to adminAddMenuSelectionBox()
 ./inc/modules/admin/overview-inc.php:164:                              // @TODO Rewrite this to a filter
 ./inc/modules/admin/overview-inc.php:277:                              // @TODO Rewrite this to something with include files and/or filter
 ./inc/modules/admin/admin-inc.php:438:// @TODO Try to rewrite this to adminAddMenuSelectionBox()
 ./inc/modules/admin/overview-inc.php:164:                              // @TODO Rewrite this to a filter
 ./inc/modules/admin/overview-inc.php:277:                              // @TODO Rewrite this to something with include files and/or filter
-./inc/modules/admin/overview-inc.php:315:                                              // @TODO This may also be rewritten to include files
-./inc/modules/admin/overview-inc.php:317:                                                      default: // @TODO Unknown support mode
-./inc/modules/admin/overview-inc.php:432:                      // @TODO Try to move this in includes
+./inc/modules/admin/overview-inc.php:311:                                              // @TODO This may also be rewritten to include files
+./inc/modules/admin/overview-inc.php:313:                                                      default: // @TODO Unknown support mode
+./inc/modules/admin/overview-inc.php:428:                      // @TODO Try to move this in includes
 ./inc/modules/admin/overview-inc.php:45:// @TODO This function does also check for uncompleted tasks
 ./inc/modules/admin/what-add_guestnl_cat.php:49:       // @TODO Check if category does already exist
 ./inc/modules/admin/what-add_surfbar_url.php:57:       // @TODO Find all convertSelectionsToTimestamp() calls and rewrite postRequestParameter() calls to $postData
 ./inc/modules/admin/overview-inc.php:45:// @TODO This function does also check for uncompleted tasks
 ./inc/modules/admin/what-add_guestnl_cat.php:49:       // @TODO Check if category does already exist
 ./inc/modules/admin/what-add_surfbar_url.php:57:       // @TODO Find all convertSelectionsToTimestamp() calls and rewrite postRequestParameter() calls to $postData
 ./inc/modules/member/what-beg.php:56:// @TODO Can't this be moved into EL?
 ./inc/modules/member/what-beg.php:65:// @TODO No more needed? define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_userid_timeout')));
 ./inc/modules/member/what-bonus.php:57:        // @TODO Rewrite this to a filter
 ./inc/modules/member/what-beg.php:56:// @TODO Can't this be moved into EL?
 ./inc/modules/member/what-beg.php:65:// @TODO No more needed? define('__BEG_UID_TIMEOUT', createFancyTime(getConfig('beg_userid_timeout')));
 ./inc/modules/member/what-bonus.php:57:        // @TODO Rewrite this to a filter
-./inc/modules/member/what-categories.php:129:          // @TODO Rewrite this to use $OUT .= ...
+./inc/modules/member/what-categories.php:132:          // @TODO Rewrite this to use $OUT .= ...
 ./inc/modules/member/what-order.php:427:                       // @TODO Rewrite this to a filter
 ./inc/modules/member/what-payout.php:196:                                      // @TODO Rewrite this to a filter
 ./inc/modules/member/what-points.php:55:// @TODO Should we rewrite this to a filter?
 ./inc/modules/member/what-order.php:427:                       // @TODO Rewrite this to a filter
 ./inc/modules/member/what-payout.php:196:                                      // @TODO Rewrite this to a filter
 ./inc/modules/member/what-points.php:55:// @TODO Should we rewrite this to a filter?
 ./inc/mysql-manager.php:1164:  // @TODO Rewrite this to a filter
 ./inc/mysql-manager.php:1411:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
 ./inc/mysql-manager.php:1509:  // @TODO Rewrite this to a filter
 ./inc/mysql-manager.php:1164:  // @TODO Rewrite this to a filter
 ./inc/mysql-manager.php:1411:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
 ./inc/mysql-manager.php:1509:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1888:                  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1932:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:1876:                  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1920:// @TODO Fix inconsistency between last_module and getWhat()
 ./inc/mysql-manager.php:370:   // @TODO Try to rewrite this to one or more functions
 ./inc/mysql-manager.php:46:// @TODO Can we cache this?
 ./inc/reset/reset_beg.php:51:// @TODO This should be converted in a daily beg rallye
 ./inc/mysql-manager.php:370:   // @TODO Try to rewrite this to one or more functions
 ./inc/mysql-manager.php:46:// @TODO Can we cache this?
 ./inc/reset/reset_beg.php:51:// @TODO This should be converted in a daily beg rallye
index 2f79ca40f598645cf8fe771f99f6c77ac9146156..c2b43ca689ea46406f8a90ae0b245ce0d554e224 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
 #!/bin/sh
 
-echo "$0: Analysing PHP script for syntax errors (lint) ..."
+echo "$0: Analysing PHP scripts for syntax errors (lint) ..."
 LINT=`find -name "*.php" -exec php -l -f {} 2>&1 \; | grep -v "No syntax errors detected in"`
 
 if test "${LINT}" != ""; then
 LINT=`find -name "*.php" -exec php -l -f {} 2>&1 \; | grep -v "No syntax errors detected in"`
 
 if test "${LINT}" != ""; then
index ac5ba52a509e8f17c562815321b59f93520b707e..5d929a993427cbf929300ff813c70a7dcf0ea7d9 100644 (file)
@@ -405,7 +405,9 @@ function translateGender ($gender) {
 
        // Male/female or company?
        switch ($gender) {
 
        // Male/female or company?
        switch ($gender) {
-               case 'M', 'M', 'C':
+               case 'M':
+               case 'M':
+               case 'C':
                        $ret = sprintf("{--GENDER_%s--}", $gender);
                        break;
 
                        $ret = sprintf("{--GENDER_%s--}", $gender);
                        break;
 
index b24b307f366b71761f16ce0238b05f5d13e11e5d..adf13c5308966c69970a65efa4d9562882b0d0d3 100644 (file)
@@ -555,7 +555,7 @@ addMessages(array(
        'NORMAL_MAIL_PROBLEM' => "Mail vom Mitgliedern bereits gel&ouml;scht",
        'BONUS_MAIL_PROBLEM' => "Bonus-Mail bereits gel&ouml;scht",
        'ADMIN_GENERAL_MAIL_PROBLEM' => "BUG! BUG! Bitte reporten auf <a href=\"http://bugs.mxchange.org/\" target=\"_blank\" title=\"Link zum Bug-Tracker\">bugs.mxchange.org</a>.",
        'NORMAL_MAIL_PROBLEM' => "Mail vom Mitgliedern bereits gel&ouml;scht",
        'BONUS_MAIL_PROBLEM' => "Bonus-Mail bereits gel&ouml;scht",
        'ADMIN_GENERAL_MAIL_PROBLEM' => "BUG! BUG! Bitte reporten auf <a href=\"http://bugs.mxchange.org/\" target=\"_blank\" title=\"Link zum Bug-Tracker\">bugs.mxchange.org</a>.",
-       'MEMBER_GENERAL_MAIL_PROBLEM' => "Allgemeines Mail-Problem erkannt. Bitte beim Support melden."
+       'MEMBER_GENERAL_MAIL_PROBLEM' => "Allgemeines Mail-Problem erkannt. Bitte beim Support melden.",
        'MEMBER_BACK_JACKPOT' => "{?POINTS?}-R&uuml;ckgutschrift",
        'ADMIN_BACK_JACKPOT' => "{?POINTS?}-Aufbuchung f&uuml;r Jackpot",
        'MEDIA_DATA' => "Mediendaten",
        'MEMBER_BACK_JACKPOT' => "{?POINTS?}-R&uuml;ckgutschrift",
        'ADMIN_BACK_JACKPOT' => "{?POINTS?}-Aufbuchung f&uuml;r Jackpot",
        'MEDIA_DATA' => "Mediendaten",
index 344b5909ffa60d37fa9f034c5454e8328797ef36..e549b1fca3b1b345f20b62f8d9df2881bf62d2af 100644 (file)
@@ -329,10 +329,7 @@ function adminsEditAdminAccount ($postData) {
 // Delete given admin accounts
 function adminsDeleteAdminAccount ($postData) {
        // Check if this account is the last one which cannot be deleted...
 // Delete given admin accounts
 function adminsDeleteAdminAccount ($postData) {
        // Check if this account is the last one which cannot be deleted...
-       $result_main = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins`", __FUNCTION__, __LINE__);
-       $accounts = SQL_NUMROWS($result_main);
-       SQL_FREERESULT($result_main);
-       if ($accounts > 1) {
+       if (countSumTotalData('', 'admins', 'id', '', true) > 1) {
                // Delete accounts
                $OUT = '';
                foreach ($postData['sel'] as $id => $selected) {
                // Delete accounts
                $OUT = '';
                foreach ($postData['sel'] as $id => $selected) {
@@ -340,12 +337,13 @@ function adminsDeleteAdminAccount ($postData) {
                        $id = bigintval($id);
 
                        // Get the admin's data
                        $id = bigintval($id);
 
                        // Get the admin's data
-                       $result = SQL_QUERY_ESC("SELECT login, email, default_acl AS mode, la_mode FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `login`, `email`, `default_acl` AS `mode`, `la_mode` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1",
                                array($id), __FUNCTION__, __LINE__);
                                array($id), __FUNCTION__, __LINE__);
+
+                       // Do we have an entry?
                        if (SQL_NUMROWS($result) == 1) {
                        if (SQL_NUMROWS($result) == 1) {
-                               // Entry found
+                               // Entry found, so load data
                                $content = SQL_FETCHARRAY($result);
                                $content = SQL_FETCHARRAY($result);
-                               SQL_FREERESULT($result);
                                $content['mode']    = '{--ADMINS_' . strtoupper($content['mode'])    . '_MODE--}';
                                $content['la_mode'] = '{--ADMINS_' . strtoupper($content['la_mode']) . '_LA_SETTING--}';
 
                                $content['mode']    = '{--ADMINS_' . strtoupper($content['mode'])    . '_MODE--}';
                                $content['la_mode'] = '{--ADMINS_' . strtoupper($content['la_mode']) . '_LA_SETTING--}';
 
@@ -355,6 +353,9 @@ function adminsDeleteAdminAccount ($postData) {
                                // Load row template and switch color
                                $OUT .= loadTemplate('admin_del_admins_row', true, $content);
                        } // END - if
                                // Load row template and switch color
                                $OUT .= loadTemplate('admin_del_admins_row', true, $content);
                        } // END - if
+
+                       // Free result
+                       SQL_FREERESULT($result);
                } // END - foreach
 
                // Load template
                } // END - foreach
 
                // Load template
index acdc940d724fc5790b354bbe5808a9895f893e9e..17736e92928eaf3137403c87d37d14d1cb70a440 100644 (file)
@@ -128,7 +128,7 @@ function addBonusRanks ($data, $type, $userid) {
                array(
                        $type,
                        $data,
                array(
                        $type,
                        $data,
-                       $userid
+                       bigintval($userid)
                ), __FUNCTION__, __LINE__);
 
        // Entry found?
                ), __FUNCTION__, __LINE__);
 
        // Entry found?
@@ -140,9 +140,7 @@ function addBonusRanks ($data, $type, $userid) {
                $self  = true;
 
                // Transfer data to template
                $self  = true;
 
                // Transfer data to template
-               $GLOBALS['ranking_content']['yr_level']  = $GLOBALS['ranking_content']['level'];
-               $GLOBALS['ranking_content']['yr_points'] = translateComma($GLOBALS['ranking_content']['points']);
-               $GLOBALS['ranking_content']['yr_tmark']  = generateDateTime($GLOBALS['ranking_content']['timemark'], 1);
+               $GLOBALS['ranking_content']['timemark'] = generateDateTime($GLOBALS['ranking_content']['timemark'], 1);
 
                // Load template
                $GLOBALS['ranking_content']['own'] = loadTemplate('show_bonus_yr', true, $GLOBALS['ranking_content']);
 
                // Load template
                $GLOBALS['ranking_content']['own'] = loadTemplate('show_bonus_yr', true, $GLOBALS['ranking_content']);
index b0fd3a9943681453f315d277b4a1bacc472cc6dd..c9a781a360194553c28ea66dbbe5cab471ae2163 100644 (file)
@@ -700,10 +700,7 @@ LIMIT 1",
 // @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId()
 function addReferalRallyeWinners ($rallye, $default=0) {
        // First check how many prices are set
 // @TODO This function does not load min_users, min_prices, please encapsulate loading rallye data with e.g. getRallyeDataFromId()
 function addReferalRallyeWinners ($rallye, $default=0) {
        // First check how many prices are set
-       $result_prices = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s ORDER BY `price_level` ASC",
-               array(bigintval($rallye)), __FUNCTION__, __LINE__);
-       $prices = SQL_NUMROWS($result_prices);
-       SQL_FREERESULT($result_prices);
+       $prices = countSumTotalData(bigintval($rallye), 'rallye_prices', 'id', 'rallye_id', true);
 
        // Load data
        $DATA = getArrayFromReferalRallyeUsers($rallye);
 
        // Load data
        $DATA = getArrayFromReferalRallyeUsers($rallye);
index 1b85cbead7f86951fc864885b97bacdd709d16ad..90bb61a8986780da3f61f211325cb5578e4d5693 100644 (file)
@@ -278,18 +278,14 @@ LIMIT 1",
                                switch ($taskData['task_type']) {
                                        case 'EXTENSION': // Install new extensions
                                                $ext_name = substr($taskData['subject'], 1, strpos($taskData['subject'], ':') - 1);
                                switch ($taskData['task_type']) {
                                        case 'EXTENSION': // Install new extensions
                                                $ext_name = substr($taskData['subject'], 1, strpos($taskData['subject'], ':') - 1);
-                                               $result_lines = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1",
-                                                       array($ext_name), __FILE__, __LINE__);
-                                               $lines = SQL_NUMROWS($result_lines);
-                                               SQL_FREERESULT($result_lines);
-                                               if ($lines == '0') {
-                                                       // New extension found
+                                               if (!isExtensionInstalled($ext_name)) {
+                                                       // New (not yet installed) extension found
                                                        $OUT .= loadTemplate('admin_extension_reg_form', true, array(
                                                                'id'       => bigintval($taskId),
                                                                'ext_name' => $ext_name
                                                        ));
                                                } else {
                                                        $OUT .= loadTemplate('admin_extension_reg_form', true, array(
                                                                'id'       => bigintval($taskId),
                                                                'ext_name' => $ext_name
                                                        ));
                                                } else {
-                                                       // Task is closed so nothing is todo
+                                                       // Extension is already installed
                                                        $OUT .= '<div class="admin_failed">{--ADMIN_EXTENSION_ALREADY_REGISTERED--}</div>';
 
                                                        // Close task but not already closed, solved, deleted or update tasks
                                                        $OUT .= '<div class="admin_failed">{--ADMIN_EXTENSION_ALREADY_REGISTERED--}</div>';
 
                                                        // Close task but not already closed, solved, deleted or update tasks
index 9cfb7b94e81698f3fd7aaf9b8332d5a6de92b3ac..8746b7d4bbd8952d45059840cd3c7099f8ba9728 100644 (file)
@@ -225,8 +225,8 @@ WHERE ".$AND." AND `id`=%s LIMIT 1",
                $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
        }
 
                $result = SQL_QUERY("SELECT id, action, what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
        }
 
-       $max = SQL_NUMROWS($result);
-       if ($max > 0) {
+       $numMenus = SQL_NUMROWS($result);
+       if ($numMenus > 0) {
                // Remember sub value
                $content['sub'] = $SUB;
 
                // Remember sub value
                $content['sub'] = $SUB;
 
@@ -243,7 +243,7 @@ WHERE ".$AND." AND `id`=%s LIMIT 1",
                        if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']+1) . '&amp;fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
                        if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']+1) . '&amp;fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
-                       } elseif ($cnt == $max) {
+                       } elseif ($cnt == $numMenus) {
                                // Is lowest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']-1) . '&amp;fid=' . $data['sort'] . '%}">{--HIGHER--}</a>';
                        } elseif ($data['sort'] > 0) {
                                // Is lowest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']-1) . '&amp;fid=' . $data['sort'] . '%}">{--HIGHER--}</a>';
                        } elseif ($data['sort'] > 0) {
index 2893e90c0b935b8747c59000494ddbb732bfa08c..9c1e556d68c94ae742c455315fd3979a542c8b93 100644 (file)
@@ -262,8 +262,8 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        }
 
        // Get number of menu entries
        }
 
        // Get number of menu entries
-       $max = SQL_NUMROWS($result);
-       if ($max > 0) {
+       $numMenus = SQL_NUMROWS($result);
+       if ($numMenus > 0) {
                // Set sub value
                $content['sub'] = $SUB;
 
                // Set sub value
                $content['sub'] = $SUB;
 
@@ -277,7 +277,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
                        if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
                                $NAVI = '<a href="{%url=modules.php?module=admin&amp;what=guestedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']+1) . '&amp;fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
                        if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
                                $NAVI = '<a href="{%url=modules.php?module=admin&amp;what=guestedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']+1) . '&amp;fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
-                       } elseif ($cnt == $max) {
+                       } elseif ($cnt == $numMenus) {
                                // Is lowest position
                                $NAVI = '<a href="{%url=modules.php?module=admin&amp;what=guestedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']-1) . '&amp;fid=' . $data['sort'] . '%}">{--HIGHER--}</a>';
                        } elseif ($data['sort'] > 0) {
                                // Is lowest position
                                $NAVI = '<a href="{%url=modules.php?module=admin&amp;what=guestedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']-1) . '&amp;fid=' . $data['sort'] . '%}">{--HIGHER--}</a>';
                        } elseif ($data['sort'] > 0) {
index aabe4643a0bf2d620106431c2b2dc3f7b2424a6c..49f8473f0f1b3547916b880ad64ab1fbd44b6015 100644 (file)
@@ -252,10 +252,10 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        }
 
        // Get total menu entries
        }
 
        // Get total menu entries
-       $max = SQL_NUMROWS($result);
+       $numMenus = SQL_NUMROWS($result);
 
        // Some are there?
 
        // Some are there?
-       if ($max > 0) {
+       if ($numMenus > 0) {
                // Set sub value
                $content['sub'] = $SUB;
 
                // Set sub value
                $content['sub'] = $SUB;
 
@@ -267,7 +267,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
                        if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']+1) . '&amp;fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
                        if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']+1) . '&amp;fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
-                       } elseif ($cnt == $max) {
+                       } elseif ($cnt == $numMenus) {
                                // Is lowest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']-1) . '&amp;fid=' . $data['sort'] . '%}">{--HIGHER--}</a>';
                        } elseif ($data['sort'] > 0) {
                                // Is lowest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']-1) . '&amp;fid=' . $data['sort'] . '%}">{--HIGHER--}</a>';
                        } elseif ($data['sort'] > 0) {
index bd198c04de9e5f1e8126f9781bbcd7cddaa13715..11735715b8ea78e97ed3d275ddfb0bce867ce9f4 100644 (file)
@@ -51,7 +51,7 @@ if (!isExtensionActive('order')) {
 } // END - if
 
 // Set empty mode to "select"
 } // END - if
 
 // Set empty mode to "select"
-if (!isGetRequestParameterSet('mode')) setGetRequestParameter('mode', "select");
+if (!isGetRequestParameterSet('mode')) setGetRequestParameter('mode', 'select');
 
 if (isFormSent()) {
        // Deliver bonus mail
 
 if (isFormSent()) {
        // Deliver bonus mail
index ce92c895308e3f28bba80909d9ca3d27a11e02ac..1117465b0d19fed15510dee85f5e03a2118e865c 100644 (file)
@@ -50,10 +50,13 @@ addMenuDescription('member', __FILE__);
 $whereStatement = " WHERE `visible`='Y'";
 if (isAdmin()) $whereStatement = '';
 
 $whereStatement = " WHERE `visible`='Y'";
 if (isAdmin()) $whereStatement = '';
 
-$result = SQL_QUERY("SELECT id, cat FROM `{?_MYSQL_PREFIX?}_cats`".$whereStatement." ORDER BY `sort`", __FILE__, __LINE__);
-$cats = SQL_NUMROWS($result);
+// Get all categories
+$result = SQL_QUERY("SELECT `id`, `cat` FROM `{?_MYSQL_PREFIX?}_cats`".$whereStatement." ORDER BY `sort` ASC", __FILE__, __LINE__);
 
 
-if ($cats > 0) {
+// Get num rows
+$numCategories = SQL_NUMROWS($result);
+
+if ($numCategories > 0) {
        $LEAST = false;
        if (isFormSent()) {
                $cnt = '0';
        $LEAST = false;
        if (isFormSent()) {
                $cnt = '0';
@@ -61,7 +64,7 @@ if ($cats > 0) {
                        if ($joined != 'Y') $cnt++;
                } // END - foreach
 
                        if ($joined != 'Y') $cnt++;
                } // END - foreach
 
-               if (($cats - $cnt) < getConfig('least_cats')) {
+               if (($numCategories - $cnt) < getConfig('least_cats')) {
                        unsetPostRequestParameter('ok');
                        $LEAST = true;
                } // END - if
                        unsetPostRequestParameter('ok');
                        $LEAST = true;
                } // END - if
@@ -120,7 +123,7 @@ if ($cats > 0) {
                } // END - if
 
                // Put some data into constants for the template
                } // END - if
 
                // Put some data into constants for the template
-               $content['rows'] = ($cats*2+4);
+               $content['rows'] = ($numCategories * 2 + 4);
 
                // Load header template
                loadTemplate('member_cats_header', false, $content);
 
                // Load header template
                loadTemplate('member_cats_header', false, $content);
index 1b6db929f0880570d88f17e881c788da1801d077..1f4d5d0ad0e811f096975197a1abd078291a760b 100644 (file)
@@ -49,16 +49,16 @@ addMenuDescription('member', __FILE__);
 
 // Query for referal levels and percents
 $result_depths = SQL_QUERY("SELECT `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC", __FILE__, __LINE__);
 
 // Query for referal levels and percents
 $result_depths = SQL_QUERY("SELECT `level`, `percents` FROM `{?_MYSQL_PREFIX?}_refdepths` ORDER BY `level` ASC", __FILE__, __LINE__);
-$depths = SQL_NUMROWS($result_depths);
+$numDepths = SQL_NUMROWS($result_depths);
 
 // Add many more rows for the login/turbo/ref/order bonus
 // @TODO Should we rewrite this to a filter?
 
 // Add many more rows for the login/turbo/ref/order bonus
 // @TODO Should we rewrite this to a filter?
-if (!isExtensionActive('bonus')) $depths += 1;
-if (isExtensionInstalledAndNewer('bonus', '0.2.2')) $depths += 6;
-if (isExtensionInstalledAndNewer('bonus', '0.4.4')) $depths += 4;
+if (!isExtensionActive('bonus')) $numDepths += 1;
+if (isExtensionInstalledAndNewer('bonus', '0.2.2')) $numDepths += 6;
+if (isExtensionInstalledAndNewer('bonus', '0.4.4')) $numDepths += 4;
 
 // Remember row count in constant
 
 // Remember row count in constant
-$content['rowspan'] = ($depths*2+15);
+$content['rowspan'] = ($numDepths * 2 + 15);
 
 // Init some vars...
 $content['total_points'] = '0';
 
 // Init some vars...
 $content['total_points'] = '0';
index 1bf7eda6ef050c28fd34e2a831ecaa0a56d85df8..1dd3aa1ca361c916a3e33212b50524acba610c66 100644 (file)
@@ -908,22 +908,22 @@ function countSumTotalData ($search, $tableName, $lookFor = 'id', $whereStatemen
                // Count or sum whole table?
                if ($countRows === true) {
                        // Count whole table
                // Count or sum whole table?
                if ($countRows === true) {
                        // Count whole table
-                       $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS res FROM `{?_MYSQL_PREFIX?}_%s`".$add,
+                       $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s`".$add,
                                array($lookFor, $tableName), __FUNCTION__, __LINE__);
                } else {
                        // Sum whole table
                                array($lookFor, $tableName), __FUNCTION__, __LINE__);
                } else {
                        // Sum whole table
-                       $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS res FROM `{?_MYSQL_PREFIX?}_%s`".$add,
+                       $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s`".$add,
                                array($lookFor, $tableName), __FUNCTION__, __LINE__);
                }
        } elseif (($countRows === true) || ($lookFor == 'userid')) {
                // Count rows
                //* DEBUG: */ debugOutput('COUNT!');
                                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,
+               $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add,
                        array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__);
        } else {
                // Add all rows
                //* DEBUG: */ debugOutput('SUM!');
                        array($lookFor, $tableName, $whereStatement, $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,
+               $result = SQL_QUERY_ESC("SELECT SUM(`%s`) AS `res` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`='%s'".$add,
                        array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__);
        }
 
                        array($lookFor, $tableName, $whereStatement, $search), __FUNCTION__, __LINE__);
        }
 
@@ -1580,21 +1580,9 @@ function subtractPoints ($subject, $userid, $points) {
 }
 
 // "Getter" for total available receivers
 }
 
 // "Getter" for total available receivers
-function getTotalReceivers ($mode='normal') {
-       // Query database
-       $result_all = SQL_QUERY("SELECT
-       `userid`
-FROM
-       `{?_MYSQL_PREFIX?}_user_data`
-WHERE
-       `status`='CONFIRMED' AND `receive_mails` > 0 ".runFilterChain('exclude_users', $mode),
-       __FUNCTION__, __LINE__);
-
+function getTotalReceivers ($mode = 'normal') {
        // Get num rows
        // Get num rows
-       $numRows = SQL_NUMROWS($result_all);
-
-       // Free result
-       SQL_FREERESULT($result_all);
+       $numRows = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true, ' AND `receive_mails` > 0' . runFilterChain('exclude_users', $mode));
 
        // Return value
        return $numRows;
 
        // Return value
        return $numRows;
index 9cb95a30167d40bfec2dd2ac13f23d351846cb1d..1ff2789518a03a099f9aa55136958cd523640e12 100644 (file)
@@ -2,10 +2,10 @@
 <tr>
        <td align="center">
                {--BONUS_SHOW_YOU_HAVE_CONFIRMED--}
 <tr>
        <td align="center">
                {--BONUS_SHOW_YOU_HAVE_CONFIRMED--}
-               <strong class="nobr">$content[yr_tmark]</strong>
-               {--_ON--} <strong>$content[yr_level].</strong>
+               <strong class="nobr">$content[timemark]</strong>
+               {--_ON--} <strong>$content[level].</strong>
                {--BONUS_SHOW_CONFIRMED_BONUS_IS--}:
                {--BONUS_SHOW_CONFIRMED_BONUS_IS--}:
-               <strong class="nobr">$content[yr_points] {?POINTS?}</strong>
+               <strong class="nobr">{%pipe,translateComma=$content[points]%} {?POINTS?}</strong>
        </td>
 </tr>
 </table>
        </td>
 </tr>
 </table>