Retrieve parameters from $_POST in server_status_monitor.php
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
58e18b57c3
commit
73a0af6287
@ -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 @@ 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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user