Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadhura Jayaratne <madhura.cj@gmail.com>2015-11-17 10:59:17 +0300
committerMadhura Jayaratne <madhura.cj@gmail.com>2015-11-17 10:59:17 +0300
commitfd098ff80e7e7844eb5fd9a4ec832e069f2ace86 (patch)
tree4e9cdae4e650a58ed614494a64c1778f2570e507 /server_variables.php
parentad0ac35ff8b7e48481df06c52d733dab5d366bc1 (diff)
Refactor server variables page
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'server_variables.php')
-rw-r--r--server_variables.php109
1 files changed, 22 insertions, 87 deletions
diff --git a/server_variables.php b/server_variables.php
index 8c0091a030..ee4602af58 100644
--- a/server_variables.php
+++ b/server_variables.php
@@ -1,97 +1,32 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
+
/**
- * Server variables
+ * Handles server variables page.
*
* @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) {
+namespace PMA;
- $serverVarsSession = array();
- while ($arr = $GLOBALS['dbi']->fetchRow($serverVarsResult)) {
- $serverVarsSession[$arr[0]] = $arr[1];
- }
- $GLOBALS['dbi']->freeResult($serverVarsResult);
+use PMA\libraries\controllers\ServerVariablesController;
+use PMA\libraries\Response;
- $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()
- );
-}
+require_once 'libraries/common.inc.php';
-exit;
+$container = libraries\di\Container::getDefaultContainer();
+$container->factory(
+ 'PMA\libraries\controllers\ServerVariablesController'
+);
+$container->alias(
+ 'ServerVariablesController',
+ 'PMA\libraries\controllers\ServerVariablesController'
+);
+$container->set('PMA\libraries\Response', Response::getInstance());
+$container->alias('response', 'PMA\libraries\Response');
+
+/** @var ServerVariablesController $controller */
+$controller = $container->get(
+ 'ServerVariablesController', array()
+);
+$controller->indexAction();