From: Roland Häder Date: Thu, 8 Apr 2010 11:55:18 +0000 (+0000) Subject: Encapsulation and fixes: X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=18e32f1a8971b18bace4f051094acf27800bd7d9 Encapsulation and fixes: - More encapsulation: isFormSent() does now accept an optional parameter - Double quotes to single converted - Some for() loops (there may be more left) "fixed" --- diff --git a/inc/functions.php b/inc/functions.php index e0bee7f20c..03376db72e 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -45,7 +45,9 @@ if (!defined('__SECURITY')) { // Output HTML code directly or 'render' it. You addionally switch the new-line character off function outputHtml ($htmlCode, $newLine = true) { // Init output - if (!isset($GLOBALS['output'])) $GLOBALS['output'] = ''; + if (!isset($GLOBALS['output'])) { + $GLOBALS['output'] = ''; + } // END - if // Transfer username $username = getMessage('USERNAME_UNKNOWN'); @@ -1169,30 +1171,30 @@ function addSelectionBox ($type, $default, $prefix = '', $id = '0', $class = 're if ($type == 'yn') { // This is a yes/no selection only! - if ($id > 0) $prefix .= "[" . $id."]"; - $OUT .= " '; } else { // Begin with regular selection box here if (!empty($prefix)) $prefix .= "_"; $type2 = $type; - if ($id > 0) $type2 .= "[" . $id."]"; - $OUT .= " '; } switch ($type) { case 'day': // Day for ($idx = 1; $idx < 32; $idx++) { - $OUT .= "'; } // END - for break; case 'month': // Month - foreach ($GLOBALS['month_descr'] as $month => $descr) { - $OUT .= "'; } // END - for } elseif ($default == -1) { // Current year minus 1 - for ($idx = $startYear; $idx <= ($year + 1); $idx++) - { - $OUT .= "\n"; - } + for ($idx = $startYear; $idx <= ($year + 1); $idx++) { + $OUT .= ''; + } // END - for } else { // Get current year and subtract the configured minimum age - $OUT .= "\n"; + $OUT .= ''; // Calculate earliest year depending on extension version if (isExtensionInstalledAndNewer('order', '0.2.1')) { // Use configured minimum age @@ -1239,41 +1240,41 @@ function addSelectionBox ($type, $default, $prefix = '', $id = '0', $class = 're // Construct year selection list for ($idx = $minYear; $idx <= $year; $idx++) { - $OUT .= "'; } // END - for } break; case 'sec': case 'min': - for ($idx = '0'; $idx < 60; $idx+=5) { + for ($idx = 0; $idx < 60; $idx+=5) { if (strlen($idx) == 1) $idx = '0' . $idx; - $OUT .= "'; } // END - for break; case 'hour': - for ($idx = '0'; $idx < 24; $idx++) { + for ($idx = 0; $idx < 24; $idx++) { if (strlen($idx) == 1) $idx = '0' . $idx; - $OUT .= "'; } // END - for break; case 'yn': - $OUT .= "\n"; } - } - else - { + } else { $OUT .= " \n"; } } diff --git a/inc/modules/admin/what-adminedit.php b/inc/modules/admin/what-adminedit.php index d5618fe6c1..f8b06dfb28 100644 --- a/inc/modules/admin/what-adminedit.php +++ b/inc/modules/admin/what-adminedit.php @@ -53,7 +53,7 @@ if (isGetRequestParameterSet('sub')) { } // END - if // List all menu points and make them editable -if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDemoModeActive())) { +if ((isFormSent('edit')l) && (countPostSelection() > 0) && (!isDemoModeActive())) { // Edit menu entries // @TODO Kill all constants in this file $content['sub'] = $SUB; @@ -103,7 +103,7 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDem // Load template loadTemplate('admin_amenu_edit_form', false, $content); -} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) { +} elseif ((isFormSent('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // Prepare misc content $content['sub'] = $SUB; $content['chk'] = countPostSelection(); diff --git a/inc/modules/admin/what-admins_add.php b/inc/modules/admin/what-admins_add.php index a5f8f6cebd..cc758a14ba 100644 --- a/inc/modules/admin/what-admins_add.php +++ b/inc/modules/admin/what-admins_add.php @@ -48,17 +48,21 @@ addMenuDescription('admin', __FILE__); // Display form is default $FORM = true; -if ((isPostRequestParameterSet('add')) && (isPostRequestParameterSet('login')) && (isPostRequestParameterSet('email')) && (isPostRequestParameterSet('pass1')) && (isPostRequestParameterSet('pass2')) && (postRequestParameter('pass1') == postRequestParameter('pass2'))) { - // Add admin when not added already - if (addAdminAccount(postRequestParameter('login'), generateHash(postRequestParameter('pass1')), postRequestParameter('email')) == 'done') { - // Do not ouput any form! - $FORM = false; +// Is the form sent? +if (isFormSent('add')) { + // Check all + if ((isPostRequestParameterSet('login')) && (isPostRequestParameterSet('email')) && (isPostRequestParameterSet('pass1')) && (isPostRequestParameterSet('pass2')) && (postRequestParameter('pass1') == postRequestParameter('pass2'))) { + // Add admin when not added already + if (addAdminAccount(postRequestParameter('login'), generateHash(postRequestParameter('pass1')), postRequestParameter('email')) == 'done') { + // Do not ouput any form! + $FORM = false; - // Admin login saved - loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ADD_DONE')); + // Admin login saved + loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ADD_DONE')); - // Run filter chain - runFilterChain('post_admin_added', postRequestArray()); + // Run filter chain + runFilterChain('post_admin_added', postRequestArray()); + } // END - if } // END - if } // END - if diff --git a/inc/modules/admin/what-admins_edit.php b/inc/modules/admin/what-admins_edit.php index 7d3ba08f49..05747bc21e 100644 --- a/inc/modules/admin/what-admins_edit.php +++ b/inc/modules/admin/what-admins_edit.php @@ -58,17 +58,17 @@ if (isGetRequestParameterSet('admin')) { setPostRequestParameter('sel', array($adminId => 1)); } // END - if -if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { +if ((isFormSent('edit')) && (countPostSelection() > 0)) { // Edit account(s) adminsEditAdminAccount(postRequestArray()); -} elseif ((isPostRequestParameterSet('change')) && (count(postRequestParameter('login')) > 0)) { +} elseif ((isFormSent('change')) && (count(postRequestParameter('login')) > 0)) { // Change admin accounts adminsChangeAdminAccount(postRequestArray()); -} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('del')) && (countPostSelection() > 0)) { // Show admin accounts for deletetion adminsDeleteAdminAccount(postRequestArray()); } else { - if ((isPostRequestParameterSet('remove')) && (countPostSelection() > 0)) { + if ((isFormSent('remove')) && (countPostSelection() > 0)) { // Remove accounts now adminsRemoveAdminAccount(postRequestArray()); } // END - if diff --git a/inc/modules/admin/what-admins_mails.php b/inc/modules/admin/what-admins_mails.php index d29061a01e..8afbb9aef9 100644 --- a/inc/modules/admin/what-admins_mails.php +++ b/inc/modules/admin/what-admins_mails.php @@ -45,7 +45,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addMenuDescription('admin', __FILE__); -if (isPostRequestParameterSet('edit')) { +if (isFormSent('edit')) { // Check if entires are checked if (countPostSelection() > 0) { // Add option for events @@ -122,7 +122,7 @@ ORDER BY if (SQL_NUMROWS($result) > 0) { // Shall I change entries? - if (isPostRequestParameterSet('change')) { + if (isFormSent('change')) { // Init SQLs initSqls(); diff --git a/inc/modules/admin/what-config_admins.php b/inc/modules/admin/what-config_admins.php index 97834713ae..99d8f8a3ad 100644 --- a/inc/modules/admin/what-config_admins.php +++ b/inc/modules/admin/what-config_admins.php @@ -45,7 +45,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addMenuDescription('admin', __FILE__); -if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { +if ((isFormSent('edit')) && (countPostSelection() > 0)) { // Edit ACLs $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $selected) { @@ -80,7 +80,7 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { // Load main template loadTemplate('admin_config_admins_edit', false, $OUT); -} elseif ((isPostRequestParameterSet('change')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('change')) && (countPostSelection() > 0)) { // Change entries foreach (postRequestParameter('sel') as $id => $selected) { // Secure id @@ -104,7 +104,7 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { // Entries changed loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ENTRIES_CHANGED')); -} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('del')) && (countPostSelection() > 0)) { // Delete ACLs $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $selected) { @@ -141,7 +141,7 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { // Load main template loadTemplate('admin_config_admins_del', false, $OUT); -} elseif ((isPostRequestParameterSet('remove')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('remove')) && (countPostSelection() > 0)) { // Remove entries // @TODO Rewrite this to filter 'run_sqls' foreach (postRequestParameter('sel') as $id => $selected) { @@ -156,7 +156,7 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { // Entries deleted loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ENTRIES_DELETED')); -} elseif (isPostRequestParameterSet('add')) { +} elseif (isFormSent('add')) { // Check if everything is fine... $mode = getAdminDefaultAcl(bigintval(postRequestParameter('admin_id'))); diff --git a/inc/modules/admin/what-config_cats.php b/inc/modules/admin/what-config_cats.php index 691f063d76..bb91e4f749 100644 --- a/inc/modules/admin/what-config_cats.php +++ b/inc/modules/admin/what-config_cats.php @@ -49,7 +49,7 @@ addMenuDescription('admin', __FILE__); // Init variable to avoid a notice $CATS = ''; -if (isPostRequestParameterSet('add')) { +if (isFormSent('add')) { // Add a new category $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_cats` WHERE `cat`='%s' LIMIT 1", array(postRequestParameter('catname')), __FILE__, __LINE__); @@ -111,7 +111,7 @@ if (isPostRequestParameterSet('add')) { // Display message loadTemplate('admin_settings_saved', false, $TEXT); } // END - if -} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('del')) && (countPostSelection() > 0)) { // Delete categories $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $value) { @@ -137,7 +137,7 @@ if (isPostRequestParameterSet('add')) { // Load main template loadTemplate('admin_del_cats', false, $OUT); -} elseif ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('edit')) && (countPostSelection() > 0)) { // Edit categories $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $value) { diff --git a/inc/modules/admin/what-config_email.php b/inc/modules/admin/what-config_email.php index 8d45685920..3986db1a1c 100644 --- a/inc/modules/admin/what-config_email.php +++ b/inc/modules/admin/what-config_email.php @@ -98,7 +98,7 @@ if (isPostRequestParameterSet(('add_max'))) { // Display message loadTemplate('admin_settings_saved', false, $TEXT); } // END - if -} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('del')) && (countPostSelection() > 0)) { // Delete entries $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $value) { @@ -124,7 +124,7 @@ if (isPostRequestParameterSet(('add_max'))) { // Load main template loadTemplate('admin_config_email_del', false, $content); -} elseif ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('edit')) && (countPostSelection() > 0)) { // Edit entries $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $value) { diff --git a/inc/modules/admin/what-config_mods.php b/inc/modules/admin/what-config_mods.php index 57c7327e0e..a24778f086 100644 --- a/inc/modules/admin/what-config_mods.php +++ b/inc/modules/admin/what-config_mods.php @@ -45,7 +45,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addMenuDescription('admin', __FILE__); -if (isPostRequestParameterSet('edit')) { +if (isFormSent('edit')) { // Check if at least one module is selected if (countPostSelection() > 0) { // Output header @@ -90,7 +90,7 @@ if (isPostRequestParameterSet('edit')) { unsetPostRequestParameter('edit'); unsetPostRequestParameter('change'); } -} elseif (isPostRequestParameterSet('change')) { +} elseif (isFormSent('change')) { // Init SQLs initSqls(); diff --git a/inc/modules/admin/what-config_payouts.php b/inc/modules/admin/what-config_payouts.php index bda7aff95f..f9a6ed4a5c 100644 --- a/inc/modules/admin/what-config_payouts.php +++ b/inc/modules/admin/what-config_payouts.php @@ -47,7 +47,7 @@ addMenuDescription('admin', __FILE__); if (isPostRequestParameterSet('rate')) setPostRequestParameter('rate', convertCommaToDot(postRequestParameter('rate'))); -if ((isPostRequestParameterSet('add')) && (isPostRequestParameterSet('title')) && (postRequestParameter('rate') > 0)) { +if ((isFormSent('add')) && (isPostRequestParameterSet('title')) && (postRequestParameter('rate') > 0)) { // Add new payout type $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_payout_types` WHERE type='%s' LIMIT 1", array(postRequestParameter('title')), __FILE__, __LINE__); @@ -84,7 +84,7 @@ VALUES ('%s', %d, %d,'%s','%s','%s','%s','%s','%s','%s')", $result_mem = SQL_QUERY("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `status`='NEW' ORDER BY payout_timestamp DESC", __FILE__, __LINE__); $display = true; -if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { +if ((isFormSent('edit')) && (countPostSelection() > 0)) { // Edit payout types if ((isGetRequestParameterSet('ok')) && (getRequestParameter('ok') == 'ok')) { // Init SQLs @@ -146,7 +146,7 @@ WHERE `id`='".$id."' LIMIT 1", // Load main template loadTemplate('admin_config_payouts_edit', false, $OUT); } -} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('del')) && (countPostSelection() > 0)) { // Delete payout types if ((isGetRequestParameterSet('ok')) && (getRequestParameter('ok') == 'ok')) { // Init SQLs diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index 73e80fc3c6..113adcf5b1 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -184,7 +184,7 @@ WHERE `mails_confirmed` < %s", $REF, $REF)); loadTemplate('admin_config_point_settings', false, $content); } elseif (getRequestParameter('sub') == 'ref') { // 12 3 32 2 3 32 2 3 4 43 21 - if ((isPostRequestParameterSet('del')) && (isPostRequestParameterSet('sel')) && (countPostSelection() > 0)) { + if ((isFormSent('del')) && (isPostRequestParameterSet('sel')) && (countPostSelection() > 0)) { // Delete entries $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $value) { @@ -208,7 +208,7 @@ WHERE `mails_confirmed` < %s", $REF, $REF)); // Load main template loadTemplate('admin_points_del', false, $OUT); - } elseif ((isPostRequestParameterSet('edit')) && (isPostRequestParameterSet('sel')) && (countPostSelection() > 0)) { + } elseif ((isFormSent('edit')) && (isPostRequestParameterSet('sel')) && (countPostSelection() > 0)) { // Edit entries $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $value) { diff --git a/inc/modules/admin/what-config_rallye_prices.php b/inc/modules/admin/what-config_rallye_prices.php index 0d08a22550..ce08c0b4c8 100644 --- a/inc/modules/admin/what-config_rallye_prices.php +++ b/inc/modules/admin/what-config_rallye_prices.php @@ -47,7 +47,7 @@ addMenuDescription('admin', __FILE__); if (isGetRequestParameterSet('rallye')) { // Price submitted? - if (isPostRequestParameterSet('add')) { + if (isFormSent('add')) { if ((isPostRequestParameterSet(('level'))) && ((isPostRequestParameterSet('points')) || (isPostRequestParameterSet(('info'))))) { // Submitted data is valid, but maybe we already have this price level? $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_rallye_prices` WHERE `rallye_id`=%s AND `price_level`='%s' LIMIT 1", @@ -72,7 +72,7 @@ VALUES ('%s','%s','%s','%s')", loadTemplate('admin_settings_saved', false, getMessage('RALLYE_PRICE_ALREADY_FOUND')); } } - } elseif (isPostRequestParameterSet('remove')) { + } elseif (isFormSent('remove')) { // Check if at last one line is selected if (countPostSelection() > 0) { // Delete selected entries @@ -86,7 +86,7 @@ VALUES ('%s','%s','%s','%s')", } else { loadTemplate('admin_settings_saved', false, getMessage('RALLYE_ENTRIES_NOT_DELETED')); } - } elseif (isPostRequestParameterSet('change')) { + } elseif (isFormSent('change')) { // Change entries foreach (postRequestParameter('level') as $id => $level) { // Secure id @@ -116,7 +116,7 @@ LIMIT 1", loadTemplate('admin_settings_saved', false, getMessage('RALLYE_ENTRIES_CHANGED')); } - if (isPostRequestParameterSet('edit')) { + if (isFormSent('edit')) { // Check if at last one line is selected if (countPostSelection() > 0) { // Make selected editable @@ -154,7 +154,7 @@ LIMIT 1", $content = '{--RALLYE_NO_PRICES_SELECTED_1--}{--RALLYE_NO_PRICES_SELECTED_2--}{--RALLYE_NO_PRICES_SELECTED_3--}'; loadTemplate('admin_settings_saved', false, $content); } - } elseif (isPostRequestParameterSet('del')) { + } elseif (isFormSent('del')) { // Check if at last one line is selected if (countPostSelection() > 0) { // List all prices @@ -235,7 +235,7 @@ LIMIT 1", } // Add form for adding new price level - if (!isPostRequestParameterSet('edit')) { + if (!isFormSent('edit')) { loadTemplate('admin_add_rallye_prices', false, getRequestParameter('rallye')); } // END - if } else { diff --git a/inc/modules/admin/what-del_transfer.php b/inc/modules/admin/what-del_transfer.php index bc82be4bf9..e6d63adc43 100644 --- a/inc/modules/admin/what-del_transfer.php +++ b/inc/modules/admin/what-del_transfer.php @@ -45,7 +45,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addMenuDescription('admin', __FILE__); -if (isPostRequestParameterSet('del')) { +if (isFormSent('del')) { // Delete entries from tables if (countPostSelection() > 0) { // Init SQLs diff --git a/inc/modules/admin/what-del_user.php b/inc/modules/admin/what-del_user.php index 6fdc06eabb..d533515a6a 100644 --- a/inc/modules/admin/what-del_user.php +++ b/inc/modules/admin/what-del_user.php @@ -46,7 +46,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { addMenuDescription('admin', __FILE__); // User exists.. -if ((isFormSent()) || ((isPostRequestParameterSet('del')) && (isPostRequestParameterSet(('reason'))))) { +if ((isFormSent()) || ((isFormSent('del')) && (isPostRequestParameterSet(('reason'))))) { // Is the account there? if (fetchUserData(getRequestParameter('userid'))) { // Delete user account diff --git a/inc/modules/admin/what-edit_emails.php b/inc/modules/admin/what-edit_emails.php index 345830600e..29bb65f1a2 100644 --- a/inc/modules/admin/what-edit_emails.php +++ b/inc/modules/admin/what-edit_emails.php @@ -47,7 +47,7 @@ addMenuDescription('admin', __FILE__); if ((isFormSent()) && (!isPostRequestParameterSet('id'))) { unsetPostRequestParameter('ok'); -} +} // END - if $result = SQL_QUERY("SELECT id, sender, subject, payment_id, cat_id FROM `{?_MYSQL_PREFIX?}_pool` ORDER BY timestamp", __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { diff --git a/inc/modules/admin/what-edit_sponsor.php b/inc/modules/admin/what-edit_sponsor.php index c906266a75..1230f036bc 100644 --- a/inc/modules/admin/what-edit_sponsor.php +++ b/inc/modules/admin/what-edit_sponsor.php @@ -83,7 +83,7 @@ LIMIT 1", initSqls(); // Sponsor was found - if ((isFormSent()) || (isPostRequestParameterSet('edit'))) { + if ((isFormSent()) || (isFormSent('edit'))) { // Perform action on mode switch (getRequestParameter('mode')) { case 'add_points': // Add points diff --git a/inc/modules/admin/what-edit_user.php b/inc/modules/admin/what-edit_user.php index c3125cbac5..9beed352b6 100644 --- a/inc/modules/admin/what-edit_user.php +++ b/inc/modules/admin/what-edit_user.php @@ -71,7 +71,7 @@ if ((!isGetRequestParameterSet('userid')) || (SQL_NUMROWS($result_main) == 1)) { if (!isGetRequestParameterSet('userid')) { // Output selection form with all confirmed user accounts listed addMemberSelectionBox(); - } elseif (isPostRequestParameterSet('edit')) { + } elseif (isFormSent('edit')) { // Ok, change the account... $updateUser = false; $add = ''; if ((!isPostRequestParameterSet('pass1')) && (!isPostRequestParameterSet('pass2'))) { diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 58965f1f43..d762d36088 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -52,7 +52,7 @@ if (isGetRequestParameterSet('reg_ext')) { // We are about to register a new extension $do = 'register'; $ext_id = bigintval(getRequestParameter('reg_ext')); // The id comes from task management and it is - of course - *not* the extension's name! -} elseif ((isPostRequestParameterSet('change')) && (countPostSelection() > 0) && (!isDemoModeActive())) { +} elseif ((isFormSent('change')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // De-/activate extensions foreach (postRequestParameter('sel') as $ext_id => $active) { // Shall we keep the extension always active? @@ -70,7 +70,7 @@ if (isGetRequestParameterSet('reg_ext')) { doExtensionSqls($ext_id, getExtensionMode()); } } -} elseif (((isPostRequestParameterSet('edit')) || (isPostRequestParameterSet('modify'))) && (countPostSelection() > 0) && (!isDemoModeActive())) { +} elseif (((isFormSent('edit')) || (isPostRequestParameterSet('modify'))) && (countPostSelection() > 0) && (!isDemoModeActive())) { // Change settings like CSS file load if (isPostRequestParameterSet('modify')) { // Change entries @@ -210,7 +210,7 @@ if (isGetRequestParameterSet('reg_ext')) { // Load template loadTemplate('admin_extensions_delete', false, $OUT); $do = 'delete'; -} elseif ((isPostRequestParameterSet('remove')) && (countPostSelection() > 0) && (!isDemoModeActive())) { +} elseif ((isFormSent('remove')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // Remove extensions from DB (you have to delete all files manually!) $cache_update = '0'; foreach (postRequestParameter('sel') as $ext_id => $active) { diff --git a/inc/modules/admin/what-guestedit.php b/inc/modules/admin/what-guestedit.php index f5ed74dbba..032a86eefa 100644 --- a/inc/modules/admin/what-guestedit.php +++ b/inc/modules/admin/what-guestedit.php @@ -54,7 +54,7 @@ if (isGetRequestParameterSet('sub')) { } // END - if // List all menu points and make them editable -if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDemoModeActive())) { +if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // Edit menu entries $content['sub'] = $SUB; $content['chk'] = countPostSelection(); @@ -101,7 +101,7 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDem // Load template loadTemplate('admin_gmenu_edit_form', false, $content); -} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) { +} elseif ((isFormSent('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // Del menu entries with or without confirmation $content['sub'] = $SUB; $content['chk'] = countPostSelection(); diff --git a/inc/modules/admin/what-list_bank_package.php b/inc/modules/admin/what-list_bank_package.php index edbc737083..55c60fa016 100644 --- a/inc/modules/admin/what-list_bank_package.php +++ b/inc/modules/admin/what-list_bank_package.php @@ -49,10 +49,10 @@ addMenuDescription('admin', __FILE__); $show = true; if ((isPostRequestParameterSet('id')) && (is_array(postRequestParameter('id'))) && (count(postRequestParameter('id')) > 0)) { // Okay, which button was pressed? - if (isPostRequestParameterSet('change')) { + if (isFormSent('change')) { // Change permissions adminChangeActivationStatus(postRequestParameter('id'), 'bank_packages', 'package_active'); - } elseif (isPostRequestParameterSet('edit')) { + } elseif (isFormSent('edit')) { // Delete entries (with confirmation) adminEditEntriesConfirm( postRequestParameter('id'), @@ -69,7 +69,7 @@ if ((isPostRequestParameterSet('id')) && (is_array(postRequestParameter('id'))) // Delete entries (with confirmation) adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array('id', 'title', 'description', 'account_fee'), array('bigintval', '', '', 'translateComma'), array('', '', '', '')); $show = false; - } elseif (isPostRequestParameterSet('remove')) { + } elseif (isFormSent('remove')) { // Delete entries (with confirmation) adminDeleteEntriesConfirm(postRequestParameter('id'), 'bank_packages', array(), array(), array(), true); } diff --git a/inc/modules/admin/what-list_country.php b/inc/modules/admin/what-list_country.php index 3026a3fb24..4407bc58cc 100644 --- a/inc/modules/admin/what-list_country.php +++ b/inc/modules/admin/what-list_country.php @@ -46,7 +46,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { addMenuDescription('admin', __FILE__); // Add new code? -if ((isPostRequestParameterSet('add')) && (isPostRequestParameterSet(('code'))) && (isPostRequestParameterSet(('descr')))) { +if ((isFormSent('add')) && (isPostRequestParameterSet('code')) && (isPostRequestParameterSet('descr'))) { // Check if country code does already exist $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_countries` WHERE code='%s' LIMIT 1", array(strtoupper(postRequestParameter('code'))), __FILE__, __LINE__); @@ -71,7 +71,7 @@ if ((isPostRequestParameterSet('add')) && (isPostRequestParameterSet(('code'))) // Display message loadTemplate('admin_settings_saved', false, $message); -} elseif ((isPostRequestParameterSet('change')) && (isPostRequestParameterSet('id'))) { +} elseif ((isFormSent('change')) && (isPostRequestParameterSet('id'))) { // Change all status adminChangeActivationStatus(postRequestParameter('id'), 'countries', 'is_active'); @@ -80,9 +80,9 @@ if ((isPostRequestParameterSet('add')) && (isPostRequestParameterSet(('code'))) 'url' => 'modules.php?module=admin&what=list_country', 'title' => getMessage('ADMIN_COUNTRY_ACTIVATION_NEXT_LINK') )); -} elseif (((isPostRequestParameterSet('edit')) || (isPostRequestParameterSet('delete'))) && (isPostRequestParameterSet('id'))) { +} elseif (((isFormSent('edit')) || (isPostRequestParameterSet('delete'))) && (isPostRequestParameterSet('id'))) { if (count(postRequestParameter('id')) > 0) { - if (isPostRequestParameterSet('edit')) { + if (isFormSent('edit')) { // Edit template $row = 'admin_list_country_edit_row'; $post = 'modify'; @@ -157,7 +157,7 @@ if ((isPostRequestParameterSet('add')) && (isPostRequestParameterSet(('code'))) // Create message $message = getMessage('ADMIN_COUNTRIES_MODIFIED'); - } elseif ((isPostRequestParameterSet('remove')) && (isPostRequestParameterSet('id'))) { + } elseif ((isFormSent('remove')) && (isPostRequestParameterSet('id'))) { // Remove $IDs = implode(',', array_keys(postRequestParameter('id'))); addSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_countries` WHERE `id` IN (".$IDs.") LIMIT ".count(postRequestParameter('id')).""); diff --git a/inc/modules/admin/what-list_rallyes.php b/inc/modules/admin/what-list_rallyes.php index 96f269d075..3029329263 100644 --- a/inc/modules/admin/what-list_rallyes.php +++ b/inc/modules/admin/what-list_rallyes.php @@ -102,7 +102,7 @@ if (isGetRequestParameterSet('rallye')) { // Run SQL command runFilterChain('run_sqls'); -} elseif (isPostRequestParameterSet('remove')) { +} elseif (isFormSent('remove')) { // Delete rallyes if (countPostSelection() > 0) { // Init SQLs @@ -128,7 +128,7 @@ if (isGetRequestParameterSet('rallye')) { // No rallye selected to delete! $message = getMessage('RALLYE_DELETE_NOTHING_SELECTED'); } -} elseif (isPostRequestParameterSet('change')) { +} elseif (isFormSent('change')) { // Change rallye if (countSelection(postRequestParameter('title')) > 0) { // Init SQLs @@ -177,7 +177,7 @@ LIMIT 1", } } -if (isPostRequestParameterSet('edit')) { +if (isFormSent('edit')) { // Check for selections if (countPostSelection() > 0) { // Make all selected and deactivated rallyes editable diff --git a/inc/modules/admin/what-list_sponsor_pay.php b/inc/modules/admin/what-list_sponsor_pay.php index d57c721c51..4d8ed2f88b 100644 --- a/inc/modules/admin/what-list_sponsor_pay.php +++ b/inc/modules/admin/what-list_sponsor_pay.php @@ -47,7 +47,7 @@ addMenuDescription('admin', __FILE__); $message = ''; -if (isPostRequestParameterSet('add')) { +if (isFormSent('add')) { // Check input variables if (!isPostRequestParameterSet('pay_name')) unsetPostRequestParameter('add'); if ((round(postRequestParameter('pay_rate')) == 0) || (!isPostRequestParameterSet('pay_rate'))) unsetPostRequestParameter('add'); @@ -57,7 +57,7 @@ if (isPostRequestParameterSet('add')) { if ((postRequestParameter('pay_min_count') == '0') || (!isPostRequestParameterSet('pay_min_count'))) unsetPostRequestParameter('add'); if (!isPostRequestParameterSet('pay_currency')) unsetPostRequestParameter('add'); -} elseif ((isPostRequestParameterSet('edit')) || (isPostRequestParameterSet('del')) || (isPostRequestParameterSet('change')) || (isPostRequestParameterSet('remove'))) { +} elseif ((isFormSent('edit')) || (isFormSent('del')) || (isFormSent('change')) || (isFormSent('remove'))) { // Check if at least one entry was selected if (!isPostRequestParameterSet('id')) { // Nothing selected for editing / deleting??? @@ -65,7 +65,7 @@ if (isPostRequestParameterSet('add')) { unsetPostRequestParameter('del'); unsetPostRequestParameter('change'); unsetPostRequestParameter('remove'); - } elseif (isPostRequestParameterSet('change')) { + } elseif (isFormSent('change')) { // Change entries here... foreach (postRequestParameter('id') as $id => $sel) { // Secure id @@ -93,7 +93,7 @@ LIMIT 1", // Generate message $message = getMessage('SPONSOR_PAY_ENTRIES_CHANGED'); - } elseif (isPostRequestParameterSet('remove')) { + } elseif (isFormSent('remove')) { // Remove entries here... foreach (postRequestParameter('id') as $id => $sel) { // Remove entry @@ -111,7 +111,7 @@ LIMIT 1", } // END - if } -if (isPostRequestParameterSet('add')) { +if (isFormSent('add')) { // Check if entry with same name does exists $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_paytypes` WHERE `pay_name`='%s' LIMIT 1", array(postRequestParameter('pay_name')), __FILE__, __LINE__); @@ -137,7 +137,7 @@ if (isPostRequestParameterSet('add')) { // Output message loadTemplate('admin_settings_saved', false, $message); -} elseif ((isPostRequestParameterSet('edit')) || (isPostRequestParameterSet('del'))) { +} elseif ((isFormSent('edit')) || (isFormSent('del'))) { // Load all data $OUT = ''; $SW = 2; foreach (postRequestParameter('id') as $id => $sel) { @@ -159,7 +159,7 @@ if (isPostRequestParameterSet('add')) { 'curr' => htmlspecialchars($curr) ); - if (isPostRequestParameterSet('edit')) { + if (isFormSent('edit')) { // Edit entry $OUT .= loadTemplate('admin_list_sponsor_pay_edit_row', true, $content); } else { @@ -176,7 +176,7 @@ if (isPostRequestParameterSet('add')) { } // END - foreach // Load main template depending on mode (edit/delete) - if (isPostRequestParameterSet('edit')) { + if (isFormSent('edit')) { // Load main edit template loadTemplate('admin_list_sponsor_pay_edit', false, $OUT); } else { diff --git a/inc/modules/admin/what-list_surfbar_urls.php b/inc/modules/admin/what-list_surfbar_urls.php index 9afddf7f6a..ce02758fb2 100644 --- a/inc/modules/admin/what-list_surfbar_urls.php +++ b/inc/modules/admin/what-list_surfbar_urls.php @@ -58,7 +58,7 @@ if ((countRequestPost() > 0) && ((!isPostRequestParameterSet('id')) || (!is_arra } // END - if // Edit or delete button hit? -if (isPostRequestParameterSet('edit')) { +if (isFormSent('edit')) { // Show entries for editing adminEditEntriesConfirm( postRequestParameter('id'), @@ -91,7 +91,7 @@ if (isPostRequestParameterSet('edit')) { } elseif (isPostRequestParameterSet('do_delete')) { // Remove entries from database adminDeleteEntriesConfirm(postRequestParameter('id'), 'surfbar_urls', array(), array(), array(), true); -} elseif (isPostRequestParameterSet('lock')) { +} elseif (isFormSent('lock')) { // Un-/lock selected URLs. This does not work for pending URLs adminLockEntriesConfirm( postRequestParameter('id'), diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index 92f4ea9321..5d5a3cd547 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -112,7 +112,7 @@ ORDER BY SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_task_system` SET `assigned_admin`=0 WHERE `id`=%s AND `assigned_admin`=%s LIMIT 1", array(bigintval($id), getCurrentAdminId()), __FILE__, __LINE__); } // END - foreach - } elseif (isPostRequestParameterSet('del')) { + } elseif (isFormSent('del')) { // Delete tasks foreach (postRequestParameter('sel') as $id => $sel) { if (getRequestParameter('type') == 'deleted') { diff --git a/inc/modules/admin/what-list_yoomedia_tm.php b/inc/modules/admin/what-list_yoomedia_tm.php index 41aa282d7f..925b7b0837 100644 --- a/inc/modules/admin/what-list_yoomedia_tm.php +++ b/inc/modules/admin/what-list_yoomedia_tm.php @@ -60,7 +60,7 @@ if (isFormSent()) { } elseif (isPostRequestParameterSet('sent')) { // Sent mail YOOMEDIA_SEND_BONUS_MAIL(postRequestArray(), 'normal'); -} elseif (isPostRequestParameterSet('remove')) { +} elseif (isFormSent('remove')) { // Add mail to exclude list YOOMEDIA_EXCLUDE_MAIL(postRequestArray(), 'normal'); } elseif (isPostRequestParameterSet('unlist')) { diff --git a/inc/modules/admin/what-lock_user.php b/inc/modules/admin/what-lock_user.php index 5656c7b34a..1f334602c0 100644 --- a/inc/modules/admin/what-lock_user.php +++ b/inc/modules/admin/what-lock_user.php @@ -53,7 +53,7 @@ if (isGetRequestParameterSet('userid')) { // Load user's data if (fetchUserData(getRequestParameter('userid'))) { // Is a lock reason set? - if ((isPostRequestParameterSet('lock')) && (getUserData('status') != 'LOCKED')) { + if ((isFormSent('lock')) && (getUserData('status') != 'LOCKED')) { // Ok, lock the account! if (isExtensionInstalledAndNewer('user', '0.3.5')) { // Lock with reason @@ -112,7 +112,7 @@ LIMIT 1", // Prepare message $message = getMaskedMessage('USER_ACCOUNT_UNLOCKED', getRequestParameter('userid')); $ACT = true; - } elseif (isPostRequestParameterSet('del')) { + } elseif (isFormSent('del')) { // Delete the account $ACT = true; loadIncludeOnce('inc/modules/admin/what-del_user.php'); diff --git a/inc/modules/admin/what-memedit.php b/inc/modules/admin/what-memedit.php index 0fb06cffbd..ac894ac23a 100644 --- a/inc/modules/admin/what-memedit.php +++ b/inc/modules/admin/what-memedit.php @@ -54,7 +54,7 @@ if (isGetRequestParameterSet('sub')) { } // END - if // List all menu points and make them editable -if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDemoModeActive())) { +if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // Edit menu entries $content['sub'] = $SUB; $content['chk'] = countPostSelection(); @@ -97,7 +97,7 @@ if ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0) && (!isDem // Load template loadTemplate('admin_mmenu_edit', false, $content); -} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) { +} elseif ((isFormSent('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) { // Del menu entries with or without confirmation $content['sub'] = $SUB; $content['chk'] = countPostSelection(); diff --git a/inc/modules/admin/what-payments.php b/inc/modules/admin/what-payments.php index c7f6ad608c..f139aa4de7 100644 --- a/inc/modules/admin/what-payments.php +++ b/inc/modules/admin/what-payments.php @@ -89,7 +89,7 @@ if (isFormSent()) { // Output template loadTemplate('admin_settings_saved', false, $content); -} elseif ((isPostRequestParameterSet('del')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('del')) && (countPostSelection() > 0)) { // Delete entries here $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $value) { @@ -113,7 +113,7 @@ if (isFormSent()) { // Load main template loadTemplate('admin_del_payments', false, $OUT); -} elseif ((isPostRequestParameterSet('edit')) && (countPostSelection() > 0)) { +} elseif ((isFormSent('edit')) && (countPostSelection() > 0)) { // Edit entries $OUT = ''; $SW = 2; foreach (postRequestParameter('sel') as $id => $value) { diff --git a/inc/modules/admin/what-refbanner.php b/inc/modules/admin/what-refbanner.php index 71f5ad53c7..dae9146b22 100644 --- a/inc/modules/admin/what-refbanner.php +++ b/inc/modules/admin/what-refbanner.php @@ -98,7 +98,7 @@ VALUES ('%s','%s','%s')", // Display message loadTemplate('admin_settings_saved', false, $content); -} elseif ((countPostSelection() > 0) && (isPostRequestParameterSet('edit'))) { +} elseif ((countPostSelection() > 0) && (isFormSent('edit'))) { // Edit banner $SW = 2; $OUT = ''; foreach (postRequestParameter('sel') as $id => $sel) { @@ -125,7 +125,7 @@ VALUES ('%s','%s','%s')", // Load main template loadTemplate('admin_refbanner_edit', false, $OUT); } else { - if ((countPostSelection() > 0) && (isPostRequestParameterSet('del'))) { + if ((countPostSelection() > 0) && (isFormSent('del'))) { // Delete banner foreach (postRequestParameter('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_edit.php b/inc/modules/admin/what-theme_edit.php index 1c5144f679..a76d8e46e6 100644 --- a/inc/modules/admin/what-theme_edit.php +++ b/inc/modules/admin/what-theme_edit.php @@ -64,7 +64,7 @@ if (countPostSelection() > 0) { $sql = "UPDATE `{?_MYSQL_PREFIX?}_themes` SET theme_active='Y' WHERE `id`='".$id."' LIMIT 1"; } $OUT = getMessage('ADMIN_THEMES_UPDATED'); - } elseif (isPostRequestParameterSet('del')) { + } elseif (isFormSent('del')) { // Delete themes $sql = "DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_themes` WHERE `id`='".$id."' LIMIT 1"; $OUT = getMessage('ADMIN_THEMES_DELETED'); diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index 9b7ed99b3f..1ce67bbb3a 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -55,8 +55,8 @@ WHERE ORDER BY `timestamp` ASC", __FILE__, __LINE__); -if ((SQL_NUMROWS($result_main) > 0) || (isPostRequestParameterSet('lock'))) { - if (isPostRequestParameterSet('accept')) { +if ((SQL_NUMROWS($result_main) > 0) || (isFormSent('lock'))) { + if (isFormSent('accept')) { if (countPostSelection() > 0) { // Accept mail orders foreach (postRequestParameter('sel') as $id => $value) { @@ -170,7 +170,7 @@ LIMIT 1", // Nothing selected loadTemplate('admin_settings_saved', false, getMessage('ADMIN_MAILS_NOTHING_CHECKED')); } - } elseif ((isPostRequestParameterSet('lock')) && (countPostSelection() > 0) && (getConfig('url_blacklist') == 'Y')) { + } elseif ((isFormSent('lock')) && (countPostSelection() > 0) && (getConfig('url_blacklist') == 'Y')) { // Lock URLs foreach (postRequestParameter('sel') as $id => $url) { // Secure id number @@ -191,7 +191,7 @@ LIMIT 1", // Output message loadTemplate('admin_settings_saved', false, getMessage('ADMIN_URLS_BLOCKED')); - } elseif ((!isPostRequestParameterSet('lock')) && (!isPostRequestParameterSet('accept')) && (!isPostRequestParameterSet('reject'))) { + } elseif ((!isFormSent('lock')) && (!isFormSent('accept')) && (!isFormSent('reject'))) { // Mail orders are in pool so we can display them $OUT = ''; $SW = 2; while ($content = SQL_FETCHARRAY($result_main)) { @@ -225,7 +225,7 @@ LIMIT 1", // Load main template loadTemplate('admin_unlock_emails', false, $content); - } elseif ((isPostRequestParameterSet('lock')) && (getConfig('url_blacklist') != 'Y')) { + } elseif ((isFormSent('lock')) && (getConfig('url_blacklist') != 'Y')) { // URL blacklist not activated loadTemplate('admin_settings_saved', false, getMessage('ADMIN_URL_BLACKLIST_DISABLED')); } else { diff --git a/inc/modules/member/what-mydata.php b/inc/modules/member/what-mydata.php index bdbb8cd8a0..0574fd7f5a 100644 --- a/inc/modules/member/what-mydata.php +++ b/inc/modules/member/what-mydata.php @@ -63,7 +63,7 @@ $URL = ''; // Detect what the member wants to do $mode = 'show'; // Show his data if (isPostRequestParameterSet('save')) $mode = 'save'; // Save entered data -if (isPostRequestParameterSet('edit')) $mode = 'edit'; // Edit data +if (isFormSent('edit')) $mode = 'edit'; // Edit data if (isPostRequestParameterSet('notify')) $mode = 'notify'; // Switch off notification switch ($mode) { diff --git a/inc/modules/member/what-refback.php b/inc/modules/member/what-refback.php index 8446643766..10f9907e76 100644 --- a/inc/modules/member/what-refback.php +++ b/inc/modules/member/what-refback.php @@ -62,7 +62,7 @@ if ((!isExtensionActive('refback')) && (!isAdmin())) { } // END - if // Was the form submitted? -if ((isPostRequestParameterSet('edit')) && (isPostRequestParameterSet('id'))) { +if ((isFormSent('edit')) && (isPostRequestParameterSet('id'))) { // Okay, has the user entered some values? if (isPostRequestParameterSet('percents')) { // Revert german commta for testing diff --git a/inc/request-functions.php b/inc/request-functions.php index b651b018e7..6237299a4a 100644 --- a/inc/request-functions.php +++ b/inc/request-functions.php @@ -224,9 +224,9 @@ function setPostRequestParameter ($element, $value) { } // Checks wether a form was sent. If so, the $_POST['ok'] element must be set -function isFormSent () { +function isFormSent ($requestParameter = 'ok') { // Simply wrap it! - return isPostRequestParameterSet('ok'); + return isPostRequestParameterSet($requestParameter); } // Checks if 'content_type' is set diff --git a/templates/de/html/admin/admin_expert_settings_form.tpl b/templates/de/html/admin/admin_expert_settings_form.tpl index a0a956e967..7198f2b13e 100644 --- a/templates/de/html/admin/admin_expert_settings_form.tpl +++ b/templates/de/html/admin/admin_expert_settings_form.tpl @@ -12,10 +12,10 @@ - {--ADMIN_EXPERT_SETTINGS_MAKE_PERMANENT--} + - + {--ADMIN_EXPERT_SETTINGS_MAKE_PERMANENT--}