diff options
author | Rouslan Placella <rouslan@placella.com> | 2012-06-09 23:43:51 +0400 |
---|---|---|
committer | Rouslan Placella <rouslan@placella.com> | 2012-06-11 17:06:05 +0400 |
commit | 1871e8279e26c91deea2b0e642dbdd9de479492e (patch) | |
tree | 3838a4909ec08647918955713cef20b7d0783ad3 /server_variables.php | |
parent | 8b0f21aa0d38751b674abf949223b0085eb03c97 (diff) |
Fixed ajax responses in server_variable.php
Diffstat (limited to 'server_variables.php')
-rw-r--r-- | server_variables.php | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/server_variables.php b/server_variables.php index 7a5e1c49fe..59a3238bfa 100644 --- a/server_variables.php +++ b/server_variables.php @@ -33,11 +33,10 @@ require 'libraries/server_variables_doc.php'; if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { // Send with correct charset - header('Content-Type: text/html; charset=UTF-8'); - if (isset($_REQUEST['type'])) { switch($_REQUEST['type']) { case 'getval': + header('Content-Type: text/html; charset=UTF-8'); $varValue = PMA_DBI_fetch_single_row( 'SHOW GLOBAL VARIABLES WHERE Variable_name="' . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM' @@ -67,6 +66,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { $value="'" . $value . "'"; } + $response = PMA_Response::getInstance(); if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName']) && PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value) ) { @@ -75,25 +75,18 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { 'SHOW GLOBAL VARIABLES WHERE Variable_name="' . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM' ); - - exit( - json_encode( - array( - 'success' => true, - 'variable' => formatVariable($_REQUEST['varName'], $varValue[1]) - ) - ) + $response->addJSON( + 'variable', + formatVariable($_REQUEST['varName'], $varValue[1]) + ); + } else { + $response->isSuccess(false); + $response->addJSON( + 'error', + __('Setting variable failed') ); } - - exit( - json_encode( - array( - 'success' => false, - 'error' => __('Setting variable failed') - ) - ) - ); + exit; break; } } |