2 /* vim: set expandtab sw=4 ts=4 sts=4: */
9 * no need for variables importing
12 if (! defined('PMA_NO_VARIABLES_IMPORT')) {
13 define('PMA_NO_VARIABLES_IMPORT', true);
15 require_once './libraries/common.inc.php';
17 $GLOBALS['js_include'][] = 'server_variables.js';
19 PMA_AddJSCode('pma_token = \'' . $_SESSION[' PMA_token '] . "';\n" .
20 'is_superuser = ' . (PMA_isSuperuser() ?
'true' : 'false') . ";\n" .
21 'url_query = \'' . str_replace('&', '&', PMA_generate_common_url($db)) . "';\n");
25 * Does the common work
27 require './libraries/server_common.inc.php';
30 * Required to display documentation links
32 require './libraries/server_variables_doc.php';
38 if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
39 // Send with correct charset
40 header('Content-Type: text/html; charset=UTF-8');
42 if (isset($_REQUEST['type'])) {
43 switch($_REQUEST['type']) {
45 $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="' . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM');
49 $value = PMA_sqlAddslashes($_REQUEST['varValue']);
50 if (!is_numeric($value)) $value="'" . $value . "'";
52 if (! preg_match("/[^a-zA-Z0-9_]+/", $_REQUEST['varName']) && PMA_DBI_query('SET GLOBAL ' . $_REQUEST['varName'] . ' = ' . $value)) {
53 // Some values are rounded down etc.
54 $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="' . PMA_sqlAddslashes($_REQUEST['varName']) . '";', 'NUM');
56 exit(json_encode(array(
58 'variable' => formatVariable($_REQUEST['varName'], $varValue[1])
63 exit(json_encode(array(
65 'error' => __('Setting variable failed')
76 require './libraries/server_links.inc.php';
80 * Displays the sub-page heading
83 . ($cfg['MainPageIconic'] ?
'<img class="icon ic_s_vars" src="themes/dot.gif" alt="" />' : '')
84 . '' . __('Server variables and settings') . "\n"
85 . PMA_showMySQLDocu('server_system_variables','server_system_variables')
89 * Sends the queries and buffers the results
91 $serverVarsSession = PMA_DBI_fetch_result('SHOW SESSION VARIABLES;', 0, 1);
92 $serverVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1);
99 <fieldset id
="tableFilter" style
="display:none;">
100 <legend
>Filters
</legend
>
101 <div
class="formelement">
102 <label
for="filterText">Containing the word
:</label
>
103 <input name
="filterText" type
="text" id
="filterText" style
="vertical-align: baseline;" />
106 <table id
="serverVariables" class="data filteredData noclick">
108 <tr
><th
><?php
echo __('Variable'); ?
></th
>
109 <th
class="valueHeader">
111 echo __('Session value') . ' / ' . __('Global value');
114 <th
><?php
echo __('Documentation'); ?
></th
>
120 foreach ($serverVars as $name => $value) {
121 $has_session_value = isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value;
122 $row_class = ($odd_row ?
'odd' : 'even') . ' ' . ($has_session_value ?
'diffSession' : '');
124 <tr
class="<?php echo $row_class; ?>">
125 <th nowrap
="nowrap"><?php
echo htmlspecialchars(str_replace('_', ' ', $name)); ?
></th
>
126 <td
class="value"><?php
echo formatVariable($name,$value); ?
></td
>
127 <td
class="value"><?php
128 // To display variable documentation link
129 if (isset($VARIABLE_DOC_LINKS[$name]))
130 echo PMA_showMySQLDocu($VARIABLE_DOC_LINKS[$name][1], $VARIABLE_DOC_LINKS[$name][1], false, $VARIABLE_DOC_LINKS[$name][2] . '_' . $VARIABLE_DOC_LINKS[$name][0]);
133 if ($has_session_value) {
136 <tr
class="<?php echo $odd_row ? 'odd' : 'even'; ?> ">
137 <td
>(<?php
echo __('Session value'); ?
>)</td
>
138 <td
class="value"><?php
echo formatVariable($name,$serverVarsSession[$name]); ?
></td
>
139 <td
class="value"></td
>
143 $odd_row = ! $odd_row;
150 function formatVariable($name,$value)
152 global $VARIABLE_DOC_LINKS;
154 if (is_numeric($value)) {
155 if (isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte')
156 return '<abbr title="'.PMA_formatNumber($value, 0).'">'.implode(' ',PMA_formatByteDown($value,3,3)).'</abbr>';
157 else return PMA_formatNumber($value, 0);
159 return htmlspecialchars($value);
165 require './libraries/footer.inc.php';