diff --git a/js/server_status_monitor.js b/js/server_status_monitor.js index efc2f47ee7..7ad61eb1e3 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/libraries/classes/Server/Status/Monitor.php b/libraries/classes/Server/Status/Monitor.php index 111bee9c20..b040193be5 100644 --- a/libraries/classes/Server/Status/Monitor.php +++ b/libraries/classes/Server/Status/Monitor.php @@ -379,7 +379,7 @@ class Monitor */ public static function getJsonForChartingData() { - $ret = json_decode($_REQUEST['requiredData'], true); + $ret = json_decode($_POST['requiredData'], true); $statusVars = array(); $serverVars = array(); $sysinfo = $cpuload = $memory = 0; @@ -633,7 +633,7 @@ class Monitor public static function getJsonForLogDataTypeGeneral($start, $end) { $limitTypes = ''; - if (isset($_REQUEST['limitTypes']) && $_REQUEST['limitTypes']) { + if (isset($_POST['limitTypes']) && $_POST['limitTypes']) { $limitTypes = 'AND argument REGEXP \'^(INSERT|SELECT|UPDATE|DELETE)\' '; } @@ -652,8 +652,8 @@ class Monitor $insertTables = array(); $insertTablesFirst = -1; $i = 0; - $removeVars = isset($_REQUEST['removeVariables']) - && $_REQUEST['removeVariables']; + $removeVars = isset($_POST['removeVariables']) + && $_POST['removeVariables']; while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { preg_match('/^(\w+)\s/', $row['argument'], $match); @@ -753,15 +753,15 @@ class Monitor */ public static function getJsonForLoggingVars() { - if (isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) { - $value = $GLOBALS['dbi']->escapeString($_REQUEST['varValue']); + if (isset($_POST['varName']) && isset($_POST['varValue'])) { + $value = $GLOBALS['dbi']->escapeString($_POST['varValue']); if (! is_numeric($value)) { $value="'" . $value . "'"; } - if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])) { + if (! preg_match("/[^a-zA-Z0-9_]+/", $_POST['varName'])) { $GLOBALS['dbi']->query( - 'SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value + 'SET GLOBAL ' . $_POST['varName'] . ' = ' . $value ); } @@ -785,8 +785,8 @@ class Monitor { $return = array(); - if (strlen($_REQUEST['database']) > 0) { - $GLOBALS['dbi']->selectDb($_REQUEST['database']); + if (strlen($_POST['database']) > 0) { + $GLOBALS['dbi']->selectDb($_POST['database']); } if ($profiling = Util::profilingSupported()) { @@ -797,7 +797,7 @@ class Monitor $query = preg_replace( '/^(\s*SELECT)/i', '\\1 SQL_NO_CACHE', - $_REQUEST['query'] + $_POST['query'] ); $GLOBALS['dbi']->tryQuery($query); diff --git a/server_status_monitor.php b/server_status_monitor.php index a24d7cb283..ed547d5d5b 100644 --- a/server_status_monitor.php +++ b/server_status_monitor.php @@ -24,8 +24,8 @@ if ($response->isAjax()) { header('Content-Type: text/html; charset=UTF-8'); // real-time charting data - if (isset($_REQUEST['chart_data'])) { - switch($_REQUEST['type']) { + if (isset($_POST['chart_data'])) { + switch($_POST['type']) { case 'chartgrid': // Data for the monitor $ret = Monitor::getJsonForChartingData(); $response->addJSON('message', $ret); @@ -33,31 +33,31 @@ if ($response->isAjax()) { } } - if (isset($_REQUEST['log_data'])) { + if (isset($_POST['log_data'])) { - $start = intval($_REQUEST['time_start']); - $end = intval($_REQUEST['time_end']); + $start = intval($_POST['time_start']); + $end = intval($_POST['time_end']); - if ($_REQUEST['type'] == 'slow') { + if ($_POST['type'] == 'slow') { $return = Monitor::getJsonForLogDataTypeSlow($start, $end); $response->addJSON('message', $return); exit; } - if ($_REQUEST['type'] == 'general') { + if ($_POST['type'] == 'general') { $return = Monitor::getJsonForLogDataTypeGeneral($start, $end); $response->addJSON('message', $return); exit; } } - if (isset($_REQUEST['logging_vars'])) { + if (isset($_POST['logging_vars'])) { $loggingVars = Monitor::getJsonForLoggingVars(); $response->addJSON('message', $loggingVars); exit; } - if (isset($_REQUEST['query_analyzer'])) { + if (isset($_POST['query_analyzer'])) { $return = Monitor::getJsonForQueryAnalyzer(); $response->addJSON('message', $return); exit; diff --git a/test/classes/Server/Status/MonitorTest.php b/test/classes/Server/Status/MonitorTest.php index 842fe3b9d8..e4073cc8d2 100644 --- a/test/classes/Server/Status/MonitorTest.php +++ b/test/classes/Server/Status/MonitorTest.php @@ -35,10 +35,6 @@ class MonitorTest extends TestCase */ public function setUp() { - //$_REQUEST - $_REQUEST['log'] = "index1"; - $_REQUEST['pos'] = 3; - //$GLOBALS $GLOBALS['cfg']['MaxRows'] = 10; $GLOBALS['cfg']['ServerDefault'] = "server"; @@ -282,7 +278,7 @@ class MonitorTest extends TestCase */ public function testPMAGetJsonForLogDataTypeGeneral() { - $_REQUEST['limitTypes'] = true; + $_POST['limitTypes'] = true; //Mock DBI $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') @@ -342,7 +338,7 @@ class MonitorTest extends TestCase */ public function testPMAGetJsonForLoggingVars() { - $_REQUEST['varName'] = "varName"; + $_POST['varName'] = "varName"; //Mock DBI $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') @@ -377,8 +373,8 @@ class MonitorTest extends TestCase */ public function testPMAGetJsonForQueryAnalyzer() { - $_REQUEST['database'] = "database"; - $_REQUEST['query'] = 'query'; + $_POST['database'] = "database"; + $_POST['query'] = 'query'; $GLOBALS['server'] = 'server'; $GLOBALS['cached_affected_rows'] = 'cached_affected_rows'; $_SESSION['cache']['server_server']['profiling_supported'] = true;