From d0d885e08aba45b77818d49bcf40396bf788c386 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 5 Nov 2009 18:10:49 +0000 Subject: [PATCH] Rewritten to not use anymore --- inc/libs/rallye_functions.php | 12 ++++----- inc/modules/admin/what-admins_mails.php | 3 +-- inc/modules/admin/what-config_admins.php | 11 +++----- inc/modules/admin/what-config_mods.php | 6 ++--- .../admin/what-config_rallye_prices.php | 9 +++---- inc/modules/admin/what-del_transfer.php | 19 +++++++------ inc/modules/admin/what-extensions.php | 17 ++++-------- inc/modules/admin/what-list_rallyes.php | 23 +++++++--------- inc/modules/admin/what-list_task.php | 7 ++--- inc/modules/admin/what-refbanner.php | 10 ++----- inc/modules/admin/what-theme_check.php | 5 ++-- inc/modules/admin/what-theme_edit.php | 27 +++++++++++++------ inc/modules/admin/what-unlock_emails.php | 16 +++-------- 13 files changed, 68 insertions(+), 97 deletions(-) diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 2199fbb9b2..1630c50e22 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -80,7 +80,7 @@ function autostartReferalRallyes ($result) { 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 @@ -195,7 +195,7 @@ ORDER BY // 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); @@ -214,7 +214,7 @@ LEFT JOIN 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__); @@ -552,7 +552,7 @@ function getArrayFromReferalRallyePrices ($rallye) { ); // 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 @@ -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)); - 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)); - 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 diff --git a/inc/modules/admin/what-admins_mails.php b/inc/modules/admin/what-admins_mails.php index c949b03161..b4f752c939 100644 --- a/inc/modules/admin/what-admins_mails.php +++ b/inc/modules/admin/what-admins_mails.php @@ -46,8 +46,7 @@ addMenuDescription('admin', __FILE__); 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 = ''; diff --git a/inc/modules/admin/what-config_admins.php b/inc/modules/admin/what-config_admins.php index 46da2c11fc..5068067c66 100644 --- a/inc/modules/admin/what-config_admins.php +++ b/inc/modules/admin/what-config_admins.php @@ -44,10 +44,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // 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) { @@ -82,7 +79,7 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) { // 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 @@ -106,7 +103,7 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) { // 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) { @@ -143,7 +140,7 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) { // 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) { diff --git a/inc/modules/admin/what-config_mods.php b/inc/modules/admin/what-config_mods.php index f490afd9d4..8d396498c1 100644 --- a/inc/modules/admin/what-config_mods.php +++ b/inc/modules/admin/what-config_mods.php @@ -44,11 +44,9 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addMenuDescription('admin', __FILE__); -$SEL = '0'; if (isPostRequestElementSet('edit')) { // Check if at least one module is selected - $SEL = countPostSelection(); - if ($SEL > 0) { + if (countPostSelection() > 0) { // Output header $OUT = ''; $SW = 2; @@ -119,7 +117,7 @@ if (isPostRequestElementSet('edit')) { 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` diff --git a/inc/modules/admin/what-config_rallye_prices.php b/inc/modules/admin/what-config_rallye_prices.php index 3245fb3000..401c7b10a9 100644 --- a/inc/modules/admin/what-config_rallye_prices.php +++ b/inc/modules/admin/what-config_rallye_prices.php @@ -73,8 +73,7 @@ VALUES ('%s','%s','%s','%s')", } } 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", @@ -118,8 +117,7 @@ LIMIT 1", 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) { @@ -157,8 +155,7 @@ LIMIT 1", } } 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) { diff --git a/inc/modules/admin/what-del_transfer.php b/inc/modules/admin/what-del_transfer.php index 7a6c1d6a85..8100ac79d7 100644 --- a/inc/modules/admin/what-del_transfer.php +++ b/inc/modules/admin/what-del_transfer.php @@ -46,26 +46,25 @@ addMenuDescription('admin', __FILE__); 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) { - 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 - if +} // END - if // 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 @@ -87,7 +86,7 @@ if (SQL_NUMROWS($result) > 0) { // Sum points and switch colors $total += $content['points']; $SW = 3 - $SW; - } + } // END - while // Free memory SQL_FREERESULT($result); diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 88811b38b0..64ff666484 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -46,19 +46,12 @@ addMenuDescription('admin', __FILE__); // 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! -} 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? @@ -75,7 +68,7 @@ if (isGetRequestElementSet('reg_ext')) { 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 @@ -162,7 +155,7 @@ if (isGetRequestElementSet('reg_ext')) { 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) { @@ -213,7 +206,7 @@ if (isGetRequestElementSet('reg_ext')) { // 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) { @@ -228,7 +221,7 @@ if (isGetRequestElementSet('reg_ext')) { } // 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'))); diff --git a/inc/modules/admin/what-list_rallyes.php b/inc/modules/admin/what-list_rallyes.php index b6fdb930c6..56acd7ac78 100644 --- a/inc/modules/admin/what-list_rallyes.php +++ b/inc/modules/admin/what-list_rallyes.php @@ -39,12 +39,12 @@ // Some security stuff... if ((!defined('__SECURITY')) || (!isAdmin())) { die(); -} +} // END - if // Add description as navigation point addMenuDescription('admin', __FILE__); -if (!isGetRequestElementSet('sub')) setRequestGetElement('sub', ''); +// Init message $message = ''; // Quick actions on a rallye @@ -66,7 +66,7 @@ if (isGetRequestElementSet('rallye')) { array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false) ); break; - } + } // END - switch } elseif (isGetRequestElementSet('notify')) { // Automatic notification switch (getRequestElement('notify')) { @@ -81,7 +81,7 @@ if (isGetRequestElementSet('rallye')) { array(bigintval(getRequestElement('rallye'))), __FILE__, __LINE__, false) ); break; - } + } // END - switch } 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; - } + } // END - switch } // Run SQL command runFilterChain('run_sqls'); } elseif (isPostRequestElementSet('remove')) { // Delete rallyes - $SEL = countPostSelection(); - if ($SEL > 0) { + if (countPostSelection() > 0) { // 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)); - 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)); - 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 @@ -130,8 +129,7 @@ if (isGetRequestElementSet('rallye')) { } } elseif (isPostRequestElementSet('change')) { // Change rallye - $SEL = countSelection(postRequestElement('title')); - if ($SEL > 0) { + if (countSelection(postRequestElement('title')) > 0) { // Init SQLs initSqls(); @@ -180,8 +178,7 @@ LIMIT 1", 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) { diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index b0d7f96980..fb6eb9080f 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -84,10 +84,7 @@ switch (getRequestElement('type')) { } 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 = ''; @@ -106,7 +103,7 @@ ORDER BY `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 diff --git a/inc/modules/admin/what-refbanner.php b/inc/modules/admin/what-refbanner.php index a157c80fd4..abab32ca9b 100644 --- a/inc/modules/admin/what-refbanner.php +++ b/inc/modules/admin/what-refbanner.php @@ -44,17 +44,11 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addMenuDescription('admin', __FILE__); -// Init variable -$SEL = '0'; - // 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'); @@ -98,7 +92,7 @@ VALUES ('%s','%s','%s')", $content = "{--SETTINGS_NOT_SAVED--}"; } 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) { @@ -125,7 +119,7 @@ VALUES ('%s','%s','%s')", // 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", diff --git a/inc/modules/admin/what-theme_check.php b/inc/modules/admin/what-theme_check.php index 082e8fdc18..ef76316c19 100644 --- a/inc/modules/admin/what-theme_check.php +++ b/inc/modules/admin/what-theme_check.php @@ -46,13 +46,12 @@ addMenuDescription('admin', __FILE__); // 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? -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 @@ -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? - 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)); diff --git a/inc/modules/admin/what-theme_edit.php b/inc/modules/admin/what-theme_edit.php index 79663f43dd..8dbbaeb692 100644 --- a/inc/modules/admin/what-theme_edit.php +++ b/inc/modules/admin/what-theme_edit.php @@ -50,9 +50,7 @@ if (!isExtensionActive('theme')) { } // 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 = ''; @@ -79,7 +77,7 @@ if ($SEL > 0) { // Rebuild cache rebuildCacheFile('themes', 'them'); } // END - if - } + } // END - foreach // Output generated? if (empty($OUT)) $OUT = getMessage('ADMIN_THEME_NO_OUTPUT'); @@ -97,13 +95,26 @@ if ($SEL > 0) { adminSaveSettings($postData); } +// Init rows +$OUT = ''; + // 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) { + // Init color + $SW = 2; 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; - } + } // END - while // Free memory SQL_FREERESULT($result); diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index f19475fa50..62814be9db 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -58,18 +58,8 @@ ORDER BY `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 ($SEL > 0) { + if (countPostSelection() > 0) { // 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'))) { - if ($SEL > 0) { + if (countPostSelection() > 0) { // 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')); } - } 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 -- 2.30.2