diff --git a/ChangeLog b/ChangeLog index cb3433450d..25757e2b4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,7 +25,9 @@ phpMyAdmin - ChangeLog - issue #14633 Use Sass instead of PHP to compile CSS - issue #14053 Fix missed padding on query results -4.8.4 (not yet released) +4.8.5 (not yet released) + +4.8.4 (2018-12-11) - issue #14452 Remove hash param in edit query URL - issue #14295 Issue in Changing theme - issue #13267 Ensure that database names with '.' are handled properly when DisableIS is true @@ -44,6 +46,9 @@ phpMyAdmin - ChangeLog - issue #13032 Fix designer errors when database contains special chars - issue #14352 Fix designer javascript errors - issue #14764 Fix left/right icons hidden +- issue [security] Local file inclusion flaw in the Transformation feature (PMASA-2018-6) +- issue [security] Multiple CSRF/XSRF vulnerabilities (PMASA-2018-7) +- issue [security] XSS vulnerability in the navigation tree (PMASA-2018-8) 4.8.3 (2018-08-22) - issue #14314 Error when naming a database '0' diff --git a/ajax.php b/ajax.php index f0c8f74877..2816d72734 100644 --- a/ajax.php +++ b/ajax.php @@ -28,19 +28,19 @@ switch ($_POST['type']) { break; case 'list-tables': Util::checkParameters(['db'], true); - $response->addJSON('tables', $GLOBALS['dbi']->getTables($_REQUEST['db'])); + $response->addJSON('tables', $GLOBALS['dbi']->getTables($_POST['db'])); break; case 'list-columns': Util::checkParameters(['db', 'table'], true); - $response->addJSON('columns', $GLOBALS['dbi']->getColumnNames($_REQUEST['db'], $_REQUEST['table'])); + $response->addJSON('columns', $GLOBALS['dbi']->getColumnNames($_POST['db'], $_POST['table'])); break; case 'config-get': Util::checkParameters(['key'], true); - $response->addJSON('value', $GLOBALS['PMA_Config']->get($_REQUEST['key'])); + $response->addJSON('value', $GLOBALS['PMA_Config']->get($_POST['key'])); break; case 'config-set': Util::checkParameters(['key', 'value'], true); - $result = $GLOBALS['PMA_Config']->setUserValue(null, $_REQUEST['key'], json_decode($_REQUEST['value'])); + $result = $GLOBALS['PMA_Config']->setUserValue(null, $_POST['key'], json_decode($_POST['value'])); if ($result !== true) { $response = Response::getInstance(); $response->setRequestStatus(false); diff --git a/browse_foreigners.php b/browse_foreigners.php index 6da290d503..2a4376de42 100644 --- a/browse_foreigners.php +++ b/browse_foreigners.php @@ -15,7 +15,7 @@ use PhpMyAdmin\Util; require_once 'libraries/common.inc.php'; /** - * Sets globals from $_REQUEST + * Sets globals from $_POST */ $request_params = [ 'data', @@ -23,8 +23,8 @@ $request_params = [ ]; foreach ($request_params as $one_request_param) { - if (isset($_REQUEST[$one_request_param])) { - $GLOBALS[$one_request_param] = $_REQUEST[$one_request_param]; + if (isset($_POST[$one_request_param])) { + $GLOBALS[$one_request_param] = $_POST[$one_request_param]; } } @@ -50,15 +50,15 @@ $browseForeigners = new BrowseForeigners( $GLOBALS['pmaThemeImage'] ); $foreign_limit = $browseForeigners->getForeignLimit( - isset($_REQUEST['foreign_showAll']) ? $_REQUEST['foreign_showAll'] : null + isset($_POST['foreign_showAll']) ? $_POST['foreign_showAll'] : null ); $foreignData = $relation->getForeignData( $foreigners, - $_REQUEST['field'], + $_POST['field'], true, - isset($_REQUEST['foreign_filter']) - ? $_REQUEST['foreign_filter'] + isset($_POST['foreign_filter']) + ? $_POST['foreign_filter'] : '', isset($foreign_limit) ? $foreign_limit : null, true // for getting value in $foreignData['the_total'] @@ -68,7 +68,7 @@ $foreignData = $relation->getForeignData( $html = $browseForeigners->getHtmlForRelationalFieldSelection( $db, $table, - $_REQUEST['field'], + $_POST['field'], $foreignData, isset($fieldkey) ? $fieldkey : '', isset($data) ? $data : '' diff --git a/chk_rel.php b/chk_rel.php index cd625fff32..80002acdb7 100644 --- a/chk_rel.php +++ b/chk_rel.php @@ -15,20 +15,20 @@ require_once 'libraries/common.inc.php'; $relation = new Relation($GLOBALS['dbi']); // If request for creating the pmadb -if (isset($_REQUEST['create_pmadb'])) { +if (isset($_POST['create_pmadb'])) { if ($relation->createPmaDatabase()) { $relation->fixPmaTables('phpmyadmin'); } } // If request for creating all PMA tables. -if (isset($_REQUEST['fixall_pmadb'])) { +if (isset($_POST['fixall_pmadb'])) { $relation->fixPmaTables($GLOBALS['db']); } $cfgRelation = $relation->getRelationsParam(); // If request for creating missing PMA tables. -if (isset($_REQUEST['fix_pmadb'])) { +if (isset($_POST['fix_pmadb'])) { $relation->fixPmaTables($cfgRelation['db']); } diff --git a/db_central_columns.php b/db_central_columns.php index 84c71e3d54..5f2dc7cdaf 100644 --- a/db_central_columns.php +++ b/db_central_columns.php @@ -101,9 +101,9 @@ $pmadb = $cfgCentralColumns['db']; $pmatable = $cfgCentralColumns['table']; $max_rows = intval($GLOBALS['cfg']['MaxRows']); -if (isset($_REQUEST['edit_central_columns_page'])) { - $selected_fld = $_REQUEST['selected_fld']; - $selected_db = $_REQUEST['db']; +if (isset($_POST['edit_central_columns_page'])) { + $selected_fld = $_POST['selected_fld']; + $selected_db = $_POST['db']; $edit_central_column_page = $centralColumns->getHtmlForEditingPage( $selected_fld, $selected_db @@ -126,15 +126,15 @@ if (isset($_POST['delete_save'])) { false ); } -if (!empty($_REQUEST['total_rows']) - && Core::isValid($_REQUEST['total_rows'], 'integer') +if (!empty($_POST['total_rows']) + && Core::isValid($_POST['total_rows'], 'integer') ) { - $total_rows = $_REQUEST['total_rows']; + $total_rows = $_POST['total_rows']; } else { $total_rows = $centralColumns->getCount($db); } -if (Core::isValid($_REQUEST['pos'], 'integer')) { - $pos = intval($_REQUEST['pos']); +if (Core::isValid($_POST['pos'], 'integer')) { + $pos = intval($_POST['pos']); } else { $pos = 0; } diff --git a/db_designer.php b/db_designer.php index 202de74712..bc9efa69f0 100644 --- a/db_designer.php +++ b/db_designer.php @@ -19,18 +19,18 @@ $databaseDesigner = new Designer($GLOBALS['dbi']); $designerCommon = new Common($GLOBALS['dbi']); if (isset($_REQUEST['dialog'])) { - if ($_REQUEST['dialog'] == 'edit') { + if ($_GET['dialog'] == 'edit') { $html = $databaseDesigner->getHtmlForEditOrDeletePages($GLOBALS['db'], 'editPage'); - } elseif ($_REQUEST['dialog'] == 'delete') { + } elseif ($_GET['dialog'] == 'delete') { $html = $databaseDesigner->getHtmlForEditOrDeletePages($GLOBALS['db'], 'deletePage'); - } elseif ($_REQUEST['dialog'] == 'save_as') { + } elseif ($_GET['dialog'] == 'save_as') { $html = $databaseDesigner->getHtmlForPageSaveAs($GLOBALS['db']); - } elseif ($_REQUEST['dialog'] == 'export') { + } elseif ($_GET['dialog'] == 'export') { $html = $databaseDesigner->getHtmlForSchemaExport( $GLOBALS['db'], - $_REQUEST['selected_page'] + $_GET['selected_page'] ); - } elseif ($_REQUEST['dialog'] == 'add_table') { + } elseif ($_POST['dialog'] == 'add_table') { $script_display_field = $designerCommon->getTablesInfo(); $required = $GLOBALS['db'] . '.' . $GLOBALS['table']; $tab_column = $designerCommon->getColumnsInfo(); @@ -61,51 +61,51 @@ if (isset($_REQUEST['dialog'])) { return; } -if (isset($_REQUEST['operation'])) { - if ($_REQUEST['operation'] == 'deletePage') { - $success = $designerCommon->deletePage($_REQUEST['selected_page']); +if (isset($_POST['operation'])) { + if ($_POST['operation'] == 'deletePage') { + $success = $designerCommon->deletePage($_POST['selected_page']); $response->setRequestStatus($success); - } elseif ($_REQUEST['operation'] == 'savePage') { - if ($_REQUEST['save_page'] == 'same') { - $page = $_REQUEST['selected_page']; + } elseif ($_POST['operation'] == 'savePage') { + if ($_POST['save_page'] == 'same') { + $page = $_POST['selected_page']; } else { // new - $page = $designerCommon->createNewPage($_REQUEST['selected_value'], $GLOBALS['db']); + $page = $designerCommon->createNewPage($_POST['selected_value'], $GLOBALS['db']); $response->addJSON('id', $page); } $success = $designerCommon->saveTablePositions($page); $response->setRequestStatus($success); - } elseif ($_REQUEST['operation'] == 'setDisplayField') { + } elseif ($_POST['operation'] == 'setDisplayField') { $designerCommon->saveDisplayField( - $_REQUEST['db'], - $_REQUEST['table'], - $_REQUEST['field'] + $_POST['db'], + $_POST['table'], + $_POST['field'] ); $response->setRequestStatus(true); - } elseif ($_REQUEST['operation'] == 'addNewRelation') { + } elseif ($_POST['operation'] == 'addNewRelation') { list($success, $message) = $designerCommon->addNewRelation( - $_REQUEST['db'], - $_REQUEST['T1'], - $_REQUEST['F1'], - $_REQUEST['T2'], - $_REQUEST['F2'], - $_REQUEST['on_delete'], - $_REQUEST['on_update'], - $_REQUEST['DB1'], - $_REQUEST['DB2'] + $_POST['db'], + $_POST['T1'], + $_POST['F1'], + $_POST['T2'], + $_POST['F2'], + $_POST['on_delete'], + $_POST['on_update'], + $_POST['DB1'], + $_POST['DB2'] ); $response->setRequestStatus($success); $response->addJSON('message', $message); - } elseif ($_REQUEST['operation'] == 'removeRelation') { + } elseif ($_POST['operation'] == 'removeRelation') { list($success, $message) = $designerCommon->removeRelation( - $_REQUEST['T1'], - $_REQUEST['F1'], - $_REQUEST['T2'], - $_REQUEST['F2'] + $_POST['T1'], + $_POST['F1'], + $_POST['T2'], + $_POST['F2'] ); $response->setRequestStatus($success); $response->addJSON('message', $message); - } elseif ($_REQUEST['operation'] == 'save_setting_value') { - $success = $designerCommon->saveSetting($_REQUEST['index'], $_REQUEST['value']); + } elseif ($_POST['operation'] == 'save_setting_value') { + $success = $designerCommon->saveSetting($_POST['index'], $_POST['value']); $response->setRequestStatus($success); } @@ -124,13 +124,13 @@ $classes_side_menu = $databaseDesigner->returnClassNamesFromMenuButtons(); $display_page = -1; $selected_page = null; -if (isset($_REQUEST['query'])) { - $display_page = $designerCommon->getDefaultPage($_REQUEST['db']); +if (isset($_GET['query'])) { + $display_page = $designerCommon->getDefaultPage($_GET['db']); } else { - if (! empty($_REQUEST['page'])) { - $display_page = $_REQUEST['page']; + if (! empty($_GET['page'])) { + $display_page = $_GET['page']; } else { - $display_page = $designerCommon->getLoadingPage($_REQUEST['db']); + $display_page = $designerCommon->getLoadingPage($_GET['db']); } } if ($display_page != -1) { @@ -180,7 +180,7 @@ $response->addHTML( $script_contr, $script_display_field, $display_page, - isset($_REQUEST['query']), + isset($_GET['query']), $selected_page, $classes_side_menu, $tab_pos, diff --git a/db_export.php b/db_export.php index 234a7d0ccb..756b46f540 100644 --- a/db_export.php +++ b/db_export.php @@ -60,8 +60,8 @@ if ($num_tables < 1) { } // end if $multi_values = '
'; -if (isset($_GET['structure_or_data_forced'])) { - $force_val = htmlspecialchars($_GET['structure_or_data_forced']); +if (isset($_POST['structure_or_data_forced'])) { + $force_val = htmlspecialchars($_POST['structure_or_data_forced']); } else { $force_val = 0; } @@ -88,20 +88,20 @@ if (!empty($_POST['selected_tbl']) && empty($table_select)) { $table_select = $_POST['selected_tbl']; } -// Check if the selected tables are defined in $_GET +// Check if the selected tables are defined in $_POST // (from clicking Back button on export.php) foreach (['table_select', 'table_structure', 'table_data'] as $one_key) { - if (isset($_GET[$one_key])) { - $_GET[$one_key] = urldecode($_GET[$one_key]); - $_GET[$one_key] = explode(",", $_GET[$one_key]); + if (isset($_POST[$one_key])) { + $_POST[$one_key] = urldecode($_POST[$one_key]); + $_POST[$one_key] = explode(",", $_POST[$one_key]); } } foreach ($tables as $each_table) { - if (isset($_GET['table_select']) && is_array($_GET['table_select'])) { + if (isset($_POST['table_select']) && is_array($_POST['table_select'])) { $is_checked = $export->getCheckedClause( $each_table['Name'], - $_GET['table_select'] + $_POST['table_select'] ); } elseif (isset($table_select)) { $is_checked = $export->getCheckedClause( @@ -111,18 +111,18 @@ foreach ($tables as $each_table) { } else { $is_checked = ' checked="checked"'; } - if (isset($_GET['table_structure']) && is_array($_GET['table_structure'])) { + if (isset($_POST['table_structure']) && is_array($_POST['table_structure'])) { $structure_checked = $export->getCheckedClause( $each_table['Name'], - $_GET['table_structure'] + $_POST['table_structure'] ); } else { $structure_checked = $is_checked; } - if (isset($_GET['table_data']) && is_array($_GET['table_data'])) { + if (isset($_POST['table_data']) && is_array($_POST['table_data'])) { $data_checked = $export->getCheckedClause( $each_table['Name'], - $_GET['table_data'] + $_POST['table_data'] ); } else { $data_checked = $is_checked; diff --git a/db_operations.php b/db_operations.php index 86128a0d26..66086fa43e 100644 --- a/db_operations.php +++ b/db_operations.php @@ -50,31 +50,31 @@ $relationCleanup = new RelationCleanup($GLOBALS['dbi'], $relation); * Rename/move or copy database */ if (strlen($GLOBALS['db']) > 0 - && (! empty($_REQUEST['db_rename']) || ! empty($_REQUEST['db_copy'])) + && (! empty($_POST['db_rename']) || ! empty($_POST['db_copy'])) ) { - if (! empty($_REQUEST['db_rename'])) { + if (! empty($_POST['db_rename'])) { $move = true; } else { $move = false; } - if (! isset($_REQUEST['newname']) || strlen($_REQUEST['newname']) === 0) { + if (! isset($_POST['newname']) || strlen($_POST['newname']) === 0) { $message = Message::error(__('The database name is empty!')); } else { // lower_case_table_names=1 `DB` becomes `db` if ($GLOBALS['dbi']->getLowerCaseNames() === '1') { - $_REQUEST['newname'] = mb_strtolower( - $_REQUEST['newname'] + $_POST['newname'] = mb_strtolower( + $_POST['newname'] ); } - if ($_REQUEST['newname'] === $_REQUEST['db']) { + if ($_POST['newname'] === $_REQUEST['db']) { $message = Message::error( __('Cannot copy database to the same name. Change the name and try again.') ); } else { $_error = false; - if ($move || ! empty($_REQUEST['create_database_before_copying'])) { + if ($move || ! empty($_POST['create_database_before_copying'])) { $operations->createDbBeforeCopy(); } @@ -143,10 +143,10 @@ if (strlen($GLOBALS['db']) > 0 $operations->duplicateBookmarks($_error, $GLOBALS['db']); if (! $_error && $move) { - if (isset($_REQUEST['adjust_privileges']) - && ! empty($_REQUEST['adjust_privileges']) + if (isset($_POST['adjust_privileges']) + && ! empty($_POST['adjust_privileges']) ) { - $operations->adjustPrivilegesMoveDb($GLOBALS['db'], $_REQUEST['newname']); + $operations->adjustPrivilegesMoveDb($GLOBALS['db'], $_POST['newname']); } /** @@ -164,19 +164,19 @@ if (strlen($GLOBALS['db']) > 0 __('Database %1$s has been renamed to %2$s.') ); $message->addParam($GLOBALS['db']); - $message->addParam($_REQUEST['newname']); + $message->addParam($_POST['newname']); } elseif (! $_error) { - if (isset($_REQUEST['adjust_privileges']) - && ! empty($_REQUEST['adjust_privileges']) + if (isset($_POST['adjust_privileges']) + && ! empty($_POST['adjust_privileges']) ) { - $operations->adjustPrivilegesCopyDb($GLOBALS['db'], $_REQUEST['newname']); + $operations->adjustPrivilegesCopyDb($GLOBALS['db'], $_POST['newname']); } $message = Message::success( __('Database %1$s has been copied to %2$s.') ); $message->addParam($GLOBALS['db']); - $message->addParam($_REQUEST['newname']); + $message->addParam($_POST['newname']); } else { $message = Message::error(); } @@ -184,13 +184,13 @@ if (strlen($GLOBALS['db']) > 0 /* Change database to be used */ if (! $_error && $move) { - $GLOBALS['db'] = $_REQUEST['newname']; + $GLOBALS['db'] = $_POST['newname']; } elseif (! $_error) { - if (isset($_REQUEST['switch_to_new']) - && $_REQUEST['switch_to_new'] == 'true' + if (isset($_POST['switch_to_new']) + && $_POST['switch_to_new'] == 'true' ) { $_SESSION['pma_switch_to_new'] = true; - $GLOBALS['db'] = $_REQUEST['newname']; + $GLOBALS['db'] = $_POST['newname']; } else { $_SESSION['pma_switch_to_new'] = false; } @@ -205,7 +205,7 @@ if (strlen($GLOBALS['db']) > 0 if ($response->isAjax()) { $response->setRequestStatus($message->isSuccess()); $response->addJSON('message', $message); - $response->addJSON('newname', $_REQUEST['newname']); + $response->addJSON('newname', $_POST['newname']); $response->addJSON( 'sql_query', Util::getMessage(null, $sql_query) @@ -224,8 +224,8 @@ $cfgRelation = $relation->getRelationsParam(); * Check if comments were updated * (must be done before displaying the menu tabs) */ -if (isset($_REQUEST['comment'])) { - $relation->setDbComment($GLOBALS['db'], $_REQUEST['comment']); +if (isset($_POST['comment'])) { + $relation->setDbComment($GLOBALS['db'], $_POST['comment']); } require 'libraries/db_common.inc.php'; @@ -253,7 +253,7 @@ if (isset($message)) { unset($message); } -$_REQUEST['db_collation'] = $GLOBALS['dbi']->getDbCollation($GLOBALS['db']); +$db_collation = $GLOBALS['dbi']->getDbCollation($GLOBALS['db']); $is_information_schema = $GLOBALS['dbi']->isSystemSchema($GLOBALS['db']); if (!$is_information_schema) { @@ -272,7 +272,7 @@ if (!$is_information_schema) { * rename database */ if ($GLOBALS['db'] != 'mysql') { - $response->addHTML($operations->getHtmlForRenameDatabase($GLOBALS['db'])); + $response->addHTML($operations->getHtmlForRenameDatabase($GLOBALS['db'], $db_collation)); } // Drop link if allowed @@ -288,12 +288,12 @@ if (!$is_information_schema) { /** * Copy database */ - $response->addHTML($operations->getHtmlForCopyDatabase($GLOBALS['db'])); + $response->addHTML($operations->getHtmlForCopyDatabase($GLOBALS['db'], $db_collation)); /** * Change database charset */ - $response->addHTML($operations->getHtmlForChangeDatabaseCharset($GLOBALS['db'], $table)); + $response->addHTML($operations->getHtmlForChangeDatabaseCharset($GLOBALS['db'], $db_collation)); if (! $cfgRelation['allworks'] && $cfg['PmaNoRelation_DisableWarning'] == false @@ -304,7 +304,7 @@ if (!$is_information_schema) { '%sFind out why%s.' ) ); - $message->addParamHtml(''); + $message->addParamHtml(''); $message->addParamHtml(''); /* Show error if user has configured something, notice elsewhere */ if (!empty($cfg['Servers'][$server]['pmadb'])) { diff --git a/db_qbe.php b/db_qbe.php index 9fa1b4c5ed..199f566f44 100644 --- a/db_qbe.php +++ b/db_qbe.php @@ -40,36 +40,36 @@ if ($cfgRelation['savedsearcheswork']) { //Get saved search list. $savedSearch = new SavedSearches($GLOBALS); $savedSearch->setUsername($GLOBALS['cfg']['Server']['user']) - ->setDbname($_REQUEST['db']); + ->setDbname($GLOBALS['db']); - if (!empty($_REQUEST['searchId'])) { - $savedSearch->setId($_REQUEST['searchId']); + if (!empty($_POST['searchId'])) { + $savedSearch->setId($_POST['searchId']); } //Action field is sent. - if (isset($_REQUEST['action'])) { - $savedSearch->setSearchName($_REQUEST['searchName']); - if ('create' === $_REQUEST['action']) { + if (isset($_POST['action'])) { + $savedSearch->setSearchName($_POST['searchName']); + if ('create' === $_POST['action']) { $saveResult = $savedSearch->setId(null) - ->setCriterias($_REQUEST) + ->setCriterias($_POST) ->save(); - } elseif ('update' === $_REQUEST['action']) { - $saveResult = $savedSearch->setCriterias($_REQUEST) + } elseif ('update' === $_POST['action']) { + $saveResult = $savedSearch->setCriterias($_POST) ->save(); - } elseif ('delete' === $_REQUEST['action']) { + } elseif ('delete' === $_POST['action']) { $deleteResult = $savedSearch->delete(); //After deletion, reset search. $savedSearch = new SavedSearches($GLOBALS); $savedSearch->setUsername($GLOBALS['cfg']['Server']['user']) - ->setDbname($_REQUEST['db']); - $_REQUEST = []; - } elseif ('load' === $_REQUEST['action']) { - if (empty($_REQUEST['searchId'])) { + ->setDbname($GLOBALS['db']); + $_POST = []; + } elseif ('load' === $_POST['action']) { + if (empty($_POST['searchId'])) { //when not loading a search, reset the object. $savedSearch = new SavedSearches($GLOBALS); $savedSearch->setUsername($GLOBALS['cfg']['Server']['user']) - ->setDbname($_REQUEST['db']); - $_REQUEST = []; + ->setDbname($GLOBALS['db']); + $_POST = []; } else { $loadResult = $savedSearch->load(); } @@ -85,7 +85,7 @@ if ($cfgRelation['savedsearcheswork']) { * A query has been submitted -> (maybe) execute it */ $message_to_display = false; -if (isset($_REQUEST['submit_sql']) && ! empty($sql_query)) { +if (isset($_POST['submit_sql']) && ! empty($sql_query)) { if (! preg_match('@^SELECT@i', $sql_query)) { $message_to_display = true; } else { @@ -94,7 +94,7 @@ if (isset($_REQUEST['submit_sql']) && ! empty($sql_query)) { $sql->executeQueryAndSendQueryResponse( null, // analyzed_sql_results false, // is_gotofile - $_REQUEST['db'], // db + $_POST['db'], // db null, // table false, // find_real_end null, // sql_query_for_bookmark diff --git a/db_search.php b/db_search.php index 56777e7a6b..49c2aada9a 100644 --- a/db_search.php +++ b/db_search.php @@ -58,7 +58,7 @@ if (! $response->isAjax()) { } // Main search form has been submitted, get results -if (isset($_REQUEST['submit_search'])) { +if (isset($_POST['submit_search'])) { $response->addHTML($db_search->getSearchResults()); } diff --git a/db_sql.php b/db_sql.php index fb403d484d..f842300ae2 100644 --- a/db_sql.php +++ b/db_sql.php @@ -44,8 +44,8 @@ $response->addHTML( $sqlQueryForm->getHtml( true, false, - isset($_REQUEST['delimiter']) - ? htmlspecialchars($_REQUEST['delimiter']) + isset($_POST['delimiter']) + ? htmlspecialchars($_POST['delimiter']) : ';' ) ); diff --git a/db_tracking.php b/db_tracking.php index 0216da7085..2f53165d34 100644 --- a/db_tracking.php +++ b/db_tracking.php @@ -34,6 +34,8 @@ $tracking = new Tracking(); */ require 'libraries/db_common.inc.php'; $url_query .= '&goto=tbl_tracking.php&back=db_tracking.php'; +$url_params['goto'] = 'tbl_tracking.php'; +$url_params['back'] = 'db_tracking.php'; // Get the database structure $sub_part = '_structure'; @@ -50,39 +52,37 @@ list( $pos ) = Util::getDbInfo($db, is_null($sub_part) ? '' : $sub_part); -// Work to do? -// (here, do not use $_REQUEST['db] as it can be crafted) -if (isset($_REQUEST['delete_tracking']) && isset($_REQUEST['table'])) { - Tracker::deleteTracking($GLOBALS['db'], $_REQUEST['table']); +if (isset($_POST['delete_tracking']) && isset($_POST['table'])) { + Tracker::deleteTracking($GLOBALS['db'], $_POST['table']); Message::success( __('Tracking data deleted successfully.') )->display(); -} elseif (isset($_REQUEST['submit_create_version'])) { - $tracking->createTrackingForMultipleTables($_REQUEST['selected']); +} elseif (isset($_POST['submit_create_version'])) { + $tracking->createTrackingForMultipleTables($_POST['selected']); Message::success( sprintf( __( 'Version %1$s was created for selected tables,' . ' tracking is active for them.' ), - htmlspecialchars($_REQUEST['version']) + htmlspecialchars($_POST['version']) ) )->display(); -} elseif (isset($_REQUEST['submit_mult'])) { - if (! empty($_REQUEST['selected_tbl'])) { - if ($_REQUEST['submit_mult'] == 'delete_tracking') { - foreach ($_REQUEST['selected_tbl'] as $table) { +} elseif (isset($_POST['submit_mult'])) { + if (! empty($_POST['selected_tbl'])) { + if ($_POST['submit_mult'] == 'delete_tracking') { + foreach ($_POST['selected_tbl'] as $table) { Tracker::deleteTracking($GLOBALS['db'], $table); } Message::success( __('Tracking data deleted successfully.') )->display(); - } elseif ($_REQUEST['submit_mult'] == 'track') { + } elseif ($_POST['submit_mult'] == 'track') { echo $tracking->getHtmlForDataDefinitionAndManipulationStatements( 'db_tracking.php' . $url_query, 0, $GLOBALS['db'], - $_REQUEST['selected_tbl'] + $_POST['selected_tbl'] ); exit; } @@ -94,7 +94,7 @@ if (isset($_REQUEST['delete_tracking']) && isset($_REQUEST['table'])) { } // Get tracked data about the database -$data = Tracker::getTrackedData($_REQUEST['db'], '', '1'); +$data = Tracker::getTrackedData($GLOBALS['db'], '', '1'); // No tables present and no log exist if ($num_tables == 0 && count($data['ddlog']) == 0) { @@ -109,7 +109,6 @@ if ($num_tables == 0 && count($data['ddlog']) == 0) { // --------------------------------------------------------------------------- echo $tracking->getHtmlForDbTrackingTables( $GLOBALS['db'], - $_REQUEST['db'], $url_query, $pmaThemeImage, $text_dir diff --git a/error_report.php b/error_report.php index 93fa64ffbd..5bb9e8ae1d 100644 --- a/error_report.php +++ b/error_report.php @@ -15,8 +15,8 @@ use PhpMyAdmin\Utils\HttpRequest; require_once 'libraries/common.inc.php'; -if (!isset($_REQUEST['exception_type']) - || !in_array($_REQUEST['exception_type'], ['js', 'php']) +if (!isset($_POST['exception_type']) + || !in_array($_POST['exception_type'], ['js', 'php']) ) { die('Oops, something went wrong!!'); } @@ -25,11 +25,11 @@ $response = Response::getInstance(); $errorReport = new ErrorReport(new HttpRequest()); -if (isset($_REQUEST['send_error_report']) - && ($_REQUEST['send_error_report'] == true - || $_REQUEST['send_error_report'] == '1') +if (isset($_POST['send_error_report']) + && ($_POST['send_error_report'] == true + || $_POST['send_error_report'] == '1') ) { - if ($_REQUEST['exception_type'] == 'php') { + if ($_POST['exception_type'] == 'php') { /** * Prevent infinite error submission. * Happens in case error submissions fails. @@ -53,7 +53,7 @@ if (isset($_REQUEST['send_error_report']) ); } } - $reportData = $errorReport->getData($_REQUEST['exception_type']); + $reportData = $errorReport->getData($_POST['exception_type']); // report if and only if there were 'actual' errors. if (count($reportData) > 0) { $server_response = $errorReport->send($reportData); @@ -67,8 +67,8 @@ if (isset($_REQUEST['send_error_report']) /* Message to show to the user */ if ($success) { - if ((isset($_REQUEST['automatic']) - && $_REQUEST['automatic'] === "true") + if ((isset($_POST['automatic']) + && $_POST['automatic'] === "true") || $GLOBALS['cfg']['SendErrorReports'] == 'always' ) { $msg = __( @@ -100,35 +100,35 @@ if (isset($_REQUEST['send_error_report']) /* Add message to response */ if ($response->isAjax()) { - if ($_REQUEST['exception_type'] == 'js') { + if ($_POST['exception_type'] == 'js') { $response->addJSON('message', $msg); } else { $response->addJSON('_errSubmitMsg', $msg); } - } elseif ($_REQUEST['exception_type'] == 'php') { + } elseif ($_POST['exception_type'] == 'php') { $jsCode = 'PMA_ajaxShowMessage("
' . $msg . '
", false);'; $response->getFooter()->getScripts()->addCode($jsCode); } - if ($_REQUEST['exception_type'] == 'php') { + if ($_POST['exception_type'] == 'php') { // clear previous errors & save new ones. $GLOBALS['error_handler']->savePreviousErrors(); } /* Persist always send settings */ - if (isset($_REQUEST['always_send']) - && $_REQUEST['always_send'] === "true" + if (isset($_POST['always_send']) + && $_POST['always_send'] === "true" ) { $userPreferences = new UserPreferences(); $userPreferences->persistOption("SendErrorReports", "always", "ask"); } } -} elseif (! empty($_REQUEST['get_settings'])) { +} elseif (! empty($_POST['get_settings'])) { $response->addJSON('report_setting', $GLOBALS['cfg']['SendErrorReports']); } else { - if ($_REQUEST['exception_type'] == 'js') { + if ($_POST['exception_type'] == 'js') { $response->addHTML($errorReport->getForm()); } else { // clear previous errors & save new ones. diff --git a/export.php b/export.php index cd8b882616..c957662e1b 100644 --- a/export.php +++ b/export.php @@ -232,39 +232,39 @@ $filename = ''; $separate_files = ''; // Is it a quick or custom export? -if (isset($_REQUEST['quick_or_custom']) - && $_REQUEST['quick_or_custom'] == 'quick' +if (isset($_POST['quick_or_custom']) + && $_POST['quick_or_custom'] == 'quick' ) { $quick_export = true; } else { $quick_export = false; } -if ($_REQUEST['output_format'] == 'astext') { +if ($_POST['output_format'] == 'astext') { $asfile = false; } else { $asfile = true; - if (isset($_REQUEST['as_separate_files']) - && ! empty($_REQUEST['as_separate_files']) + if (isset($_POST['as_separate_files']) + && ! empty($_POST['as_separate_files']) ) { - if (isset($_REQUEST['compression']) - && ! empty($_REQUEST['compression']) - && $_REQUEST['compression'] == 'zip' + if (isset($_POST['compression']) + && ! empty($_POST['compression']) + && $_POST['compression'] == 'zip' ) { - $separate_files = $_REQUEST['as_separate_files']; + $separate_files = $_POST['as_separate_files']; } } - if (in_array($_REQUEST['compression'], $compression_methods)) { - $compression = $_REQUEST['compression']; + if (in_array($_POST['compression'], $compression_methods)) { + $compression = $_POST['compression']; $buffer_needed = true; } - if (($quick_export && ! empty($_REQUEST['quick_export_onserver'])) - || (! $quick_export && ! empty($_REQUEST['onserver'])) + if (($quick_export && ! empty($_POST['quick_export_onserver'])) + || (! $quick_export && ! empty($_POST['onserver'])) ) { if ($quick_export) { - $onserver = $_REQUEST['quick_export_onserver']; + $onserver = $_POST['quick_export_onserver']; } else { - $onserver = $_REQUEST['onserver']; + $onserver = $_POST['onserver']; } // Will we save dump on server? $save_on_server = ! empty($cfg['SaveDir']) && $onserver; @@ -302,9 +302,9 @@ if ((!empty($parser->statements[0])) ) { $aliases = \PhpMyAdmin\SqlParser\Utils\Misc::getAliases($parser->statements[0], $db); } -if (!empty($_REQUEST['aliases'])) { - $aliases = $export->mergeAliases($aliases, $_REQUEST['aliases']); - $_SESSION['tmpval']['aliases'] = $_REQUEST['aliases']; +if (!empty($_POST['aliases'])) { + $aliases = $export->mergeAliases($aliases, $_POST['aliases']); + $_SESSION['tmpval']['aliases'] = $_POST['aliases']; } /** @@ -466,7 +466,7 @@ do { if (!isset($table_data) || !is_array($table_data)) { $table_data = []; } - if (!empty($_REQUEST['structure_or_data_forced'])) { + if (!empty($_POST['structure_or_data_forced'])) { $table_structure = $tables; $table_data = $tables; } diff --git a/gis_data_editor.php b/gis_data_editor.php index 56f7aa3c9d..1a80100cff 100644 --- a/gis_data_editor.php +++ b/gis_data_editor.php @@ -18,14 +18,14 @@ require_once 'libraries/common.inc.php'; $template = new Template(); -if (! isset($_REQUEST['field'])) { +if (! isset($_POST['field'])) { Util::checkParameters(['field']); } // Get data if any posted $gis_data = []; -if (Core::isValid($_REQUEST['gis_data'], 'array')) { - $gis_data = $_REQUEST['gis_data']; +if (Core::isValid($_POST['gis_data'], 'array')) { + $gis_data = $_POST['gis_data']; } $gis_types = [ @@ -41,15 +41,15 @@ $gis_types = [ // Extract type from the initial call and make sure that it's a valid one. // Extract from field's values if available, if not use the column type passed. if (! isset($gis_data['gis_type'])) { - if (isset($_REQUEST['type']) && $_REQUEST['type'] != '') { - $gis_data['gis_type'] = mb_strtoupper($_REQUEST['type']); + if (isset($_POST['type']) && $_POST['type'] != '') { + $gis_data['gis_type'] = mb_strtoupper($_POST['type']); } - if (isset($_REQUEST['value']) && trim($_REQUEST['value']) != '') { - $start = (substr($_REQUEST['value'], 0, 1) == "'") ? 1 : 0; + if (isset($_POST['value']) && trim($_POST['value']) != '') { + $start = (substr($_POST['value'], 0, 1) == "'") ? 1 : 0; $gis_data['gis_type'] = mb_substr( - $_REQUEST['value'], + $_POST['value'], $start, - mb_strpos($_REQUEST['value'], "(") - $start + mb_strpos($_POST['value'], "(") - $start ); } if ((! isset($gis_data['gis_type'])) @@ -62,10 +62,10 @@ $geom_type = $gis_data['gis_type']; // Generate parameters from value passed. $gis_obj = GisFactory::factory($geom_type); -if (isset($_REQUEST['value'])) { +if (isset($_POST['value'])) { $gis_data = array_merge( $gis_data, - $gis_obj->generateParams($_REQUEST['value']) + $gis_obj->generateParams($_POST['value']) ); } @@ -89,7 +89,7 @@ $open_layers = GisVisualization::getByData($data, $visualizationSettings) ->asOl(); // If the call is to update the WKT and visualization make an AJAX response -if (isset($_REQUEST['generate']) && $_REQUEST['generate'] == true) { +if (isset($_POST['generate']) && $_POST['generate'] == true) { $extra_data = [ 'result' => $result, 'visualization' => $visualization, @@ -111,8 +111,8 @@ if ($geom_type == 'GEOMETRYCOLLECTION') { $templateOutput = $template->render('gis_data_editor_form', [ 'pma_theme_image' => $GLOBALS['pmaThemeImage'], - 'field' => $_REQUEST['field'], - 'input_name' => $_REQUEST['input_name'], + 'field' => $_POST['field'], + 'input_name' => $_POST['input_name'], 'srid' => $srid, 'visualization' => $visualization, 'open_layers' => $open_layers, diff --git a/import.php b/import.php index c5388168cc..16b7977133 100644 --- a/import.php +++ b/import.php @@ -32,12 +32,12 @@ require_once 'libraries/common.inc.php'; $import = new Import(); -if (isset($_REQUEST['show_as_php'])) { - $GLOBALS['show_as_php'] = $_REQUEST['show_as_php']; +if (isset($_POST['show_as_php'])) { + $GLOBALS['show_as_php'] = $_POST['show_as_php']; } // If there is a request to 'Simulate DML'. -if (isset($_REQUEST['simulate_dml'])) { +if (isset($_POST['simulate_dml'])) { $import->handleSimulateDmlRequest(); exit; } @@ -47,7 +47,7 @@ $response = Response::getInstance(); $sql = new Sql(); // If it's a refresh console bookmarks request -if (isset($_REQUEST['console_bookmark_refresh'])) { +if (isset($_GET['console_bookmark_refresh'])) { $response->addJSON( 'console_message_bookmark', PhpMyAdmin\Console::getBookmarkContent() @@ -55,18 +55,18 @@ if (isset($_REQUEST['console_bookmark_refresh'])) { exit; } // If it's a console bookmark add request -if (isset($_REQUEST['console_bookmark_add'])) { - if (isset($_REQUEST['label']) && isset($_REQUEST['db']) - && isset($_REQUEST['bookmark_query']) && isset($_REQUEST['shared']) +if (isset($_POST['console_bookmark_add'])) { + if (isset($_POST['label']) && isset($_POST['db']) + && isset($_POST['bookmark_query']) && isset($_POST['shared']) ) { $cfgBookmark = Bookmark::getParams($GLOBALS['cfg']['Server']['user']); $bookmarkFields = [ - 'bkm_database' => $_REQUEST['db'], + 'bkm_database' => $_POST['db'], 'bkm_user' => $cfgBookmark['user'], - 'bkm_sql_query' => $_REQUEST['bookmark_query'], - 'bkm_label' => $_REQUEST['label'] + 'bkm_sql_query' => $_POST['bookmark_query'], + 'bkm_label' => $_POST['label'] ]; - $isShared = ($_REQUEST['shared'] == 'true' ? true : false); + $isShared = ($_POST['shared'] == 'true' ? true : false); $bookmark = Bookmark::createBookmark( $GLOBALS['dbi'], $GLOBALS['cfg']['Server']['user'], @@ -128,11 +128,11 @@ $import_text = ''; // (eg. non import, but query box/window run) if (! empty($sql_query)) { // apply values for parameters - if (! empty($_REQUEST['parameterized']) - && ! empty($_REQUEST['parameters']) - && is_array($_REQUEST['parameters']) + if (! empty($_POST['parameterized']) + && ! empty($_POST['parameters']) + && is_array($_POST['parameters']) ) { - $parameters = $_REQUEST['parameters']; + $parameters = $_POST['parameters']; foreach ($parameters as $parameter => $replacement) { $quoted = preg_quote($parameter, '/'); // making sure that :param does not apply values to :param1 @@ -157,7 +157,7 @@ if (! empty($sql_query)) { $_SESSION['sql_from_query_box'] = true; // If there is a request to ROLLBACK when finished. - if (isset($_REQUEST['rollback_query'])) { + if (isset($_POST['rollback_query'])) { $import->handleRollbackRequest($import_text); } @@ -195,7 +195,7 @@ if (! empty($sql_query)) { $import_type = 'queryfile'; $format = 'sql'; unset($sql_file); -} elseif (! empty($_REQUEST['id_bookmark'])) { +} elseif (! empty($_POST['id_bookmark'])) { // run bookmark $import_type = 'query'; $format = 'sql'; @@ -309,7 +309,7 @@ if (! empty($cfg['MemoryLimit'])) { } $timestamp = time(); -if (isset($_REQUEST['allow_interrupt'])) { +if (isset($_POST['allow_interrupt'])) { $maximum_time = ini_get('max_execution_time'); } else { $maximum_time = 0; @@ -335,9 +335,9 @@ $result = false; $msg = 'Sorry an unexpected error happened!'; // Bookmark Support: get a query back from bookmark if required -if (! empty($_REQUEST['id_bookmark'])) { - $id_bookmark = (int)$_REQUEST['id_bookmark']; - switch ($_REQUEST['action_bookmark']) { +if (! empty($_POST['id_bookmark'])) { + $id_bookmark = (int)$_POST['id_bookmark']; + switch ($_POST['action_bookmark']) { case 0: // bookmarked query that have to be run $bookmark = Bookmark::get( $GLOBALS['dbi'], @@ -345,12 +345,12 @@ if (! empty($_REQUEST['id_bookmark'])) { $db, $id_bookmark, 'id', - isset($_REQUEST['action_bookmark_all']) + isset($_POST['action_bookmark_all']) ); - if (! empty($_REQUEST['bookmark_variable'])) { + if (! empty($_POST['bookmark_variable'])) { $import_text = $bookmark->applyVariables( - $_REQUEST['bookmark_variable'] + $_POST['bookmark_variable'] ); } else { $import_text = $bookmark->getQuery(); @@ -387,7 +387,7 @@ if (! empty($_REQUEST['id_bookmark'])) { $response->setRequestStatus($message->isSuccess()); $response->addJSON('message', $message); $response->addJSON('sql_query', $import_text); - $response->addJSON('action_bookmark', $_REQUEST['action_bookmark']); + $response->addJSON('action_bookmark', $_POST['action_bookmark']); exit; } else { $run_query = false; @@ -408,7 +408,7 @@ if (! empty($_REQUEST['id_bookmark'])) { ); $response->setRequestStatus($message->isSuccess()); $response->addJSON('message', $message); - $response->addJSON('action_bookmark', $_REQUEST['action_bookmark']); + $response->addJSON('action_bookmark', $_POST['action_bookmark']); $response->addJSON('id_bookmark', $id_bookmark); exit; } else { @@ -580,11 +580,11 @@ if ($reset_charset) { } // Show correct message -if (! empty($id_bookmark) && $_REQUEST['action_bookmark'] == 2) { +if (! empty($id_bookmark) && $_POST['action_bookmark'] == 2) { $message = PhpMyAdmin\Message::success(__('The bookmark has been deleted.')); $display_query = $import_text; $error = false; // unset error marker, it was used just to skip processing -} elseif (! empty($id_bookmark) && $_REQUEST['action_bookmark'] == 1) { +} elseif (! empty($id_bookmark) && $_POST['action_bookmark'] == 1) { $message = PhpMyAdmin\Message::notice(__('Showing bookmark')); } elseif ($bookmark_created) { $special_message = '[br]' . sprintf( @@ -790,6 +790,6 @@ if ($go_sql) { } // If there is request for ROLLBACK in the end. -if (isset($_REQUEST['rollback_query'])) { +if (isset($_POST['rollback_query'])) { $GLOBALS['dbi']->query('ROLLBACK'); } diff --git a/index.php b/index.php index 6ab209e1a8..4eff01060f 100644 --- a/index.php +++ b/index.php @@ -624,7 +624,7 @@ if ($server > 0) { ); } $msg = Message::notice($msg_text); - $msg->addParamHtml(''); + $msg->addParamHtml(''); $msg->addParamHtml(''); /* Show error if user has configured something, notice elsewhere */ if (!empty($cfg['Servers'][$server]['pmadb'])) { diff --git a/js/db_central_columns.js b/js/db_central_columns.js index 1faa8a99db..3f649e34b2 100644 --- a/js/db_central_columns.js +++ b/js/db_central_columns.js @@ -65,10 +65,10 @@ AJAX.registerOnload('db_central_columns.js', function () { return false; } var argsep = PMA_commonParams.get('arg_separator'); - var editColumnData = editColumnList + '' + argsep + 'edit_central_columns_page=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + PMA_commonParams.get('db'); + var editColumnData = editColumnList + '' + argsep + 'edit_central_columns_page=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(PMA_commonParams.get('db')); PMA_ajaxShowMessage(); AJAX.source = $(this); - $.get('db_central_columns.php', editColumnData, AJAX.responseHandler); + $.post('db_central_columns.php', editColumnData, AJAX.responseHandler); }); $('#multi_edit_central_columns').submit(function (event) { event.preventDefault(); diff --git a/js/db_tracking.js b/js/db_tracking.js index 36b8ae3e2e..ce2febab9c 100644 --- a/js/db_tracking.js +++ b/js/db_tracking.js @@ -84,10 +84,9 @@ AJAX.registerOnload('db_tracking.js', function () { $anchor.PMA_confirm(question, $anchor.attr('href'), function (url) { PMA_ajaxShowMessage(PMA_messages.strDeletingTrackingData); AJAX.source = $anchor; - var params = { - 'ajax_page_request': true, - 'ajax_request': true - }; + var argSep = PMA_commonParams.get('arg_separator'); + var params = getJSConfirmCommonParam(this, $anchor.getPostData()); + params += argSep + 'ajax_page_request=1'; $.post(url, params, AJAX.responseHandler); }); }); diff --git a/js/error_report.js b/js/error_report.js index b35e768018..fb0eca209c 100644 --- a/js/error_report.js +++ b/js/error_report.js @@ -23,7 +23,7 @@ var ErrorReport = { exception.name = ErrorReport._extractExceptionName(exception); } ErrorReport._last_exception = exception; - $.get('error_report.php', { + $.post('error_report.php', { ajax_request: true, server: PMA_commonParams.get('server'), get_settings: true, @@ -111,7 +111,7 @@ var ErrorReport = { } }); } - }); // end $.get() + }); }, /** * Shows the small notification that asks for user permission diff --git a/js/functions.js b/js/functions.js index ef74591a9b..4b5c9c6dcf 100644 --- a/js/functions.js +++ b/js/functions.js @@ -3857,7 +3857,7 @@ function indexEditorDialog (url, title, callback_success, callback_failure) { $(this).dialog('close'); }; var $msgbox = PMA_ajaxShowMessage(); - $.get('tbl_indexes.php', url, function (data) { + $.post('tbl_indexes.php', url, function (data) { if (typeof data !== 'undefined' && data.success === false) { // in the case of an error, show the error message returned. PMA_ajaxShowMessage(data.error, false); @@ -4607,8 +4607,9 @@ function PMA_createViewDialog ($this) { var $msg = PMA_ajaxShowMessage(); var syntaxHighlighter = null; var sep = PMA_commonParams.get('arg_separator'); - params = $this.getPostData(); - $.get($this.attr('href') + sep + 'ajax_request=1' + sep + 'ajax_dialog=1' + sep + params, function (data) { + var params = getJSConfirmCommonParam(this, $this.getPostData()); + params += sep + 'ajax_dialog=1'; + $.post($this.attr('href'), params, function (data) { if (typeof data !== 'undefined' && data.success === true) { PMA_ajaxRemoveMessage($msg); var buttonOptions = {}; diff --git a/js/indexes.js b/js/indexes.js index a33cf50b99..255091d651 100644 --- a/js/indexes.js +++ b/js/indexes.js @@ -697,10 +697,7 @@ AJAX.registerOnload('indexes.js', function () { title = PMA_messages.strAddIndex; } else { // Edit index - url = $(this).find('a').attr('href'); - if (url.substring(0, 16) === 'tbl_indexes.php?') { - url = url.substring(16, url.length); - } + url = $(this).find('a').getPostData(); title = PMA_messages.strEditIndex; } url += PMA_commonParams.get('arg_separator') + 'ajax_request=true'; diff --git a/js/navigation.js b/js/navigation.js index 2fce26031e..f116bb6593 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -519,12 +519,13 @@ $(function () { /** Hide navigation tree item */ $(document).on('click', 'a.hideNavItem.ajax', function (event) { event.preventDefault(); + var argSep = PMA_commonParams.get('arg_separator'); + var params = $(this).getPostData(); + params += argSep + 'ajax_request=true' + argSep + 'server=' + PMA_commonParams.get('server'); $.ajax({ type: 'POST', - data: { - server: PMA_commonParams.get('server'), - }, - url: $(this).attr('href') + PMA_commonParams.get('arg_separator') + 'ajax_request=true', + data: params, + url: $(this).attr('href'), success: function (data) { if (typeof data !== 'undefined' && data.success === true) { PMA_reloadNavigation(); @@ -539,7 +540,10 @@ $(function () { $(document).on('click', 'a.showUnhide.ajax', function (event) { event.preventDefault(); var $msg = PMA_ajaxShowMessage(); - $.get($(this).attr('href') + PMA_commonParams.get('arg_separator') + 'ajax_request=1', function (data) { + var argSep = PMA_commonParams.get('arg_separator'); + var params = $(this).getPostData(); + params += argSep + 'ajax_request=true'; + $.post($(this).attr('href'), params, function (data) { if (typeof data !== 'undefined' && data.success === true) { PMA_ajaxRemoveMessage($msg); var buttonOptions = {}; @@ -572,12 +576,13 @@ $(function () { var $hidden_table_count = $tr.parents('tbody').children().length; var $hide_dialog_box = $tr.closest('div.ui-dialog'); var $msg = PMA_ajaxShowMessage(); + var argSep = PMA_commonParams.get('arg_separator'); + var params = $(this).getPostData(); + params += argSep + 'ajax_request=true' + argSep + 'server=' + PMA_commonParams.get('server'); $.ajax({ type: 'POST', - data: { - server: PMA_commonParams.get('server'), - }, - url: $(this).attr('href') + PMA_commonParams.get('arg_separator') + 'ajax_request=true', + data: params, + url: $(this).attr('href'), success: function (data) { PMA_ajaxRemoveMessage($msg); if (typeof data !== 'undefined' && data.success === true) { diff --git a/js/server_databases.js b/js/server_databases.js index 2285619b74..a1a00513f0 100644 --- a/js/server_databases.js +++ b/js/server_databases.js @@ -60,13 +60,14 @@ AJAX.registerOnload('server_databases.js', function () { $(this).PMA_confirm( question, $form.prop('action') + '?' + $(this).serialize() + - argsep + 'drop_selected_dbs=1' + argsep + 'is_js_confirmed=1' + argsep + 'ajax_request=true', + argsep + 'drop_selected_dbs=1', function (url) { PMA_ajaxShowMessage(PMA_messages.strProcessingRequest, false); - var params = getJSConfirmCommonParam(this); + var parts = url.split('?'); + var params = getJSConfirmCommonParam(this, parts[1]); - $.post(url, params, function (data) { + $.post(parts[0], params, function (data) { if (typeof data !== 'undefined' && data.success === true) { PMA_ajaxShowMessage(data.message); diff --git a/js/server_status_monitor.js b/js/server_status_monitor.js index e6b67e920c..149378ab15 100644 --- a/js/server_status_monitor.js +++ b/js/server_status_monitor.js @@ -686,7 +686,7 @@ AJAX.registerOnload('server_status_monitor.js', function () { $.extend(vars, getvars); } - $.get('server_status_monitor.php' + PMA_commonParams.get('common_query'), vars, + $.post('server_status_monitor.php' + PMA_commonParams.get('common_query'), vars, function (data) { var logVars; if (typeof data !== 'undefined' && data.success === true) { @@ -1591,9 +1591,10 @@ AJAX.registerOnload('server_status_monitor.js', function () { buttons: dlgBtns }); - - logRequest = $.get('server_status_monitor.php' + PMA_commonParams.get('common_query'), - { ajax_request: true, + logRequest = $.post( + 'server_status_monitor.php' + PMA_commonParams.get('common_query'), + { + ajax_request: true, log_data: 1, type: opts.src, time_start: Math.round(opts.start / 1000), diff --git a/js/server_status_processes.js b/js/server_status_processes.js index 928c10b328..2865bca9a7 100644 --- a/js/server_status_processes.js +++ b/js/server_status_processes.js @@ -47,10 +47,12 @@ var processList = { */ killProcessHandler: function (event) { event.preventDefault(); - var url = $(this).attr('href'); + var argSep = PMA_commonParams.get('arg_separator'); + var params = $(this).getPostData(); + params += argSep + 'ajax_request=1' + argSep + 'server=' + PMA_commonParams.get('server'); // Get row element of the process to be killed. var $tr = $(this).closest('tr'); - $.getJSON(url, function (data) { + $.post($(this).attr('href'), params, function (data) { // Check if process was killed or not. if (data.hasOwnProperty('success') && data.success) { // remove the row of killed process. @@ -66,7 +68,7 @@ var processList = { // Show process error message PMA_ajaxShowMessage(data.error, false); } - }); + }, 'json'); }, /** @@ -86,7 +88,7 @@ var processList = { if (processList.autoRefresh) { var interval = parseInt(processList.refreshInterval, 10) * 1000; var urlParams = processList.getUrlParams(); - processList.refreshRequest = $.get(processList.refreshUrl, + processList.refreshRequest = $.post(processList.refreshUrl, urlParams, function (data) { if (data.hasOwnProperty('success') && data.success) { diff --git a/js/sql.js b/js/sql.js index 813a4d0ba1..38f14b3552 100644 --- a/js/sql.js +++ b/js/sql.js @@ -866,7 +866,10 @@ function browseForeignDialog ($this_a) { var tableId = '#browse_foreign_table'; var filterId = '#input_foreign_filter'; var $dialog = null; - $.get($this_a.attr('href'), { 'ajax_request': true }, function (data) { + var argSep = PMA_commonParams.get('arg_separator'); + var params = $this_a.getPostData(); + params += argSep + 'ajax_request=true'; + $.post($this_a.attr('href'), params, function (data) { // Creates browse foreign value dialog $dialog = $('
').append(data.message).dialog({ title: PMA_messages.strBrowseForeignValues, diff --git a/js/tbl_relation.js b/js/tbl_relation.js index 6446b8b1e6..ffc0aff435 100644 --- a/js/tbl_relation.js +++ b/js/tbl_relation.js @@ -72,7 +72,7 @@ function getDropdownValues ($dropdown) { var $msgbox = PMA_ajaxShowMessage(); var $form = $dropdown.parents('form'); var argsep = PMA_commonParams.get('arg_separator'); - var url = 'tbl_relation.php?getDropdownValues=true' + argsep + 'ajax_request=true' + + var params = 'getDropdownValues=true' + argsep + 'ajax_request=true' + argsep + 'db=' + $form.find('input[name="db"]').val() + argsep + 'table=' + $form.find('input[name="table"]').val() + argsep + 'foreign=' + (foreign !== '') + @@ -82,11 +82,13 @@ function getDropdownValues ($dropdown) { ); var $server = $form.find('input[name="server"]'); if ($server.length > 0) { - url += argsep + 'server=' + $form.find('input[name="server"]').val(); + params += argsep + 'server=' + $form.find('input[name="server"]').val(); } $.ajax({ - url: url, - datatype: 'json', + type: 'POST', + url: 'tbl_relation.php', + data: params, + dataType: 'json', success: function (data) { PMA_ajaxRemoveMessage($msgbox); if (typeof data !== 'undefined' && data.success) { diff --git a/js/tbl_tracking.js b/js/tbl_tracking.js index 9415f37a66..cd08957302 100644 --- a/js/tbl_tracking.js +++ b/js/tbl_tracking.js @@ -80,10 +80,9 @@ AJAX.registerOnload('tbl_tracking.js', function () { $anchor.PMA_confirm(question, $anchor.attr('href'), function (url) { PMA_ajaxShowMessage(); AJAX.source = $anchor; - var params = { - 'ajax_page_request': true, - 'ajax_request': true - }; + var argSep = PMA_commonParams.get('arg_separator'); + var params = getJSConfirmCommonParam(this, $anchor.getPostData()); + params += argSep + 'ajax_page_request=1'; $.post(url, params, AJAX.responseHandler); }); }); @@ -98,10 +97,9 @@ AJAX.registerOnload('tbl_tracking.js', function () { $anchor.PMA_confirm(question, $anchor.attr('href'), function (url) { PMA_ajaxShowMessage(); AJAX.source = $anchor; - var params = { - 'ajax_page_request': true, - 'ajax_request': true - }; + var argSep = PMA_commonParams.get('arg_separator'); + var params = getJSConfirmCommonParam(this, $anchor.getPostData()); + params += argSep + 'ajax_page_request=1'; $.post(url, params, AJAX.responseHandler); }); }); diff --git a/libraries/classes/BrowseForeigners.php b/libraries/classes/BrowseForeigners.php index b38115e70a..8fd7e7f0c7 100644 --- a/libraries/classes/BrowseForeigners.php +++ b/libraries/classes/BrowseForeigners.php @@ -186,12 +186,12 @@ class BrowseForeigners . ''; - if (isset($_REQUEST['rownumber'])) { + if (isset($_POST['rownumber'])) { $output .= ''; + . htmlspecialchars((string) $_POST['rownumber']) . '" />'; } - $filter_value = (isset($_REQUEST['foreign_filter']) - ? htmlspecialchars($_REQUEST['foreign_filter']) + $filter_value = (isset($_POST['foreign_filter']) + ? htmlspecialchars($_POST['foreign_filter']) : ''); $output .= '' . '' @@ -308,7 +308,7 @@ class BrowseForeigners private function getHtmlForGotoPage(?array $foreignData): string { $gotopage = ''; - isset($_REQUEST['pos']) ? $pos = $_REQUEST['pos'] : $pos = 0; + isset($_POST['pos']) ? $pos = $_POST['pos'] : $pos = 0; if (!is_array($foreignData['disp_row'])) { return $gotopage; } @@ -346,7 +346,7 @@ class BrowseForeigners if (isset($foreignShowAll) && $foreignShowAll == __('Show all')) { return null; } - isset($_REQUEST['pos']) ? $pos = $_REQUEST['pos'] : $pos = 0; + isset($_POST['pos']) ? $pos = $_POST['pos'] : $pos = 0; return 'LIMIT ' . $pos . ', ' . $this->maxRows . ' '; } } diff --git a/libraries/classes/CentralColumns.php b/libraries/classes/CentralColumns.php index ba2f9ddac9..c383e1c252 100644 --- a/libraries/classes/CentralColumns.php +++ b/libraries/classes/CentralColumns.php @@ -310,7 +310,7 @@ class CentralColumns if (empty($cfgCentralColumns)) { return $this->configErrorMessage(); } - $db = $_REQUEST['db']; + $db = $_POST['db']; $pmadb = $cfgCentralColumns['db']; $central_list_table = $cfgCentralColumns['table']; $this->dbi->selectDb($db); @@ -350,7 +350,7 @@ class CentralColumns } } else { if ($table === null) { - $table = $_REQUEST['table']; + $table = $_POST['table']; } foreach ($field_select as $column) { $cols .= "'" . $this->dbi->escapeString($column) . "',"; @@ -429,7 +429,7 @@ class CentralColumns if (empty($cfgCentralColumns)) { return $this->configErrorMessage(); } - $db = $_REQUEST['db']; + $db = $_POST['db']; $pmadb = $cfgCentralColumns['db']; $central_list_table = $cfgCentralColumns['table']; $this->dbi->selectDb($db); diff --git a/libraries/classes/Controllers/Server/ServerBinlogController.php b/libraries/classes/Controllers/Server/ServerBinlogController.php index 57cca6daff..dc6813e749 100644 --- a/libraries/classes/Controllers/Server/ServerBinlogController.php +++ b/libraries/classes/Controllers/Server/ServerBinlogController.php @@ -60,15 +60,15 @@ class ServerBinlogController extends Controller include_once 'libraries/server_common.inc.php'; $url_params = []; - if (! isset($_REQUEST['log']) - || ! array_key_exists($_REQUEST['log'], $this->binary_logs) + if (! isset($_POST['log']) + || ! array_key_exists($_POST['log'], $this->binary_logs) ) { - $_REQUEST['log'] = ''; + $_POST['log'] = ''; } else { - $url_params['log'] = $_REQUEST['log']; + $url_params['log'] = $_POST['log']; } - if (!empty($_REQUEST['dontlimitchars'])) { + if (!empty($_POST['dontlimitchars'])) { $url_params['dontlimitchars'] = 1; } @@ -93,7 +93,7 @@ class ServerBinlogController extends Controller return $this->template->render('server/binlog/log_selector', [ 'url_params' => $url_params, 'binary_logs' => $this->binary_logs, - 'log' => $_REQUEST['log'], + 'log' => $_POST['log'], ]); } @@ -109,16 +109,16 @@ class ServerBinlogController extends Controller /** * Need to find the real end of rows? */ - if (! isset($_REQUEST['pos'])) { + if (! isset($_POST['pos'])) { $pos = 0; } else { /* We need this to be a integer */ - $pos = (int) $_REQUEST['pos']; + $pos = (int) $_POST['pos']; } $sql_query = 'SHOW BINLOG EVENTS'; - if (! empty($_REQUEST['log'])) { - $sql_query .= ' IN \'' . $_REQUEST['log'] . '\''; + if (! empty($_POST['log'])) { + $sql_query .= ' IN \'' . $_POST['log'] . '\''; } $sql_query .= ' LIMIT ' . $pos . ', ' . intval($GLOBALS['cfg']['MaxRows']); @@ -137,7 +137,7 @@ class ServerBinlogController extends Controller $num_rows = 0; } - if (empty($_REQUEST['dontlimitchars'])) { + if (empty($_POST['dontlimitchars'])) { $dontlimitchars = false; } else { $dontlimitchars = true; @@ -195,8 +195,8 @@ class ServerBinlogController extends Controller $this_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxRows']; } - $html .= ''; } else { @@ -218,7 +218,7 @@ class ServerBinlogController extends Controller $tempTitle = __('Show Full Queries'); $tempImgMode = 'full'; } - $html .= '' . '' . $tempTitle . ''; @@ -228,8 +228,8 @@ class ServerBinlogController extends Controller if ($num_rows >= $GLOBALS['cfg']['MaxRows']) { $this_url_params = $url_params; $this_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxRows']; - $html .= ' - '; diff --git a/libraries/classes/Controllers/Server/ServerDatabasesController.php b/libraries/classes/Controllers/Server/ServerDatabasesController.php index 62aa2d9717..4321cec0d6 100644 --- a/libraries/classes/Controllers/Server/ServerDatabasesController.php +++ b/libraries/classes/Controllers/Server/ServerDatabasesController.php @@ -61,7 +61,7 @@ class ServerDatabasesController extends Controller $response = Response::getInstance(); - if (isset($_REQUEST['drop_selected_dbs']) + if (isset($_POST['drop_selected_dbs']) && $response->isAjax() && ($this->dbi->isSuperuser() || $GLOBALS['cfg']['AllowUserDropDatabase']) ) { @@ -214,7 +214,7 @@ class ServerDatabasesController extends Controller */ public function dropDatabasesAction() { - if (! isset($_REQUEST['selected_dbs'])) { + if (! isset($_POST['selected_dbs'])) { $message = Message::error(__('No databases selected.')); } else { $action = 'server_databases.php'; diff --git a/libraries/classes/Controllers/Server/ServerVariablesController.php b/libraries/classes/Controllers/Server/ServerVariablesController.php index b09977ff40..6d6b4cb815 100644 --- a/libraries/classes/Controllers/Server/ServerVariablesController.php +++ b/libraries/classes/Controllers/Server/ServerVariablesController.php @@ -48,16 +48,16 @@ class ServerVariablesController extends Controller { $response = Response::getInstance(); if ($response->isAjax() - && isset($_REQUEST['type']) - && $_REQUEST['type'] === 'getval' + && isset($_GET['type']) + && $_GET['type'] === 'getval' ) { $this->getValueAction(); return; } if ($response->isAjax() - && isset($_REQUEST['type']) - && $_REQUEST['type'] === 'setval' + && isset($_POST['type']) + && $_POST['type'] === 'setval' ) { $this->setValueAction(); return; @@ -138,12 +138,12 @@ class ServerVariablesController extends Controller // when server is running in ANSI_QUOTES sql_mode $varValue = $this->dbi->fetchSingleRow( 'SHOW GLOBAL VARIABLES WHERE Variable_name=\'' - . $this->dbi->escapeString($_REQUEST['varName']) . '\';', + . $this->dbi->escapeString($_GET['varName']) . '\';', 'NUM' ); try { - $type = KBSearch::getVariableType($_REQUEST['varName']); + $type = KBSearch::getVariableType($_GET['varName']); if ($type === 'byte') { $this->response->addJSON( 'message', @@ -170,10 +170,10 @@ class ServerVariablesController extends Controller */ public function setValueAction() { - $value = $_REQUEST['varValue']; + $value = $_POST['varValue']; $matches = []; try { - $type = KBSearch::getVariableType($_REQUEST['varName']); + $type = KBSearch::getVariableType($_POST['varName']); if ($type === 'byte' && preg_match( '/^\s*(\d+(\.\d+)?)\s*(mb|kb|mib|kib|gb|gib)\s*$/i', $value, @@ -202,20 +202,20 @@ class ServerVariablesController extends Controller $value = "'" . $value . "'"; } - if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName']) + if (! preg_match("/[^a-zA-Z0-9_]+/", $_POST['varName']) && $this->dbi->query( - 'SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value + 'SET GLOBAL ' . $_POST['varName'] . ' = ' . $value ) ) { // Some values are rounded down etc. $varValue = $this->dbi->fetchSingleRow( 'SHOW GLOBAL VARIABLES WHERE Variable_name="' - . $this->dbi->escapeString($_REQUEST['varName']) + . $this->dbi->escapeString($_POST['varName']) . '";', 'NUM' ); list($formattedValue, $isHtmlFormatted) = $this->_formatVariable( - $_REQUEST['varName'], + $_POST['varName'], $varValue[1] ); diff --git a/libraries/classes/Controllers/Table/TableIndexesController.php b/libraries/classes/Controllers/Table/TableIndexesController.php index 9552943f34..b76356f985 100644 --- a/libraries/classes/Controllers/Table/TableIndexesController.php +++ b/libraries/classes/Controllers/Table/TableIndexesController.php @@ -55,7 +55,7 @@ class TableIndexesController extends TableController */ public function indexAction() { - if (isset($_REQUEST['do_save_data'])) { + if (isset($_POST['do_save_data'])) { $this->doSaveDataAction(); return; } // end builds the new index @@ -72,24 +72,24 @@ class TableIndexesController extends TableController { $this->dbi->selectDb($GLOBALS['db']); $add_fields = 0; - if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) { + if (isset($_POST['index']) && is_array($_POST['index'])) { // coming already from form - if (isset($_REQUEST['index']['columns']['names'])) { - $add_fields = count($_REQUEST['index']['columns']['names']) + if (isset($_POST['index']['columns']['names'])) { + $add_fields = count($_POST['index']['columns']['names']) - $this->index->getColumnCount(); } - if (isset($_REQUEST['add_fields'])) { - $add_fields += $_REQUEST['added_fields']; + if (isset($_POST['add_fields'])) { + $add_fields += $_POST['added_fields']; } - } elseif (isset($_REQUEST['create_index'])) { - $add_fields = $_REQUEST['added_fields']; + } elseif (isset($_POST['create_index'])) { + $add_fields = $_POST['added_fields']; } // end preparing form values // Get fields and stores their name/type - if (isset($_REQUEST['create_edit_table'])) { - $fields = json_decode($_REQUEST['columns'], true); + if (isset($_POST['create_edit_table'])) { + $fields = json_decode($_POST['columns'], true); $index_params = [ - 'Non_unique' => $_REQUEST['index']['Index_choice'] == 'UNIQUE' + 'Non_unique' => $_POST['index']['Index_choice'] == 'UNIQUE' ? '0' : '1', ]; $this->index->set($index_params); @@ -104,12 +104,12 @@ class TableIndexesController extends TableController 'table' => $this->table, ]; - if (isset($_REQUEST['create_index'])) { + if (isset($_POST['create_index'])) { $form_params['create_index'] = 1; - } elseif (isset($_REQUEST['old_index'])) { - $form_params['old_index'] = $_REQUEST['old_index']; - } elseif (isset($_REQUEST['index'])) { - $form_params['old_index'] = $_REQUEST['index']; + } elseif (isset($_POST['old_index'])) { + $form_params['old_index'] = $_POST['old_index']; + } elseif (isset($_POST['index'])) { + $form_params['old_index'] = $_POST['index']; } $this->response->getHeader()->getScripts()->addFile('indexes.js'); @@ -120,7 +120,7 @@ class TableIndexesController extends TableController 'index' => $this->index, 'form_params' => $form_params, 'add_fields' => $add_fields, - 'create_edit_table' => isset($_REQUEST['create_edit_table']), + 'create_edit_table' => isset($_POST['create_edit_table']), 'default_sliders_state' => $GLOBALS['cfg']['InitialSlidersState'], ]) ); @@ -141,7 +141,7 @@ class TableIndexesController extends TableController ->getSqlQueryForIndexCreateOrEdit($this->index, $error); // If there is a request for SQL previewing. - if (isset($_REQUEST['preview_sql'])) { + if (isset($_POST['preview_sql'])) { $this->response->addJSON( 'sql_data', $this->template->render('preview_sql', ['query_data' => $sql_query]) diff --git a/libraries/classes/Controllers/Table/TableRelationController.php b/libraries/classes/Controllers/Table/TableRelationController.php index 2982f91f95..c95e718335 100644 --- a/libraries/classes/Controllers/Table/TableRelationController.php +++ b/libraries/classes/Controllers/Table/TableRelationController.php @@ -105,11 +105,11 @@ class TableRelationController extends TableController { // Send table of column names to populate corresponding dropdowns depending // on the current selection - if (isset($_REQUEST['getDropdownValues']) - && $_REQUEST['getDropdownValues'] === 'true' + if (isset($_POST['getDropdownValues']) + && $_POST['getDropdownValues'] === 'true' ) { // if both db and table are selected - if (isset($_REQUEST['foreignTable'])) { + if (isset($_POST['foreignTable'])) { $this->getDropdownValueForTableAction(); } else { // if only the db is selected $this->getDropdownValueForDbAction(); @@ -241,8 +241,8 @@ class TableRelationController extends TableController */ public function updateForForeignKeysAction() { - $multi_edit_columns_name = isset($_REQUEST['foreign_key_fields_name']) - ? $_REQUEST['foreign_key_fields_name'] + $multi_edit_columns_name = isset($_POST['foreign_key_fields_name']) + ? $_POST['foreign_key_fields_name'] : null; // (for now, one index name only; we keep the definitions if the @@ -262,7 +262,7 @@ class TableRelationController extends TableController $this->response->addHTML($html); // If there is a request for SQL previewing. - if (isset($_REQUEST['preview_sql'])) { + if (isset($_POST['preview_sql'])) { Core::previewSQL($preview_sql_data); } @@ -285,8 +285,8 @@ class TableRelationController extends TableController */ public function updateForInternalRelationAction() { - $multi_edit_columns_name = isset($_REQUEST['fields_name']) - ? $_REQUEST['fields_name'] + $multi_edit_columns_name = isset($_POST['fields_name']) + ? $_POST['fields_name'] : null; if ($this->upd_query->updateInternalRelations( @@ -316,8 +316,8 @@ class TableRelationController extends TableController */ public function getDropdownValueForTableAction() { - $foreignTable = $_REQUEST['foreignTable']; - $table_obj = $this->dbi->getTable($_REQUEST['foreignDb'], $foreignTable); + $foreignTable = $_POST['foreignTable']; + $table_obj = $this->dbi->getTable($_POST['foreignDb'], $foreignTable); // Since views do not have keys defined on them provide the full list of // columns if ($table_obj->isView()) { @@ -335,7 +335,7 @@ class TableRelationController extends TableController $this->response->addJSON('columns', $columns); // @todo should be: $server->db($db)->table($table)->primary() - $primary = Index::getPrimary($foreignTable, $_REQUEST['foreignDb']); + $primary = Index::getPrimary($foreignTable, $_POST['foreignDb']); if (false === $primary) { return; } @@ -352,11 +352,11 @@ class TableRelationController extends TableController public function getDropdownValueForDbAction() { $tables = []; - $foreign = isset($_REQUEST['foreign']) && $_REQUEST['foreign'] === 'true'; + $foreign = isset($_POST['foreign']) && $_POST['foreign'] === 'true'; if ($foreign) { $query = 'SHOW TABLE STATUS FROM ' - . Util::backquote($_REQUEST['foreignDb']); + . Util::backquote($_POST['foreignDb']); $tables_rs = $this->dbi->query( $query, DatabaseInterface::CONNECT_USER, @@ -372,7 +372,7 @@ class TableRelationController extends TableController } } else { $query = 'SHOW TABLES FROM ' - . Util::backquote($_REQUEST['foreignDb']); + . Util::backquote($_POST['foreignDb']); $tables_rs = $this->dbi->query( $query, DatabaseInterface::CONNECT_USER, diff --git a/libraries/classes/Controllers/Table/TableSearchController.php b/libraries/classes/Controllers/Table/TableSearchController.php index a0ef7bd31d..545cac0579 100644 --- a/libraries/classes/Controllers/Table/TableSearchController.php +++ b/libraries/classes/Controllers/Table/TableSearchController.php @@ -221,7 +221,7 @@ class TableSearchController extends TableController ] ); - if (isset($_REQUEST['range_search'])) { + if (isset($_POST['range_search'])) { $this->rangeSearchAction(); return; @@ -262,8 +262,8 @@ class TableSearchController extends TableController * * @var boolean Object containing parameters for the POST request */ - if (isset($_REQUEST['get_data_row']) - && $_REQUEST['get_data_row'] == true + if (isset($_POST['get_data_row']) + && $_POST['get_data_row'] == true ) { $this->getDataRowAction(); @@ -275,8 +275,8 @@ class TableSearchController extends TableController * * @var boolean Object containing parameters for the POST request */ - if (isset($_REQUEST['change_tbl_info']) - && $_REQUEST['change_tbl_info'] == true + if (isset($_POST['change_tbl_info']) + && $_POST['change_tbl_info'] == true ) { $this->changeTableInfoAction(); @@ -407,7 +407,7 @@ class TableSearchController extends TableController */ public function changeTableInfoAction() { - $field = $_REQUEST['field']; + $field = $_POST['field']; if ($field == 'pma_null') { $this->response->addJSON('field_type', ''); $this->response->addJSON('field_collation', ''); @@ -417,8 +417,8 @@ class TableSearchController extends TableController } $key = array_search($field, $this->_columnNames); $search_index - = (isset($_REQUEST['it']) && is_numeric($_REQUEST['it']) - ? intval($_REQUEST['it']) : 0); + = (isset($_POST['it']) && is_numeric($_POST['it']) + ? intval($_POST['it']) : 0); $properties = $this->getColumnProperties($search_index, $key); $this->response->addJSON( @@ -438,8 +438,8 @@ class TableSearchController extends TableController public function getDataRowAction() { $extra_data = []; - $row_info_query = 'SELECT * FROM `' . $_REQUEST['db'] . '`.`' - . $_REQUEST['table'] . '` WHERE ' . $_REQUEST['where_clause']; + $row_info_query = 'SELECT * FROM `' . $_POST['db'] . '`.`' + . $_POST['table'] . '` WHERE ' . $_POST['where_clause']; $result = $this->dbi->query( $row_info_query . ";", DatabaseInterface::CONNECT_USER, @@ -584,7 +584,7 @@ class TableSearchController extends TableController */ public function rangeSearchAction() { - $min_max = $this->getColumnMinMax($_REQUEST['column']); + $min_max = $this->getColumnMinMax($_POST['column']); $this->response->addJSON('column_data', $min_max); } diff --git a/libraries/classes/Controllers/Table/TableStructureController.php b/libraries/classes/Controllers/Table/TableStructureController.php index 23e2c5eeec..28781a7554 100644 --- a/libraries/classes/Controllers/Table/TableStructureController.php +++ b/libraries/classes/Controllers/Table/TableStructureController.php @@ -163,8 +163,8 @@ class TableStructureController extends TableController /** * Handle column moving */ - if (isset($_REQUEST['move_columns']) - && is_array($_REQUEST['move_columns']) + if (isset($_POST['move_columns']) + && is_array($_POST['move_columns']) && $this->response->isAjax() ) { $this->moveColumns(); @@ -174,9 +174,9 @@ class TableStructureController extends TableController /** * handle MySQL reserved words columns check */ - if (isset($_REQUEST['reserved_word_check'])) { + if (isset($_POST['reserved_word_check'])) { if ($GLOBALS['cfg']['ReservedWordDisableWarning'] === false) { - $columns_names = $_REQUEST['field_name']; + $columns_names = $_POST['field_name']; $reserved_keywords_names = []; foreach ($columns_names as $column) { if (Context::isKeyword(trim($column), true)) { @@ -208,7 +208,7 @@ class TableStructureController extends TableController /** * A click on Change has been made for one column */ - if (isset($_REQUEST['change_column'])) { + if (isset($_GET['change_column'])) { $this->displayHtmlForColumnChange(null, 'tbl_structure.php'); return; } @@ -216,8 +216,8 @@ class TableStructureController extends TableController /** * Adding or editing partitioning of the table */ - if (isset($_REQUEST['edit_partitioning']) - && ! isset($_REQUEST['save_partitioning']) + if (isset($_POST['edit_partitioning']) + && ! isset($_POST['save_partitioning']) ) { $this->displayHtmlForPartitionChange(); return; @@ -231,7 +231,7 @@ class TableStructureController extends TableController $submit_mult = $this->getMultipleFieldCommandType(); if (! empty($submit_mult)) { - if (isset($_REQUEST['selected_fld'])) { + if (isset($_POST['selected_fld'])) { if ($submit_mult == 'browse') { // browsing the table displaying only selected columns $this->displayTableBrowseForSelectedColumns( @@ -242,14 +242,14 @@ class TableStructureController extends TableController // handle multiple field commands // handle confirmation of deleting multiple columns $action = 'tbl_structure.php'; - $GLOBALS['selected'] = $_REQUEST['selected_fld']; + $GLOBALS['selected'] = $_POST['selected_fld']; list( $what_ret, $query_type_ret, $is_unset_submit_mult, $mult_btn_ret, $centralColsError ) = $this->getDataForSubmitMult( $submit_mult, - $_REQUEST['selected_fld'], + $_POST['selected_fld'], $action ); //update the existing variables @@ -291,29 +291,29 @@ class TableStructureController extends TableController /** * Modifications have been submitted -> updates the table */ - if (isset($_REQUEST['do_save_data'])) { + if (isset($_POST['do_save_data'])) { $regenerate = $this->updateColumns(); if ($regenerate) { // This happens when updating failed // @todo: do something appropriate } else { // continue to show the table's structure - unset($_REQUEST['selected']); + unset($_POST['selected']); } } /** * Modifications to the partitioning have been submitted -> updates the table */ - if (isset($_REQUEST['save_partitioning'])) { + if (isset($_POST['save_partitioning'])) { $this->updatePartitioning(); } /** * Adding indexes */ - if (isset($_REQUEST['add_key']) - || isset($_REQUEST['partition_maintenance']) + if (isset($_POST['add_key']) + || isset($_POST['partition_maintenance']) ) { //todo: set some variables for sql.php include, to be eliminated //after refactoring sql.php @@ -402,8 +402,8 @@ class TableStructureController extends TableController $changes = []; // move columns from first to last - for ($i = 0, $l = count($_REQUEST['move_columns']); $i < $l; $i++) { - $column = $_REQUEST['move_columns'][$i]; + for ($i = 0, $l = count($_POST['move_columns']); $i < $l; $i++) { + $column = $_POST['move_columns'][$i]; // is this column already correctly placed? if ($column_names[$i] == $column) { continue; @@ -568,7 +568,7 @@ class TableStructureController extends TableController protected function displayHtmlForPartitionChange() { $partitionDetails = null; - if (! isset($_REQUEST['partition_by'])) { + if (! isset($_POST['partition_by'])) { $partitionDetails = $this->_extractPartitionDetails(); } @@ -788,18 +788,18 @@ class TableStructureController extends TableController ]; foreach ($types as $type) { - if (isset($_REQUEST['submit_mult_' . $type . '_x'])) { + if (isset($_POST['submit_mult_' . $type . '_x'])) { return $type; } } - if (isset($_REQUEST['submit_mult'])) { - return $_REQUEST['submit_mult']; - } elseif (isset($_REQUEST['mult_btn']) - && $_REQUEST['mult_btn'] == __('Yes') + if (isset($_POST['submit_mult'])) { + return $_POST['submit_mult']; + } elseif (isset($_POST['mult_btn']) + && $_POST['mult_btn'] == __('Yes') ) { - if (isset($_REQUEST['selected'])) { - $_REQUEST['selected_fld'] = $_REQUEST['selected']; + if (isset($_POST['selected'])) { + $_POST['selected_fld'] = $_POST['selected']; } return 'row_delete'; } @@ -819,7 +819,7 @@ class TableStructureController extends TableController { $GLOBALS['active_page'] = 'sql.php'; $fields = []; - foreach ($_REQUEST['selected_fld'] as $sval) { + foreach ($_POST['selected_fld'] as $sval) { $fields[] = Util::backquote($sval); } $sql_query = sprintf( @@ -877,7 +877,7 @@ class TableStructureController extends TableController ] ); $regenerate = false; - $field_cnt = count($_REQUEST['field_name']); + $field_cnt = count($_POST['field_name']); $changes = []; $adjust_privileges = []; $columns_with_index = $this->dbi @@ -891,20 +891,20 @@ class TableStructureController extends TableController } $changes[] = 'CHANGE ' . Table::generateAlter( - Util::getValueByKey($_REQUEST, "field_orig.${i}", ''), - $_REQUEST['field_name'][$i], - $_REQUEST['field_type'][$i], - $_REQUEST['field_length'][$i], - $_REQUEST['field_attribute'][$i], - Util::getValueByKey($_REQUEST, "field_collation.${i}", ''), - Util::getValueByKey($_REQUEST, "field_null.${i}", 'NOT NULL'), - $_REQUEST['field_default_type'][$i], - $_REQUEST['field_default_value'][$i], - Util::getValueByKey($_REQUEST, "field_extra.${i}", false), - Util::getValueByKey($_REQUEST, "field_comments.${i}", ''), - Util::getValueByKey($_REQUEST, "field_virtuality.${i}", ''), - Util::getValueByKey($_REQUEST, "field_expression.${i}", ''), - Util::getValueByKey($_REQUEST, "field_move_to.${i}", ''), + Util::getValueByKey($_POST, "field_orig.${i}", ''), + $_POST['field_name'][$i], + $_POST['field_type'][$i], + $_POST['field_length'][$i], + $_POST['field_attribute'][$i], + Util::getValueByKey($_POST, "field_collation.${i}", ''), + Util::getValueByKey($_POST, "field_null.${i}", 'NOT NULL'), + $_POST['field_default_type'][$i], + $_POST['field_default_value'][$i], + Util::getValueByKey($_POST, "field_extra.${i}", false), + Util::getValueByKey($_POST, "field_comments.${i}", ''), + Util::getValueByKey($_POST, "field_virtuality.${i}", ''), + Util::getValueByKey($_POST, "field_expression.${i}", ''), + Util::getValueByKey($_POST, "field_move_to.${i}", ''), $columns_with_index ); @@ -915,22 +915,22 @@ class TableStructureController extends TableController // if the old column name is part of the remembered sort expression if (mb_strpos( (string) $sorted_col, - Util::backquote($_REQUEST['field_orig'][$i]) + Util::backquote($_POST['field_orig'][$i]) ) !== false) { // delete the whole remembered sort expression $this->table_obj->removeUiProp(Table::PROP_SORTED_COLUMN); } - if (isset($_REQUEST['field_adjust_privileges'][$i]) - && ! empty($_REQUEST['field_adjust_privileges'][$i]) - && $_REQUEST['field_orig'][$i] != $_REQUEST['field_name'][$i] + if (isset($_POST['field_adjust_privileges'][$i]) + && ! empty($_POST['field_adjust_privileges'][$i]) + && $_POST['field_orig'][$i] != $_POST['field_name'][$i] ) { - $adjust_privileges[$_REQUEST['field_orig'][$i]] - = $_REQUEST['field_name'][$i]; + $adjust_privileges[$_POST['field_orig'][$i]] + = $_POST['field_name'][$i]; } } // end for - if (count($changes) > 0 || isset($_REQUEST['preview_sql'])) { + if (count($changes) > 0 || isset($_POST['preview_sql'])) { // Builds the primary keys statements and updates the table $key_query = ''; /** @@ -957,7 +957,7 @@ class TableStructureController extends TableController $sql_query .= ';'; // If there is a request for SQL previewing. - if (isset($_REQUEST['preview_sql'])) { + if (isset($_POST['preview_sql'])) { Core::previewSQL(count($changes) > 0 ? $sql_query : ''); } @@ -972,18 +972,18 @@ class TableStructureController extends TableController // While changing the Column Collation // First change to BLOB for ($i = 0; $i < $field_cnt; $i++) { - if (isset($_REQUEST['field_collation'][$i]) - && isset($_REQUEST['field_collation_orig'][$i]) - && $_REQUEST['field_collation'][$i] !== $_REQUEST['field_collation_orig'][$i] - && ! in_array($_REQUEST['field_orig'][$i], $columns_with_index) + if (isset($_POST['field_collation'][$i]) + && isset($_POST['field_collation_orig'][$i]) + && $_POST['field_collation'][$i] !== $_POST['field_collation_orig'][$i] + && ! in_array($_POST['field_orig'][$i], $columns_with_index) ) { $secondary_query = 'ALTER TABLE ' . Util::backquote( $this->table ) . ' CHANGE ' . Util::backquote( - $_REQUEST['field_orig'][$i] + $_POST['field_orig'][$i] ) - . ' ' . Util::backquote($_REQUEST['field_orig'][$i]) + . ' ' . Util::backquote($_POST['field_orig'][$i]) . ' BLOB;'; $this->dbi->query($secondary_query); $changedToBlob[$i] = true; @@ -1028,20 +1028,20 @@ class TableStructureController extends TableController for ($i = 0; $i < $field_cnt; $i++) { if ($changedToBlob[$i]) { $changes_revert[] = 'CHANGE ' . Table::generateAlter( - Util::getValueByKey($_REQUEST, "field_orig.${i}", ''), - $_REQUEST['field_name'][$i], - $_REQUEST['field_type_orig'][$i], - $_REQUEST['field_length_orig'][$i], - $_REQUEST['field_attribute_orig'][$i], - Util::getValueByKey($_REQUEST, "field_collation_orig.${i}", ''), - Util::getValueByKey($_REQUEST, "field_null_orig.${i}", 'NOT NULL'), - $_REQUEST['field_default_type_orig'][$i], - $_REQUEST['field_default_value_orig'][$i], - Util::getValueByKey($_REQUEST, "field_extra_orig.${i}", false), - Util::getValueByKey($_REQUEST, "field_comments_orig.${i}", ''), - Util::getValueByKey($_REQUEST, "field_virtuality_orig.${i}", ''), - Util::getValueByKey($_REQUEST, "field_expression_orig.${i}", ''), - Util::getValueByKey($_REQUEST, "field_move_to_orig.${i}", '') + Util::getValueByKey($_POST, "field_orig.${i}", ''), + $_POST['field_name'][$i], + $_POST['field_type_orig'][$i], + $_POST['field_length_orig'][$i], + $_POST['field_attribute_orig'][$i], + Util::getValueByKey($_POST, "field_collation_orig.${i}", ''), + Util::getValueByKey($_POST, "field_null_orig.${i}", 'NOT NULL'), + $_POST['field_default_type_orig'][$i], + $_POST['field_default_value_orig'][$i], + Util::getValueByKey($_POST, "field_extra_orig.${i}", false), + Util::getValueByKey($_POST, "field_comments_orig.${i}", ''), + Util::getValueByKey($_POST, "field_virtuality_orig.${i}", ''), + Util::getValueByKey($_POST, "field_expression_orig.${i}", ''), + Util::getValueByKey($_POST, "field_move_to_orig.${i}", '') ); } } @@ -1066,37 +1066,37 @@ class TableStructureController extends TableController } // update field names in relation - if (isset($_REQUEST['field_orig']) && is_array($_REQUEST['field_orig'])) { - foreach ($_REQUEST['field_orig'] as $fieldindex => $fieldcontent) { - if ($_REQUEST['field_name'][$fieldindex] != $fieldcontent) { + if (isset($_POST['field_orig']) && is_array($_POST['field_orig'])) { + foreach ($_POST['field_orig'] as $fieldindex => $fieldcontent) { + if ($_POST['field_name'][$fieldindex] != $fieldcontent) { $this->relation->renameField( $this->db, $this->table, $fieldcontent, - $_REQUEST['field_name'][$fieldindex] + $_POST['field_name'][$fieldindex] ); } } } // update mime types - if (isset($_REQUEST['field_mimetype']) - && is_array($_REQUEST['field_mimetype']) + if (isset($_POST['field_mimetype']) + && is_array($_POST['field_mimetype']) && $GLOBALS['cfg']['BrowseMIME'] ) { - foreach ($_REQUEST['field_mimetype'] as $fieldindex => $mimetype) { - if (isset($_REQUEST['field_name'][$fieldindex]) - && strlen($_REQUEST['field_name'][$fieldindex]) > 0 + foreach ($_POST['field_mimetype'] as $fieldindex => $mimetype) { + if (isset($_POST['field_name'][$fieldindex]) + && strlen($_POST['field_name'][$fieldindex]) > 0 ) { $this->transformations->setMime( $this->db, $this->table, - $_REQUEST['field_name'][$fieldindex], + $_POST['field_name'][$fieldindex], $mimetype, - $_REQUEST['field_transformation'][$fieldindex], - $_REQUEST['field_transformation_options'][$fieldindex], - $_REQUEST['field_input_transformation'][$fieldindex], - $_REQUEST['field_input_transformation_options'][$fieldindex] + $_POST['field_transformation'][$fieldindex], + $_POST['field_transformation_options'][$fieldindex], + $_POST['field_input_transformation'][$fieldindex], + $_POST['field_input_transformation_options'][$fieldindex] ); } } @@ -1163,15 +1163,15 @@ class TableStructureController extends TableController { // these two fields are checkboxes so might not be part of the // request; therefore we define them to avoid notices below - if (! isset($_REQUEST['field_null'][$i])) { - $_REQUEST['field_null'][$i] = 'NO'; + if (! isset($_POST['field_null'][$i])) { + $_POST['field_null'][$i] = 'NO'; } - if (! isset($_REQUEST['field_extra'][$i])) { - $_REQUEST['field_extra'][$i] = ''; + if (! isset($_POST['field_extra'][$i])) { + $_POST['field_extra'][$i] = ''; } // field_name does not follow the convention (corresponds to field_orig) - if ($_REQUEST['field_name'][$i] != $_REQUEST['field_orig'][$i]) { + if ($_POST['field_name'][$i] != $_POST['field_orig'][$i]) { return true; } @@ -1181,11 +1181,11 @@ class TableStructureController extends TableController 'field_length', 'field_null', 'field_type' ]; foreach ($fields as $field) { - if ($_REQUEST[$field][$i] != $_REQUEST[$field . '_orig'][$i]) { + if ($_POST[$field][$i] != $_POST[$field . '_orig'][$i]) { return true; } } - return !empty($_REQUEST['field_move_to'][$i]); + return !empty($_POST['field_move_to'][$i]); } /** diff --git a/libraries/classes/CreateAddField.php b/libraries/classes/CreateAddField.php index 86a7baf96d..fdb8f4a092 100644 --- a/libraries/classes/CreateAddField.php +++ b/libraries/classes/CreateAddField.php @@ -38,12 +38,12 @@ class CreateAddField */ private function getIndexedColumns(): array { - $fieldCount = count($_REQUEST['field_name']); - $fieldPrimary = json_decode($_REQUEST['primary_indexes'], true); - $fieldIndex = json_decode($_REQUEST['indexes'], true); - $fieldUnique = json_decode($_REQUEST['unique_indexes'], true); - $fieldFullText = json_decode($_REQUEST['fulltext_indexes'], true); - $fieldSpatial = json_decode($_REQUEST['spatial_indexes'], true); + $fieldCount = count($_POST['field_name']); + $fieldPrimary = json_decode($_POST['primary_indexes'], true); + $fieldIndex = json_decode($_POST['indexes'], true); + $fieldUnique = json_decode($_POST['unique_indexes'], true); + $fieldFullText = json_decode($_POST['fulltext_indexes'], true); + $fieldSpatial = json_decode($_POST['spatial_indexes'], true); return [ $fieldCount, @@ -74,35 +74,35 @@ class CreateAddField $previousField = -1; for ($i = 0; $i < $fieldCount; ++$i) { // '0' is also empty for php :-( - if (strlen($_REQUEST['field_name'][$i]) === 0) { + if (strlen($_POST['field_name'][$i]) === 0) { continue; } $definition = $this->getStatementPrefix($isCreateTable) . Table::generateFieldSpec( - trim($_REQUEST['field_name'][$i]), - $_REQUEST['field_type'][$i], - $_REQUEST['field_length'][$i], - $_REQUEST['field_attribute'][$i], - isset($_REQUEST['field_collation'][$i]) - ? $_REQUEST['field_collation'][$i] + trim($_POST['field_name'][$i]), + $_POST['field_type'][$i], + $_POST['field_length'][$i], + $_POST['field_attribute'][$i], + isset($_POST['field_collation'][$i]) + ? $_POST['field_collation'][$i] : '', - isset($_REQUEST['field_null'][$i]) - ? $_REQUEST['field_null'][$i] + isset($_POST['field_null'][$i]) + ? $_POST['field_null'][$i] : 'NOT NULL', - $_REQUEST['field_default_type'][$i], - $_REQUEST['field_default_value'][$i], - isset($_REQUEST['field_extra'][$i]) - ? $_REQUEST['field_extra'][$i] + $_POST['field_default_type'][$i], + $_POST['field_default_value'][$i], + isset($_POST['field_extra'][$i]) + ? $_POST['field_extra'][$i] : false, - isset($_REQUEST['field_comments'][$i]) - ? $_REQUEST['field_comments'][$i] + isset($_POST['field_comments'][$i]) + ? $_POST['field_comments'][$i] : '', - isset($_REQUEST['field_virtuality'][$i]) - ? $_REQUEST['field_virtuality'][$i] + isset($_POST['field_virtuality'][$i]) + ? $_POST['field_virtuality'][$i] : '', - isset($_REQUEST['field_expression'][$i]) - ? $_REQUEST['field_expression'][$i] + isset($_POST['field_expression'][$i]) + ? $_POST['field_expression'][$i] : '' ); @@ -136,22 +136,22 @@ class CreateAddField return $sqlSuffix; } - if ((string) $_REQUEST['field_where'] === 'last') { + if ((string) $_POST['field_where'] === 'last') { return $sqlSuffix; } // Only the first field can be added somewhere other than at the end if ($previousField == -1) { - if ((string) $_REQUEST['field_where'] === 'first') { + if ((string) $_POST['field_where'] === 'first') { $sqlSuffix .= ' FIRST'; } else { $sqlSuffix .= ' AFTER ' - . Util::backquote($_REQUEST['after_field']); + . Util::backquote($_POST['after_field']); } } else { $sqlSuffix .= ' AFTER ' . Util::backquote( - $_REQUEST['field_name'][$previousField] + $_POST['field_name'][$previousField] ); } @@ -189,7 +189,7 @@ class CreateAddField $indexFields = []; foreach ($index['columns'] as $key => $column) { $indexFields[$key] = Util::backquote( - $_REQUEST['field_name'][$column['col_index']] + $_POST['field_name'][$column['col_index']] ); if ($column['size']) { $indexFields[$key] .= '(' . $column['size'] . ')'; @@ -353,30 +353,30 @@ class CreateAddField public function getPartitionsDefinition(): string { $sqlQuery = ""; - if (! empty($_REQUEST['partition_by']) - && ! empty($_REQUEST['partition_expr']) - && ! empty($_REQUEST['partition_count']) - && $_REQUEST['partition_count'] > 1 + if (! empty($_POST['partition_by']) + && ! empty($_POST['partition_expr']) + && ! empty($_POST['partition_count']) + && $_POST['partition_count'] > 1 ) { - $sqlQuery .= " PARTITION BY " . $_REQUEST['partition_by'] - . " (" . $_REQUEST['partition_expr'] . ")" - . " PARTITIONS " . $_REQUEST['partition_count']; + $sqlQuery .= " PARTITION BY " . $_POST['partition_by'] + . " (" . $_POST['partition_expr'] . ")" + . " PARTITIONS " . $_POST['partition_count']; } - if (! empty($_REQUEST['subpartition_by']) - && ! empty($_REQUEST['subpartition_expr']) - && ! empty($_REQUEST['subpartition_count']) - && $_REQUEST['subpartition_count'] > 1 + if (! empty($_POST['subpartition_by']) + && ! empty($_POST['subpartition_expr']) + && ! empty($_POST['subpartition_count']) + && $_POST['subpartition_count'] > 1 ) { - $sqlQuery .= " SUBPARTITION BY " . $_REQUEST['subpartition_by'] - . " (" . $_REQUEST['subpartition_expr'] . ")" - . " SUBPARTITIONS " . $_REQUEST['subpartition_count']; + $sqlQuery .= " SUBPARTITION BY " . $_POST['subpartition_by'] + . " (" . $_POST['subpartition_expr'] . ")" + . " SUBPARTITIONS " . $_POST['subpartition_count']; } - if (! empty($_REQUEST['partitions'])) { + if (! empty($_POST['partitions'])) { $i = 0; $partitions = []; - foreach ($_REQUEST['partitions'] as $partition) { + foreach ($_POST['partitions'] as $partition) { $partitions[] = $this->getPartitionDefinition($partition); $i++; } @@ -468,24 +468,24 @@ class CreateAddField . Util::backquote(trim($table)) . ' (' . $sqlStatement . ')'; // Adds table type, character set, comments and partition definition - if (!empty($_REQUEST['tbl_storage_engine']) - && ($_REQUEST['tbl_storage_engine'] != 'Default') + if (!empty($_POST['tbl_storage_engine']) + && ($_POST['tbl_storage_engine'] != 'Default') ) { - $sqlQuery .= ' ENGINE = ' . $_REQUEST['tbl_storage_engine']; + $sqlQuery .= ' ENGINE = ' . $_POST['tbl_storage_engine']; } - if (!empty($_REQUEST['tbl_collation'])) { - $sqlQuery .= Util::getCharsetQueryPart($_REQUEST['tbl_collation']); + if (!empty($_POST['tbl_collation'])) { + $sqlQuery .= Util::getCharsetQueryPart($_POST['tbl_collation']); } - if (! empty($_REQUEST['connection']) - && ! empty($_REQUEST['tbl_storage_engine']) - && $_REQUEST['tbl_storage_engine'] == 'FEDERATED' + if (! empty($_POST['connection']) + && ! empty($_POST['tbl_storage_engine']) + && $_POST['tbl_storage_engine'] == 'FEDERATED' ) { $sqlQuery .= " CONNECTION = '" - . $this->dbi->escapeString($_REQUEST['connection']) . "'"; + . $this->dbi->escapeString($_POST['connection']) . "'"; } - if (!empty($_REQUEST['comment'])) { + if (!empty($_POST['comment'])) { $sqlQuery .= ' COMMENT = \'' - . $this->dbi->escapeString($_REQUEST['comment']) . '\''; + . $this->dbi->escapeString($_POST['comment']) . '\''; } $sqlQuery .= $this->getPartitionsDefinition(); $sqlQuery .= ';'; @@ -503,14 +503,14 @@ class CreateAddField // Limit to 4096 fields (MySQL maximal value) $mysqlLimit = 4096; - if (isset($_REQUEST['submit_num_fields'])) { // adding new fields - $numberOfFields = intval($_REQUEST['orig_num_fields']) + intval($_REQUEST['added_fields']); - } elseif (isset($_REQUEST['orig_num_fields'])) { // retaining existing fields - $numberOfFields = intval($_REQUEST['orig_num_fields']); - } elseif (isset($_REQUEST['num_fields']) - && intval($_REQUEST['num_fields']) > 0 + if (isset($_POST['submit_num_fields'])) { // adding new fields + $numberOfFields = intval($_POST['orig_num_fields']) + intval($_POST['added_fields']); + } elseif (isset($_POST['orig_num_fields'])) { // retaining existing fields + $numberOfFields = intval($_POST['orig_num_fields']); + } elseif (isset($_POST['num_fields']) + && intval($_POST['num_fields']) > 0 ) { // new table with specified number of fields - $numberOfFields = intval($_REQUEST['num_fields']); + $numberOfFields = intval($_POST['num_fields']); } else { // new table with unspecified number of fields $numberOfFields = 4; } @@ -548,7 +548,7 @@ class CreateAddField $sqlQuery = 'ALTER TABLE ' . Util::backquote($table) . ' ' . $sqlStatement . ';'; // If there is a request for SQL previewing. - if (isset($_REQUEST['preview_sql'])) { + if (isset($_POST['preview_sql'])) { Core::previewSQL($sqlQuery); } return [$this->dbi->tryQuery($sqlQuery), $sqlQuery]; diff --git a/libraries/classes/Database/Qbe.php b/libraries/classes/Database/Qbe.php index 1b0b5006d5..d2c8db86e6 100644 --- a/libraries/classes/Database/Qbe.php +++ b/libraries/classes/Database/Qbe.php @@ -271,7 +271,7 @@ class Qbe } $criterias = $this->_currentSearch->getCriterias(); - $_REQUEST = $criterias + $_REQUEST; + $_POST = $criterias + $_POST; return $this; } @@ -296,34 +296,34 @@ class Qbe $criteriaColumnCount = $this->_initializeCriteriasCount(); $this->_criteriaColumnInsert = Core::ifSetOr( - $_REQUEST['criteriaColumnInsert'], + $_POST['criteriaColumnInsert'], null, 'array' ); $this->_criteriaColumnDelete = Core::ifSetOr( - $_REQUEST['criteriaColumnDelete'], + $_POST['criteriaColumnDelete'], null, 'array' ); - $this->_prev_criteria = isset($_REQUEST['prev_criteria']) - ? $_REQUEST['prev_criteria'] + $this->_prev_criteria = isset($_POST['prev_criteria']) + ? $_POST['prev_criteria'] : []; - $this->_criteria = isset($_REQUEST['criteria']) - ? $_REQUEST['criteria'] + $this->_criteria = isset($_POST['criteria']) + ? $_POST['criteria'] : array_fill(0, $criteriaColumnCount, ''); - $this->_criteriaRowInsert = isset($_REQUEST['criteriaRowInsert']) - ? $_REQUEST['criteriaRowInsert'] + $this->_criteriaRowInsert = isset($_POST['criteriaRowInsert']) + ? $_POST['criteriaRowInsert'] : array_fill(0, $criteriaColumnCount, ''); - $this->_criteriaRowDelete = isset($_REQUEST['criteriaRowDelete']) - ? $_REQUEST['criteriaRowDelete'] + $this->_criteriaRowDelete = isset($_POST['criteriaRowDelete']) + ? $_POST['criteriaRowDelete'] : array_fill(0, $criteriaColumnCount, ''); - $this->_criteriaAndOrRow = isset($_REQUEST['criteriaAndOrRow']) - ? $_REQUEST['criteriaAndOrRow'] + $this->_criteriaAndOrRow = isset($_POST['criteriaAndOrRow']) + ? $_POST['criteriaAndOrRow'] : array_fill(0, $criteriaColumnCount, ''); - $this->_criteriaAndOrColumn = isset($_REQUEST['criteriaAndOrColumn']) - ? $_REQUEST['criteriaAndOrColumn'] + $this->_criteriaAndOrColumn = isset($_POST['criteriaAndOrColumn']) + ? $_POST['criteriaAndOrColumn'] : array_fill(0, $criteriaColumnCount, ''); // sets minimum width $this->_form_column_width = 12; @@ -343,8 +343,8 @@ class Qbe private function _setCriteriaTablesAndColumns() { // The tables list sent by a previously submitted form - if (Core::isValid($_REQUEST['TableList'], 'array')) { - foreach ($_REQUEST['TableList'] as $each_table) { + if (Core::isValid($_POST['TableList'], 'array')) { + foreach ($_POST['TableList'] as $each_table) { $this->_criteriaTables[$each_table] = ' selected="selected"'; } } // end if @@ -363,7 +363,7 @@ class Qbe $columns = $this->dbi->getColumns($this->_db, $table); if (empty($this->_criteriaTables[$table]) - && ! empty($_REQUEST['TableList']) + && ! empty($_POST['TableList']) ) { $this->_criteriaTables[$table] = ''; } else { @@ -490,10 +490,10 @@ class Qbe continue; } $selected = ''; - if (isset($_REQUEST['criteriaColumn'][$column_index])) { - $selected = $_REQUEST['criteriaColumn'][$column_index]; + if (isset($_POST['criteriaColumn'][$column_index])) { + $selected = $_POST['criteriaColumn'][$column_index]; $this->_formColumns[$new_column_count] - = $_REQUEST['criteriaColumn'][$column_index]; + = $_POST['criteriaColumn'][$column_index]; } $html_output .= $this->_showColumnSelectCell( $new_column_count, @@ -539,10 +539,10 @@ class Qbe } $tmp_alias = ''; - if (! empty($_REQUEST['criteriaAlias'][$colInd])) { + if (! empty($_POST['criteriaAlias'][$colInd])) { $tmp_alias = $this->_formAliases[$new_column_count] - = $_REQUEST['criteriaAlias'][$colInd]; + = $_POST['criteriaAlias'][$colInd]; }// end if $html_output .= ''; @@ -586,21 +586,21 @@ class Qbe } // If they have chosen all fields using the * selector, // then sorting is not available, Fix for Bug #570698 - if (isset($_REQUEST['criteriaSort'][$colInd]) - && isset($_REQUEST['criteriaColumn'][$colInd]) - && mb_substr($_REQUEST['criteriaColumn'][$colInd], -2) == '.*' + if (isset($_POST['criteriaSort'][$colInd]) + && isset($_POST['criteriaColumn'][$colInd]) + && mb_substr($_POST['criteriaColumn'][$colInd], -2) == '.*' ) { - $_REQUEST['criteriaSort'][$colInd] = ''; + $_POST['criteriaSort'][$colInd] = ''; } //end if $selected = ''; - if (isset($_REQUEST['criteriaSort'][$colInd])) { + if (isset($_POST['criteriaSort'][$colInd])) { $this->_formSorts[$new_column_count] - = $_REQUEST['criteriaSort'][$colInd]; + = $_POST['criteriaSort'][$colInd]; - if ($_REQUEST['criteriaSort'][$colInd] == 'ASC') { + if ($_POST['criteriaSort'][$colInd] == 'ASC') { $selected = 'ASC'; - } elseif ($_REQUEST['criteriaSort'][$colInd] == 'DESC') { + } elseif ($_POST['criteriaSort'][$colInd] == 'DESC') { $selected = 'DESC'; } } else { @@ -650,10 +650,10 @@ class Qbe } $sortOrder = null; - if (! empty($_REQUEST['criteriaSortOrder'][$colInd])) { + if (! empty($_POST['criteriaSortOrder'][$colInd])) { $sortOrder = $this->_formSortOrders[$new_column_count] - = $_REQUEST['criteriaSortOrder'][$colInd]; + = $_POST['criteriaSortOrder'][$colInd]; } $html_output .= $this->_getSortOrderSelectCell( @@ -695,10 +695,10 @@ class Qbe ) { continue; } - if (isset($_REQUEST['criteriaShow'][$column_index])) { + if (isset($_POST['criteriaShow'][$column_index])) { $checked_options = ' checked="checked"'; $this->_formShows[$new_column_count] - = $_REQUEST['criteriaShow'][$column_index]; + = $_POST['criteriaShow'][$column_index]; } else { $checked_options = ''; } @@ -1014,8 +1014,8 @@ class Qbe continue; } $or = 'Or' . $new_row_index; - if (! empty($_REQUEST[$or]) && isset($_REQUEST[$or][$column_index])) { - $tmp_or = $_REQUEST[$or][$column_index]; + if (! empty($_POST[$or]) && isset($_POST[$or][$column_index])) { + $tmp_or = $_POST[$or][$column_index]; } else { $tmp_or = ''; } @@ -1176,7 +1176,7 @@ class Qbe $column_index < $this->_criteria_column_count; $column_index++) { if (! empty($this->_formColumns[$column_index]) - && ! empty($_REQUEST['Or' . $row_index][$column_index]) + && ! empty($_POST['Or' . $row_index][$column_index]) && $column_index ) { $qry_orwhere .= ' ' @@ -1186,11 +1186,11 @@ class Qbe . ' '; } if (! empty($this->_formColumns[$column_index]) - && ! empty($_REQUEST['Or' . $row_index][$column_index]) + && ! empty($_POST['Or' . $row_index][$column_index]) ) { $qry_orwhere .= '(' . $this->_formColumns[$column_index] . ' ' - . $_REQUEST['Or' . $row_index][$column_index] + . $_POST['Or' . $row_index][$column_index] . ')'; $last_orwhere = $column_index; $criteria_cnt++; @@ -1913,12 +1913,12 @@ class Qbe { // sets column count $criteriaColumnCount = Core::ifSetOr( - $_REQUEST['criteriaColumnCount'], + $_POST['criteriaColumnCount'], 3, 'numeric' ); $criteriaColumnAdd = Core::ifSetOr( - $_REQUEST['criteriaColumnAdd'], + $_POST['criteriaColumnAdd'], 0, 'numeric' ); @@ -1928,8 +1928,8 @@ class Qbe ); // sets row count - $rows = Core::ifSetOr($_REQUEST['rows'], 0, 'numeric'); - $criteriaRowAdd = Core::ifSetOr($_REQUEST['criteriaRowAdd'], 0, 'numeric'); + $rows = Core::ifSetOr($_POST['rows'], 0, 'numeric'); + $criteriaRowAdd = Core::ifSetOr($_POST['criteriaRowAdd'], 0, 'numeric'); $this->_criteria_row_count = min( 100, max($rows + $criteriaRowAdd, 0) diff --git a/libraries/classes/Database/Search.php b/libraries/classes/Database/Search.php index e6dfd32a44..69396af444 100644 --- a/libraries/classes/Database/Search.php +++ b/libraries/classes/Database/Search.php @@ -125,49 +125,49 @@ class Search { $this->tablesNamesOnly = $this->dbi->getTables($this->db); - if (empty($_REQUEST['criteriaSearchType']) - || ! is_string($_REQUEST['criteriaSearchType']) + if (empty($_POST['criteriaSearchType']) + || ! is_string($_POST['criteriaSearchType']) || ! array_key_exists( - $_REQUEST['criteriaSearchType'], + $_POST['criteriaSearchType'], $this->searchTypes ) ) { $this->criteriaSearchType = 1; - unset($_REQUEST['submit_search']); + unset($_POST['submit_search']); } else { - $this->criteriaSearchType = (int) $_REQUEST['criteriaSearchType']; + $this->criteriaSearchType = (int) $_POST['criteriaSearchType']; $this->searchTypeDescription - = $this->searchTypes[$_REQUEST['criteriaSearchType']]; + = $this->searchTypes[$_POST['criteriaSearchType']]; } - if (empty($_REQUEST['criteriaSearchString']) - || ! is_string($_REQUEST['criteriaSearchString']) + if (empty($_POST['criteriaSearchString']) + || ! is_string($_POST['criteriaSearchString']) ) { $this->criteriaSearchString = ''; - unset($_REQUEST['submit_search']); + unset($_POST['submit_search']); } else { - $this->criteriaSearchString = $_REQUEST['criteriaSearchString']; + $this->criteriaSearchString = $_POST['criteriaSearchString']; } $this->criteriaTables = []; - if (empty($_REQUEST['criteriaTables']) - || ! is_array($_REQUEST['criteriaTables']) + if (empty($_POST['criteriaTables']) + || ! is_array($_POST['criteriaTables']) ) { - unset($_REQUEST['submit_search']); + unset($_POST['submit_search']); } else { $this->criteriaTables = array_intersect( - $_REQUEST['criteriaTables'], + $_POST['criteriaTables'], $this->tablesNamesOnly ); } - if (empty($_REQUEST['criteriaColumnName']) - || ! is_string($_REQUEST['criteriaColumnName']) + if (empty($_POST['criteriaColumnName']) + || ! is_string($_POST['criteriaColumnName']) ) { unset($this->criteriaColumnName); } else { $this->criteriaColumnName = $this->dbi->escapeString( - $_REQUEST['criteriaColumnName'] + $_POST['criteriaColumnName'] ); } } diff --git a/libraries/classes/Display/Export.php b/libraries/classes/Display/Export.php index 88080c71d5..421b6a3f50 100644 --- a/libraries/classes/Display/Export.php +++ b/libraries/classes/Display/Export.php @@ -69,11 +69,11 @@ class Export */ public function getHtmlForSelectOptions($tmpSelect = '') { - // Check if the selected databases are defined in $_GET + // Check if the selected databases are defined in $_POST // (from clicking Back button on export.php) - if (isset($_GET['db_select'])) { - $_GET['db_select'] = urldecode($_GET['db_select']); - $_GET['db_select'] = explode(",", $_GET['db_select']); + if (isset($_POST['db_select'])) { + $_POST['db_select'] = urldecode($_POST['db_select']); + $_POST['db_select'] = explode(",", $_POST['db_select']); } $databases = []; @@ -82,8 +82,8 @@ class Export continue; } $isSelected = false; - if (isset($_GET['db_select'])) { - if (in_array($currentDb, $_GET['db_select'])) { + if (isset($_POST['db_select'])) { + if (in_array($currentDb, $_POST['db_select'])) { $isSelected = true; } } elseif (!empty($tmpSelect)) { @@ -128,14 +128,14 @@ class Export global $cfg; // If the export method was not set, the default is quick - if (isset($_GET['export_method'])) { - $cfg['Export']['method'] = $_GET['export_method']; + if (isset($_POST['export_method'])) { + $cfg['Export']['method'] = $_POST['export_method']; } elseif (! isset($cfg['Export']['method'])) { $cfg['Export']['method'] = 'quick'; } - if (empty($sqlQuery) && isset($_GET['sql_query'])) { - $sqlQuery = $_GET['sql_query']; + if (empty($sqlQuery) && isset($_POST['sql_query'])) { + $sqlQuery = $_POST['sql_query']; } return $this->template->render('display/export/hidden_inputs', [ @@ -145,7 +145,7 @@ class Export 'export_method' => $cfg['Export']['method'], 'single_table' => $singleTable, 'sql_query' => $sqlQuery, - 'template_id' => isset($_GET['template_id']) ? $_GET['template_id'] : '', + 'template_id' => isset($_POST['template_id']) ? $_POST['template_id'] : '', ]); } @@ -183,7 +183,7 @@ class Export return $this->template->render('display/export/template_options', [ 'templates' => $templates, - 'selected_template' => !empty($_GET['template_id']) ? $_GET['template_id'] : null, + 'selected_template' => !empty($_POST['template_id']) ? $_POST['template_id'] : null, ]); } @@ -195,8 +195,8 @@ class Export private function getHtmlForOptionsMethod() { global $cfg; - if (isset($_GET['quick_or_custom'])) { - $exportMethod = $_GET['quick_or_custom']; + if (isset($_POST['quick_or_custom'])) { + $exportMethod = $_POST['quick_or_custom']; } else { $exportMethod = $cfg['Export']['method']; } @@ -271,9 +271,9 @@ class Export $numberOfRows = $tableObject->countRecords(); return $this->template->render('display/export/options_rows', [ - 'allrows' => isset($_GET['allrows']) ? $_GET['allrows'] : null, - 'limit_to' => isset($_GET['limit_to']) ? $_GET['limit_to'] : null, - 'limit_from' => isset($_GET['limit_from']) ? $_GET['limit_from'] : null, + 'allrows' => isset($_POST['allrows']) ? $_POST['allrows'] : null, + 'limit_to' => isset($_POST['limit_to']) ? $_POST['limit_to'] : null, + 'limit_from' => isset($_POST['limit_from']) ? $_POST['limit_from'] : null, 'unlim_num_rows' => $unlimNumRows, 'number_of_rows' => $numberOfRows, ]); @@ -364,8 +364,8 @@ class Export ); $msg->addParamHtml(''); - if (isset($_GET['filename_template'])) { - $filenameTemplate = $_GET['filename_template']; + if (isset($_POST['filename_template'])) { + $filenameTemplate = $_POST['filename_template']; } else { if ($exportType == 'database') { $filenameTemplate = $GLOBALS['PMA_Config']->getUserValue( @@ -415,8 +415,8 @@ class Export private function getHtmlForOptionsOutputCompression() { global $cfg; - if (isset($_GET['compression'])) { - $selectedCompression = $_GET['compression']; + if (isset($_POST['compression'])) { + $selectedCompression = $_POST['compression']; } elseif (isset($cfg['Export']['compression'])) { $selectedCompression = $cfg['Export']['compression']; } else { @@ -449,7 +449,7 @@ class Export private function getHtmlForOptionsOutputRadio() { return $this->template->render('display/export/options_output_radio', [ - 'has_repopulate' => isset($_GET['repopulate']), + 'has_repopulate' => isset($_POST['repopulate']), 'export_asfile' => $GLOBALS['cfg']['Export']['asfile'], ]); } @@ -512,8 +512,8 @@ class Export 'export_type' => $exportType, 'is_checked_lock_tables' => $isCheckedLockTables, 'is_checked_asfile' => $isCheckedAsfile, - 'repopulate' => isset($_GET['repopulate']), - 'lock_tables' => isset($_GET['lock_tables']), + 'repopulate' => isset($_POST['repopulate']), + 'lock_tables' => isset($_POST['lock_tables']), 'save_dir' => isset($cfg['SaveDir']) ? $cfg['SaveDir'] : null, 'is_encoding_supported' => Encoding::isSupported(), 'options_output_save_dir' => $optionsOutputSaveDir, @@ -665,8 +665,8 @@ class Export ) { $cfgRelation = $this->relation->getRelationsParam(); - if (isset($_REQUEST['single_table'])) { - $GLOBALS['single_table'] = $_REQUEST['single_table']; + if (isset($_POST['single_table'])) { + $GLOBALS['single_table'] = $_POST['single_table']; } /* Scan for plugins */ @@ -738,8 +738,8 @@ class Export */ public function handleTemplateActions(array $cfgRelation) { - if (isset($_REQUEST['templateId'])) { - $id = $GLOBALS['dbi']->escapeString($_REQUEST['templateId']); + if (isset($_POST['templateId'])) { + $id = $GLOBALS['dbi']->escapeString($_POST['templateId']); } else { $id = ''; } @@ -748,16 +748,16 @@ class Export . Util::backquote($cfgRelation['export_templates']); $user = $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']); - switch ($_REQUEST['templateAction']) { + switch ($_POST['templateAction']) { case 'create': $query = "INSERT INTO " . $templateTable . "(" . " `username`, `export_type`," . " `template_name`, `template_data`" . ") VALUES (" . "'" . $user . "', " - . "'" . $GLOBALS['dbi']->escapeString($_REQUEST['exportType']) - . "', '" . $GLOBALS['dbi']->escapeString($_REQUEST['templateName']) - . "', '" . $GLOBALS['dbi']->escapeString($_REQUEST['templateData']) + . "'" . $GLOBALS['dbi']->escapeString($_POST['exportType']) + . "', '" . $GLOBALS['dbi']->escapeString($_POST['templateName']) + . "', '" . $GLOBALS['dbi']->escapeString($_POST['templateData']) . "');"; break; case 'load': @@ -766,7 +766,7 @@ class Export break; case 'update': $query = "UPDATE " . $templateTable . " SET `template_data` = " - . "'" . $GLOBALS['dbi']->escapeString($_REQUEST['templateData']) . "'" + . "'" . $GLOBALS['dbi']->escapeString($_POST['templateData']) . "'" . " WHERE `id` = " . $id . " AND `username` = '" . $user . "'"; break; case 'delete': @@ -789,12 +789,12 @@ class Export } $response->setRequestStatus(true); - if ('create' == $_REQUEST['templateAction']) { + if ('create' == $_POST['templateAction']) { $response->addJSON( 'data', - $this->getOptionsForTemplates($_REQUEST['exportType']) + $this->getOptionsForTemplates($_POST['exportType']) ); - } elseif ('load' == $_REQUEST['templateAction']) { + } elseif ('load' == $_POST['templateAction']) { $data = null; while ($row = $GLOBALS['dbi']->fetchAssoc( $result, diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index 98a60c8ddf..5845b3f3a9 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -3032,29 +3032,30 @@ class Results $include_file = 'libraries/classes/Plugins/Transformations/' . $file; if (@file_exists($include_file)) { - include_once $include_file; $class_name = $this->transformations->getClassName($include_file); - // todo add $plugin_manager - $plugin_manager = null; - $transformation_plugin = new $class_name( - $plugin_manager - ); + if (class_exists($class_name)) { + // todo add $plugin_manager + $plugin_manager = null; + $transformation_plugin = new $class_name( + $plugin_manager + ); - $transform_options = $this->transformations->getOptions( - isset( - $mime_map[$orgFullColName] + $transform_options = $this->transformations->getOptions( + isset( + $mime_map[$orgFullColName] + ['transformation_options'] + ) + ? $mime_map[$orgFullColName] ['transformation_options'] - ) - ? $mime_map[$orgFullColName] - ['transformation_options'] - : '' - ); + : '' + ); - $meta->mimetype = str_replace( - '_', - '/', - $mime_map[$orgFullColName]['mimetype'] - ); + $meta->mimetype = str_replace( + '_', + '/', + $mime_map[$orgFullColName]['mimetype'] + ); + } } // end if file_exists } // end if transformation is set } // end if mime/transformation works. @@ -4168,13 +4169,13 @@ class Results } // as this is a form value, the type is always string so we cannot - // use Core::isValid($_REQUEST['session_max_rows'], 'integer') - if (Core::isValid($_REQUEST['session_max_rows'], 'numeric')) { - $query['max_rows'] = (int)$_REQUEST['session_max_rows']; - unset($_REQUEST['session_max_rows']); - } elseif ($_REQUEST['session_max_rows'] == self::ALL_ROWS) { + // use Core::isValid($_POST['session_max_rows'], 'integer') + if (Core::isValid($_POST['session_max_rows'], 'numeric')) { + $query['max_rows'] = (int)$_POST['session_max_rows']; + unset($_POST['session_max_rows']); + } elseif ($_POST['session_max_rows'] == self::ALL_ROWS) { $query['max_rows'] = self::ALL_ROWS; - unset($_REQUEST['session_max_rows']); + unset($_POST['session_max_rows']); } elseif (empty($query['max_rows'])) { $query['max_rows'] = intval($GLOBALS['cfg']['MaxRows']); } diff --git a/libraries/classes/ErrorReport.php b/libraries/classes/ErrorReport.php index 3dfd72270d..d8873fc1b2 100644 --- a/libraries/classes/ErrorReport.php +++ b/libraries/classes/ErrorReport.php @@ -103,10 +103,10 @@ class ErrorReport ]; if ($exceptionType == 'js') { - if (empty($_REQUEST['exception'])) { + if (empty($_POST['exception'])) { return []; } - $exception = $_REQUEST['exception']; + $exception = $_POST['exception']; $exception["stack"] = $this->translateStacktrace($exception["stack"]); list($uri, $scriptName) = $this->sanitizeUrl((string)$exception["url"]); $exception["uri"] = $uri; @@ -115,10 +115,10 @@ class ErrorReport $report["exception_type"] = 'js'; $report["exception"] = $exception; $report["script_name"] = $scriptName; - $report["microhistory"] = $_REQUEST['microhistory']; + $report["microhistory"] = $_POST['microhistory']; - if (! empty($_REQUEST['description'])) { - $report['steps'] = $_REQUEST['description']; + if (! empty($_POST['description'])) { + $report['steps'] = $_POST['description']; } } elseif ($exceptionType == 'php') { $errors = []; diff --git a/libraries/classes/Export.php b/libraries/classes/Export.php index 62c93361d4..95091107ab 100644 --- a/libraries/classes/Export.php +++ b/libraries/classes/Export.php @@ -342,9 +342,9 @@ class Export . preg_replace('@[/\\\\]@', '_', $filename); if (@file_exists($save_filename) - && ((! $quick_export && empty($_REQUEST['onserver_overwrite'])) + && ((! $quick_export && empty($_POST['onserver_overwrite'])) || ($quick_export - && $_REQUEST['quick_export_onserver_overwrite'] != 'saveitover')) + && $_POST['quick_export_onserver_overwrite'] != 'saveitover')) ) { $message = Message::error( __( @@ -474,45 +474,44 @@ class Export $html = '
'; /** - * Displays a back button with all the $_REQUEST data in the URL + * Displays a back button with all the $_POST data in the URL * (store in a variable to also display after the textarea) */ $back_button = '

[ $value) { + foreach ($_POST as $name => $value) { if (!is_array($value)) { $back_button .= '&' . urlencode((string) $name) . '=' . urlencode((string) $value); } diff --git a/libraries/classes/Footer.php b/libraries/classes/Footer.php index aba11c80a4..899c2a4a1b 100644 --- a/libraries/classes/Footer.php +++ b/libraries/classes/Footer.php @@ -154,28 +154,28 @@ class Footer 'target' => $target ]; // needed for server privileges tabs - if (isset($_REQUEST['viewing_mode']) - && in_array($_REQUEST['viewing_mode'], ['server', 'db', 'table']) + if (isset($_GET['viewing_mode']) + && in_array($_GET['viewing_mode'], ['server', 'db', 'table']) ) { - $params['viewing_mode'] = $_REQUEST['viewing_mode']; + $params['viewing_mode'] = $_GET['viewing_mode']; } /* * @todo coming from server_privileges.php, here $db is not set, * add the following condition below when that is fixed - * && $_REQUEST['checkprivsdb'] == $db + * && $_GET['checkprivsdb'] == $db */ - if (isset($_REQUEST['checkprivsdb']) + if (isset($_GET['checkprivsdb']) ) { - $params['checkprivsdb'] = $_REQUEST['checkprivsdb']; + $params['checkprivsdb'] = $_GET['checkprivsdb']; } /* * @todo coming from server_privileges.php, here $table is not set, * add the following condition below when that is fixed * && $_REQUEST['checkprivstable'] == $table */ - if (isset($_REQUEST['checkprivstable']) + if (isset($_GET['checkprivstable']) ) { - $params['checkprivstable'] = $_REQUEST['checkprivstable']; + $params['checkprivstable'] = $_GET['checkprivstable']; } if (isset($_REQUEST['single_table']) && in_array($_REQUEST['single_table'], [true, false]) diff --git a/libraries/classes/Import.php b/libraries/classes/Import.php index d26ef100c9..336a8d6c43 100644 --- a/libraries/classes/Import.php +++ b/libraries/classes/Import.php @@ -297,7 +297,7 @@ class Import $import_run_buffer = $this->runQueryPost($import_run_buffer, $sql, $full); // In case of ROLLBACK, notify the user. - if (isset($_REQUEST['rollback_query'])) { + if (isset($_POST['rollback_query'])) { $msg .= __('[ROLLBACK occurred.]'); } } @@ -1365,7 +1365,7 @@ class Import $response = Response::getInstance(); $error = false; $error_msg = __('Only single-table UPDATE and DELETE queries can be simulated.'); - $sql_delimiter = $_REQUEST['sql_delimiter']; + $sql_delimiter = $_POST['sql_delimiter']; $sql_data = []; $queries = explode($sql_delimiter, $GLOBALS['sql_query']); foreach ($queries as $sql_query) { @@ -1587,7 +1587,7 @@ class Import */ public function handleRollbackRequest(string $sql_query): void { - $sql_delimiter = $_REQUEST['sql_delimiter']; + $sql_delimiter = $_POST['sql_delimiter']; $queries = explode($sql_delimiter, $sql_query); $error = false; $error_msg = __( @@ -1612,7 +1612,7 @@ class Import } if ($error) { - unset($_REQUEST['rollback_query']); + unset($_POST['rollback_query']); $response = Response::getInstance(); $message = Message::rawError($error); $response->addJSON('message', $message); diff --git a/libraries/classes/Index.php b/libraries/classes/Index.php index 2d5765d51b..6df7ad7f3e 100644 --- a/libraries/classes/Index.php +++ b/libraries/classes/Index.php @@ -740,7 +740,7 @@ class Index $r .= '" ' . $row_span . '>' . ' ' . Util::getIcon('b_edit', __('Edit')) . '' . '' . "\n"; $this_params = $GLOBALS['url_params']; diff --git a/libraries/classes/InsertEdit.php b/libraries/classes/InsertEdit.php index 53478c73fa..340d011c37 100644 --- a/libraries/classes/InsertEdit.php +++ b/libraries/classes/InsertEdit.php @@ -89,8 +89,8 @@ class InsertEdit $_form_params['where_clause[' . $key_id . ']'] = trim($where_clause); } } - if (isset($_REQUEST['clause_is_unique'])) { - $_form_params['clause_is_unique'] = $_REQUEST['clause_is_unique']; + if (isset($_POST['clause_is_unique'])) { + $_form_params['clause_is_unique'] = $_POST['clause_is_unique']; } return $_form_params; } @@ -290,13 +290,13 @@ class InsertEdit $this_url_params = array_merge($url_params, $params); if (! $is_show) { - return ' : ' + return ' : ' . $this->showTypeOrFunctionLabel($which) . ''; } - return '' . $this->showTypeOrFunctionLabel($which) . ''; @@ -860,7 +860,7 @@ class InsertEdit . 'id="field_' . $idindex . '_3" ' . 'value="' . htmlspecialchars($data) . '" />'; - $html_output .= '' . str_replace("'", "\'", $titles['Browse']) . ''; return $html_output; @@ -1137,7 +1138,7 @@ class InsertEdit $html_output .= '

' . '
'; - if (isset($_REQUEST['db_collation'])) { + if (!is_null($db_collation)) { $html_output .= '' . "\n"; } $html_output .= '' @@ -185,11 +186,12 @@ class Operations /** * Get HTML snippet for copy database * - * @param string $db database name + * @param string $db database name + * @param string $db_collation dataset collation * * @return string */ - public function getHtmlForCopyDatabase($db) + public function getHtmlForCopyDatabase($db, $db_collation) { $drop_clause = 'DROP TABLE / DROP VIEW'; $choices = [ @@ -206,9 +208,9 @@ class Operations . 'method="post" action="db_operations.php" ' . 'onsubmit="return emptyCheckTheField(this, \'newname\')">'; - if (isset($_REQUEST['db_collation'])) { + if (!is_null($db_collation)) { $html_output .= '' . "\n"; + . 'value="' . $db_collation . '" />' . "\n"; } $html_output .= '' . "\n" . Url::getHiddenInputs($db); @@ -285,19 +287,19 @@ class Operations /** * Get HTML snippet for change database charset * - * @param string $db database name - * @param string $table table name + * @param string $db database name + * @param string $db_collation dataset collation * * @return string */ - public function getHtmlForChangeDatabaseCharset($db, $table) + public function getHtmlForChangeDatabaseCharset($db, $db_collation) { $html_output = '
' . ''; @@ -312,7 +314,7 @@ class Operations $GLOBALS['cfg']['Server']['DisableIS'], 'db_collation', 'select_db_collation', - isset($_REQUEST['db_collation']) ? $_REQUEST['db_collation'] : '', + !is_null($db_collation) ? $db_collation : '', false ) . '
' @@ -362,7 +364,7 @@ class Operations if ($tmp_query !== null) { // collect for later display $GLOBALS['sql_query'] .= "\n" . $tmp_query; - $this->dbi->selectDb($_REQUEST['newname']); + $this->dbi->selectDb($_POST['newname']); $this->dbi->query($tmp_query); } } @@ -380,7 +382,7 @@ class Operations if ($tmp_query !== null) { // collect for later display $GLOBALS['sql_query'] .= "\n" . $tmp_query; - $this->dbi->selectDb($_REQUEST['newname']); + $this->dbi->selectDb($_POST['newname']); $this->dbi->query($tmp_query); } } @@ -395,10 +397,10 @@ class Operations public function createDbBeforeCopy() { $local_query = 'CREATE DATABASE IF NOT EXISTS ' - . Util::backquote($_REQUEST['newname']); - if (isset($_REQUEST['db_collation'])) { + . Util::backquote($_POST['newname']); + if (isset($_POST['db_collation'])) { $local_query .= ' DEFAULT' - . Util::getCharsetQueryPart($_REQUEST['db_collation']); + . Util::getCharsetQueryPart($_POST['db_collation']); } $local_query .= ';'; $GLOBALS['sql_query'] .= $local_query; @@ -441,12 +443,12 @@ class Operations // the real views are created after the tables if ($this->dbi->getTable($db, (string)$each_table)->isView()) { // If view exists, and 'add drop view' is selected: Drop it! - if ($_REQUEST['what'] != 'nocopy' - && isset($_REQUEST['drop_if_exists']) - && $_REQUEST['drop_if_exists'] == 'true' + if ($_POST['what'] != 'nocopy' + && isset($_POST['drop_if_exists']) + && $_POST['drop_if_exists'] == 'true' ) { $drop_query = 'DROP VIEW IF EXISTS ' - . Util::backquote($_REQUEST['newname']) . '.' + . Util::backquote($_POST['newname']) . '.' . Util::backquote($each_table); $this->dbi->query($drop_query); @@ -460,7 +462,7 @@ class Operations $each_table, "\n" ); - $this->dbi->selectDb($_REQUEST['newname']); + $this->dbi->selectDb($_POST['newname']); $this->dbi->query($sql_view_standin); $GLOBALS['sql_query'] .= "\n" . $sql_view_standin; } @@ -487,7 +489,7 @@ class Operations } // value of $what for this table only - $this_what = $_REQUEST['what']; + $this_what = $_POST['what']; // do not copy the data from a Merge table // note: on the calling FORM, 'data' means 'structure and data' @@ -509,7 +511,7 @@ class Operations if (! Table::moveCopy( $db, $each_table, - $_REQUEST['newname'], + $_POST['newname'], $each_table, (isset($this_what) ? $this_what : 'data'), $move, @@ -520,7 +522,7 @@ class Operations } // apply the triggers to the destination db+table if ($triggers) { - $this->dbi->selectDb($_REQUEST['newname']); + $this->dbi->selectDb($_POST['newname']); foreach ($triggers as $trigger) { $this->dbi->query($trigger['create']); $GLOBALS['sql_query'] .= "\n" . $trigger['create'] . ';'; @@ -528,7 +530,7 @@ class Operations } // this does not apply to a rename operation - if (isset($_REQUEST['add_constraints']) + if (isset($_POST['add_constraints']) && ! empty($GLOBALS['sql_constraints_query']) ) { $sqlContraints[] = $GLOBALS['sql_constraints_query']; @@ -562,7 +564,7 @@ class Operations $tmp_query = $this->dbi->getDefinition($db, 'EVENT', $event_name); // collect for later display $GLOBALS['sql_query'] .= "\n" . $tmp_query; - $this->dbi->selectDb($_REQUEST['newname']); + $this->dbi->selectDb($_POST['newname']); $this->dbi->query($tmp_query); } } @@ -581,17 +583,17 @@ class Operations { // temporarily force to add DROP IF EXIST to CREATE VIEW query, // to remove stand-in VIEW that was created earlier - // ( $_REQUEST['drop_if_exists'] is used in moveCopy() ) - if (isset($_REQUEST['drop_if_exists'])) { - $temp_drop_if_exists = $_REQUEST['drop_if_exists']; + // ( $_POST['drop_if_exists'] is used in moveCopy() ) + if (isset($_POST['drop_if_exists'])) { + $temp_drop_if_exists = $_POST['drop_if_exists']; } - $_REQUEST['drop_if_exists'] = 'true'; + $_POST['drop_if_exists'] = 'true'; foreach ($views as $view) { $copying_succeeded = Table::moveCopy( $db, $view, - $_REQUEST['newname'], + $_POST['newname'], $view, 'structure', $move, @@ -602,11 +604,11 @@ class Operations break; } } - unset($_REQUEST['drop_if_exists']); + unset($_POST['drop_if_exists']); if (isset($temp_drop_if_exists)) { // restore previous value - $_REQUEST['drop_if_exists'] = $temp_drop_if_exists; + $_POST['drop_if_exists'] = $temp_drop_if_exists; } } @@ -774,7 +776,7 @@ class Operations */ public function createAllAccumulatedConstraints(array $sqlConstratints) { - $this->dbi->selectDb($_REQUEST['newname']); + $this->dbi->selectDb($_POST['newname']); foreach ($sqlConstratints as $one_query) { $this->dbi->query($one_query); // and prepare to display them @@ -792,10 +794,10 @@ class Operations */ public function duplicateBookmarks($_error, $db) { - if (! $_error && $db != $_REQUEST['newname']) { + if (! $_error && $db != $_POST['newname']) { $get_fields = ['user', 'label', 'query']; $where_fields = ['dbase' => $db]; - $new_fields = ['dbase' => $_REQUEST['newname']]; + $new_fields = ['dbase' => $_POST['newname']]; Table::duplicateInfo( 'bookmarkwork', 'bookmark', @@ -1793,9 +1795,9 @@ class Operations $sql_query = 'ALTER TABLE ' . Util::backquote($GLOBALS['table']) . ' ORDER BY ' - . Util::backquote(urldecode($_REQUEST['order_field'])); - if (isset($_REQUEST['order_order']) - && $_REQUEST['order_order'] === 'desc' + . Util::backquote(urldecode($_POST['order_field'])); + if (isset($_POST['order_order']) + && $_POST['order_order'] === 'desc' ) { $sql_query .= ' DESC'; } else { @@ -1837,11 +1839,11 @@ class Operations $table_alters = []; - if (isset($_REQUEST['comment']) - && urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment'] + if (isset($_POST['comment']) + && urldecode($_POST['prev_comment']) !== $_POST['comment'] ) { $table_alters[] = 'COMMENT = \'' - . $this->dbi->escapeString($_REQUEST['comment']) . '\''; + . $this->dbi->escapeString($_POST['comment']) . '\''; } if (! empty($newTblStorageEngine) @@ -1849,62 +1851,62 @@ class Operations ) { $table_alters[] = 'ENGINE = ' . $newTblStorageEngine; } - if (! empty($_REQUEST['tbl_collation']) - && $_REQUEST['tbl_collation'] !== $tbl_collation + if (! empty($_POST['tbl_collation']) + && $_POST['tbl_collation'] !== $tbl_collation ) { $table_alters[] = 'DEFAULT ' - . Util::getCharsetQueryPart($_REQUEST['tbl_collation']); + . Util::getCharsetQueryPart($_POST['tbl_collation']); } if ($pma_table->isEngine(['MYISAM', 'ARIA', 'ISAM']) - && isset($_REQUEST['new_pack_keys']) - && $_REQUEST['new_pack_keys'] != (string)$pack_keys + && isset($_POST['new_pack_keys']) + && $_POST['new_pack_keys'] != (string)$pack_keys ) { - $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys']; + $table_alters[] = 'pack_keys = ' . $_POST['new_pack_keys']; } - $_REQUEST['new_checksum'] = empty($_REQUEST['new_checksum']) ? '0' : '1'; + $_POST['new_checksum'] = empty($_POST['new_checksum']) ? '0' : '1'; if ($pma_table->isEngine(['MYISAM', 'ARIA']) - && $_REQUEST['new_checksum'] !== $checksum + && $_POST['new_checksum'] !== $checksum ) { - $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum']; + $table_alters[] = 'checksum = ' . $_POST['new_checksum']; } - $_REQUEST['new_transactional'] - = empty($_REQUEST['new_transactional']) ? '0' : '1'; + $_POST['new_transactional'] + = empty($_POST['new_transactional']) ? '0' : '1'; if ($pma_table->isEngine('ARIA') - && $_REQUEST['new_transactional'] !== $transactional + && $_POST['new_transactional'] !== $transactional ) { - $table_alters[] = 'TRANSACTIONAL = ' . $_REQUEST['new_transactional']; + $table_alters[] = 'TRANSACTIONAL = ' . $_POST['new_transactional']; } - $_REQUEST['new_page_checksum'] - = empty($_REQUEST['new_page_checksum']) ? '0' : '1'; + $_POST['new_page_checksum'] + = empty($_POST['new_page_checksum']) ? '0' : '1'; if ($pma_table->isEngine('ARIA') - && $_REQUEST['new_page_checksum'] !== $page_checksum + && $_POST['new_page_checksum'] !== $page_checksum ) { - $table_alters[] = 'PAGE_CHECKSUM = ' . $_REQUEST['new_page_checksum']; + $table_alters[] = 'PAGE_CHECKSUM = ' . $_POST['new_page_checksum']; } - $_REQUEST['new_delay_key_write'] - = empty($_REQUEST['new_delay_key_write']) ? '0' : '1'; + $_POST['new_delay_key_write'] + = empty($_POST['new_delay_key_write']) ? '0' : '1'; if ($pma_table->isEngine(['MYISAM', 'ARIA']) - && $_REQUEST['new_delay_key_write'] !== $delay_key_write + && $_POST['new_delay_key_write'] !== $delay_key_write ) { - $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write']; + $table_alters[] = 'delay_key_write = ' . $_POST['new_delay_key_write']; } if ($pma_table->isEngine(['MYISAM', 'ARIA', 'INNODB', 'PBXT']) - && ! empty($_REQUEST['new_auto_increment']) + && ! empty($_POST['new_auto_increment']) && (! isset($auto_increment) - || $_REQUEST['new_auto_increment'] !== $auto_increment) + || $_POST['new_auto_increment'] !== $auto_increment) ) { $table_alters[] = 'auto_increment = ' - . $this->dbi->escapeString($_REQUEST['new_auto_increment']); + . $this->dbi->escapeString($_POST['new_auto_increment']); } - if (! empty($_REQUEST['new_row_format'])) { - $newRowFormat = $_REQUEST['new_row_format']; + if (! empty($_POST['new_row_format'])) { + $newRowFormat = $_POST['new_row_format']; $newRowFormatLower = mb_strtolower($newRowFormat); if ($pma_table->isEngine(['MYISAM', 'ARIA', 'INNODB', 'PBXT']) && (strlen($row_format) === 0 @@ -1933,8 +1935,8 @@ class Operations // should not be reported with a Level of Error, so here // I just ignore it. But there are other 1478 messages // that it's better to show. - if (! (isset($_REQUEST['new_tbl_storage_engine']) - && $_REQUEST['new_tbl_storage_engine'] == 'MyISAM' + if (! (isset($_POST['new_tbl_storage_engine']) + && $_POST['new_tbl_storage_engine'] == 'MyISAM' && $warning['Code'] == '1478' && $warning['Level'] == 'Error') ) { @@ -1955,13 +1957,13 @@ class Operations { $sql_query = 'ALTER TABLE ' . Util::backquote($GLOBALS['table']) . ' ' - . $_REQUEST['partition_operation'] + . $_POST['partition_operation'] . ' PARTITION '; - if ($_REQUEST['partition_operation'] == 'COALESCE') { - $sql_query .= count($_REQUEST['partition_name']); + if ($_POST['partition_operation'] == 'COALESCE') { + $sql_query .= count($_POST['partition_name']); } else { - $sql_query .= implode(', ', $_REQUEST['partition_name']) . ';'; + $sql_query .= implode(', ', $_POST['partition_name']) . ';'; } $result = $this->dbi->query($sql_query); @@ -2110,19 +2112,19 @@ class Operations $this->dbi->selectDb($db); /** - * $_REQUEST['target_db'] could be empty in case we came from an input field + * $_POST['target_db'] could be empty in case we came from an input field * (when there are many databases, no drop-down) */ - if (empty($_REQUEST['target_db'])) { - $_REQUEST['target_db'] = $db; + if (empty($_POST['target_db'])) { + $_POST['target_db'] = $db; } /** * A target table name has been sent to this script -> do the work */ - if (Core::isValid($_REQUEST['new_name'])) { - if ($db == $_REQUEST['target_db'] && $table == $_REQUEST['new_name']) { - if (isset($_REQUEST['submit_move'])) { + if (Core::isValid($_POST['new_name'])) { + if ($db == $_POST['target_db'] && $table == $_POST['new_name']) { + if (isset($_POST['submit_move'])) { $message = Message::error(__('Can\'t move table to same one!')); } else { $message = Message::error(__('Can\'t copy table to same one!')); @@ -2131,33 +2133,33 @@ class Operations Table::moveCopy( $db, $table, - $_REQUEST['target_db'], - $_REQUEST['new_name'], - $_REQUEST['what'], - isset($_REQUEST['submit_move']), + $_POST['target_db'], + $_POST['new_name'], + $_POST['what'], + isset($_POST['submit_move']), 'one_table' ); - if (isset($_REQUEST['adjust_privileges']) - && ! empty($_REQUEST['adjust_privileges']) + if (isset($_POST['adjust_privileges']) + && ! empty($_POST['adjust_privileges']) ) { - if (isset($_REQUEST['submit_move'])) { + if (isset($_POST['submit_move'])) { $this->adjustPrivilegesRenameOrMoveTable( $db, $table, - $_REQUEST['target_db'], - $_REQUEST['new_name'] + $_POST['target_db'], + $_POST['new_name'] ); } else { $this->adjustPrivilegesCopyTable( $db, $table, - $_REQUEST['target_db'], - $_REQUEST['new_name'] + $_POST['target_db'], + $_POST['new_name'] ); } - if (isset($_REQUEST['submit_move'])) { + if (isset($_POST['submit_move'])) { $message = Message::success( __( 'Table %s has been moved to %s. Privileges have been ' @@ -2173,7 +2175,7 @@ class Operations ); } } else { - if (isset($_REQUEST['submit_move'])) { + if (isset($_POST['submit_move'])) { $message = Message::success( __('Table %s has been moved to %s.') ); @@ -2188,20 +2190,20 @@ class Operations . Util::backquote($table); $message->addParam($old); - $new_name = $_REQUEST['new_name']; + $new_name = $_POST['new_name']; if ($this->dbi->getLowerCaseNames() === '1') { $new_name = strtolower($new_name); } $GLOBALS['table'] = $new_name; - $new = Util::backquote($_REQUEST['target_db']) . '.' + $new = Util::backquote($_POST['target_db']) . '.' . Util::backquote($new_name); $message->addParam($new); /* Check: Work on new table or on old table? */ - if (isset($_REQUEST['submit_move']) - || Core::isValid($_REQUEST['switch_to_new']) + if (isset($_POST['submit_move']) + || Core::isValid($_POST['switch_to_new']) ) { } } diff --git a/libraries/classes/Relation.php b/libraries/classes/Relation.php index 145bf34474..9c59fa7f1a 100644 --- a/libraries/classes/Relation.php +++ b/libraries/classes/Relation.php @@ -2095,7 +2095,7 @@ class Relation { $retval = ''; - $url_query = Url::getCommon(['db' => $GLOBALS['db']]); + $url_query = Url::getCommon(['db' => $GLOBALS['db']], ''); if ($allTables) { if ($createDb) { $url_query .= '&goto=db_operations.php&create_pmadb=1'; @@ -2120,7 +2120,7 @@ class Relation __('%sCreate%s missing phpMyAdmin configuration storage tables.') ); } - $message->addParamHtml(''); + $message->addParamHtml(''); $message->addParamHtml(''); $retval .= $message->getDisplay(); diff --git a/libraries/classes/ReplicationGui.php b/libraries/classes/ReplicationGui.php index 5673e89030..81ac565a1a 100644 --- a/libraries/classes/ReplicationGui.php +++ b/libraries/classes/ReplicationGui.php @@ -68,7 +68,7 @@ class ReplicationGui public function getHtmlForMasterReplication() { $html = ''; - if (! isset($_REQUEST['repl_clear_scr'])) { + if (! isset($_POST['repl_clear_scr'])) { $html .= '
'; $html .= '' . __('Master replication') . ''; $html .= __('This server is configured as master in a replication process.'); @@ -87,16 +87,16 @@ class ReplicationGui $_url_params['mr_adduser'] = true; $_url_params['repl_clear_scr'] = true; - $html .= '
  • '; $html .= __('Add slave replication user') . '
  • '; } // Display 'Add replication slave user' form - if (isset($_REQUEST['mr_adduser'])) { + if (isset($_POST['mr_adduser'])) { $html .= $this->getHtmlForReplicationMasterAddSlaveUser(); - } elseif (! isset($_REQUEST['repl_clear_scr'])) { + } elseif (! isset($_POST['repl_clear_scr'])) { $html .= ""; $html .= "
    "; } @@ -180,8 +180,8 @@ class ReplicationGui $html .= ' ' . '
    '; @@ -857,7 +853,7 @@ class ReplicationGui . '' . '' . Util::showHint( @@ -875,12 +871,12 @@ class ReplicationGui . ' ' . '' @@ -921,22 +917,22 @@ class ReplicationGui */ public function handleControlRequest() { - if (isset($_REQUEST['sr_take_action'])) { + if (isset($_POST['sr_take_action'])) { $refresh = false; $result = false; $messageSuccess = null; $messageError = null; - if (isset($_REQUEST['slave_changemaster']) && ! $GLOBALS['cfg']['AllowArbitraryServer']) { + if (isset($_POST['slave_changemaster']) && ! $GLOBALS['cfg']['AllowArbitraryServer']) { $_SESSION['replication']['sr_action_status'] = 'error'; $_SESSION['replication']['sr_action_info'] = __('Connection to server is disabled, please enable $cfg[\'AllowArbitraryServer\'] in phpMyAdmin configuration.'); - } elseif (isset($_REQUEST['slave_changemaster'])) { + } elseif (isset($_POST['slave_changemaster'])) { $result = $this->handleRequestForSlaveChangeMaster(); - } elseif (isset($_REQUEST['sr_slave_server_control'])) { + } elseif (isset($_POST['sr_slave_server_control'])) { $result = $this->handleRequestForSlaveServerControl(); $refresh = true; - switch ($_REQUEST['sr_slave_action']) { + switch ($_POST['sr_slave_action']) { case 'start': $messageSuccess = __('Replication started successfully.'); $messageError = __('Error starting replication.'); @@ -954,7 +950,7 @@ class ReplicationGui $messageError = __('Error.'); break; } - } elseif (isset($_REQUEST['sr_slave_skip_error'])) { + } elseif (isset($_POST['sr_slave_skip_error'])) { $result = $this->handleRequestForSlaveSkipError(); } @@ -988,13 +984,13 @@ class ReplicationGui { $sr = []; $_SESSION['replication']['m_username'] = $sr['username'] - = $GLOBALS['dbi']->escapeString($_REQUEST['username']); + = $GLOBALS['dbi']->escapeString($_POST['username']); $_SESSION['replication']['m_password'] = $sr['pma_pw'] - = $GLOBALS['dbi']->escapeString($_REQUEST['pma_pw']); + = $GLOBALS['dbi']->escapeString($_POST['pma_pw']); $_SESSION['replication']['m_hostname'] = $sr['hostname'] - = $GLOBALS['dbi']->escapeString($_REQUEST['hostname']); + = $GLOBALS['dbi']->escapeString($_POST['hostname']); $_SESSION['replication']['m_port'] = $sr['port'] - = $GLOBALS['dbi']->escapeString($_REQUEST['text_port']); + = $GLOBALS['dbi']->escapeString($_POST['text_port']); $_SESSION['replication']['m_correct'] = ''; $_SESSION['replication']['sr_action_status'] = 'error'; $_SESSION['replication']['sr_action_info'] = __('Unknown error'); @@ -1060,10 +1056,10 @@ class ReplicationGui */ public function handleRequestForSlaveServerControl() { - if (empty($_REQUEST['sr_slave_control_parm'])) { - $_REQUEST['sr_slave_control_parm'] = null; + if (empty($_POST['sr_slave_control_parm'])) { + $_POST['sr_slave_control_parm'] = null; } - if ($_REQUEST['sr_slave_action'] == 'reset') { + if ($_POST['sr_slave_action'] == 'reset') { $qStop = $this->replication->slaveControl("STOP"); $qReset = $GLOBALS['dbi']->tryQuery("RESET SLAVE;"); $qStart = $this->replication->slaveControl("START"); @@ -1073,8 +1069,8 @@ class ReplicationGui $qStart !== false && $qStart !== -1); } else { $qControl = $this->replication->slaveControl( - $_REQUEST['sr_slave_action'], - $_REQUEST['sr_slave_control_parm'] + $_POST['sr_slave_action'], + $_POST['sr_slave_control_parm'] ); $result = ($qControl !== false && $qControl !== -1); @@ -1091,8 +1087,8 @@ class ReplicationGui public function handleRequestForSlaveSkipError() { $count = 1; - if (isset($_REQUEST['sr_skip_errors_count'])) { - $count = $_REQUEST['sr_skip_errors_count'] * 1; + if (isset($_POST['sr_skip_errors_count'])) { + $count = $_POST['sr_skip_errors_count'] * 1; } $qStop = $this->replication->slaveControl("STOP"); diff --git a/libraries/classes/Rte/Events.php b/libraries/classes/Rte/Events.php index e9a1a85914..3bf48f1e5d 100644 --- a/libraries/classes/Rte/Events.php +++ b/libraries/classes/Rte/Events.php @@ -153,8 +153,8 @@ class Events { global $_REQUEST, $_POST, $errors, $db; - if (! empty($_REQUEST['editor_process_add']) - || ! empty($_REQUEST['editor_process_edit']) + if (! empty($_POST['editor_process_add']) + || ! empty($_POST['editor_process_edit']) ) { $sql_query = ''; @@ -162,15 +162,15 @@ class Events if (! count($errors)) { // set by PhpMyAdmin\Rte\Routines::getQueryFromRequest() // Execute the created query - if (! empty($_REQUEST['editor_process_edit'])) { + if (! empty($_POST['editor_process_edit'])) { // Backup the old trigger, in case something goes wrong $create_item = $this->dbi->getDefinition( $db, 'EVENT', - $_REQUEST['item_original_name'] + $_POST['item_original_name'] ); $drop_item = "DROP EVENT " - . Util::backquote($_REQUEST['item_original_name']) + . Util::backquote($_POST['item_original_name']) . ";\n"; $result = $this->dbi->tryQuery($drop_item); if (! $result) { @@ -205,7 +205,7 @@ class Events __('Event %1$s has been modified.') ); $message->addParam( - Util::backquote($_REQUEST['item_name']) + Util::backquote($_POST['item_name']) ); $sql_query = $drop_item . $item_query; } @@ -225,7 +225,7 @@ class Events __('Event %1$s has been created.') ); $message->addParam( - Util::backquote($_REQUEST['item_name']) + Util::backquote($_POST['item_name']) ); $sql_query = $item_query; } @@ -251,12 +251,12 @@ class Events $response = Response::getInstance(); if ($response->isAjax()) { if ($message->isSuccess()) { - $events = $this->dbi->getEvents($db, $_REQUEST['item_name']); + $events = $this->dbi->getEvents($db, $_POST['item_name']); $event = $events[0]; $response->addJSON( 'name', htmlspecialchars( - mb_strtoupper($_REQUEST['item_name']) + mb_strtoupper($_POST['item_name']) ) ); if (! empty($event)) { @@ -275,14 +275,14 @@ class Events * Display a form used to add/edit a trigger, if necessary */ if (count($errors) - || (empty($_REQUEST['editor_process_add']) - && empty($_REQUEST['editor_process_edit']) + || (empty($_POST['editor_process_add']) + && empty($_POST['editor_process_edit']) && (! empty($_REQUEST['add_item']) || ! empty($_REQUEST['edit_item']) - || ! empty($_REQUEST['item_changetype']))) + || ! empty($_POST['item_changetype']))) ) { // FIXME: this must be simpler than that $operation = ''; - if (! empty($_REQUEST['item_changetype'])) { + if (! empty($_POST['item_changetype'])) { $operation = 'change'; } // Get the data for the form (if any) @@ -293,8 +293,8 @@ class Events } elseif (! empty($_REQUEST['edit_item'])) { $title = __("Edit event"); if (! empty($_REQUEST['item_name']) - && empty($_REQUEST['editor_process_edit']) - && empty($_REQUEST['item_changetype']) + && empty($_POST['editor_process_edit']) + && empty($_POST['item_changetype']) ) { $item = $this->getDataFromName($_REQUEST['item_name']); if ($item !== false) { @@ -330,11 +330,11 @@ class Events 'item_comment', 'item_definer']; foreach ($indices as $index) { - $retval[$index] = isset($_REQUEST[$index]) ? $_REQUEST[$index] : ''; + $retval[$index] = isset($_POST[$index]) ? $_POST[$index] : ''; } $retval['item_type'] = 'ONE TIME'; $retval['item_type_toggle'] = 'RECURRING'; - if (isset($_REQUEST['item_type']) && $_REQUEST['item_type'] == 'RECURRING') { + if (isset($_POST['item_type']) && $_POST['item_type'] == 'RECURRING') { $retval['item_type'] = 'RECURRING'; $retval['item_type_toggle'] = 'ONE TIME'; } @@ -599,10 +599,10 @@ class Events global $_REQUEST, $errors, $event_status, $event_type, $event_interval; $query = 'CREATE '; - if (! empty($_REQUEST['item_definer'])) { - if (mb_strpos($_REQUEST['item_definer'], '@') !== false + if (! empty($_POST['item_definer'])) { + if (mb_strpos($_POST['item_definer'], '@') !== false ) { - $arr = explode('@', $_REQUEST['item_definer']); + $arr = explode('@', $_POST['item_definer']); $query .= 'DEFINER=' . Util::backquote($arr[0]); $query .= '@' . Util::backquote($arr[1]) . ' '; } else { @@ -610,40 +610,40 @@ class Events } } $query .= 'EVENT '; - if (! empty($_REQUEST['item_name'])) { - $query .= Util::backquote($_REQUEST['item_name']) . ' '; + if (! empty($_POST['item_name'])) { + $query .= Util::backquote($_POST['item_name']) . ' '; } else { $errors[] = __('You must provide an event name!'); } $query .= 'ON SCHEDULE '; - if (! empty($_REQUEST['item_type']) - && in_array($_REQUEST['item_type'], $event_type) + if (! empty($_POST['item_type']) + && in_array($_POST['item_type'], $event_type) ) { - if ($_REQUEST['item_type'] == 'RECURRING') { - if (! empty($_REQUEST['item_interval_value']) - && !empty($_REQUEST['item_interval_field']) - && in_array($_REQUEST['item_interval_field'], $event_interval) + if ($_POST['item_type'] == 'RECURRING') { + if (! empty($_POST['item_interval_value']) + && !empty($_POST['item_interval_field']) + && in_array($_POST['item_interval_field'], $event_interval) ) { - $query .= 'EVERY ' . intval($_REQUEST['item_interval_value']) . ' '; - $query .= $_REQUEST['item_interval_field'] . ' '; + $query .= 'EVERY ' . intval($_POST['item_interval_value']) . ' '; + $query .= $_POST['item_interval_field'] . ' '; } else { $errors[] = __('You must provide a valid interval value for the event.'); } - if (! empty($_REQUEST['item_starts'])) { + if (! empty($_POST['item_starts'])) { $query .= "STARTS '" - . $this->dbi->escapeString($_REQUEST['item_starts']) + . $this->dbi->escapeString($_POST['item_starts']) . "' "; } - if (! empty($_REQUEST['item_ends'])) { + if (! empty($_POST['item_ends'])) { $query .= "ENDS '" - . $this->dbi->escapeString($_REQUEST['item_ends']) + . $this->dbi->escapeString($_POST['item_ends']) . "' "; } } else { - if (! empty($_REQUEST['item_execute_at'])) { + if (! empty($_POST['item_execute_at'])) { $query .= "AT '" - . $this->dbi->escapeString($_REQUEST['item_execute_at']) + . $this->dbi->escapeString($_POST['item_execute_at']) . "' "; } else { $errors[] @@ -654,26 +654,26 @@ class Events $errors[] = __('You must provide a valid type for the event.'); } $query .= 'ON COMPLETION '; - if (empty($_REQUEST['item_preserve'])) { + if (empty($_POST['item_preserve'])) { $query .= 'NOT '; } $query .= 'PRESERVE '; - if (! empty($_REQUEST['item_status'])) { + if (! empty($_POST['item_status'])) { foreach ($event_status['display'] as $key => $value) { - if ($value == $_REQUEST['item_status']) { + if ($value == $_POST['item_status']) { $query .= $event_status['query'][$key] . ' '; break; } } } - if (! empty($_REQUEST['item_comment'])) { + if (! empty($_POST['item_comment'])) { $query .= "COMMENT '" . $this->dbi->escapeString( - $_REQUEST['item_comment'] + $_POST['item_comment'] ) . "' "; } $query .= 'DO '; - if (! empty($_REQUEST['item_definition'])) { - $query .= $_REQUEST['item_definition']; + if (! empty($_POST['item_definition'])) { + $query .= $_POST['item_definition']; } else { $errors[] = __('You must provide an event definition.'); } diff --git a/libraries/classes/Rte/Routines.php b/libraries/classes/Rte/Routines.php index 6006906eb9..7bd70b0526 100644 --- a/libraries/classes/Rte/Routines.php +++ b/libraries/classes/Rte/Routines.php @@ -170,21 +170,21 @@ class Routines */ // FIXME: this must be simpler than that if (count($errors) - || ( empty($_REQUEST['editor_process_add']) - && empty($_REQUEST['editor_process_edit']) + || ( empty($_POST['editor_process_add']) + && empty($_POST['editor_process_edit']) && (! empty($_REQUEST['add_item']) || ! empty($_REQUEST['edit_item']) - || ! empty($_REQUEST['routine_addparameter']) - || ! empty($_REQUEST['routine_removeparameter']) - || ! empty($_REQUEST['routine_changetype']))) + || ! empty($_POST['routine_addparameter']) + || ! empty($_POST['routine_removeparameter']) + || ! empty($_POST['routine_changetype']))) ) { // Handle requests to add/remove parameters and changing routine type // This is necessary when JS is disabled $operation = ''; - if (! empty($_REQUEST['routine_addparameter'])) { + if (! empty($_POST['routine_addparameter'])) { $operation = 'add'; - } elseif (! empty($_REQUEST['routine_removeparameter'])) { + } elseif (! empty($_POST['routine_removeparameter'])) { $operation = 'remove'; - } elseif (! empty($_REQUEST['routine_changetype'])) { + } elseif (! empty($_POST['routine_changetype'])) { $operation = 'change'; } // Get the data for the form (if any) @@ -194,12 +194,12 @@ class Routines $mode = 'add'; } elseif (! empty($_REQUEST['edit_item'])) { $title = __("Edit routine"); - if (! $operation && ! empty($_REQUEST['item_name']) - && empty($_REQUEST['editor_process_edit']) + if (! $operation && ! empty($_GET['item_name']) + && empty($_POST['editor_process_edit']) ) { $routine = $this->getDataFromName( - $_REQUEST['item_name'], - $_REQUEST['item_type'] + $_GET['item_name'], + $_GET['item_type'] ); if ($routine !== false) { $routine['item_original_name'] = $routine['item_name']; @@ -254,8 +254,8 @@ class Routines */ public function handleRequestCreateOrEdit(array $errors, $db) { - if (empty($_REQUEST['editor_process_add']) - && empty($_REQUEST['editor_process_edit']) + if (empty($_POST['editor_process_add']) + && empty($_POST['editor_process_edit']) ) { return $errors; } @@ -264,29 +264,29 @@ class Routines $routine_query = $this->getQueryFromRequest(); if (!count($errors)) { // Execute the created query - if (!empty($_REQUEST['editor_process_edit'])) { + if (!empty($_POST['editor_process_edit'])) { $isProcOrFunc = in_array( - $_REQUEST['item_original_type'], + $_POST['item_original_type'], ['PROCEDURE', 'FUNCTION'] ); if (!$isProcOrFunc) { $errors[] = sprintf( __('Invalid routine type: "%s"'), - htmlspecialchars($_REQUEST['item_original_type']) + htmlspecialchars($_POST['item_original_type']) ); } else { // Backup the old routine, in case something goes wrong $create_routine = $this->dbi->getDefinition( $db, - $_REQUEST['item_original_type'], - $_REQUEST['item_original_name'] + $_POST['item_original_type'], + $_POST['item_original_name'] ); $privilegesBackup = $this->backupPrivileges(); - $drop_routine = "DROP {$_REQUEST['item_original_type']} " - . Util::backquote($_REQUEST['item_original_name']) + $drop_routine = "DROP {$_POST['item_original_type']} " + . Util::backquote($_POST['item_original_name']) . ";\n"; $result = $this->dbi->tryQuery($drop_routine); if (!$result) { @@ -328,7 +328,7 @@ class Routines __('Routine %1$s has been created.') ); $message->addParam( - Util::backquote($_REQUEST['item_name']) + Util::backquote($_POST['item_name']) ); $sql_query = $routine_query; } @@ -363,14 +363,14 @@ class Routines $routines = $this->dbi->getRoutines( $db, - $_REQUEST['item_type'], - $_REQUEST['item_name'] + $_POST['item_type'], + $_POST['item_name'] ); $routine = $routines[0]; $response->addJSON( 'name', htmlspecialchars( - mb_strtoupper($_REQUEST['item_name']) + mb_strtoupper($_POST['item_name']) ) ); $response->addJSON('new_row', $this->rteList->getRoutineRow($routine)); @@ -391,9 +391,9 @@ class Routines } // Backup the Old Privileges before dropping - // if $_REQUEST['item_adjust_privileges'] set - if (! isset($_REQUEST['item_adjust_privileges']) - || empty($_REQUEST['item_adjust_privileges']) + // if $_POST['item_adjust_privileges'] set + if (! isset($_POST['item_adjust_privileges']) + || empty($_POST['item_adjust_privileges']) ) { return []; } @@ -402,8 +402,8 @@ class Routines 'mysql' ) . '.' . Util::backquote('procs_priv') - . ' where Routine_name = "' . $_REQUEST['item_original_name'] - . '" AND Routine_type = "' . $_REQUEST['item_original_type'] + . ' where Routine_name = "' . $_POST['item_original_name'] + . '" AND Routine_type = "' . $_POST['item_original_type'] . '";'; $privilegesBackup = $this->dbi->fetchResult( @@ -468,8 +468,8 @@ class Routines . Util::backquote('procs_priv') . ' VALUES("' . $priv[0] . '", "' . $priv[1] . '", "' . $priv[2] . '", "' - . $_REQUEST['item_name'] . '", "' - . $_REQUEST['item_type'] . '", "' + . $_POST['item_name'] . '", "' + . $_POST['item_type'] . '", "' . $priv[5] . '", "' . $priv[6] . '", "' . $priv[7] . '");'; @@ -509,7 +509,7 @@ class Routines ); } $message->addParam( - Util::backquote($_REQUEST['item_name']) + Util::backquote($_POST['item_name']) ); return $message; @@ -537,7 +537,7 @@ class Routines 'item_comment', 'item_definer']; foreach ($indices as $index) { - $retval[$index] = isset($_REQUEST[$index]) ? $_REQUEST[$index] : ''; + $retval[$index] = isset($_POST[$index]) ? $_POST[$index] : ''; } $retval['item_type'] = 'PROCEDURE'; @@ -547,8 +547,8 @@ class Routines $retval['item_type_toggle'] = 'PROCEDURE'; } $retval['item_original_type'] = 'PROCEDURE'; - if (isset($_REQUEST['item_original_type']) - && $_REQUEST['item_original_type'] == 'FUNCTION' + if (isset($_POST['item_original_type']) + && $_POST['item_original_type'] == 'FUNCTION' ) { $retval['item_original_type'] = 'FUNCTION'; } @@ -559,35 +559,35 @@ class Routines $retval['item_param_length'] = []; $retval['item_param_opts_num'] = []; $retval['item_param_opts_text'] = []; - if (isset($_REQUEST['item_param_name']) - && isset($_REQUEST['item_param_type']) - && isset($_REQUEST['item_param_length']) - && isset($_REQUEST['item_param_opts_num']) - && isset($_REQUEST['item_param_opts_text']) - && is_array($_REQUEST['item_param_name']) - && is_array($_REQUEST['item_param_type']) - && is_array($_REQUEST['item_param_length']) - && is_array($_REQUEST['item_param_opts_num']) - && is_array($_REQUEST['item_param_opts_text']) + if (isset($_POST['item_param_name']) + && isset($_POST['item_param_type']) + && isset($_POST['item_param_length']) + && isset($_POST['item_param_opts_num']) + && isset($_POST['item_param_opts_text']) + && is_array($_POST['item_param_name']) + && is_array($_POST['item_param_type']) + && is_array($_POST['item_param_length']) + && is_array($_POST['item_param_opts_num']) + && is_array($_POST['item_param_opts_text']) ) { - if ($_REQUEST['item_type'] == 'PROCEDURE') { - $retval['item_param_dir'] = $_REQUEST['item_param_dir']; + if ($_POST['item_type'] == 'PROCEDURE') { + $retval['item_param_dir'] = $_POST['item_param_dir']; foreach ($retval['item_param_dir'] as $key => $value) { if (! in_array($value, $param_directions, true)) { $retval['item_param_dir'][$key] = ''; } } } - $retval['item_param_name'] = $_REQUEST['item_param_name']; - $retval['item_param_type'] = $_REQUEST['item_param_type']; + $retval['item_param_name'] = $_POST['item_param_name']; + $retval['item_param_type'] = $_POST['item_param_type']; foreach ($retval['item_param_type'] as $key => $value) { if (! in_array($value, Util::getSupportedDatatypes(), true)) { $retval['item_param_type'][$key] = ''; } } - $retval['item_param_length'] = $_REQUEST['item_param_length']; - $retval['item_param_opts_num'] = $_REQUEST['item_param_opts_num']; - $retval['item_param_opts_text'] = $_REQUEST['item_param_opts_text']; + $retval['item_param_length'] = $_POST['item_param_length']; + $retval['item_param_opts_num'] = $_POST['item_param_opts_num']; + $retval['item_param_opts_text'] = $_POST['item_param_opts_text']; $retval['item_num_params'] = max( count($retval['item_param_name']), count($retval['item_param_type']), @@ -597,32 +597,32 @@ class Routines ); } $retval['item_returntype'] = ''; - if (isset($_REQUEST['item_returntype']) - && in_array($_REQUEST['item_returntype'], Util::getSupportedDatatypes()) + if (isset($_POST['item_returntype']) + && in_array($_POST['item_returntype'], Util::getSupportedDatatypes()) ) { - $retval['item_returntype'] = $_REQUEST['item_returntype']; + $retval['item_returntype'] = $_POST['item_returntype']; } $retval['item_isdeterministic'] = ''; - if (isset($_REQUEST['item_isdeterministic']) - && mb_strtolower($_REQUEST['item_isdeterministic']) == 'on' + if (isset($_POST['item_isdeterministic']) + && mb_strtolower($_POST['item_isdeterministic']) == 'on' ) { $retval['item_isdeterministic'] = " checked='checked'"; } $retval['item_securitytype_definer'] = ''; $retval['item_securitytype_invoker'] = ''; - if (isset($_REQUEST['item_securitytype'])) { - if ($_REQUEST['item_securitytype'] === 'DEFINER') { + if (isset($_POST['item_securitytype'])) { + if ($_POST['item_securitytype'] === 'DEFINER') { $retval['item_securitytype_definer'] = " selected='selected'"; - } elseif ($_REQUEST['item_securitytype'] === 'INVOKER') { + } elseif ($_POST['item_securitytype'] === 'INVOKER') { $retval['item_securitytype_invoker'] = " selected='selected'"; } } $retval['item_sqldataaccess'] = ''; - if (isset($_REQUEST['item_sqldataaccess']) - && in_array($_REQUEST['item_sqldataaccess'], $param_sqldataaccess, true) + if (isset($_POST['item_sqldataaccess']) + && in_array($_POST['item_sqldataaccess'], $param_sqldataaccess, true) ) { - $retval['item_sqldataaccess'] = $_REQUEST['item_sqldataaccess']; + $retval['item_sqldataaccess'] = $_POST['item_sqldataaccess']; } return $retval; @@ -1151,13 +1151,13 @@ class Routines { global $_REQUEST, $errors, $param_sqldataaccess, $param_directions, $dbi; - $_REQUEST['item_type'] = isset($_REQUEST['item_type']) - ? $_REQUEST['item_type'] : ''; + $_POST['item_type'] = isset($_POST['item_type']) + ? $_POST['item_type'] : ''; $query = 'CREATE '; - if (! empty($_REQUEST['item_definer'])) { - if (mb_strpos($_REQUEST['item_definer'], '@') !== false) { - $arr = explode('@', $_REQUEST['item_definer']); + if (! empty($_POST['item_definer'])) { + if (mb_strpos($_POST['item_definer'], '@') !== false) { + $arr = explode('@', $_POST['item_definer']); $do_backquote = true; if (substr($arr[0], 0, 1) === "`" @@ -1178,18 +1178,18 @@ class Routines $errors[] = __('The definer must be in the "username@hostname" format!'); } } - if ($_REQUEST['item_type'] == 'FUNCTION' - || $_REQUEST['item_type'] == 'PROCEDURE' + if ($_POST['item_type'] == 'FUNCTION' + || $_POST['item_type'] == 'PROCEDURE' ) { - $query .= $_REQUEST['item_type'] . ' '; + $query .= $_POST['item_type'] . ' '; } else { $errors[] = sprintf( __('Invalid routine type: "%s"'), - htmlspecialchars($_REQUEST['item_type']) + htmlspecialchars($_POST['item_type']) ); } - if (! empty($_REQUEST['item_name'])) { - $query .= Util::backquote($_REQUEST['item_name']); + if (! empty($_POST['item_name'])) { + $query .= Util::backquote($_POST['item_name']); } else { $errors[] = __('You must provide a routine name!'); } @@ -1197,36 +1197,36 @@ class Routines $warned_about_dir = false; $warned_about_length = false; - if (! empty($_REQUEST['item_param_name']) - && ! empty($_REQUEST['item_param_type']) - && ! empty($_REQUEST['item_param_length']) - && is_array($_REQUEST['item_param_name']) - && is_array($_REQUEST['item_param_type']) - && is_array($_REQUEST['item_param_length']) + if (! empty($_POST['item_param_name']) + && ! empty($_POST['item_param_type']) + && ! empty($_POST['item_param_length']) + && is_array($_POST['item_param_name']) + && is_array($_POST['item_param_type']) + && is_array($_POST['item_param_length']) ) { - $item_param_name = $_REQUEST['item_param_name']; - $item_param_type = $_REQUEST['item_param_type']; - $item_param_length = $_REQUEST['item_param_length']; + $item_param_name = $_POST['item_param_name']; + $item_param_type = $_POST['item_param_type']; + $item_param_length = $_POST['item_param_length']; for ($i = 0, $nb = count($item_param_name); $i < $nb; $i++) { if (! empty($item_param_name[$i]) && ! empty($item_param_type[$i]) ) { - if ($_REQUEST['item_type'] == 'PROCEDURE' - && ! empty($_REQUEST['item_param_dir'][$i]) - && in_array($_REQUEST['item_param_dir'][$i], $param_directions) + if ($_POST['item_type'] == 'PROCEDURE' + && ! empty($_POST['item_param_dir'][$i]) + && in_array($_POST['item_param_dir'][$i], $param_directions) ) { - $params .= $_REQUEST['item_param_dir'][$i] . " " + $params .= $_POST['item_param_dir'][$i] . " " . Util::backquote($item_param_name[$i]) . " " . $item_param_type[$i]; - } elseif ($_REQUEST['item_type'] == 'FUNCTION') { + } elseif ($_POST['item_type'] == 'FUNCTION') { $params .= Util::backquote($item_param_name[$i]) . " " . $item_param_type[$i]; } elseif (! $warned_about_dir) { $warned_about_dir = true; $errors[] = sprintf( __('Invalid direction "%s" given for parameter.'), - htmlspecialchars($_REQUEST['item_param_dir'][$i]) + htmlspecialchars($_POST['item_param_dir'][$i]) ); } if ($item_param_length[$i] != '' @@ -1252,21 +1252,21 @@ class Routines ); } } - if (! empty($_REQUEST['item_param_opts_text'][$i])) { + if (! empty($_POST['item_param_opts_text'][$i])) { if ($dbi->types->getTypeClass($item_param_type[$i]) == 'CHAR') { if (! in_array($item_param_type[$i], ['VARBINARY', 'BINARY'])) { $params .= ' CHARSET ' . mb_strtolower( - $_REQUEST['item_param_opts_text'][$i] + $_POST['item_param_opts_text'][$i] ); } } } - if (! empty($_REQUEST['item_param_opts_num'][$i])) { + if (! empty($_POST['item_param_opts_num'][$i])) { if ($dbi->types->getTypeClass($item_param_type[$i]) == 'NUMBER') { $params .= ' ' . mb_strtoupper( - $_REQUEST['item_param_opts_num'][$i] + $_POST['item_param_opts_num'][$i] ); } } @@ -1282,9 +1282,9 @@ class Routines } } $query .= "(" . $params . ") "; - if ($_REQUEST['item_type'] == 'FUNCTION') { - $item_returntype = isset($_REQUEST['item_returntype']) - ? $_REQUEST['item_returntype'] + if ($_POST['item_type'] == 'FUNCTION') { + $item_returntype = isset($_POST['item_returntype']) + ? $_POST['item_returntype'] : null; if (! empty($item_returntype) @@ -1297,15 +1297,15 @@ class Routines } else { $errors[] = __('You must provide a valid return type for the routine.'); } - if (! empty($_REQUEST['item_returnlength']) + if (! empty($_POST['item_returnlength']) && !preg_match( '@^(DATE|DATETIME|TIME|TINYBLOB|TINYTEXT|BLOB|TEXT|' . 'MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|SERIAL|BOOLEAN)$@i', $item_returntype ) ) { - $query .= "(" . $_REQUEST['item_returnlength'] . ")"; - } elseif (empty($_REQUEST['item_returnlength']) + $query .= "(" . $_POST['item_returnlength'] . ")"; + } elseif (empty($_POST['item_returnlength']) && preg_match( '@^(ENUM|SET|VARCHAR|VARBINARY)$@i', $item_returntype @@ -1318,43 +1318,43 @@ class Routines ); } } - if (! empty($_REQUEST['item_returnopts_text'])) { + if (! empty($_POST['item_returnopts_text'])) { if ($dbi->types->getTypeClass($item_returntype) == 'CHAR') { $query .= ' CHARSET ' - . mb_strtolower($_REQUEST['item_returnopts_text']); + . mb_strtolower($_POST['item_returnopts_text']); } } - if (! empty($_REQUEST['item_returnopts_num'])) { + if (! empty($_POST['item_returnopts_num'])) { if ($dbi->types->getTypeClass($item_returntype) == 'NUMBER') { $query .= ' ' - . mb_strtoupper($_REQUEST['item_returnopts_num']); + . mb_strtoupper($_POST['item_returnopts_num']); } } $query .= ' '; } - if (! empty($_REQUEST['item_comment'])) { - $query .= "COMMENT '" . $this->dbi->escapeString($_REQUEST['item_comment']) + if (! empty($_POST['item_comment'])) { + $query .= "COMMENT '" . $this->dbi->escapeString($_POST['item_comment']) . "' "; } - if (isset($_REQUEST['item_isdeterministic'])) { + if (isset($_POST['item_isdeterministic'])) { $query .= 'DETERMINISTIC '; } else { $query .= 'NOT DETERMINISTIC '; } - if (! empty($_REQUEST['item_sqldataaccess']) - && in_array($_REQUEST['item_sqldataaccess'], $param_sqldataaccess) + if (! empty($_POST['item_sqldataaccess']) + && in_array($_POST['item_sqldataaccess'], $param_sqldataaccess) ) { - $query .= $_REQUEST['item_sqldataaccess'] . ' '; + $query .= $_POST['item_sqldataaccess'] . ' '; } - if (! empty($_REQUEST['item_securitytype'])) { - if ($_REQUEST['item_securitytype'] == 'DEFINER' - || $_REQUEST['item_securitytype'] == 'INVOKER' + if (! empty($_POST['item_securitytype'])) { + if ($_POST['item_securitytype'] == 'DEFINER' + || $_POST['item_securitytype'] == 'INVOKER' ) { - $query .= 'SQL SECURITY ' . $_REQUEST['item_securitytype'] . ' '; + $query .= 'SQL SECURITY ' . $_POST['item_securitytype'] . ' '; } } - if (! empty($_REQUEST['item_definition'])) { - $query .= $_REQUEST['item_definition']; + if (! empty($_POST['item_definition'])) { + $query .= $_POST['item_definition']; } else { $errors[] = __('You must provide a routine definition.'); } @@ -1376,18 +1376,18 @@ class Routines /** * Handle all user requests other than the default of listing routines */ - if (! empty($_REQUEST['execute_routine']) && ! empty($_REQUEST['item_name'])) { + if (! empty($_POST['execute_routine']) && ! empty($_POST['item_name'])) { // Build the queries $routine = $this->getDataFromName( - $_REQUEST['item_name'], - $_REQUEST['item_type'], + $_POST['item_name'], + $_POST['item_type'], false ); if ($routine === false) { $message = __('Error in processing request:') . ' '; $message .= sprintf( $this->words->get('not_found'), - htmlspecialchars(Util::backquote($_REQUEST['item_name'])), + htmlspecialchars(Util::backquote($_POST['item_name'])), htmlspecialchars(Util::backquote($db)) ); $message = Message::error($message); @@ -1406,20 +1406,20 @@ class Routines $args = []; $all_functions = $this->dbi->types->getAllFunctions(); for ($i = 0; $i < $routine['item_num_params']; $i++) { - if (isset($_REQUEST['params'][$routine['item_param_name'][$i]])) { - $value = $_REQUEST['params'][$routine['item_param_name'][$i]]; + if (isset($_POST['params'][$routine['item_param_name'][$i]])) { + $value = $_POST['params'][$routine['item_param_name'][$i]]; if (is_array($value)) { // is SET type $value = implode(',', $value); } $value = $this->dbi->escapeString($value); - if (! empty($_REQUEST['funcs'][$routine['item_param_name'][$i]]) + if (! empty($_POST['funcs'][$routine['item_param_name'][$i]]) && in_array( - $_REQUEST['funcs'][$routine['item_param_name'][$i]], + $_POST['funcs'][$routine['item_param_name'][$i]], $all_functions ) ) { $queries[] = "SET @p$i=" - . $_REQUEST['funcs'][$routine['item_param_name'][$i]] + . $_POST['funcs'][$routine['item_param_name'][$i]] . "('$value');\n"; } else { $queries[] = "SET @p$i='$value';\n"; @@ -1592,7 +1592,7 @@ class Routines $message = __('Error in processing request:') . ' '; $message .= sprintf( $this->words->get('not_found'), - htmlspecialchars(Util::backquote($_REQUEST['item_name'])), + htmlspecialchars(Util::backquote($_GET['item_name'])), htmlspecialchars(Util::backquote($db)) ); $message = Message::error($message); diff --git a/libraries/classes/Rte/Triggers.php b/libraries/classes/Rte/Triggers.php index 8412b7dfdb..3e90b931ae 100644 --- a/libraries/classes/Rte/Triggers.php +++ b/libraries/classes/Rte/Triggers.php @@ -129,8 +129,8 @@ class Triggers { global $_REQUEST, $_POST, $errors, $db, $table; - if (! empty($_REQUEST['editor_process_add']) - || ! empty($_REQUEST['editor_process_edit']) + if (! empty($_POST['editor_process_add']) + || ! empty($_POST['editor_process_edit']) ) { $sql_query = ''; @@ -138,9 +138,9 @@ class Triggers if (! count($errors)) { // set by PhpMyAdmin\Rte\Routines::getQueryFromRequest() // Execute the created query - if (! empty($_REQUEST['editor_process_edit'])) { + if (! empty($_POST['editor_process_edit'])) { // Backup the old trigger, in case something goes wrong - $trigger = $this->getDataFromName($_REQUEST['item_original_name']); + $trigger = $this->getDataFromName($_POST['item_original_name']); $create_item = $trigger['create']; $drop_item = $trigger['drop'] . ';'; $result = $this->dbi->tryQuery($drop_item); @@ -177,7 +177,7 @@ class Triggers __('Trigger %1$s has been modified.') ); $message->addParam( - Util::backquote($_REQUEST['item_name']) + Util::backquote($_POST['item_name']) ); $sql_query = $drop_item . $item_query; } @@ -197,7 +197,7 @@ class Triggers __('Trigger %1$s has been created.') ); $message->addParam( - Util::backquote($_REQUEST['item_name']) + Util::backquote($_POST['item_name']) ); $sql_query = $item_query; } @@ -226,7 +226,7 @@ class Triggers $items = $this->dbi->getTriggers($db, $table, ''); $trigger = false; foreach ($items as $value) { - if ($value['name'] == $_REQUEST['item_name']) { + if ($value['name'] == $_POST['item_name']) { $trigger = $value; } } @@ -240,7 +240,7 @@ class Triggers 'name', htmlspecialchars( mb_strtoupper( - $_REQUEST['item_name'] + $_POST['item_name'] ) ) ); @@ -259,8 +259,8 @@ class Triggers * Display a form used to add/edit a trigger, if necessary */ if (count($errors) - || (empty($_REQUEST['editor_process_add']) - && empty($_REQUEST['editor_process_edit']) + || (empty($_POST['editor_process_add']) + && empty($_POST['editor_process_edit']) && (! empty($_REQUEST['add_item']) || ! empty($_REQUEST['edit_item']))) // FIXME: this must be simpler than that ) { @@ -272,7 +272,7 @@ class Triggers } elseif (! empty($_REQUEST['edit_item'])) { $title = __("Edit trigger"); if (! empty($_REQUEST['item_name']) - && empty($_REQUEST['editor_process_edit']) + && empty($_POST['editor_process_edit']) ) { $item = $this->getDataFromName($_REQUEST['item_name']); if ($item !== false) { @@ -303,7 +303,7 @@ class Triggers 'item_definition', 'item_definer']; foreach ($indices as $index) { - $retval[$index] = isset($_REQUEST[$index]) ? $_REQUEST[$index] : ''; + $retval[$index] = isset($_POST[$index]) ? $_POST[$index] : ''; } return $retval; } @@ -480,10 +480,10 @@ class Triggers global $_REQUEST, $db, $errors, $action_timings, $event_manipulations; $query = 'CREATE '; - if (! empty($_REQUEST['item_definer'])) { - if (mb_strpos($_REQUEST['item_definer'], '@') !== false + if (! empty($_POST['item_definer'])) { + if (mb_strpos($_POST['item_definer'], '@') !== false ) { - $arr = explode('@', $_REQUEST['item_definer']); + $arr = explode('@', $_POST['item_definer']); $query .= 'DEFINER=' . Util::backquote($arr[0]); $query .= '@' . Util::backquote($arr[1]) . ' '; } else { @@ -491,36 +491,36 @@ class Triggers } } $query .= 'TRIGGER '; - if (! empty($_REQUEST['item_name'])) { - $query .= Util::backquote($_REQUEST['item_name']) . ' '; + if (! empty($_POST['item_name'])) { + $query .= Util::backquote($_POST['item_name']) . ' '; } else { $errors[] = __('You must provide a trigger name!'); } - if (! empty($_REQUEST['item_timing']) - && in_array($_REQUEST['item_timing'], $action_timings) + if (! empty($_POST['item_timing']) + && in_array($_POST['item_timing'], $action_timings) ) { - $query .= $_REQUEST['item_timing'] . ' '; + $query .= $_POST['item_timing'] . ' '; } else { $errors[] = __('You must provide a valid timing for the trigger!'); } - if (! empty($_REQUEST['item_event']) - && in_array($_REQUEST['item_event'], $event_manipulations) + if (! empty($_POST['item_event']) + && in_array($_POST['item_event'], $event_manipulations) ) { - $query .= $_REQUEST['item_event'] . ' '; + $query .= $_POST['item_event'] . ' '; } else { $errors[] = __('You must provide a valid event for the trigger!'); } $query .= 'ON '; - if (! empty($_REQUEST['item_table']) - && in_array($_REQUEST['item_table'], $this->dbi->getTables($db)) + if (! empty($_POST['item_table']) + && in_array($_POST['item_table'], $this->dbi->getTables($db)) ) { - $query .= Util::backquote($_REQUEST['item_table']); + $query .= Util::backquote($_POST['item_table']); } else { $errors[] = __('You must provide a valid table name!'); } $query .= ' FOR EACH ROW '; - if (! empty($_REQUEST['item_definition'])) { - $query .= $_REQUEST['item_definition']; + if (! empty($_POST['item_definition'])) { + $query .= $_POST['item_definition']; } else { $errors[] = __('You must provide a trigger definition.'); } diff --git a/libraries/classes/Server/Privileges.php b/libraries/classes/Server/Privileges.php index 801a8fef0e..ae81b16760 100644 --- a/libraries/classes/Server/Privileges.php +++ b/libraries/classes/Server/Privileges.php @@ -78,7 +78,7 @@ class Privileges public function getHtmlForUserGroupDialog($username, $is_menuswork) { $html = ''; - if (! empty($_REQUEST['edit_user_group_dialog']) && $is_menuswork) { + if (! empty($_GET['edit_user_group_dialog']) && $is_menuswork) { $dialog = $this->getHtmlToChooseUserGroup($username); $response = Response::getInstance(); if ($response->isAjax()) { @@ -1949,7 +1949,7 @@ class Privileges // similar logic in user_password.php $message = null; - if (empty($_REQUEST['nopass']) + if (empty($_POST['nopass']) && isset($_POST['pma_pw']) && isset($_POST['pma_pw2']) ) { @@ -1966,8 +1966,8 @@ class Privileges $serverType = Util::getServerType(); $serverVersion = $this->dbi->getVersion(); $authentication_plugin - = (isset($_REQUEST['authentication_plugin']) - ? $_REQUEST['authentication_plugin'] + = (isset($_POST['authentication_plugin']) + ? $_POST['authentication_plugin'] : $this->getCurrentAuthenticationPlugin( 'change', $username, @@ -2234,7 +2234,7 @@ class Privileges } /** - * Get HTML for addUsersForm, This function call if isset($_REQUEST['adduser']) + * Get HTML for addUsersForm, This function call if isset($_GET['adduser']) * * @param string $dbname database name * @@ -2915,9 +2915,13 @@ class Privileges break; } - $html .= ' href="server_privileges.php' - . Url::getCommon($params) - . '">'; + $html .= ' href="server_privileges.php'; + if ($linktype == 'revoke') { + $html .= '" data-post="' . Url::getCommon($params, ''); + } else { + $html .= Url::getCommon($params); + } + $html .= '">'; switch ($linktype) { case 'edit': @@ -3045,7 +3049,7 @@ class Privileges $extra_data['sql_query'] = Util::getMessage(null, $sql_query); } - if (isset($_REQUEST['change_copy'])) { + if (isset($_POST['change_copy'])) { /** * generate html on the fly for the new user that was just created. */ @@ -3057,7 +3061,7 @@ class Privileges . '&#27;' . htmlspecialchars($hostname) . '" />' . '' . "\n" . '' . "\n" . '' . htmlspecialchars($hostname) . '' . "\n"; @@ -3146,9 +3150,9 @@ class Privileges $extra_data['new_privileges'] = $new_privileges; } - if (isset($_REQUEST['validate_username'])) { + if (isset($_GET['validate_username'])) { $sql_query = "SELECT * FROM `mysql`.`user` WHERE `User` = '" - . $_REQUEST['username'] . "';"; + . $_GET['username'] . "';"; $res = $this->dbi->query($sql_query); $row = $this->dbi->fetchRow($res); if (empty($row)) { @@ -3868,7 +3872,7 @@ class Privileges return $this->template->render('server/privileges/initials_row', [ 'array_initials' => $array_initials, - 'initial' => isset($_REQUEST['initial']) ? $_REQUEST['initial'] : null, + 'initial' => isset($_GET['initial']) ? $_GET['initial'] : null, ]); } @@ -3936,7 +3940,7 @@ class Privileges if (empty($queries)) { $message = Message::error(__('No users selected for deleting!')); } else { - if ($_REQUEST['mode'] == 3) { + if ($_POST['mode'] == 3) { $queries[] = '# ' . __('Reloading the privileges') . ' …'; $queries[] = 'FLUSH PRIVILEGES;'; } @@ -4047,11 +4051,11 @@ class Privileges $queries = null; $password = null; - if (isset($_REQUEST['change_copy'])) { + if (isset($_POST['change_copy'])) { $user_host_condition = ' WHERE `User` = ' - . "'" . $this->dbi->escapeString($_REQUEST['old_username']) . "'" + . "'" . $this->dbi->escapeString($_POST['old_username']) . "'" . ' AND `Host` = ' - . "'" . $this->dbi->escapeString($_REQUEST['old_hostname']) . "';"; + . "'" . $this->dbi->escapeString($_POST['old_hostname']) . "';"; $row = $this->dbi->fetchSingleRow( 'SELECT * FROM `mysql`.`user` ' . $user_host_condition ); @@ -4060,7 +4064,7 @@ class Privileges $response->addHTML( Message::notice(__('No user found.'))->getDisplay() ); - unset($_REQUEST['change_copy']); + unset($_POST['change_copy']); } else { foreach ($row as $key => $value) { $GLOBALS[$key] = $value; @@ -4117,12 +4121,12 @@ class Privileges */ public function getDataForDeleteUsers($queries) { - if (isset($_REQUEST['change_copy'])) { + if (isset($_POST['change_copy'])) { $selected_usr = [ - $_REQUEST['old_username'] . '&#27;' . $_REQUEST['old_hostname'] + $_POST['old_username'] . '&#27;' . $_POST['old_hostname'] ]; } else { - $selected_usr = $_REQUEST['selected_usr']; + $selected_usr = $_POST['selected_usr']; $queries = []; } @@ -4144,7 +4148,7 @@ class Privileges . '\'@\'' . $this->dbi->escapeString($this_host) . '\';'; $this->relationCleanup->user($this_user); - if (isset($_REQUEST['drop_users_db'])) { + if (isset($_POST['drop_users_db'])) { $queries[] = 'DROP DATABASE IF EXISTS ' . Util::backquote($this_user) . ';'; $GLOBALS['reload'] = true; @@ -4161,7 +4165,7 @@ class Privileges public function updateMessageForReload() { $message = null; - if (isset($_REQUEST['flush_privileges'])) { + if (isset($_GET['flush_privileges'])) { $sql_query = 'FLUSH PRIVILEGES;'; $this->dbi->query($sql_query); $message = Message::success( @@ -4169,7 +4173,7 @@ class Privileges ); } - if (isset($_REQUEST['validate_username'])) { + if (isset($_GET['validate_username'])) { $message = Message::success(); } @@ -4226,7 +4230,7 @@ class Privileges $queries_for_display = null; $sql_query = null; - if (!isset($_REQUEST['adduser_submit']) && !isset($_REQUEST['change_copy'])) { + if (!isset($_POST['adduser_submit']) && !isset($_POST['change_copy'])) { return [ $message, $queries, $queries_for_display, $sql_query, $_add_user_error ]; @@ -4261,7 +4265,7 @@ class Privileges if ($this->dbi->fetchValue($sql) == 1) { $message = Message::error(__('The user %s already exists!')); $message->addParam('[em]\'' . $username . '\'@\'' . $hostname . '\'[/em]'); - $_REQUEST['adduser'] = true; + $_GET['adduser'] = true; $_add_user_error = true; return [ @@ -4282,7 +4286,7 @@ class Privileges (isset($password) ? $password : '') ); - if (empty($_REQUEST['change_copy'])) { + if (empty($_POST['change_copy'])) { $_error = false; if (! is_null($create_user_real)) { @@ -4290,10 +4294,10 @@ class Privileges $_error = true; } if (isset($password_set_real) && !empty($password_set_real) - && isset($_REQUEST['authentication_plugin']) + && isset($_POST['authentication_plugin']) ) { $this->setProperPasswordHashing( - $_REQUEST['authentication_plugin'] + $_POST['authentication_plugin'] ); if ($this->dbi->tryQuery($password_set_real)) { $sql_query .= $password_set_show; @@ -4310,8 +4314,8 @@ class Privileges $hostname, $dbname ); - if (!empty($_REQUEST['userGroup']) && $is_menuwork) { - $this->setUserGroup($GLOBALS['username'], $_REQUEST['userGroup']); + if (!empty($_POST['userGroup']) && $is_menuwork) { + $this->setUserGroup($GLOBALS['username'], $_POST['userGroup']); } return [ @@ -4325,8 +4329,8 @@ class Privileges // Copy the user group while copying a user $old_usergroup = - isset($_REQUEST['old_usergroup']) ? $_REQUEST['old_usergroup'] : null; - $this->setUserGroup($_REQUEST['username'], $old_usergroup); + isset($_POST['old_usergroup']) ? $_POST['old_usergroup'] : null; + $this->setUserGroup($_POST['username'], $old_usergroup); if (is_null($create_user_real)) { $queries[] = $create_user_real; @@ -4334,10 +4338,10 @@ class Privileges $queries[] = $real_sql_query; if (isset($password_set_real) && ! empty($password_set_real) - && isset($_REQUEST['authentication_plugin']) + && isset($_POST['authentication_plugin']) ) { $this->setProperPasswordHashing( - $_REQUEST['authentication_plugin'] + $_POST['authentication_plugin'] ); $queries[] = $password_set_real; @@ -4406,25 +4410,25 @@ class Privileges /** * Checks if a dropdown box has been used for selecting a database / table */ - if (Core::isValid($_REQUEST['pred_tablename'])) { - $tablename = $_REQUEST['pred_tablename']; + if (Core::isValid($_POST['pred_tablename'])) { + $tablename = $_POST['pred_tablename']; } elseif (Core::isValid($_REQUEST['tablename'])) { $tablename = $_REQUEST['tablename']; } else { unset($tablename); } - if (Core::isValid($_REQUEST['pred_routinename'])) { - $routinename = $_REQUEST['pred_routinename']; + if (Core::isValid($_POST['pred_routinename'])) { + $routinename = $_POST['pred_routinename']; } elseif (Core::isValid($_REQUEST['routinename'])) { $routinename = $_REQUEST['routinename']; } else { unset($routinename); } - if (isset($_REQUEST['pred_dbname'])) { + if (isset($_POST['pred_dbname'])) { $is_valid_pred_dbname = true; - foreach ($_REQUEST['pred_dbname'] as $key => $db_name) { + foreach ($_POST['pred_dbname'] as $key => $db_name) { if (! Core::isValid($db_name)) { $is_valid_pred_dbname = false; break; @@ -4449,7 +4453,7 @@ class Privileges } if (isset($is_valid_pred_dbname) && $is_valid_pred_dbname) { - $dbname = $_REQUEST['pred_dbname']; + $dbname = $_POST['pred_dbname']; // If dbname contains only one database. if (count($dbname) == 1) { $dbname = $dbname[0]; @@ -4518,14 +4522,14 @@ class Privileges { $export = '