Rewritten to not use anymore
authorRoland Häder <roland@mxchange.org>
Thu, 5 Nov 2009 18:10:49 +0000 (18:10 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 5 Nov 2009 18:10:49 +0000 (18:10 +0000)
13 files changed:
inc/libs/rallye_functions.php
inc/modules/admin/what-admins_mails.php
inc/modules/admin/what-config_admins.php
inc/modules/admin/what-config_mods.php
inc/modules/admin/what-config_rallye_prices.php
inc/modules/admin/what-del_transfer.php
inc/modules/admin/what-extensions.php
inc/modules/admin/what-list_rallyes.php
inc/modules/admin/what-list_task.php
inc/modules/admin/what-refbanner.php
inc/modules/admin/what-theme_check.php
inc/modules/admin/what-theme_edit.php
inc/modules/admin/what-unlock_emails.php

index 2199fbb9b2cf9d5dd4e999d726f295194db9192d..1630c50e22b6443d185b75264bc970c5f60a8a51 100644 (file)
@@ -80,7 +80,7 @@ function autostartReferalRallyes ($result) {
                if (empty($cnt)) $cnt = '0'; // Added prevent some unknown troubles... :-?
 
                // Check if line is already included...
                if (empty($cnt)) $cnt = '0'; // Added prevent some unknown troubles... :-?
 
                // Check if line is already included...
-               $result_ref = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE rallye_id=%s AND `userid`=%s LIMIT 1",
+               $result_ref = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s AND `userid`=%s LIMIT 1",
                        array(bigintval($id), bigintval($content['userid'])), __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result_ref) == '0') {
                        // Free memory
                        array(bigintval($id), bigintval($content['userid'])), __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result_ref) == '0') {
                        // Free memory
@@ -195,7 +195,7 @@ ORDER BY
 //
 function addReferalRallyeTopUsers ($rallye, $default=0) {
        // First check how many prices are set
 //
 function addReferalRallyeTopUsers ($rallye, $default=0) {
        // First check how many prices are set
-       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
+       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s ORDER BY price_level",
                array(bigintval($rallye)), __FUNCTION__, __LINE__);
        $prices = SQL_NUMROWS($result);
        SQL_FREERESULT($result);
                array(bigintval($rallye)), __FUNCTION__, __LINE__);
        $prices = SQL_NUMROWS($result);
        SQL_FREERESULT($result);
@@ -214,7 +214,7 @@ LEFT JOIN
 ON
        u.rallye_id=rd.id
 WHERE
 ON
        u.rallye_id=rd.id
 WHERE
-       u.rallye_id=%s AND r.counter > 0
+       u.`rallye_id`=%s AND r.counter > 0
 ORDER BY
        u.refs DESC",
                array(bigintval($rallye)), __FUNCTION__, __LINE__);
 ORDER BY
        u.refs DESC",
                array(bigintval($rallye)), __FUNCTION__, __LINE__);
@@ -552,7 +552,7 @@ function getArrayFromReferalRallyePrices ($rallye) {
        );
 
        // Load prices
        );
 
        // Load prices
-       $result = SQL_QUERY_ESC("SELECT price_level, points, info FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE rallye_id=%s ORDER BY price_level",
+       $result = SQL_QUERY_ESC("SELECT price_level, points, info FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s ORDER BY price_level",
        array(bigintval($rallye)), __FUNCTION__, __LINE__);
 
        // Transfer elements
        array(bigintval($rallye)), __FUNCTION__, __LINE__);
 
        // Transfer elements
@@ -738,9 +738,9 @@ WHERE end_time <= (UNIX_TIMESTAMP() - {?ONE_DAY?} - %s) AND expired='Y'",
                        // Purge whole rallye
                        addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1",
                                array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
                        // Purge whole rallye
                        addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1",
                                array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
-                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE rallye_id=%s LIMIT 1",
+                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s LIMIT 1",
                                array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
                                array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
-                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE rallye_id=%s LIMIT 1",
+                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s LIMIT 1",
                                array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
 
                        // Add task
                                array(bigintval($content['id'])), __FUNCTION__, __LINE__, false));
 
                        // Add task
