forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server_variables.php
97 lines (82 loc) · 2.29 KB
/
server_variables.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Server variables
*
* @package PhpMyAdmin
*/
use PMA\libraries\Message;
use PMA\libraries\Util;
require_once 'libraries/common.inc.php';
require_once 'libraries/server_variables.lib.php';
$response = PMA\libraries\Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('server_variables.js');
/**
* Does the common work
*/
require 'libraries/server_common.inc.php';
/**
* Array of documentation links
*/
$variable_doc_links = PMA_getArrayForDocumentLinks();
/**
* Ajax request
*/
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
if (isset($_REQUEST['type'])) {
if ($_REQUEST['type'] === 'getval') {
PMA_getAjaxReturnForGetVal($variable_doc_links);
} else if ($_REQUEST['type'] === 'setval') {
PMA_getAjaxReturnForSetVal($variable_doc_links);
}
exit;
}
}
/**
* Displays the sub-page heading
*/
$doc_link = PMA\libraries\Util::showMySQLDocu('server_system_variables');
$response->addHtml(PMA_getHtmlForSubPageHeader('variables', $doc_link));
/**
* Sends the queries and buffers the results
*/
$serverVarsResult = $GLOBALS['dbi']->tryQuery('SHOW SESSION VARIABLES;');
if ($serverVarsResult !== false) {
$serverVarsSession = array();
while ($arr = $GLOBALS['dbi']->fetchRow($serverVarsResult)) {
$serverVarsSession[$arr[0]] = $arr[1];
}
$GLOBALS['dbi']->freeResult($serverVarsResult);
$serverVars = $GLOBALS['dbi']->fetchResult('SHOW GLOBAL VARIABLES;', 0, 1);
/**
* Link templates
*/
$response->addHtml(PMA_getHtmlForLinkTemplates());
/**
* Displays the page
*/
$response->addHtml(
PMA_getHtmlForServerVariables(
$variable_doc_links, $serverVars, $serverVarsSession
)
);
} else {
/**
* Display the error message
*/
$response->addHTML(
Message::error(
sprintf(
__('Not enough privilege to view server variables and settings. %s'),
Util::showMySQLDocu(
'server-system-variables',
false,
'sysvar_show_compatibility_56'
)
)
)->getDisplay()
);
}
exit;