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';
20 * Does the common work
22 require './libraries/server_common.inc.php';
25 * Required to display documentation links
27 require './libraries/server_variables_doc.php';
33 if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
34 // Send with correct charset
35 header('Content-Type: text/html; charset=UTF-8');
37 if (isset($_REQUEST['type'])) {
38 switch($_REQUEST['type']) {
40 $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.PMA_sqlAddslashes($_REQUEST['varName']).'";','NUM');
44 $value = PMA_sqlAddslashes($_REQUEST['varValue']);
45 if (!is_numeric($value)) $value="'".$value."'";
47 if (! preg_match("/[^a-zA-Z0-9_]+/",$_REQUEST['varName']) && PMA_DBI_query('SET GLOBAL '.$_REQUEST['varName'].' = '.$value))
48 // Some values are rounded down etc.
49 $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.PMA_sqlAddslashes($_REQUEST['varName']).'";','NUM');
51 exit(json_encode(array(
53 'variable' => formatVariable($_REQUEST['varName'],$varValue[1])
56 exit(json_encode(array(
58 'error' => __('Setting variable failed')
69 require './libraries/server_links.inc.php';
73 * Displays the sub-page heading
76 . ($cfg['MainPageIconic'] ?
'<img class="icon ic_s_vars" src="themes/dot.gif" alt="" />' : '')
77 . '' . __('Server variables and settings') . "\n"
78 . PMA_showMySQLDocu('server_system_variables','server_system_variables')
82 * Sends the queries and buffers the results
84 $serverVarsSession = PMA_DBI_fetch_result('SHOW SESSION VARIABLES;', 0, 1);
85 $serverVars = PMA_DBI_fetch_result('SHOW GLOBAL VARIABLES;', 0, 1);
92 <script type
="text/javascript">
93 pma_token
= '<?php echo $_SESSION[' PMA_token
']; ?>';
94 url_query
= '<?php echo str_replace('&
;','&',$url_query);?>';
95 isSuperuser
= <?php
echo PMA_isSuperuser()?
'true':'false'; ?
>;
98 <fieldset id
="tableFilter" style
="display:none;">
99 <legend
>Filters
</legend
>
100 <div
class="formelement">
101 <label
for="filterText">Containing the word
:</label
>
102 <input name
="filterText" type
="text" id
="filterText" style
="vertical-align: baseline;" />
105 <table id
="serverVariables" class="data filteredData">
107 <tr
><th
><?php
echo __('Variable'); ?
></th
>
108 <th
class="valueHeader">
110 echo __('Session value') . ' / ' . __('Global value');
113 <th
><?php
echo __('Documentation'); ?
></th
>
119 foreach ($serverVars as $name => $value) {
121 <tr
class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
122 <th nowrap
="nowrap"><?php
echo htmlspecialchars(str_replace('_', ' ', $name)); ?
></th
>
123 <td
class="value"><?php
echo formatVariable($name,$value); ?
></td
>
124 <td
class="value"><?php
125 if (isset($VARIABLE_DOC_LINKS[$name])) // To display variable documentation link
126 echo PMA_showMySQLDocu($VARIABLE_DOC_LINKS[$name][1], $VARIABLE_DOC_LINKS[$name][1], false, $VARIABLE_DOC_LINKS[$name][2] . '_' . $VARIABLE_DOC_LINKS[$name][0]);
129 if (isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value) {
132 <tr
class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?> ">
133 <td
>(<?php
echo __('Session value'); ?
>)</td
>
134 <td
class="value"><?php
echo formatVariable($name,$serverVarsSession[$name]); ?
></td
>
135 <td
class="value"></td
>
139 $odd_row = !$odd_row;
150 require './libraries/footer.inc.php';
152 function formatVariable($name,$value) {
153 global $VARIABLE_DOC_LINKS;
155 if (is_numeric($value)) {
156 if (isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte')
157 return '<abbr title="'.PMA_formatNumber($value, 0).'">'.implode(' ',PMA_formatByteDown($value,3,3)).'</abbr>';
158 else return PMA_formatNumber($value, 0);
160 return htmlspecialchars($value);