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="'.$_REQUEST['varName'].'";','NUM');
44 $value = $_REQUEST['varValue'];
45 if(!is_numeric($value)) $value="'".$value."'";
47 if(PMA_DBI_query('SET GLOBAL '.PMA_backquote($_REQUEST['varName']).' = '.$value))
48 // Some values are rounded down etc.
49 $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.$_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" src="' . $pmaThemeImage . 's_vars.png" width="16" height="16" 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 pma_theme_image
= '<?php echo $GLOBALS['pmaThemeImage
']; ?>';
96 isSuperuser
= <?php
echo PMA_isSuperuser()?
'true':'false'; ?
>;
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">
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) {
122 <tr
class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?>">
123 <th nowrap
="nowrap"><?php
echo htmlspecialchars(str_replace('_', ' ', $name)); ?
></th
>
124 <td
class="value"><?php
echo formatVariable($name,$value); ?
></td
>
125 <td
class="value"><?php
126 if (isset($VARIABLE_DOC_LINKS[$name])) // To display variable documentation link
127 echo PMA_showMySQLDocu($VARIABLE_DOC_LINKS[$name][1], $VARIABLE_DOC_LINKS[$name][1], false, $VARIABLE_DOC_LINKS[$name][2] . '_' . $VARIABLE_DOC_LINKS[$name][0]);
130 if (isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value) {
133 <tr
class="noclick <?php echo $odd_row ? 'odd' : 'even'; ?> ">
134 <td
>(<?php
echo __('Session value'); ?
>)</td
>
135 <td
class="value"><?php
echo formatVariable($name,$serverVarsSession[$name]); ?
></td
>
136 <td
class="value"></td
>
140 $odd_row = !$odd_row;
151 require './libraries/footer.inc.php';
153 function formatVariable($name,$value) {
154 global $VARIABLE_DOC_LINKS;
156 if (is_numeric($value)) {
157 if(isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte')
158 return '<abbr title="'.PMA_formatNumber($value, 0).'">'.implode(' ',PMA_formatByteDown($value,3,3)).'</abbr>';
159 else return PMA_formatNumber($value, 0);
161 return htmlspecialchars($value);