index c949b03161714f08e2abf121410f9968e1a2f313..b4f752c93986e2618dd5037c3cba9a372958d404 100644 (file)
@@ -46,8 +46,7 @@ addMenuDescription('admin', __FILE__);
 
 if (isPostRequestElementSet('edit')) {
        // Check if entires are checked
 
 if (isPostRequestElementSet('edit')) {
        // Check if entires are checked
-       $SEL = countPostSelection();
-       if ($SEL > 0) {
+       if (countPostSelection() > 0) {
                // Add option for events
                $adminsList = generateOptionList('admins', 'id', 'login', '', 'email');
                $SW = 2; $rowNameS = '';
                // Add option for events
                $adminsList = generateOptionList('admins', 'id', 'login', '', 'email');
                $SW = 2; $rowNameS = '';
index 46da2c11fc6c29a3900263d501ffeb5f0c939efa..5068067c66dc56375dc931e83f9b7b9b666ea5ae 100644 (file)
@@ -44,10 +44,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
-$SEL = '0';
-if (isPostRequestElementSet('sel')) $SEL = countPostSelection();
-
-if ((isPostRequestElementSet('edit')) && ($SEL > 0)) {
+if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0)) {
        // Edit ACLs
        $OUT = ''; $SW = 2;
        foreach (postRequestElement('sel') as $id => $selected) {
        // Edit ACLs
        $OUT = ''; $SW = 2;
        foreach (postRequestElement('sel') as $id => $selected) {
@@ -82,7 +79,7 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) {
 
        // Load main template
        loadTemplate('admin_config_admins_edit', false, $OUT);
 
        // Load main template
        loadTemplate('admin_config_admins_edit', false, $OUT);
-} elseif ((isPostRequestElementSet('change')) && ($SEL > 0)) {
+} elseif ((isPostRequestElementSet('change')) && (countPostSelection() > 0)) {
        // Change entries
        foreach (postRequestElement('sel') as $id => $selected) {
                // Secure id
        // Change entries
        foreach (postRequestElement('sel') as $id => $selected) {
                // Secure id
@@ -106,7 +103,7 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) {
 
        // Entries changed
        loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ENTRIES_CHANGED'));
 
        // Entries changed
        loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ENTRIES_CHANGED'));
-} elseif ((isPostRequestElementSet('del')) && ($SEL > 0)) {
+} elseif ((isPostRequestElementSet('del')) && (countPostSelection() > 0)) {
        // Delete ACLs
        $OUT = ''; $SW = 2;
        foreach (postRequestElement('sel') as $id => $selected) {
        // Delete ACLs
        $OUT = ''; $SW = 2;
        foreach (postRequestElement('sel') as $id => $selected) {
@@ -143,7 +140,7 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) {
 
        // Load main template
        loadTemplate('admin_config_admins_del', false, $OUT);
 
        // Load main template
        loadTemplate('admin_config_admins_del', false, $OUT);
-} elseif ((isPostRequestElementSet('remove')) && ($SEL > 0)) {
+} elseif ((isPostRequestElementSet('remove')) && (countPostSelection() > 0)) {
        // Remove entries
        // @TODO Rewrite this to filter 'run_sqls'
        foreach (postRequestElement('sel') as $id => $selected) {
        // Remove entries
        // @TODO Rewrite this to filter 'run_sqls'
        foreach (postRequestElement('sel') as $id => $selected) {
index f490afd9d42039f2055e70060dd33330cc68373a..8d396498c1a6e1591df9d660d280869ac7731382 100644 (file)
@@ -44,11 +44,9 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
-$SEL = '0';
 if (isPostRequestElementSet('edit')) {
        // Check if at least one module is selected
 if (isPostRequestElementSet('edit')) {
        // Check if at least one module is selected
-       $SEL = countPostSelection();
-       if ($SEL > 0) {
+       if (countPostSelection() > 0) {
                // Output header
                $OUT = ''; $SW = 2;
 
                // Output header
                $OUT = ''; $SW = 2;
 
@@ -119,7 +117,7 @@ if (isPostRequestElementSet('edit')) {
        loadTemplate('admin_settings_saved', false, getMessage('MODS_CHANGED'));
 }
 
        loadTemplate('admin_settings_saved', false, getMessage('MODS_CHANGED'));
 }
 
-if ($SEL == '0') {
+if (countPostSelection() == '0') {
        // Load module data (We do not need to check if there's at least one...)
        $result = SQL_QUERY('SELECT id, module, locked, hidden, admin_only, title, mem_only
 FROM `{?_MYSQL_PREFIX?}_mod_reg`
        // Load module data (We do not need to check if there's at least one...)
        $result = SQL_QUERY('SELECT id, module, locked, hidden, admin_only, title, mem_only
 FROM `{?_MYSQL_PREFIX?}_mod_reg`
index 3245fb300025a35d0ed0ac50e286fc796f6c1460..401c7b10a9b1f8876b2c75dcc3f8632ff1af8318 100644 (file)
@@ -73,8 +73,7 @@ VALUES ('%s','%s','%s','%s')",
                }
        } elseif (isPostRequestElementSet('remove')) {
                // Check if at last one line is selected
                }
        } elseif (isPostRequestElementSet('remove')) {
                // Check if at last one line is selected
-               $SEL = countPostSelection();
-               if ($SEL > 0) {
+               if (countPostSelection() > 0) {
                        // Delete selected entries
                        foreach (postRequestElement('sel') as $id => $sel) {
                                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `id`=%s LIMIT 1",
                        // Delete selected entries
                        foreach (postRequestElement('sel') as $id => $sel) {
                                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `id`=%s LIMIT 1",
@@ -118,8 +117,7 @@ LIMIT 1",
 
        if (isPostRequestElementSet('edit')) {
                // Check if at last one line is selected
 
        if (isPostRequestElementSet('edit')) {
                // Check if at last one line is selected
-               $SEL = countPostSelection();
-               if ($SEL > 0) {
+               if (countPostSelection() > 0) {
                        // Make selected editable
                        $OUT = ''; $SW = 2;
                        foreach (postRequestElement('sel') as $id => $sel) {
                        // Make selected editable
                        $OUT = ''; $SW = 2;
                        foreach (postRequestElement('sel') as $id => $sel) {
@@ -157,8 +155,7 @@ LIMIT 1",
                }
        } elseif (isPostRequestElementSet('del')) {
                // Check if at last one line is selected
                }
        } elseif (isPostRequestElementSet('del')) {
                // Check if at last one line is selected
-               $SEL = countPostSelection();
-               if ($SEL > 0) {
+               if (countPostSelection() > 0) {
                        // List all prices
                        $OUT = ''; $SW = 2;
                        foreach (postRequestElement('sel') as $id => $sel) {
                        // List all prices
                        $OUT = ''; $SW = 2;
                        foreach (postRequestElement('sel') as $id => $sel) {
index 7a6c1d6a8543f908fe1412f9e69caa44a7c10028..8100ac79d7357280ee95fb7446b10acc5d088c29 100644 (file)
@@ -46,26 +46,25 @@ addMenuDescription('admin', __FILE__);
 
 if (isPostRequestElementSet('del')) {
        // Delete entries from tables
 
 if (isPostRequestElementSet('del')) {
        // Delete entries from tables
-       $SEL = countPostSelection();
-       if ($SEL > 0) {
+       if (countPostSelection() > 0) {
                // Init SQLs
                initSqls();
 
                // Delete entries...
                foreach (postRequestElement('sel') as $id => $sel) {
                // Init SQLs
                initSqls();
 
                // Delete entries...
                foreach (postRequestElement('sel') as $id => $sel) {
-                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE trans_id=%s LIMIT 1",
-                       array(bigintval($id)), __FILE__, __LINE__, false));
-                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE trans_id=%s LIMIT 1",
-                       array(bigintval($id)), __FILE__, __LINE__, false));
+                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_in` WHERE `trans_id`=%s LIMIT 1",
+                               array(bigintval($id)), __FILE__, __LINE__, false));
+                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_transfers_out` WHERE `trans_id`=%s LIMIT 1",
+                               array(bigintval($id)), __FILE__, __LINE__, false));
                } // END - foreach
 
                // Run all SQLs
                runFilterChain('run_sqls');
                } // END - foreach
 
                // Run all SQLs
                runFilterChain('run_sqls');
-       }
-}
+       } // END - if
+} // END - if
 
 // We only need outgoing transfers
 
 // We only need outgoing transfers
-$result = SQL_QUERY("SELECT userid, to_userid, trans_id, points, reason, time_trans FROM `{?_MYSQL_PREFIX?}_user_transfers_out` ORDER BY trans_id", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT `userid`, `to_userid`, `trans_id`, `points`, `reason`, `time_trans` FROM `{?_MYSQL_PREFIX?}_user_transfers_out` ORDER BY `trans_id` ASC", __FILE__, __LINE__);
 $total = '0';
 if (SQL_NUMROWS($result) > 0) {
        // Output rows
 $total = '0';
 if (SQL_NUMROWS($result) > 0) {
        // Output rows
@@ -87,7 +86,7 @@ if (SQL_NUMROWS($result) > 0) {
 
                // Sum points and switch colors
                $total += $content['points']; $SW = 3 - $SW;
 
                // Sum points and switch colors
                $total += $content['points']; $SW = 3 - $SW;
-       }
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
 
        // Free memory
        SQL_FREERESULT($result);
index 88811b38b0c92c8625b64c2e1bb32385d4a08f98..64ff666484733be25f7373db30eb8d3d10338774 100644 (file)
@@ -46,19 +46,12 @@ addMenuDescription('admin', __FILE__);
 
 // Normally we want the overview of all registered extensions
 $do = 'overview';
 
 // Normally we want the overview of all registered extensions
 $do = 'overview';
-$SEL = '0';
-
-// Are some extensions submitted?
-if (isPostRequestElementSet('sel')) {
-       // Then count all
-       $SEL = countPostSelection();
-} // END - if
 
 if (isGetRequestElementSet('reg_ext')) {
        // We are about to register a new extension
        $do = 'register'; $ext_id = bigintval(getRequestElement('reg_ext'));
        // The id comes from task management and it is - of course - *not* the extension's name!
 
 if (isGetRequestElementSet('reg_ext')) {
        // We are about to register a new extension
        $do = 'register'; $ext_id = bigintval(getRequestElement('reg_ext'));
        // The id comes from task management and it is - of course - *not* the extension's name!
-} elseif ((isPostRequestElementSet('change')) && ($SEL > 0) && (!isDemoModeActive())) {
+} elseif ((isPostRequestElementSet('change')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
        // De-/activate extensions
        foreach (postRequestElement('sel') as $ext_id => $active) {
                // Shall we keep the extension always active?
        // De-/activate extensions
        foreach (postRequestElement('sel') as $ext_id => $active) {
                // Shall we keep the extension always active?
@@ -75,7 +68,7 @@ if (isGetRequestElementSet('reg_ext')) {
                        doExtensionSqls($ext_id, getExtensionMode());
                }
        }
                        doExtensionSqls($ext_id, getExtensionMode());
                }
        }
-} elseif (((isPostRequestElementSet('edit')) || (isPostRequestElementSet(('modify')))) && ($SEL > 0) && (!isDemoModeActive())) {
+} elseif (((isPostRequestElementSet('edit')) || (isPostRequestElementSet(('modify')))) && (countPostSelection() > 0) && (!isDemoModeActive())) {
        // Change settings like CSS file load
        if (isPostRequestElementSet(('modify'))) {
                // Change entries
        // Change settings like CSS file load
        if (isPostRequestElementSet(('modify'))) {
                // Change entries
@@ -162,7 +155,7 @@ if (isGetRequestElementSet('reg_ext')) {
                loadTemplate('admin_extensions_edit', false, $OUT);
                $do = 'edit';
        }
                loadTemplate('admin_extensions_edit', false, $OUT);
                $do = 'edit';
        }
-} elseif ((isPostRequestElementSet('delete')) && ($SEL > 0) && (!isDemoModeActive())) {
+} elseif ((isPostRequestElementSet('delete')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
        // List extensions and when verbose is enabled SQL statements which will be executed
        $OUT = ''; $SW = 2;
        foreach (postRequestElement('sel') as $ext_id => $sel) {
        // List extensions and when verbose is enabled SQL statements which will be executed
        $OUT = ''; $SW = 2;
        foreach (postRequestElement('sel') as $ext_id => $sel) {
@@ -213,7 +206,7 @@ if (isGetRequestElementSet('reg_ext')) {
        // Load template
        loadTemplate('admin_extensions_delete', false, $OUT);
        $do = 'delete';
        // Load template
        loadTemplate('admin_extensions_delete', false, $OUT);
        $do = 'delete';
-} elseif ((isPostRequestElementSet('remove')) && ($SEL > 0) && (!isDemoModeActive())) {
+} elseif ((isPostRequestElementSet('remove')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
        // Remove extensions from DB (you have to delete all files manually!)
        $cache_update = '0';
        foreach (postRequestElement('sel') as $ext_id => $active) {
        // Remove extensions from DB (you have to delete all files manually!)
        $cache_update = '0';
        foreach (postRequestElement('sel') as $ext_id => $active) {
@@ -228,7 +221,7 @@ if (isGetRequestElementSet('reg_ext')) {
        } // END - foreach
 
        // Extensions removed
        } // END - foreach
 
        // Extensions removed
-       loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_EXTENSIONS_REMOVED'), $SEL));
+       loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_EXTENSIONS_REMOVED'), countPostSelection()));
 } elseif ((isGetRequestElementSet('do')) && (!isDemoModeActive())) {
        // Other things to do
        $do = SQL_ESCAPE(secureString(getRequestElement('do')));
 } elseif ((isGetRequestElementSet('do')) && (!isDemoModeActive())) {
        // Other things to do
        $do = SQL_ESCAPE(secureString(getRequestElement('do')));
index b6fdb930c6d3f44067df2d92d2d9d603fa0f0221..56acd7ac78767b7ef79722713ae4aba770ca6a0b 100644 (file)
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
-}
+} // END - if
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
-if (!isGetRequestElementSet('sub')) setRequestGetElement('sub', '');
+// Init message
 $message = '';
 
 // Quick actions on a rallye
 $message = '';
 
 // Quick actions on a rallye
@@ -66,7 +66,7 @@ if (isGetRequestElementSet('rallye')) {
                                        array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false)
                                );
                                break;
                                        array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false)
                                );
                                break;
-               }
+               } // END - switch
        } elseif (isGetRequestElementSet('notify')) {
                // Automatic notification
                switch (getRequestElement('notify')) {
        } elseif (isGetRequestElementSet('notify')) {
                // Automatic notification
                switch (getRequestElement('notify')) {
@@ -81,7 +81,7 @@ if (isGetRequestElementSet('rallye')) {
                                        array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false)
                                );
                                break;
                                        array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false)
                                );
                                break;
-               }
+               } // END - switch
        } elseif (isGetRequestElementSet('auto')) {
                // Automatic adding of new members
                switch (getRequestElement('auto')) {
        } elseif (isGetRequestElementSet('auto')) {
                // Automatic adding of new members
                switch (getRequestElement('auto')) {
@@ -96,15 +96,14 @@ if (isGetRequestElementSet('rallye')) {
                                        array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false)
                                );
                                break;
                                        array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false)
                                );
                                break;
-               }
+               } // END - switch
        }
 
        // Run SQL command
        runFilterChain('run_sqls');
 } elseif (isPostRequestElementSet('remove')) {
        // Delete rallyes
        }
 
        // Run SQL command
        runFilterChain('run_sqls');
 } elseif (isPostRequestElementSet('remove')) {
        // Delete rallyes
-       $SEL = countPostSelection();
-       if ($SEL > 0) {
+       if (countPostSelection() > 0) {
                // Init SQLs
                initSqls();
 
                // Init SQLs
                initSqls();
 
@@ -113,9 +112,9 @@ if (isGetRequestElementSet('rallye')) {
                        // Remove selected rallye entirely...
                        addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__, false));
                        // Remove selected rallye entirely...
                        addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_data` WHERE `id`=%s LIMIT 1",
                                array(bigintval($id)), __FILE__, __LINE__, false));
-                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE rallye_id=%s",
+                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s",
                                array(bigintval($id)), __FILE__, __LINE__, false));
                                array(bigintval($id)), __FILE__, __LINE__, false));
-                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE rallye_id=%s",
+                       addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_rallye_users` WHERE `rallye_id`=%s",
                                array(bigintval($id)), __FILE__, __LINE__, false));
                } // END - foreach
 
                                array(bigintval($id)), __FILE__, __LINE__, false));
                } // END - foreach
 
@@ -130,8 +129,7 @@ if (isGetRequestElementSet('rallye')) {
        }
 } elseif (isPostRequestElementSet('change')) {
        // Change rallye
        }
 } elseif (isPostRequestElementSet('change')) {
        // Change rallye
-       $SEL = countSelection(postRequestElement('title'));
-       if ($SEL > 0) {
+       if (countSelection(postRequestElement('title')) > 0) {
                // Init SQLs
                initSqls();
 
                // Init SQLs
                initSqls();
 
@@ -180,8 +178,7 @@ LIMIT 1",
 
 if (isPostRequestElementSet('edit')) {
        // Check for selections
 
 if (isPostRequestElementSet('edit')) {
        // Check for selections
-       $SEL = countPostSelection();
-       if ($SEL > 0) {
+       if (countPostSelection() > 0) {
                // Make all selected and deactivated rallyes editable
                $OUT = ''; $SW = 2;
                foreach (postRequestElement('sel') as $id => $selected) {
                // Make all selected and deactivated rallyes editable
                $OUT = ''; $SW = 2;
                foreach (postRequestElement('sel') as $id => $selected) {
index b0d7f96980f0931c4fef8535cfbde2a26607052d..fb6eb9080f023e3c33945457ec2878d865e91d5a 100644 (file)
@@ -84,10 +84,7 @@ switch (getRequestElement('type')) {
 }
 
 if (!empty($whereStatement)) {
 }
 
 if (!empty($whereStatement)) {
-       $SEL = '0';
-       if (isPostRequestElementSet(('task'))) $SEL = countSelection(postRequestElement('task'));
-
-       if ((isPostRequestElementSet(('assign'))) && ($SEL > 0)) {
+       if ((isPostRequestElementSet(('assign'))) && (countPostSelection() > 0)) {
                // Assign / do tasks
                loadIncludeOnce("inc/modules/admin/overview-inc.php");
                if (empty($dmy)) $dmy = '';
                // Assign / do tasks
                loadIncludeOnce("inc/modules/admin/overview-inc.php");
                if (empty($dmy)) $dmy = '';
@@ -106,7 +103,7 @@ ORDER BY
        `subject` ASC,
        `task_created` DESC',
                        __FILE__, __LINE__);
        `subject` ASC,
        `task_created` DESC',
                        __FILE__, __LINE__);
-               if (($SEL > 0) && (!isDemoModeActive())) {
+               if ((countPostSelection() > 0) && (!isDemoModeActive())) {
                        // Only unassign / delete tasks when there are selected tasks posted
                        if (isPostRequestElementSet('unassign')) {
                                // Unassign from tasks
                        // Only unassign / delete tasks when there are selected tasks posted
                        if (isPostRequestElementSet('unassign')) {
                                // Unassign from tasks
index a157c80fd4bc1232abb7992a50a43261a81cd376..abab32ca9bb617f7689dc028ce767a09e7e2ae22 100644 (file)
@@ -44,17 +44,11 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
 
-// Init variable
-$SEL = '0';
-
 // Some sanity-check
 if ((!isPostRequestElementSet('url')) || (!isPostRequestElementSet(('alternate')))) {
        unsetPostRequestElement('ok');
 }
 
 // Some sanity-check
 if ((!isPostRequestElementSet('url')) || (!isPostRequestElementSet(('alternate')))) {
        unsetPostRequestElement('ok');
 }
 
-// Check selection count
-if (isPostRequestElementSet('sel')) $SEL = countPostSelection();
-
 if (isFormSent()) {
        // Fix older calls from add-new-banner-form
        if (!isGetRequestElementSet('mode')) setRequestGetElement('mode', 'add');
 if (isFormSent()) {
        // Fix older calls from add-new-banner-form
        if (!isGetRequestElementSet('mode')) setRequestGetElement('mode', 'add');
@@ -98,7 +92,7 @@ VALUES ('%s','%s','%s')",
                $content = "<span class=\"admin_failed\">{--SETTINGS_NOT_SAVED--}</span>";
        }
        loadTemplate('admin_settings_saved', false, $content);
                $content = "<span class=\"admin_failed\">{--SETTINGS_NOT_SAVED--}</span>";
        }
        loadTemplate('admin_settings_saved', false, $content);
-} elseif (($SEL > 0) && (isPostRequestElementSet('edit'))) {
+} elseif ((countPostSelection() > 0) && (isPostRequestElementSet('edit'))) {
        // Edit banner
        $SW = 2; $OUT = '';
        foreach (postRequestElement('sel') as $id => $sel) {
        // Edit banner
        $SW = 2; $OUT = '';
        foreach (postRequestElement('sel') as $id => $sel) {
@@ -125,7 +119,7 @@ VALUES ('%s','%s','%s')",
        // Load main template
        loadTemplate('admin_refbanner_edit', false, $OUT);
 } else {
        // Load main template
        loadTemplate('admin_refbanner_edit', false, $OUT);
 } else {
-       if (($SEL > 0) && (isPostRequestElementSet('del'))) {
+       if ((countPostSelection() > 0) && (isPostRequestElementSet('del'))) {
                // Delete banner
                foreach (postRequestElement('sel') as $id => $sel) {
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `id`=%s LIMIT 1",
                // Delete banner
                foreach (postRequestElement('sel') as $id => $sel) {
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_refbanner` WHERE `id`=%s LIMIT 1",
index 082e8fdc1835ae8d0f04cf87fee594764453c71a..ef76316c192ec894d73b9ba4aec3c1afff555944 100644 (file)
@@ -46,13 +46,12 @@ addMenuDescription('admin', __FILE__);
 
 // Normally we want the overview of all registered theme_check
 $mode = 'overview';
 
 // Normally we want the overview of all registered theme_check
 $mode = 'overview';
-$SEL = '0';
 
 // Get response from our server
 $response = sendGetRequest('check-themes.php');
 
 // Are theme_check found?
 
 // Get response from our server
 $response = sendGetRequest('check-themes.php');
 
 // Are theme_check found?
-if (($response[count($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) {
+if (($response[count($response) - 1] == '[EOF]') && ($response[0] != '[EOF]')) {
        // Ok, mark found and create the array
        $themes = array(
                'fname'  => array(), // File names
        // Ok, mark found and create the array
        $themes = array(
                'fname'  => array(), // File names
@@ -69,7 +68,7 @@ if (($response[count($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) {
                $value = str_replace("\n", '', $value); $ver = '';
 
                // Leave loop when data is invalid or EOF?
                $value = str_replace("\n", '', $value); $ver = '';
 
                // Leave loop when data is invalid or EOF?
-               if ((substr($value, 0, 6) == "theme-") && (substr($value, -4) == ".zip")) {
+               if ((substr($value, 0, 6) == 'theme-') && (substr($value, -4) == '.zip')) {
                        // Extract name and version
                        $name = substr($value, 6, -4);
                        $ver  = trim(substr($response[$idx + 3], 4));
                        // Extract name and version
                        $name = substr($value, 6, -4);
                        $ver  = trim(substr($response[$idx + 3], 4));
index 79663f43dd6c2beb38f25e0057c9a0cfbfa5e6f0..8dbbaeb6923cf5cb5aaaec2ba1ff1db7dc9add27 100644 (file)
@@ -50,9 +50,7 @@ if (!isExtensionActive('theme')) {
 } // END - if
 
 // Check for selected themes
 } // END - if
 
 // Check for selected themes
-$SEL = '0';
-if (isPostRequestElementSet('sel')) $SEL = countPostSelection();
-if ($SEL > 0) {
+if (countPostSelection() > 0) {
        $OUT = '';
        foreach (postRequestElement('sel') as $id => $sel) {
                $sql = '';
        $OUT = '';
        foreach (postRequestElement('sel') as $id => $sel) {
                $sql = '';
@@ -79,7 +77,7 @@ if ($SEL > 0) {
                        // Rebuild cache
                        rebuildCacheFile('themes', 'them');
                } // END - if
                        // Rebuild cache
                        rebuildCacheFile('themes', 'them');
                } // END - if
-       }
+       } // END - foreach
 
        // Output generated?
        if (empty($OUT)) $OUT = getMessage('ADMIN_THEME_NO_OUTPUT');
 
        // Output generated?
        if (empty($OUT)) $OUT = getMessage('ADMIN_THEME_NO_OUTPUT');
@@ -97,13 +95,26 @@ if ($SEL > 0) {
        adminSaveSettings($postData);
 }
 
        adminSaveSettings($postData);
 }
 
+// Init rows
+$OUT = ''; 
+
 // Switch to testing mode
 $GLOBALS['theme_mode'] = 'test';
 
 // Switch to testing mode
 $GLOBALS['theme_mode'] = 'test';
 
-// Generate output lines for the template
-$OUT = ''; $SW = 2;
-$result = SQL_QUERY("SELECT `id`, `theme_path`, `theme_active`, `theme_ver`, `theme_name` FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY theme_path", __FILE__, __LINE__);
+$result = SQL_QUERY("SELECT
+       `id`,
+       `theme_path`,
+       `theme_active`,
+       `theme_ver`,
+       `theme_name`
+FROM
+       `{?_MYSQL_PREFIX?}_themes`
+ORDER BY
+       `theme_path` ASC", __FILE__, __LINE__);
+
 if (SQL_NUMROWS($result) > 0) {
 if (SQL_NUMROWS($result) > 0) {
+       // Init color
+       $SW = 2;
        while ($content = SQL_FETCHARRAY($result)) {
                // Construct IFN
                $inc = sprintf("theme/%s/theme.php", $content['theme_path']);
        while ($content = SQL_FETCHARRAY($result)) {
                // Construct IFN
                $inc = sprintf("theme/%s/theme.php", $content['theme_path']);
@@ -132,7 +143,7 @@ if (SQL_NUMROWS($result) > 0) {
                // Load row template and switch color
                $OUT .= loadTemplate('admin_theme_edit_row', true, $content);
                $SW = 3 - $SW;
                // Load row template and switch color
                $OUT .= loadTemplate('admin_theme_edit_row', true, $content);
                $SW = 3 - $SW;
-       }
+       } // END - while
 
        // Free memory
        SQL_FREERESULT($result);
 
        // Free memory
        SQL_FREERESULT($result);
index f19475fa50bba273a8d5a21873c783d46ad269cc..62814be9db7759317e6ab6538fe9e54051aaeead 100644 (file)
@@ -58,18 +58,8 @@ ORDER BY
        `timestamp` ASC", __FILE__, __LINE__);
 
 if ((SQL_NUMROWS($result_main) > 0) || (isPostRequestElementSet('lock'))) {
        `timestamp` ASC", __FILE__, __LINE__);
 
 if ((SQL_NUMROWS($result_main) > 0) || (isPostRequestElementSet('lock'))) {
-       // Count checked checkboxes
-       $SEL = '0';
-       if (isPostRequestElementSet('sel')) {
-               // Are there checked boxes?
-               if (count(postRequestElement('sel')) > 0) {
-                       // Count now... We use an own function for now
-                       $SEL = countPostSelection();
-               } // END - if
-       } // END - if
-
        if (isPostRequestElementSet('accept')) {
        if (isPostRequestElementSet('accept')) {
-               if ($SEL > 0) {
+               if (countPostSelection() > 0) {
                        // Accept mail orders
                        foreach (postRequestElement('sel') as $id => $value) {
                                // Secure id number
                        // Accept mail orders
                        foreach (postRequestElement('sel') as $id => $value) {
                                // Secure id number
@@ -136,7 +126,7 @@ LIMIT 1",
                // Mails unlocked for mail delivery
                loadTemplate('admin_settings_saved', false, $message);
        } elseif (isPostRequestElementSet(('reject'))) {
                // Mails unlocked for mail delivery
                loadTemplate('admin_settings_saved', false, $message);
        } elseif (isPostRequestElementSet(('reject'))) {
-               if ($SEL > 0) {
+               if (countPostSelection() > 0) {
                        // Reject mail orders
                        $OUT = ''; $SW = 2;
                        foreach (postRequestElement('sel') as $id => $value) {
                        // Reject mail orders
                        $OUT = ''; $SW = 2;
                        foreach (postRequestElement('sel') as $id => $value) {
@@ -182,7 +172,7 @@ LIMIT 1",
                        // Nothing selected
                        loadTemplate('admin_settings_saved', false, getMessage('ADMIN_MAILS_NOTHING_CHECKED'));
                }
                        // Nothing selected
                        loadTemplate('admin_settings_saved', false, getMessage('ADMIN_MAILS_NOTHING_CHECKED'));
                }
-       } elseif ((isPostRequestElementSet('lock')) && ($SEL > 0) && (getConfig('url_blacklist') == 'Y')) {
+       } elseif ((isPostRequestElementSet('lock')) && (countPostSelection() > 0) && (getConfig('url_blacklist') == 'Y')) {
                // Lock URLs
                foreach (postRequestElement('sel') as $id => $url) {
                        // Secure id number
                // Lock URLs
                foreach (postRequestElement('sel') as $id => $url) {
                        // Secure id number