Skip to content
Permalink
Browse files

Retrieve parameters from $_POST in server_status_monitor.php

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
  • Loading branch information...
mauriciofauth committed Nov 10, 2018
1 parent d1d90b5 commit a98207c6de3bde433602273d1cccc7f2f99d7501
@@ -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),
@@ -379,7 +379,7 @@ public static function getHtmlForClientSideDataAndLinks(Data $serverStatusData)
*/
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 @@ public static function getJsonForLogDataTypeSlow($start, $end)
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 @@ public static function getJsonForLogDataTypeGeneral($start, $end)
$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 @@ public static function getSuspensionPoints($lastChar)
*/
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 @@ public static function getJsonForQueryAnalyzer()
{
$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 @@ public static function getJsonForQueryAnalyzer()
$query = preg_replace(
'/^(\s*SELECT)/i',
'\\1 SQL_NO_CACHE',
$_REQUEST['query']
$_POST['query']
);
$GLOBALS['dbi']->tryQuery($query);
@@ -24,40 +24,40 @@
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);
exit;
}
}
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;
@@ -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 @@ public function testPMAGetJsonForLogDataTypeSlow()
*/
public function testPMAGetJsonForLogDataTypeGeneral()
{
$_REQUEST['limitTypes'] = true;
$_POST['limitTypes'] = true;
//Mock DBI
$dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
@@ -342,7 +338,7 @@ public function testPMAGetJsonForLogDataTypeGeneral()
*/
public function testPMAGetJsonForLoggingVars()
{
$_REQUEST['varName'] = "varName";
$_POST['varName'] = "varName";
//Mock DBI
$dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
@@ -377,8 +373,8 @@ public function testPMAGetJsonForLoggingVars()
*/
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;

0 comments on commit a98207c

Please sign in to comment.
You can’t perform that action at this time.