Remove unused function from most export plugins: PMA_exportComment
[phpmyadmin.git] / server_variables.php
blob792bb99daea1864718f20c5e5beb231c51d7a6c4
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
8 /**
9 * no need for variables importing
10 * @ignore
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 /**
20 * Does the common work
22 require './libraries/server_common.inc.php';
24 /**
25 * Required to display documentation links
27 require './libraries/server_variables_doc.php';
29 /**
30 * Ajax request
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']) {
39 case 'getval':
40 $varValue = PMA_DBI_fetch_single_row('SHOW GLOBAL VARIABLES WHERE Variable_name="'.$_REQUEST['varName'].'";','NUM');
41 exit($varValue[1]);
42 break;
43 case 'setval':
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(
52 'success' => true,
53 'variable' => formatVariable($_REQUEST['varName'],$varValue[1])
56 exit(json_encode(array(
57 'success' => false,
58 'error' => __('Setting variable failed')
61 break;
66 /**
67 * Displays the links
69 require './libraries/server_links.inc.php';
72 /**
73 * Displays the sub-page heading
75 echo '<h2>' . "\n"
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')
79 . '</h2>' . "\n";
81 /**
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);
88 /**
89 * Displays the page
92 <script type="text/javascript">
93 pma_token = '<?php echo $_SESSION[' PMA_token ']; ?>';
94 url_query = '<?php echo str_replace('&amp;','&',$url_query);?>';
95 pma_theme_image = '<?php echo $GLOBALS['pmaThemeImage']; ?>';
96 isSuperuser = <?php echo PMA_isSuperuser()?'true':'false'; ?>;
97 </script>
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;" />
104 </div>
105 </fieldset>
106 <table id="serverVariables" class="data filteredData">
107 <thead>
108 <tr><th><?php echo __('Variable'); ?></th>
109 <th class="valueHeader">
110 <?php
111 echo __('Session value') . ' / ' . __('Global value');
113 </th>
114 <th><?php echo __('Documentation'); ?></th>
115 </tr>
116 </thead>
117 <tbody>
118 <?php
119 $odd_row = true;
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]);
128 ?></td>
129 <?php
130 if (isset($serverVarsSession[$name]) && $serverVarsSession[$name] != $value) {
132 </tr>
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>
137 <?php } ?>
138 </tr>
139 <?php
140 $odd_row = !$odd_row;
143 </tbody>
144 </table>
145 <?php
149 * Sends the footer
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);