Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server_collations.php3
-rw-r--r--server_databases.php15
-rw-r--r--server_engines.php18
-rw-r--r--server_export.php7
-rw-r--r--server_privileges.php11
-rw-r--r--server_status.php93
-rw-r--r--server_synchronize.php39
-rw-r--r--server_variables.php96
8 files changed, 161 insertions, 121 deletions
diff --git a/server_collations.php b/server_collations.php
index 5ce7643d74..076b79ca43 100644
--- a/server_collations.php
+++ b/server_collations.php
@@ -63,7 +63,8 @@ foreach ($mysql_charsets as $current_charset) {
. (empty($mysql_charsets_descriptions[$current_charset])
? ''
: ' (<i>' . htmlspecialchars(
- $mysql_charsets_descriptions[$current_charset]) . '</i>)' . "\n")
+ $mysql_charsets_descriptions[$current_charset]
+ ) . '</i>)' . "\n")
. ' </th>' . "\n"
. '</tr>' . "\n";
$odd_row = true;
diff --git a/server_databases.php b/server_databases.php
index 57ae0edfc0..7ad910fcfb 100644
--- a/server_databases.php
+++ b/server_databases.php
@@ -11,7 +11,7 @@
require_once 'libraries/common.inc.php';
require 'libraries/server_common.inc.php';
-if (!PMA_DRIZZLE) {
+if (! PMA_DRIZZLE) {
include_once 'libraries/replication.inc.php';
} else {
$replication_types = array();
@@ -57,7 +57,8 @@ if (empty($_REQUEST['sort_by'])) {
}
if (isset($_REQUEST['sort_order'])
- && strtolower($_REQUEST['sort_order']) == 'desc') {
+ && strtolower($_REQUEST['sort_order']) == 'desc'
+) {
$sort_order = 'desc';
} else {
$sort_order = 'asc';
@@ -78,7 +79,8 @@ if (isset($_REQUEST['drop_selected_dbs_x'])) {
}
if ((isset($_REQUEST['drop_selected_dbs']) || isset($_REQUEST['query_type']))
- && ($is_superuser || $cfg['AllowUserDropDatabase'])) {
+ && ($is_superuser || $cfg['AllowUserDropDatabase'])
+) {
if (! isset($_REQUEST['selected_dbs']) && ! isset($_REQUEST['query_type'])) {
$message = PMA_Message::error(__('No databases selected.'));
} else {
@@ -131,8 +133,9 @@ if ($cfg['ShowCreateDb']) {
* Gets the databases list
*/
if ($server > 0) {
- $databases = PMA_DBI_get_databases_full(null, $dbstats, null, $sort_by,
- $sort_order, $pos, true);
+ $databases = PMA_DBI_get_databases_full(
+ null, $dbstats, null, $sort_by, $sort_order, $pos, true
+ );
$databases_count = count($GLOBALS['pma']->databases);
} else {
$databases_count = 0;
@@ -203,7 +206,7 @@ if ($databases_count > 0) {
echo ' <th>'. $name .'</th>' . "\n";
}
- if ($is_superuser && !PMA_DRIZZLE) {
+ if ($is_superuser && ! PMA_DRIZZLE) {
echo ' <th>' . ($cfg['PropertiesIconic'] ? '' : __('Action')) . "\n"
. ' </th>' . "\n";
}
diff --git a/server_engines.php b/server_engines.php
index 19e484a0bb..1c26dc6942 100644
--- a/server_engines.php
+++ b/server_engines.php
@@ -27,7 +27,8 @@ require 'libraries/server_links.inc.php';
* Did the user request information about a certain storage engine?
*/
if (empty($_REQUEST['engine'])
- || ! PMA_StorageEngine::isValid($_REQUEST['engine'])) {
+ || ! PMA_StorageEngine::isValid($_REQUEST['engine'])
+) {
/**
* Displays the sub-page heading
@@ -70,7 +71,7 @@ if (empty($_REQUEST['engine'])
$odd_row = !$odd_row;
}
- unset($odd_row, $engine, $details);
+ unset($odd_row, $engine, $details);
echo '</tbody>' . "\n"
. '</table>' . "\n";
@@ -92,15 +93,15 @@ if (empty($_REQUEST['engine'])
. ' </em>' . "\n"
. '</p>' . "\n\n";
$infoPages = $engine_plugin->getInfoPages();
- if (!empty($infoPages) && is_array($infoPages)) {
+ if (! empty($infoPages) && is_array($infoPages)) {
echo '<p>' . "\n"
. ' <strong>[</strong>' . "\n";
if (empty($_REQUEST['page'])) {
echo ' <strong>' . __('Variables') . '</strong>' . "\n";
} else {
echo ' <a href="server_engines.php'
- . PMA_generate_common_url(array('engine' => $_REQUEST['engine'])) . '">'
- . __('Variables') . '</a>' . "\n";
+ . PMA_generate_common_url(array('engine' => $_REQUEST['engine']))
+ . '">' . __('Variables') . '</a>' . "\n";
}
foreach ($infoPages as $current => $label) {
echo ' <strong>|</strong>' . "\n";
@@ -109,7 +110,8 @@ if (empty($_REQUEST['engine'])
} else {
echo ' <a href="server_engines.php'
. PMA_generate_common_url(
- array('engine' => $_REQUEST['engine'], 'page' => $current))
+ array('engine' => $_REQUEST['engine'], 'page' => $current)
+ )
. '">' . htmlspecialchars($label) . '</a>' . "\n";
}
}
@@ -118,10 +120,10 @@ if (empty($_REQUEST['engine'])
. '</p>' . "\n\n";
}
unset($infoPages, $page_output);
- if (!empty($_REQUEST['page'])) {
+ if (! empty($_REQUEST['page'])) {
$page_output = $engine_plugin->getPage($_REQUEST['page']);
}
- if (!empty($page_output)) {
+ if (! empty($page_output)) {
echo $page_output;
} else {
echo '<p> ' . $engine_plugin->getSupportInformationMessage() . "\n"
diff --git a/server_export.php b/server_export.php
index f915ac0c3e..fa14bbb058 100644
--- a/server_export.php
+++ b/server_export.php
@@ -43,13 +43,16 @@ foreach ($GLOBALS['pma']->databases as $current_db) {
} else {
$is_selected = '';
}
- } elseif (!empty($selectall) || (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))) {
+ } elseif (! empty($selectall)
+ || (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))
+ ) {
$is_selected = ' selected="selected"';
} else {
$is_selected = '';
}
$current_db = htmlspecialchars($current_db);
- $multi_values .= ' <option value="' . $current_db . '"' . $is_selected . '>' . $current_db . '</option>' . "\n";
+ $multi_values .= ' <option value="' . $current_db . '"'
+ . $is_selected . '>' . $current_db . '</option>' . "\n";
} // end while
$multi_values .= "\n";
$multi_values .= '</select></div>';
diff --git a/server_privileges.php b/server_privileges.php
index a96eef03c2..1f70b38059 100644
--- a/server_privileges.php
+++ b/server_privileges.php
@@ -1649,14 +1649,15 @@ if (isset($_REQUEST['export']) || (isset($_REQUEST['submit_mult']) && $_REQUEST[
foreach ($_REQUEST['selected_usr'] as $export_user) {
$export_username = substr($export_user, 0, strpos($export_user, '&'));
$export_hostname = substr($export_user, strrpos($export_user, ';') + 1);
- $response .= '# ' .
- sprintf(__('Privileges for %s'),
- '`' . htmlspecialchars($export_username) . '`@`' . htmlspecialchars($export_hostname) . '`')
+ $response .= '# '
+ . sprintf(
+ __('Privileges for %s'),
+ '`' . htmlspecialchars($export_username) . '`@`' . htmlspecialchars($export_hostname) . '`'
+ )
. "\n\n";
$response .= PMA_getGrants($export_username, $export_hostname) . "\n";
}
- }
- else {
+ } else {
// export privileges for a single user
$title = __('User') . ' `' . htmlspecialchars($username) . '`@`' . htmlspecialchars($hostname) . '`';
$response .= PMA_getGrants($username, $hostname);
diff --git a/server_status.php b/server_status.php
index be4f8ac748..4c6c8ec589 100644
--- a/server_status.php
+++ b/server_status.php
@@ -40,8 +40,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($ret));
- // Query realtime chart
- case 'queries':
+ case 'queries': // Query realtime chart
if (PMA_DRIZZLE) {
$sql = "SELECT concat('Com_', variable_name), variable_value
FROM data_dictionary.GLOBAL_STATEMENTS
@@ -73,8 +72,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($ret));
- // Traffic realtime chart
- case 'traffic':
+ case 'traffic': // Traffic realtime chart
$traffic = PMA_DBI_fetch_result(
"SHOW GLOBAL STATUS
WHERE Variable_name = 'Bytes_received'
@@ -89,8 +87,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
exit(json_encode($ret));
- // Data for the monitor
- case 'chartgrid':
+ case 'chartgrid': // Data for the monitor
$ret = json_decode($_REQUEST['requiredData'], true);
$statusVars = array();
$serverVars = array();
@@ -113,13 +110,13 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
* Also do some white list filtering on the names
*/
case 'servervar':
- if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
+ if (! preg_match('/[^a-zA-Z_]+/', $pName)) {
$serverVars[] = $pName;
}
break;
case 'statusvar':
- if (!preg_match('/[^a-zA-Z_]+/', $pName)) {
+ if (! preg_match('/[^a-zA-Z_]+/', $pName)) {
$statusVars[] = $pName;
}
break;
@@ -144,9 +141,10 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
= $cpuload['idle'];
$ret[$chart_id][$node_id][$point_id]['busy']
= $cpuload['busy'];
- } else
+ } else {
$ret[$chart_id][$node_id][$point_id]['value']
= $cpuload['loadavg'];
+ }
break;
@@ -257,7 +255,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
break;
}
- if (!isset($return['sum'][$type])) {
+ if (! isset($return['sum'][$type])) {
$return['sum'][$type] = 0;
}
$return['sum'][$type] += $row['#'];
@@ -298,7 +296,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
preg_match('/^(\w+)\s/', $row['argument'], $match);
$type = strtolower($match[1]);
- if (!isset($return['sum'][$type])) {
+ if (! isset($return['sum'][$type])) {
$return['sum'][$type] = 0;
}
$return['sum'][$type] += $row['#'];
@@ -356,7 +354,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
if (isset($_REQUEST['logging_vars'])) {
if (isset($_REQUEST['varName']) && isset($_REQUEST['varValue'])) {
$value = PMA_sqlAddslashes($_REQUEST['varValue']);
- if (!is_numeric($value)) {
+ if (! is_numeric($value)) {
$value="'" . $value . "'";
}
@@ -464,7 +462,7 @@ if (isset($_REQUEST['flush'])) {
/**
* Kills a selected process
*/
-if (!empty($_REQUEST['kill'])) {
+if (! empty($_REQUEST['kill'])) {
if (PMA_DBI_try_query('KILL ' . $_REQUEST['kill'] . ';')) {
$message = PMA_Message::success(__('Thread %s was successfully killed.'));
} else {
@@ -1117,35 +1115,41 @@ function printServerTraffic()
<tr class="odd">
<th class="name"><?php echo __('Received'); ?></th>
<td class="value"><?php echo
- implode(' ',
- PMA_formatByteDown($server_status['Bytes_received'], 3, 1)); ?></td>
+ implode(
+ ' ', PMA_formatByteDown($server_status['Bytes_received'], 3, 1)
+ ); ?></td>
<td class="value"><?php echo
- implode(' ',
- PMA_formatByteDown(
- $server_status['Bytes_received'] * $hour_factor, 3, 1)); ?></td>
+ implode(
+ ' ', PMA_formatByteDown($server_status['Bytes_received'] * $hour_factor, 3, 1)
+ ); ?></td>
</tr>
<tr class="even">
<th class="name"><?php echo __('Sent'); ?></th>
<td class="value"><?php echo
- implode(' ',
- PMA_formatByteDown($server_status['Bytes_sent'], 3, 1)); ?></td>
+ implode(
+ ' ', PMA_formatByteDown($server_status['Bytes_sent'], 3, 1)
+ ); ?></td>
<td class="value"><?php echo
- implode(' ',
- PMA_formatByteDown(
- $server_status['Bytes_sent'] * $hour_factor, 3, 1)); ?></td>
+ implode(
+ ' ', PMA_formatByteDown($server_status['Bytes_sent'] * $hour_factor, 3, 1)
+ ); ?></td>
</tr>
<tr class="odd">
<th class="name"><?php echo __('Total'); ?></th>
<td class="value"><?php echo
- implode(' ',
+ implode(
+ ' ',
PMA_formatByteDown(
- $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1)
+ $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1
+ )
); ?></td>
<td class="value"><?php echo
- implode(' ',
+ implode(
+ ' ',
PMA_formatByteDown(
($server_status['Bytes_received'] + $server_status['Bytes_sent'])
- * $hour_factor, 3, 1)
+ * $hour_factor, 3, 1
+ )
); ?></td>
</tr>
</tbody>
@@ -1172,36 +1176,41 @@ function printServerTraffic()
<td class="value"><?php echo
PMA_formatNumber($server_status['Aborted_connects'], 4, 1, true); ?></td>
<td class="value"><?php echo
- PMA_formatNumber($server_status['Aborted_connects'] * $hour_factor,
- 4, 2, true); ?></td>
+ PMA_formatNumber(
+ $server_status['Aborted_connects'] * $hour_factor, 4, 2, true
+ ); ?></td>
<td class="value"><?php echo
$server_status['Connections'] > 0
- ? PMA_formatNumber(
+ ? PMA_formatNumber(
$server_status['Aborted_connects'] * 100 / $server_status['Connections'],
- 0, 2, true) . '%'
- : '--- '; ?></td>
+ 0, 2, true
+ ) . '%'
+ : '--- '; ?></td>
</tr>
<tr class="odd">
<th class="name"><?php echo __('Aborted'); ?></th>
<td class="value"><?php echo
PMA_formatNumber($server_status['Aborted_clients'], 4, 1, true); ?></td>
<td class="value"><?php echo
- PMA_formatNumber($server_status['Aborted_clients'] * $hour_factor,
- 4, 2, true); ?></td>
+ PMA_formatNumber(
+ $server_status['Aborted_clients'] * $hour_factor, 4, 2, true
+ ); ?></td>
<td class="value"><?php echo
$server_status['Connections'] > 0
- ? PMA_formatNumber(
+ ? PMA_formatNumber(
$server_status['Aborted_clients'] * 100 / $server_status['Connections'],
- 0, 2, true) . '%'
- : '--- '; ?></td>
+ 0, 2, true
+ ) . '%'
+ : '--- '; ?></td>
</tr>
<tr class="even">
<th class="name"><?php echo __('Total'); ?></th>
<td class="value"><?php echo
PMA_formatNumber($server_status['Connections'], 4, 0); ?></td>
<td class="value"><?php echo
- PMA_formatNumber($server_status['Connections'] * $hour_factor,
- 4, 2); ?></td>
+ PMA_formatNumber(
+ $server_status['Connections'] * $hour_factor, 4, 2
+ ); ?></td>
<td class="value"><?php echo
PMA_formatNumber(100, 0, 2); ?>%</td>
</tr>
@@ -1211,7 +1220,7 @@ function printServerTraffic()
$url_params = array();
- $show_full_sql = !empty($_REQUEST['full']);
+ $show_full_sql = ! empty($_REQUEST['full']);
if ($show_full_sql) {
$url_params['full'] = 1;
$full_text_link = 'server_status.php' . PMA_generate_common_url(array(), 'html', '?');
@@ -1576,7 +1585,7 @@ function printMonitor()
<?php echo PMA_getImage('s_cog.png'); ?>
<?php echo __('Settings'); ?>
</a>
- <?php if (!PMA_DRIZZLE) { ?>
+ <?php if (! PMA_DRIZZLE) { ?>
<a href="#monitorInstructionsDialog">
<?php echo PMA_getImage('b_help.png'); ?>
<?php echo __('Instructions/Setup'); ?>
@@ -1726,7 +1735,7 @@ function printMonitor()
<div id="emptyDialog" title="Dialog" style="display:none;">
</div>
- <?php if (!PMA_DRIZZLE) { ?>
+ <?php if (! PMA_DRIZZLE) { ?>
<div id="logAnalyseDialog" title="<?php echo __('Log statistics'); ?>" style="display:none;">
<p> <?php echo __('Selected time range:'); ?>
<input type="text" name="dateStart" class="datetimefield" value="" /> -
diff --git a/server_synchronize.php b/server_synchronize.php
index 68a859a24a..a9c4f19501 100644
--- a/server_synchronize.php
+++ b/server_synchronize.php
@@ -315,8 +315,9 @@ if ((isset($_REQUEST['submit_connect']))) {
* Calculating the number of updates for each matching table
*/
if (isset($update_array[$i]) && isset($update_array[$i][0])
- && !empty($matching_tables_keys[$i][0])
- && isset($update_array[$i][0][$matching_tables_keys[$i][0]])) {
+ && ! empty($matching_tables_keys[$i][0])
+ && isset($update_array[$i][0][$matching_tables_keys[$i][0]])
+ ) {
$num_of_updates = sizeof($update_array[$i]);
} else {
$num_of_updates = 0;
@@ -325,8 +326,9 @@ if ((isset($_REQUEST['submit_connect']))) {
* Calculating the number of insertions for each matching table
*/
if (isset($insert_array[$i]) && isset($insert_array[$i][0])
- && !empty($matching_tables_keys[$i])
- && isset($insert_array[$i][0][$matching_tables_keys[$i][0]])) {
+ && ! empty($matching_tables_keys[$i])
+ && isset($insert_array[$i][0][$matching_tables_keys[$i][0]])
+ ) {
$num_of_insertions = sizeof($insert_array[$i]);
} else {
$num_of_insertions = 0;
@@ -386,7 +388,7 @@ if ((isset($_REQUEST['submit_connect']))) {
*/
if ((isset($update_array[$i])
|| isset($insert_array[$i]))
- && !empty($matching_tables_keys[$i])
+ && ! empty($matching_tables_keys[$i])
) {
if (isset($update_array[$i][0][$matching_tables_keys[$i][0]])
|| isset($insert_array[$i][0][$matching_tables_keys[$i][0]])
@@ -839,7 +841,7 @@ if (isset($_REQUEST['Table_ids'])) {
$btn_structure_params = array($i, $num_alter_cols, $num_insert_cols,
$num_remove_cols, $num_add_index, $num_remove_index);
}
- if (!(in_array($i, $matching_table_data_diff))) {
+ if (! (in_array($i, $matching_table_data_diff))) {
if (isset($matching_tables_keys[$i][0])
&& isset($update_array[$i][0][$matching_tables_keys[$i][0]])
) {
@@ -1033,9 +1035,9 @@ if (isset($_REQUEST['synchronize_db'])) {
$target_indexes = $_SESSION['target_indexes'];
$uncommon_cols = $uncommon_columns;
- /**
- * Display success message.
- */
+ /**
+ * Display success message.
+ */
echo '<div class="success">'
. __('Target database has been synchronized with source database')
. '</div>';
@@ -1219,9 +1221,9 @@ if (! isset($_REQUEST['submit_connect'])
&& ! isset($_REQUEST['synchronize_db'])
&& ! isset($_REQUEST['Table_ids'])
) {
-/**
-* Displays the sub-page heading
-*/
+ /**
+ * Displays the sub-page heading
+ */
echo '<h2>' . PMA_getImage('s_sync.png') . __('Synchronize') .'</h2>';
echo '<div id="serverstatus">
@@ -1293,17 +1295,18 @@ if (! isset($_REQUEST['submit_connect'])
continue;
}
- if (!empty($tmp_server['verbose'])) {
+ if (! empty($tmp_server['verbose'])) {
$label = $tmp_server['verbose'];
} else {
$label = $tmp_server['host'];
- if (!empty($tmp_server['port'])) {
+ if (! empty($tmp_server['port'])) {
$label .= ':' . $tmp_server['port'];
}
}
if ($loaded_dbi == 'drizzle' && $tmp_server['extension'] != 'drizzle'
- || $loaded_dbi != 'drizzle' && $tmp_server['extension'] == 'drizzle') {
+ || $loaded_dbi != 'drizzle' && $tmp_server['extension'] == 'drizzle'
+ ) {
// incompatible connection protocols
$disabled = ' disabled="disabled"';
$value = '';
@@ -1377,9 +1380,9 @@ if (! isset($_REQUEST['submit_connect'])
unset($options_list);
}
echo '</td> </tr>
- </table>';
- }
- unset ($types, $type);
+ </table>';
+ }
+ unset ($types, $type);
echo '
</fieldset>
diff --git a/server_variables.php b/server_variables.php
index c5abf25de5..246d124a1d 100644
--- a/server_variables.php
+++ b/server_variables.php
@@ -34,46 +34,64 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
if (isset($_REQUEST['type'])) {
switch($_REQUEST['type']) {
- case 'getval':
- $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="' . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM');
- if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
- && $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte') {
- exit(implode(' ', PMA_formatByteDown($varValue[1], 3, 3)));
- }
- exit($varValue[1]);
- break;
-
- case 'setval':
- $value = $_REQUEST['varValue'];
-
- if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
- && $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
- && preg_match('/^\s*(\d+(\.\d+)?)\s*(mb|kb|mib|kib|gb|gib)\s*$/i', $value, $matches)) {
- $exp = array('kb' => 1, 'kib' => 1, 'mb' => 2, 'mib' => 2, 'gb' => 3, 'gib' => 3);
- $value = floatval($matches[1]) * pow(1024, $exp[strtolower($matches[3])]);
- } else {
- $value = PMA_sqlAddslashes($value);
- }
-
- if (! is_numeric($value)) $value="'" . $value . "'";
-
- if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName']) && PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value)) {
- // Some values are rounded down etc.
- $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="' . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM');
-
- exit(json_encode(array(
- 'success' => true,
- 'variable' => formatVariable($_REQUEST['varName'], $varValue[1])
- ))
- );
- }
-
- exit(json_encode(array(
- 'success' => false,
- 'error' => __('Setting variable failed')
- ))
+ case 'getval':
+ $varValue = PMA_DBI_fetch_single_row(
+ 'SHOW GLOBAL VARIABLES WHERE Variable_name="'
+ . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM'
+ );
+ if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
+ && $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
+ ) {
+ exit(implode(' ', PMA_formatByteDown($varValue[1], 3, 3)));
+ }
+ exit($varValue[1]);
+ break;
+
+ case 'setval':
+ $value = $_REQUEST['varValue'];
+
+ if (isset($VARIABLE_DOC_LINKS[$_REQUEST['varName']][3])
+ && $VARIABLE_DOC_LINKS[$_REQUEST['varName']][3] == 'byte'
+ && preg_match('/^\s*(\d+(\.\d+)?)\s*(mb|kb|mib|kib|gb|gib)\s*$/i', $value, $matches)
+ ) {
+ $exp = array('kb' => 1, 'kib' => 1, 'mb' => 2, 'mib' => 2, 'gb' => 3, 'gib' => 3);
+ $value = floatval($matches[1]) * pow(1024, $exp[strtolower($matches[3])]);
+ } else {
+ $value = PMA_sqlAddslashes($value);
+ }
+
+ if (! is_numeric($value)) {
+ $value="'" . $value . "'";
+ }
+
+ if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName'])
+ && PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value)
+ ) {
+ // Some values are rounded down etc.
+ $varValue = PMA_DBI_fetch_single_row(
+ 'SHOW GLOBAL VARIABLES WHERE Variable_name="'
+ . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM'
);
- break;
+
+ exit(
+ json_encode(
+ array(
+ 'success' => true,
+ 'variable' => formatVariable($_REQUEST['varName'], $varValue[1])
+ )
+ )
+ );
+ }
+
+ exit(
+ json_encode(
+ array(
+ 'success' => false,
+ 'error' => __('Setting variable failed')
+ )
+ )
+ );
+ break;
}
}
}