summaryrefslogtreecommitdiff
path: root/hugo/setup
diff options
context:
space:
mode:
authorTristan Zur <tzur@web.web.ccwn.org>2014-03-27 22:27:47 +0100
committerTristan Zur <tzur@web.web.ccwn.org>2014-03-27 22:27:47 +0100
commitb62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch)
tree86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /hugo/setup
Initial commit of intern.ccwn.org contentsHEADmaster
Diffstat (limited to 'hugo/setup')
-rw-r--r--hugo/setup/ajax.js11
-rw-r--r--hugo/setup/config.php78
-rw-r--r--hugo/setup/frames/config.inc.php48
-rw-r--r--hugo/setup/frames/form.inc.php36
-rw-r--r--hugo/setup/frames/index.inc.php276
-rw-r--r--hugo/setup/frames/menu.inc.php23
-rw-r--r--hugo/setup/frames/servers.inc.php49
-rw-r--r--hugo/setup/index.php60
-rw-r--r--hugo/setup/lib/ConfigGenerator.class.php154
-rw-r--r--hugo/setup/lib/common.inc.php56
-rw-r--r--hugo/setup/lib/form_processing.lib.php62
-rw-r--r--hugo/setup/lib/index.lib.php605
-rw-r--r--hugo/setup/scripts.js204
-rw-r--r--hugo/setup/styles.css631
-rw-r--r--hugo/setup/validate.php30
15 files changed, 2323 insertions, 0 deletions
diff --git a/hugo/setup/ajax.js b/hugo/setup/ajax.js
new file mode 100644
index 0000000..98d985a
--- /dev/null
+++ b/hugo/setup/ajax.js
@@ -0,0 +1,11 @@
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Dummy implementation of the ajax page loader
+ */
+var AJAX = {
+ registerOnload: function (idx, func) {
+ $(document).ready(func);
+ },
+ registerTeardown: function (idx, func) {
+ }
+};
diff --git a/hugo/setup/config.php b/hugo/setup/config.php
new file mode 100644
index 0000000..e923211
--- /dev/null
+++ b/hugo/setup/config.php
@@ -0,0 +1,78 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Front controller for config view / download and clear
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+/**
+ * Core libraries.
+ */
+require './lib/common.inc.php';
+require_once './libraries/config/Form.class.php';
+require_once './libraries/config/FormDisplay.class.php';
+require_once './setup/lib/ConfigGenerator.class.php';
+
+require './libraries/config/setup.forms.php';
+
+$form_display = new FormDisplay();
+$form_display->registerForm('_config.php', $forms['_config.php']);
+$form_display->save('_config.php');
+$config_file_path = ConfigFile::getInstance()->getFilePath();
+
+if (isset($_POST['eol'])) {
+ $_SESSION['eol'] = ($_POST['eol'] == 'unix') ? 'unix' : 'win';
+}
+
+if (PMA_ifSetOr($_POST['submit_clear'], '')) {
+ //
+ // Clear current config and return to main page
+ //
+ ConfigFile::getInstance()->resetConfigData();
+ // drop post data
+ header('HTTP/1.1 303 See Other');
+ header('Location: index.php');
+ exit;
+} elseif (PMA_ifSetOr($_POST['submit_download'], '')) {
+ //
+ // Output generated config file
+ //
+ PMA_downloadHeader('config.inc.php', 'text/plain');
+ echo ConfigGenerator::getConfigFile();
+ exit;
+} elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
+ //
+ // Save generated config file on the server
+ //
+ file_put_contents($config_file_path, ConfigGenerator::getConfigFile());
+ header('HTTP/1.1 303 See Other');
+ header('Location: index.php?action_done=config_saved');
+ exit;
+} elseif (PMA_ifSetOr($_POST['submit_load'], '')) {
+ //
+ // Load config file from the server
+ //
+ $cfg = array();
+ include_once $config_file_path;
+ ConfigFile::getInstance()->setConfigData($cfg);
+ header('HTTP/1.1 303 See Other');
+ header('Location: index.php');
+ exit;
+} elseif (PMA_ifSetOr($_POST['submit_delete'], '')) {
+ //
+ // Delete config file on the server
+ //
+ @unlink($config_file_path);
+ header('HTTP/1.1 303 See Other');
+ header('Location: index.php');
+ exit;
+} else {
+ //
+ // Show generated config file in a <textarea>
+ //
+ header('HTTP/1.1 303 See Other');
+ header('Location: index.php?page=config');
+ exit;
+}
+?>
diff --git a/hugo/setup/frames/config.inc.php b/hugo/setup/frames/config.inc.php
new file mode 100644
index 0000000..c409c64
--- /dev/null
+++ b/hugo/setup/frames/config.inc.php
@@ -0,0 +1,48 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Config file view and save screen
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+if (!defined('PHPMYADMIN')) {
+ exit;
+}
+
+/**
+ * Core libraries.
+ */
+require_once './libraries/config/FormDisplay.class.php';
+require_once './setup/lib/index.lib.php';
+require_once './setup/lib/ConfigGenerator.class.php';
+
+$config_readable = false;
+$config_writable = false;
+$config_exists = false;
+check_config_rw($config_readable, $config_writable, $config_exists);
+?>
+<h2><?php echo __('Configuration file') ?></h2>
+<?php PMA_displayFormTop('config.php'); ?>
+<input type="hidden" name="eol" value="<?php echo htmlspecialchars(PMA_ifSetOr($_GET['eol'], 'unix')) ?>" />
+<?php PMA_displayFieldsetTop('', '', null, array('class' => 'simple')); ?>
+<tr>
+ <td>
+ <textarea cols="50" rows="20" name="textconfig" id="textconfig" spellcheck="false"><?php
+ echo htmlspecialchars(ConfigGenerator::getConfigFile())
+ ?></textarea>
+ </td>
+</tr>
+<tr>
+ <td class="lastrow" style="text-align: left">
+ <input type="submit" name="submit_download" value="<?php echo __('Download') ?>" class="green" />
+ <input type="submit" name="submit_save" value="<?php echo __('Save') ?>"<?php
+if (!$config_writable) {
+ echo ' disabled="disabled"';
+} ?> />
+ </td>
+</tr>
+<?php
+PMA_displayFieldsetBottomSimple();
+PMA_displayFormBottom();
+?>
diff --git a/hugo/setup/frames/form.inc.php b/hugo/setup/frames/form.inc.php
new file mode 100644
index 0000000..cf188eb
--- /dev/null
+++ b/hugo/setup/frames/form.inc.php
@@ -0,0 +1,36 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Form edit view
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+if (!defined('PHPMYADMIN')) {
+ exit;
+}
+
+/**
+ * Core libraries.
+ */
+require_once './libraries/config/Form.class.php';
+require_once './libraries/config/FormDisplay.class.php';
+require_once './setup/lib/form_processing.lib.php';
+
+require './libraries/config/setup.forms.php';
+
+$formset_id = filter_input(INPUT_GET, 'formset');
+$mode = filter_input(INPUT_GET, 'mode');
+if (! isset($forms[$formset_id])) {
+ PMA_fatalError(__('Incorrect formset, check $formsets array in setup/frames/form.inc.php'));
+}
+
+if (isset($GLOBALS['strConfigFormset_' . $formset_id])) {
+ echo '<h2>' . $GLOBALS['strConfigFormset_' . $formset_id] . '</h2>';
+}
+$form_display = new FormDisplay();
+foreach ($forms[$formset_id] as $form_name => $form) {
+ $form_display->registerForm($form_name, $form);
+}
+process_formset($form_display);
+?>
diff --git a/hugo/setup/frames/index.inc.php b/hugo/setup/frames/index.inc.php
new file mode 100644
index 0000000..ddc6af5
--- /dev/null
+++ b/hugo/setup/frames/index.inc.php
@@ -0,0 +1,276 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Overview (main page)
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+if (!defined('PHPMYADMIN')) {
+ exit;
+}
+
+/**
+ * Core libraries.
+ */
+require_once './libraries/display_select_lang.lib.php';
+require_once './libraries/config/FormDisplay.class.php';
+require_once './setup/lib/index.lib.php';
+
+// prepare unfiltered language list
+$all_languages = PMA_langList();
+uasort($all_languages, 'PMA_languageCmp');
+
+$cf = ConfigFile::getInstance();
+$separator = PMA_get_arg_separator('html');
+
+// message handling
+messages_begin();
+
+//
+// Check phpMyAdmin version
+//
+if (isset($_GET['version_check'])) {
+ PMA_version_check();
+}
+
+//
+// Perform various security, compatibility and consistency checks
+//
+perform_config_checks();
+
+//
+// Check whether we can read/write configuration
+//
+$config_readable = false;
+$config_writable = false;
+$config_exists = false;
+check_config_rw($config_readable, $config_writable, $config_exists);
+if (!$config_writable || !$config_readable) {
+ messages_set(
+ 'error', 'config_rw', __('Cannot load or save configuration'),
+ PMA_lang(__('Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [doc@setup_script]documentation[/doc]. Otherwise you will be only able to download or display it.'))
+ );
+}
+//
+// Check https connection
+//
+$is_https = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
+if (!$is_https) {
+ $text = __('You are not using a secure connection; all data (including potentially sensitive information, like passwords) is transferred unencrypted!');
+
+ if (!empty($_SERVER['REQUEST_URI']) && !empty($_SERVER['HTTP_HOST'])) {
+ $link = 'https://' . htmlspecialchars($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+ $strInsecureConnectionMsg2 = __('If your server is also configured to accept HTTPS requests follow [a@%s]this link[/a] to use a secure connection.');
+ $strInsecureConnectionMsg2 = sprintf($strInsecureConnectionMsg2, $link);
+ $text .= ' ' . PMA_lang($strInsecureConnectionMsg2);
+ }
+ messages_set('notice', 'no_https', __('Insecure connection'), $text);
+}
+?>
+
+<form id="select_lang" method="post" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']) ?>">
+ <?php echo PMA_generate_common_hidden_inputs() ?>
+ <bdo lang="en" dir="ltr"><label for="lang">
+ <?php echo __('Language') . (__('Language') != 'Language' ? ' - Language' : '') ?>
+ </label></bdo><br />
+ <select id="lang" name="lang" class="autosubmit" lang="en" dir="ltr">
+ <?php
+ // create language list
+ $lang_list = array();
+ foreach ($all_languages as $each_lang_key => $each_lang) {
+ $lang_name = PMA_langName($each_lang);
+ //Is current one active?
+ $selected = ($GLOBALS['lang'] == $each_lang_key) ? ' selected="selected"' : '';
+ echo '<option value="' . $each_lang_key . '"' . $selected . '>' . $lang_name
+ . '</option>' . "\n";
+ }
+ ?>
+ </select>
+</form>
+
+<?php
+// Check for done action info and set notice message if present
+switch ($action_done) {
+case 'config_saved':
+ /* Use uniqid to display this message every time configuration is saved */
+ messages_set(
+ 'notice', uniqid('config_saved'), __('Configuration saved.'),
+ PMA_lang(__('Configuration saved to file config/config.inc.php in phpMyAdmin top level directory, copy it to top level one and delete directory config to use it.'))
+ );
+ break;
+default:
+ break;
+}
+?>
+
+<h2><?php echo __('Overview') ?></h2>
+
+<?php
+// message handling
+messages_end();
+messages_show_html();
+?>
+
+<a href="#" id="show_hidden_messages" style="display:none"><?php echo __('Show hidden messages (#MSG_COUNT)') ?></a>
+
+<fieldset class="simple"><legend><?php echo __('Servers') ?></legend>
+<?php
+//
+// Display server list
+//
+PMA_displayFormTop(
+ 'index.php', 'get',
+ array(
+ 'page' => 'servers',
+ 'mode' => 'add'
+ )
+);
+?>
+<div class="form">
+<?php if ($cf->getServerCount() > 0) { ?>
+<table cellspacing="0" class="datatable" style="table-layout: fixed">
+<tr>
+ <th>#</th>
+ <th><?php echo __('Name') ?></th>
+ <th><?php echo __('Authentication type') ?></th>
+ <th colspan="2">DSN</th>
+</tr>
+<?php foreach ($cf->getServers() as $id => $server) { ?>
+<tr>
+ <td><?php echo $id ?></td>
+ <td><?php echo htmlspecialchars($cf->getServerName($id)) ?></td>
+ <td><?php echo htmlspecialchars($cf->getValue("Servers/$id/auth_type")) ?></td>
+ <td><?php echo htmlspecialchars($cf->getServerDSN($id)) ?></td>
+ <td style="white-space: nowrap">
+ <small>
+ <a href="<?php echo "?page=servers{$separator}mode=edit{$separator}id=$id" ?>"><?php echo __('Edit') ?></a>
+ | <a href="<?php echo "?page=servers{$separator}mode=remove{$separator}id=$id" ?>"><?php echo __('Delete') ?></a>
+ </small>
+ </td>
+</tr>
+<?php } ?>
+</table>
+<?php } else { ?>
+<table width="100%">
+<tr>
+ <td>
+ <i><?php echo __('There are no configured servers') ?></i>
+ </td>
+</tr>
+</table>
+<?php } ?>
+<table width="100%">
+<tr>
+ <td class="lastrow" style="text-align: left">
+ <input type="submit" name="submit" value="<?php echo __('New server') ?>" />
+ </td>
+</tr>
+</table>
+</div>
+<?php
+PMA_displayFormBottom();
+?>
+</fieldset>
+
+<fieldset class="simple"><legend><?php echo __('Configuration file') ?></legend>
+<?php
+//
+// Display config file settings and load/save form
+//
+$form_display = new FormDisplay();
+
+PMA_displayFormTop('config.php');
+?>
+<table width="100%" cellspacing="0">
+<?php
+
+// Display language list
+$opts = array(
+ 'doc' => $form_display->getDocLink('DefaultLang'),
+ 'wiki' => $form_display->getWikiLink('DefaultLang'),
+ 'values' => array(),
+ 'values_escaped' => true);
+foreach ($all_languages as $each_lang_key => $each_lang) {
+ $lang_name = PMA_langName($each_lang);
+ $opts['values'][$each_lang_key] = $lang_name;
+}
+PMA_displayInput(
+ 'DefaultLang', __('Default language'), 'select',
+ $cf->getValue('DefaultLang'), '', true, $opts
+);
+
+// Display server list
+$opts = array(
+ 'doc' => $form_display->getDocLink('ServerDefault'),
+ 'wiki' => $form_display->getWikiLink('ServerDefault'),
+ 'values' => array(),
+ 'values_disabled' => array());
+if ($cf->getServerCount() > 0) {
+ $opts['values']['0'] = __('let the user choose');
+ $opts['values']['-'] = '------------------------------';
+ if ($cf->getServerCount() == 1) {
+ $opts['values_disabled'][] = '0';
+ }
+ $opts['values_disabled'][] = '-';
+
+ foreach ($cf->getServers() as $id => $server) {
+ $opts['values'][(string)$id] = $cf->getServerName($id) . " [$id]";
+ }
+} else {
+ $opts['values']['1'] = __('- none -');
+ $opts['values_escaped'] = true;
+}
+PMA_displayInput(
+ 'ServerDefault', __('Default server'), 'select',
+ $cf->getValue('ServerDefault'), '', true, $opts
+);
+
+// Display EOL list
+$opts = array(
+ 'values' => array(
+ 'unix' => 'UNIX / Linux (\n)',
+ 'win' => 'Windows (\r\n)'),
+ 'values_escaped' => true);
+$eol = PMA_ifSetOr($_SESSION['eol'], (PMA_IS_WINDOWS ? 'win' : 'unix'));
+PMA_displayInput(
+ 'eol', __('End of line'), 'select',
+ $eol, '', true, $opts
+);
+?>
+<tr>
+ <td colspan="2" class="lastrow" style="text-align: left">
+ <input type="submit" name="submit_display" value="<?php echo __('Display') ?>" />
+ <input type="submit" name="submit_download" value="<?php echo __('Download') ?>" />
+ &nbsp; &nbsp;
+ <input type="submit" name="submit_save" value="<?php echo __('Save') ?>"<?php
+if (!$config_writable) {
+ echo ' disabled="disabled"';
+} ?> />
+ <input type="submit" name="submit_load" value="<?php echo __('Load') ?>"<?php
+if (!$config_exists) {
+ echo ' disabled="disabled"';
+} ?> />
+ <input type="submit" name="submit_delete" value="<?php echo __('Delete')
+ ?>"<?php
+if (!$config_exists || !$config_writable) {
+ echo ' disabled="disabled"';
+} ?> />
+ &nbsp; &nbsp;
+ <input type="submit" name="submit_clear" value="<?php echo __('Clear')
+ ?>" class="red" />
+ </td>
+</tr>
+</table>
+<?php
+PMA_displayFormBottom();
+?>
+</fieldset>
+<div id="footer">
+ <a href="http://phpmyadmin.net"><?php echo __('phpMyAdmin homepage') ?></a>
+ <a href="http://sourceforge.net/donate/index.php?group_id=23067"><?php
+ echo __('Donate') ?></a>
+ <a href="?version_check=1<?php
+ echo "{$separator}token="
+ . $_SESSION[' PMA_token '] ?>"><?php echo __('Check for latest version') ?></a>
+</div>
diff --git a/hugo/setup/frames/menu.inc.php b/hugo/setup/frames/menu.inc.php
new file mode 100644
index 0000000..69563a2
--- /dev/null
+++ b/hugo/setup/frames/menu.inc.php
@@ -0,0 +1,23 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Menu items
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+if (!defined('PHPMYADMIN')) {
+ exit;
+}
+
+$separator = PMA_get_arg_separator('html');
+?>
+<ul>
+ <li><a href="index.php"><?php echo __('Overview') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Features"><?php echo __('Features') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Sql_queries"><?php echo __('SQL queries') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Navi_panel"><?php echo __('Navigation panel') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Main_panel"><?php echo __('Main panel') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Import"><?php echo __('Import') ?></a></li>
+ <li><a href="?page=form<?php echo $separator ?>formset=Export"><?php echo __('Export') ?></a></li>
+</ul>
diff --git a/hugo/setup/frames/servers.inc.php b/hugo/setup/frames/servers.inc.php
new file mode 100644
index 0000000..d28a17d
--- /dev/null
+++ b/hugo/setup/frames/servers.inc.php
@@ -0,0 +1,49 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Server create and edit view
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+if (!defined('PHPMYADMIN')) {
+ exit;
+}
+
+/**
+ * Core libraries.
+ */
+require_once './libraries/config/Form.class.php';
+require_once './libraries/config/FormDisplay.class.php';
+require_once './setup/lib/form_processing.lib.php';
+
+require './libraries/config/setup.forms.php';
+
+$mode = filter_input(INPUT_GET, 'mode');
+$id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
+
+$cf = ConfigFile::getInstance();
+$server_exists = !empty($id) && $cf->get("Servers/$id") !== null;
+
+if ($mode == 'edit' && $server_exists) {
+ $page_title = __('Edit server')
+ . ' ' . $id . ' <small>(' . htmlspecialchars($cf->getServerDSN($id)) . ')</small>';
+} elseif ($mode == 'remove' && $server_exists) {
+ $cf->removeServer($id);
+ header('Location: index.php');
+ exit;
+} elseif ($mode == 'revert' && $server_exists) {
+ // handled by process_formset()
+} else {
+ $page_title = __('Add a new server');
+ $id = 0;
+}
+if (isset($page_title)) {
+ echo '<h2>' . $page_title . '</h2>';
+}
+$form_display = new FormDisplay();
+foreach ($forms['Servers'] as $form_name => $form) {
+ $form_display->registerForm($form_name, $form, $id);
+}
+process_formset($form_display);
+?>
diff --git a/hugo/setup/index.php b/hugo/setup/index.php
new file mode 100644
index 0000000..373825b
--- /dev/null
+++ b/hugo/setup/index.php
@@ -0,0 +1,60 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Front controller for setup script
+ *
+ * @package PhpMyAdmin-Setup
+ * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
+ */
+
+/**
+ * Core libraries.
+ */
+require './lib/common.inc.php';
+
+$page = filter_input(INPUT_GET, 'page');
+$page = preg_replace('/[^a-z]/', '', $page);
+if ($page === '') {
+ $page = 'index';
+}
+if (!file_exists("./setup/frames/$page.inc.php")) {
+ // it will happen only when entering URL by hand, we don't care for these cases
+ PMA_fatalError(__('Wrong GET file attribute value'));
+}
+
+// Handle done action info
+$action_done = filter_input(INPUT_GET, 'action_done');
+$action_done = preg_replace('/[^a-z_]/', '', $action_done);
+
+PMA_noCacheHeader();
+
+?>
+<!DOCTYPE HTML>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta charset="utf-8" />
+<title>phpMyAdmin setup</title>
+<link href="../favicon.ico" rel="icon" type="image/x-icon" />
+<link href="../favicon.ico" rel="shortcut icon" type="image/x-icon" />
+<link href="styles.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="../js/jquery/jquery-1.8.3.min.js"></script>
+<script type="text/javascript" src="../js/jquery/jquery-ui-1.9.2.custom.min.js"></script>
+<script type="text/javascript" src="../js/jquery/jquery.json-2.4.js"></script>
+<script type="text/javascript" src="ajax.js"></script>
+<script type="text/javascript" src="../js/config.js"></script>
+<script type="text/javascript" src="scripts.js"></script>
+</head>
+<body>
+<h1><span class="blue">php</span><span class="orange">MyAdmin</span> setup</h1>
+<div id="menu">
+<?php
+require './setup/frames/menu.inc.php';
+?>
+</div>
+<div id="page">
+<?php
+require "./setup/frames/$page.inc.php";
+?>
+</div>
+</body>
+</html>
diff --git a/hugo/setup/lib/ConfigGenerator.class.php b/hugo/setup/lib/ConfigGenerator.class.php
new file mode 100644
index 0000000..8dc359b
--- /dev/null
+++ b/hugo/setup/lib/ConfigGenerator.class.php
@@ -0,0 +1,154 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Config file generator
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+/**
+ * Config file generation class
+ *
+ * @package PhpMyAdmin
+ */
+class ConfigGenerator
+{
+ /**
+ * Creates config file
+ *
+ * @return string
+ */
+ public static function getConfigFile()
+ {
+ $cf = ConfigFile::getInstance();
+
+ $crlf = (isset($_SESSION['eol']) && $_SESSION['eol'] == 'win') ? "\r\n" : "\n";
+ $c = $cf->getConfig();
+
+ // header
+ $ret = '<?php' . $crlf
+ . '/*' . $crlf
+ . ' * Generated configuration file' . $crlf
+ . ' * Generated by: phpMyAdmin '
+ . $GLOBALS['PMA_Config']->get('PMA_VERSION')
+ . ' setup script' . $crlf
+ . ' * Date: ' . date(DATE_RFC1123) . $crlf
+ . ' */' . $crlf . $crlf;
+
+ // servers
+ if ($cf->getServerCount() > 0) {
+ $ret .= "/* Servers configuration */$crlf\$i = 0;" . $crlf . $crlf;
+ foreach ($c['Servers'] as $id => $server) {
+ $ret .= '/* Server: ' . strtr($cf->getServerName($id) . " [$id] ", '*/', '-') . "*/" . $crlf
+ . '$i++;' . $crlf;
+ foreach ($server as $k => $v) {
+ $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
+ $ret .= "\$cfg['Servers'][\$i]['$k'] = "
+ . (is_array($v) && self::_isZeroBasedArray($v)
+ ? self::_exportZeroBasedArray($v, $crlf)
+ : var_export($v, true))
+ . ';' . $crlf;
+ }
+ $ret .= $crlf;
+ }
+ $ret .= '/* End of servers configuration */' . $crlf . $crlf;
+ }
+ unset($c['Servers']);
+
+ // other settings
+ $persistKeys = $cf->getPersistKeysMap();
+
+ foreach ($c as $k => $v) {
+ $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
+ $ret .= self::_getVarExport($k, $v, $crlf);
+ if (isset($persistKeys[$k])) {
+ unset($persistKeys[$k]);
+ }
+ }
+ // keep 1d array keys which are present in $persist_keys (config.values.php)
+ foreach (array_keys($persistKeys) as $k) {
+ if (strpos($k, '/') === false) {
+ $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
+ $ret .= self::_getVarExport($k, $cf->getDefault($k), $crlf);
+ }
+ }
+ $ret .= '?>';
+
+ return $ret;
+ }
+
+ /**
+ * Returns exported configuration variable
+ *
+ * @param string $var_name
+ * @param mixed $var_value
+ * @param string $crlf
+ *
+ * @return string
+ */
+ private static function _getVarExport($var_name, $var_value, $crlf)
+ {
+ if (!is_array($var_value) || empty($var_value)) {
+ return "\$cfg['$var_name'] = " . var_export($var_value, true) . ';' . $crlf;
+ }
+ $ret = '';
+ if (self::_isZeroBasedArray($var_value)) {
+ $ret = "\$cfg['$var_name'] = " . self::_exportZeroBasedArray($var_value, $crlf)
+ . ';' . $crlf;
+ } else {
+ // string keys: $cfg[key][subkey] = value
+ foreach ($var_value as $k => $v) {
+ $k = preg_replace('/[^A-Za-z0-9_]/', '_', $k);
+ $ret .= "\$cfg['$var_name']['$k'] = " . var_export($v, true) . ';' . $crlf;
+ }
+ }
+ return $ret;
+ }
+
+ /**
+ * Check whether $array is a continuous 0-based array
+ *
+ * @param array $array
+ *
+ * @return boolean
+ */
+ private static function _isZeroBasedArray(array $array)
+ {
+ for ($i = 0; $i < count($array); $i++) {
+ if (! isset($array[$i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Exports continuous 0-based array
+ *
+ * @param array $array
+ * @param string $crlf
+ *
+ * @return string
+ */
+ private static function _exportZeroBasedArray(array $array, $crlf)
+ {
+ $retv = array();
+ foreach ($array as $v) {
+ $retv[] = var_export($v, true);
+ }
+ $ret = "array(";
+ if (count($retv) <= 4) {
+ // up to 4 values - one line
+ $ret .= implode(', ', $retv);
+ } else {
+ // more than 4 values - value per line
+ $imax = count($retv);
+ for ($i = 0; $i < $imax; $i++) {
+ $ret .= ($i > 0 ? ',' : '') . $crlf . ' ' . $retv[$i];
+ }
+ }
+ $ret .= ')';
+ return $ret;
+ }
+}
+?>
diff --git a/hugo/setup/lib/common.inc.php b/hugo/setup/lib/common.inc.php
new file mode 100644
index 0000000..4744321
--- /dev/null
+++ b/hugo/setup/lib/common.inc.php
@@ -0,0 +1,56 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Loads libraries/common.inc.php and preforms some additional actions
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+/**
+ * Do not include full common.
+ * @ignore
+ */
+define('PMA_MINIMUM_COMMON', true);
+define('PMA_SETUP', true);
+chdir('..');
+
+if (!file_exists('./libraries/common.inc.php')) {
+ PMA_fatalError('Bad invocation!');
+}
+
+require_once './libraries/common.inc.php';
+require_once './libraries/Util.class.php';
+require_once './libraries/config/config_functions.lib.php';
+require_once './libraries/config/messages.inc.php';
+require_once './libraries/config/ConfigFile.class.php';
+require_once './libraries/url_generating.lib.php';
+require_once './libraries/user_preferences.lib.php';
+
+// use default error handler
+restore_error_handler();
+
+// Save current language in a cookie, required since we use PMA_MINIMUM_COMMON
+$GLOBALS['PMA_Config']->setCookie('pma_lang', $GLOBALS['lang']);
+
+ConfigFile::getInstance()->setPersistKeys(
+ array(
+ 'DefaultLang',
+ 'ServerDefault',
+ 'UploadDir',
+ 'SaveDir',
+ 'Servers/1/verbose',
+ 'Servers/1/host',
+ 'Servers/1/port',
+ 'Servers/1/socket',
+ 'Servers/1/extension',
+ 'Servers/1/connect_type',
+ 'Servers/1/auth_type',
+ 'Servers/1/user',
+ 'Servers/1/password'
+ )
+);
+
+// allows for redirection even after sending some data
+ob_start();
+
+?>
diff --git a/hugo/setup/lib/form_processing.lib.php b/hugo/setup/lib/form_processing.lib.php
new file mode 100644
index 0000000..d9b6e6a
--- /dev/null
+++ b/hugo/setup/lib/form_processing.lib.php
@@ -0,0 +1,62 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Formset processing library
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+/**
+ * Processes forms registered in $form_display, handles error correction
+ *
+ * @param FormDisplay $form_display
+ *
+ * @return void
+ */
+function process_formset(FormDisplay $form_display)
+{
+ if (filter_input(INPUT_GET, 'mode') == 'revert') {
+ // revert erroneous fields to their default values
+ $form_display->fixErrors();
+ // drop post data
+ header('HTTP/1.1 303 See Other');
+ header('Location: index.php');
+ exit;
+ }
+ if (!$form_display->process(false)) {
+ // handle form view and failed POST
+ $form_display->display(true, true);
+ } else {
+ // check for form errors
+ if ($form_display->hasErrors()) {
+ // form has errors, show warning
+ $separator = PMA_get_arg_separator('html');
+ $page = filter_input(INPUT_GET, 'page');
+ $formset = filter_input(INPUT_GET, 'formset');
+ $formset = $formset ? "{$separator}formset=$formset" : '';
+ $id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
+ if ($id === null && $page == 'servers') {
+ // we've just added a new server, get it's id
+ $id = ConfigFile::getInstance()->getServerCount();
+ }
+ $id = $id ? "{$separator}id=$id" : '';
+ ?>
+ <div class="error">
+ <h4><?php echo __('Warning') ?></h4>
+ <?php echo __('Submitted form contains errors') ?><br />
+ <a href="?page=<?php echo $page . $formset . $id . $separator ?>mode=revert"><?php echo __('Try to revert erroneous fields to their default values') ?></a>
+ </div>
+ <?php $form_display->displayErrors() ?>
+ <a class="btn" href="index.php"><?php echo __('Ignore errors') ?></a>
+ &nbsp;
+ <a class="btn" href="?page=<?php echo $page . $formset . $id . $separator ?>mode=edit"><?php echo __('Show form') ?></a>
+ <?php
+ } else {
+ // drop post data
+ header('HTTP/1.1 303 See Other');
+ header('Location: index.php');
+ exit;
+ }
+ }
+}
+?>
diff --git a/hugo/setup/lib/index.lib.php b/hugo/setup/lib/index.lib.php
new file mode 100644
index 0000000..fe82b1e
--- /dev/null
+++ b/hugo/setup/lib/index.lib.php
@@ -0,0 +1,605 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Various checks and message functions used on index page.
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+if (!defined('PHPMYADMIN')) {
+ exit;
+}
+
+/**
+ * Initializes message list
+ *
+ * @return void
+ */
+function messages_begin()
+{
+ if (! isset($_SESSION['messages']) || !is_array($_SESSION['messages'])) {
+ $_SESSION['messages'] = array('error' => array(), 'notice' => array());
+ } else {
+ // reset message states
+ foreach ($_SESSION['messages'] as &$messages) {
+ foreach ($messages as &$msg) {
+ $msg['fresh'] = false;
+ $msg['active'] = false;
+ }
+ }
+ }
+}
+
+/**
+ * Adds a new message to message list
+ *
+ * @param string $type one of: notice, error
+ * @param string $id unique message identifier
+ * @param string $title language string id (in $str array)
+ * @param string $message message text
+ *
+ * @return void
+ */
+function messages_set($type, $id, $title, $message)
+{
+ $fresh = ! isset($_SESSION['messages'][$type][$id]);
+ $_SESSION['messages'][$type][$id] = array(
+ 'fresh' => $fresh,
+ 'active' => true,
+ 'title' => $title,
+ 'message' => $message);
+}
+
+/**
+ * Cleans up message list
+ *
+ * @return void
+ */
+function messages_end()
+{
+ foreach ($_SESSION['messages'] as &$messages) {
+ $remove_ids = array();
+ foreach ($messages as $id => &$msg) {
+ if ($msg['active'] == false) {
+ $remove_ids[] = $id;
+ }
+ }
+ foreach ($remove_ids as $id) {
+ unset($messages[$id]);
+ }
+ }
+}
+
+/**
+ * Prints message list, must be called after messages_end()
+ *
+ * @return void
+ */
+function messages_show_html()
+{
+ $old_ids = array();
+ foreach ($_SESSION['messages'] as $type => $messages) {
+ foreach ($messages as $id => $msg) {
+ echo '<div class="' . $type . '" id="' . $id . '">'
+ . '<h4>' . $msg['title'] . '</h4>'
+ . $msg['message'] . '</div>';
+ if (!$msg['fresh'] && $type != 'error') {
+ $old_ids[] = $id;
+ }
+ }
+ }
+
+ echo "\n" . '<script type="text/javascript">';
+ foreach ($old_ids as $id) {
+ echo "\nhiddenMessages.push('$id');";
+ }
+ echo "\n</script>\n";
+}
+
+/**
+ * Checks for newest phpMyAdmin version and sets result as a new notice
+ *
+ * @return void
+ */
+function PMA_version_check()
+{
+ // version check messages should always be visible so let's make
+ // a unique message id each time we run it
+ $message_id = uniqid('version_check');
+ // wait 3s at most for server response, it's enough to get information
+ // from a working server
+ $connection_timeout = 3;
+
+ $url = 'http://phpmyadmin.net/home_page/version.php';
+ $context = stream_context_create(
+ array(
+ 'http' => array('timeout' => $connection_timeout)
+ )
+ );
+ $data = @file_get_contents($url, null, $context);
+ if ($data === false) {
+ if (function_exists('curl_init')) {
+ $ch = curl_init($url);
+ curl_setopt($ch, CURLOPT_HEADER, false);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_TIMEOUT, $connection_timeout);
+ $data = curl_exec($ch);
+ curl_close($ch);
+ } else {
+ messages_set(
+ 'error',
+ $message_id,
+ __('Version check'),
+ __('Neither URL wrapper nor CURL is available. Version check is not possible.')
+ );
+ return;
+ }
+ }
+
+ if (empty($data)) {
+ messages_set(
+ 'error',
+ $message_id,
+ __('Version check'),
+ __('Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.')
+ );
+ return;
+ }
+
+ /* Format: version\ndate\n(download\n)* */
+ $data_list = explode("\n", $data);
+
+ if (count($data_list) > 1) {
+ $version = $data_list[0];
+ $date = $data_list[1];
+ } else {
+ $version = $date = '';
+ }
+
+ $version_upstream = version_to_int($version);
+ if ($version_upstream === false) {
+ messages_set(
+ 'error',
+ $message_id,
+ __('Version check'),
+ __('Got invalid version string from server')
+ );
+ return;
+ }
+
+ $version_local = version_to_int($GLOBALS['PMA_Config']->get('PMA_VERSION'));
+ if ($version_local === false) {
+ messages_set(
+ 'error',
+ $message_id,
+ __('Version check'),
+ __('Unparsable version string')
+ );
+ return;
+ }
+
+ if ($version_upstream > $version_local) {
+ $version = htmlspecialchars($version);
+ $date = htmlspecialchars($date);
+ messages_set(
+ 'notice',
+ $message_id,
+ __('Version check'),
+ sprintf(__('A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is %s, released on %s.'), $version, $date)
+ );
+ } else {
+ if ($version_local % 100 == 0) {
+ messages_set(
+ 'notice',
+ $message_id,
+ __('Version check'),
+ PMA_sanitize(sprintf(__('You are using Git version, run [kbd]git pull[/kbd] :-)[br]The latest stable version is %s, released on %s.'), $version, $date))
+ );
+ } else {
+ messages_set(
+ 'notice',
+ $message_id,
+ __('Version check'),
+ __('No newer stable version is available')
+ );
+ }
+ }
+}
+
+/**
+ * Calculates numerical equivalent of phpMyAdmin version string
+ *
+ * @param string $version version
+ *
+ * @return mixed false on failure, integer on success
+ */
+function version_to_int($version)
+{
+ $matches = array();
+ if (!preg_match('/^(\d+)\.(\d+)\.(\d+)((\.|-(pl|rc|dev|beta|alpha))(\d+)?(-dev)?)?$/', $version, $matches)) {
+ return false;
+ }
+ if (!empty($matches[6])) {
+ switch ($matches[6]) {
+ case 'pl':
+ $added = 60;
+ break;
+ case 'rc':
+ $added = 30;
+ break;
+ case 'beta':
+ $added = 20;
+ break;
+ case 'alpha':
+ $added = 10;
+ break;
+ case 'dev':
+ $added = 0;
+ break;
+ default:
+ messages_set(
+ 'notice',
+ 'version_match',
+ __('Version check'),
+ 'Unknown version part: ' . htmlspecialchars($matches[6])
+ );
+ $added = 0;
+ break;
+ }
+ } else {
+ $added = 50; // for final
+ }
+ if (!empty($matches[7])) {
+ $added = $added + $matches[7];
+ }
+ return $matches[1] * 1000000 + $matches[2] * 10000 + $matches[3] * 100 + $added;
+}
+
+/**
+ * Checks whether config file is readable/writable
+ *
+ * @param bool &$is_readable
+ * @param bool &$is_writable
+ * @param bool &$file_exists
+ *
+ * @return void
+ */
+function check_config_rw(&$is_readable, &$is_writable, &$file_exists)
+{
+ $file_path = ConfigFile::getInstance()->getFilePath();
+ $file_dir = dirname($file_path);
+ $is_readable = true;
+ $is_writable = is_dir($file_dir);
+ if (SETUP_DIR_WRITABLE) {
+ $is_writable = $is_writable && is_writable($file_dir);
+ }
+ $file_exists = file_exists($file_path);
+ if ($file_exists) {
+ $is_readable = is_readable($file_path);
+ $is_writable = $is_writable && is_writable($file_path);
+ }
+}
+
+/**
+ * Performs various compatibility, security and consistency checks on current config
+ *
+ * Outputs results to message list, must be called between messages_begin()
+ * and messages_end()
+ *
+ * @return void
+ */
+function perform_config_checks()
+{
+ $cf = ConfigFile::getInstance();
+ $blowfish_secret = $cf->get('blowfish_secret');
+ $blowfish_secret_set = false;
+ $cookie_auth_used = false;
+
+ $strAllowArbitraryServerWarning = __('This %soption%s should be disabled as it allows attackers to bruteforce login to any MySQL server. If you feel this is necessary, use %strusted proxies list%s. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.');
+ $strAllowArbitraryServerWarning = sprintf($strAllowArbitraryServerWarning, '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]', '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]');
+ $strBlowfishSecretMsg = __('You didn\'t have blowfish secret set and have enabled cookie authentication, so a key was automatically generated for you. It is used to encrypt cookies; you don\'t need to remember it.');
+ $strBZipDumpWarning = __('%sBzip2 compression and decompression%s requires functions (%s) which are unavailable on this system.');
+ $strBZipDumpWarning = sprintf($strBZipDumpWarning, '[a@?page=form&amp;formset=Features#tab_Import_export]', '[/a]', '%s');
+ $strDirectoryNotice = __('This value should be double checked to ensure that this directory is neither world accessible nor readable or writable by other users on your server.');
+ $strForceSSLNotice = __('This %soption%s should be enabled if your web server supports it.');
+ $strForceSSLNotice = sprintf($strForceSSLNotice, '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]');
+ $strGZipDumpWarning = __('%sGZip compression and decompression%s requires functions (%s) which are unavailable on this system.');
+ $strGZipDumpWarning = sprintf($strGZipDumpWarning, '[a@?page=form&amp;formset=Features#tab_Import_export]', '[/a]', '%s');
+ $strLoginCookieValidityWarning = __('%sLogin cookie validity%s greater than 1440 seconds may cause random session invalidation if %ssession.gc_maxlifetime%s is lower than its value (currently %d).');
+ $strLoginCookieValidityWarning = sprintf($strLoginCookieValidityWarning, '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]', '[a@' . PMA_getPHPDocLink('session.configuration.php#ini.session.gc-maxlifetime') . ']', '[/a]', ini_get('session.gc_maxlifetime'));
+ $strLoginCookieValidityWarning2 = __('%sLogin cookie validity%s should be set to 1800 seconds (30 minutes) at most. Values larger than 1800 may pose a security risk such as impersonation.');
+ $strLoginCookieValidityWarning2 = sprintf($strLoginCookieValidityWarning2, '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]');
+ $strLoginCookieValidityWarning3 = __('If using cookie authentication and %sLogin cookie store%s is not 0, %sLogin cookie validity%s must be set to a value less or equal to it.');
+ $strLoginCookieValidityWarning3 = sprintf($strLoginCookieValidityWarning3, '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]', '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]');
+ $strSecurityInfoMsg = __('If you feel this is necessary, use additional protection settings - %shost authentication%s settings and %strusted proxies list%s. However, IP-based protection may not be reliable if your IP belongs to an ISP where thousands of users, including you, are connected to.');
+ $strSecurityInfoMsg = sprintf($strSecurityInfoMsg, '[a@?page=servers&amp;mode=edit&amp;id=%1$d#tab_Server_config]', '[/a]', '[a@?page=form&amp;formset=Features#tab_Security]', '[/a]');
+ $strServerAuthConfigMsg = __('You set the [kbd]config[/kbd] authentication type and included username and password for auto-login, which is not a desirable option for live hosts. Anyone who knows or guesses your phpMyAdmin URL can directly access your phpMyAdmin panel. Set %sauthentication type%s to [kbd]cookie[/kbd] or [kbd]http[/kbd].');
+ $strServerAuthConfigMsg = sprintf($strServerAuthConfigMsg, '[a@?page=servers&amp;mode=edit&amp;id=%1$d#tab_Server]', '[/a]');
+ $strZipDumpExportWarning = __('%sZip compression%s requires functions (%s) which are unavailable on this system.');
+ $strZipDumpExportWarning = sprintf($strZipDumpExportWarning, '[a@?page=form&amp;formset=Features#tab_Import_export]', '[/a]', '%s');
+ $strZipDumpImportWarning = __('%sZip decompression%s requires functions (%s) which are unavailable on this system.');
+ $strZipDumpImportWarning = sprintf($strZipDumpImportWarning, '[a@?page=form&amp;formset=Features#tab_Import_export]', '[/a]', '%s');
+
+ for ($i = 1, $server_cnt = $cf->getServerCount(); $i <= $server_cnt; $i++) {
+ $cookie_auth_server = ($cf->getValue("Servers/$i/auth_type") == 'cookie');
+ $cookie_auth_used |= $cookie_auth_server;
+ $server_name = $cf->getServerName($i);
+ if ($server_name == 'localhost') {
+ $server_name .= " [$i]";
+ }
+ $server_name = htmlspecialchars($server_name);
+
+ if ($cookie_auth_server && $blowfish_secret === null) {
+ $blowfish_secret = uniqid('', true);
+ $blowfish_secret_set = true;
+ $cf->set('blowfish_secret', $blowfish_secret);
+ }
+
+ //
+ // $cfg['Servers'][$i]['ssl']
+ // should be enabled if possible
+ //
+ if (!$cf->getValue("Servers/$i/ssl")) {
+ $title = PMA_lang(PMA_lang_name('Servers/1/ssl')) . " ($server_name)";
+ messages_set(
+ 'notice',
+ "Servers/$i/ssl",
+ $title,
+ __('You should use SSL connections if your database server supports it.')
+ );
+ }
+
+ //
+ // $cfg['Servers'][$i]['extension']
+ // warn about using 'mysql'
+ //
+ if ($cf->getValue("Servers/$i/extension") == 'mysql') {
+ $title = PMA_lang(PMA_lang_name('Servers/1/extension'))
+ . " ($server_name)";
+ messages_set(
+ 'notice',
+ "Servers/$i/extension",
+ $title,
+ __('You should use mysqli for performance reasons.')
+ );
+ }
+
+ //
+ // $cfg['Servers'][$i]['auth_type']
+ // warn about full user credentials if 'auth_type' is 'config'
+ //
+ if ($cf->getValue("Servers/$i/auth_type") == 'config'
+ && $cf->getValue("Servers/$i/user") != ''
+ && $cf->getValue("Servers/$i/password") != ''
+ ) {
+ $title = PMA_lang(PMA_lang_name('Servers/1/auth_type'))
+ . " ($server_name)";
+ messages_set(
+ 'notice',
+ "Servers/$i/auth_type",
+ $title,
+ PMA_lang($strServerAuthConfigMsg, $i) . ' '
+ . PMA_lang($strSecurityInfoMsg, $i)
+ );
+ }
+
+ //
+ // $cfg['Servers'][$i]['AllowRoot']
+ // $cfg['Servers'][$i]['AllowNoPassword']
+ // serious security flaw
+ //
+ if ($cf->getValue("Servers/$i/AllowRoot")
+ && $cf->getValue("Servers/$i/AllowNoPassword")
+ ) {
+ $title = PMA_lang(PMA_lang_name('Servers/1/AllowNoPassword'))
+ . " ($server_name)";
+ messages_set(
+ 'notice',
+ "Servers/$i/AllowNoPassword",
+ $title,
+ __('You allow for connecting to the server without a password.') . ' '
+ . PMA_lang($strSecurityInfoMsg, $i)
+ );
+ }
+ }
+
+ //
+ // $cfg['blowfish_secret']
+ // it's required for 'cookie' authentication
+ //
+ if ($cookie_auth_used) {
+ if ($blowfish_secret_set) {
+ // 'cookie' auth used, blowfish_secret was generated
+ messages_set(
+ 'notice',
+ 'blowfish_secret_created',
+ PMA_lang(PMA_lang_name('blowfish_secret')),
+ $strBlowfishSecretMsg
+ );
+ } else {
+ $blowfish_warnings = array();
+ // check length
+ if (strlen($blowfish_secret) < 8) {
+ // too short key
+ $blowfish_warnings[] = __('Key is too short, it should have at least 8 characters.');
+ }
+ // check used characters
+ $has_digits = (bool) preg_match('/\d/', $blowfish_secret);
+ $has_chars = (bool) preg_match('/\S/', $blowfish_secret);
+ $has_nonword = (bool) preg_match('/\W/', $blowfish_secret);
+ if (!$has_digits || !$has_chars || !$has_nonword) {
+ $blowfish_warnings[] = PMA_lang(__('Key should contain letters, numbers [em]and[/em] special characters.'));
+ }
+ if (!empty($blowfish_warnings)) {
+ messages_set(
+ 'error',
+ 'blowfish_warnings' . count($blowfish_warnings),
+ PMA_lang(PMA_lang_name('blowfish_secret')),
+ implode('<br />', $blowfish_warnings)
+ );
+ }
+ }
+ }
+
+ //
+ // $cfg['ForceSSL']
+ // should be enabled if possible
+ //
+ if (!$cf->getValue('ForceSSL')) {
+ messages_set(
+ 'notice',
+ 'ForceSSL',
+ PMA_lang(PMA_lang_name('ForceSSL')),
+ PMA_lang($strForceSSLNotice)
+ );
+ }
+
+ //
+ // $cfg['AllowArbitraryServer']
+ // should be disabled
+ //
+ if ($cf->getValue('AllowArbitraryServer')) {
+ messages_set(
+ 'notice',
+ 'AllowArbitraryServer',
+ PMA_lang(PMA_lang_name('AllowArbitraryServer')),
+ PMA_lang($strAllowArbitraryServerWarning)
+ );
+ }
+
+ //
+ // $cfg['LoginCookieValidity']
+ // value greater than session.gc_maxlifetime will cause
+ // random session invalidation after that time
+ if ($cf->getValue('LoginCookieValidity') > 1440
+ || $cf->getValue('LoginCookieValidity') > ini_get('session.gc_maxlifetime')
+ ) {
+ $message_type = $cf->getValue('LoginCookieValidity') > ini_get('session.gc_maxlifetime')
+ ? 'error'
+ : 'notice';
+ messages_set(
+ $message_type,
+ 'LoginCookieValidity',
+ PMA_lang(PMA_lang_name('LoginCookieValidity')),
+ PMA_lang($strLoginCookieValidityWarning)
+ );
+ }
+
+ //
+ // $cfg['LoginCookieValidity']
+ // should be at most 1800 (30 min)
+ //
+ if ($cf->getValue('LoginCookieValidity') > 1800) {
+ messages_set(
+ 'notice',
+ 'LoginCookieValidity',
+ PMA_lang(PMA_lang_name('LoginCookieValidity')),
+ PMA_lang($strLoginCookieValidityWarning2)
+ );
+ }
+
+ //
+ // $cfg['LoginCookieValidity']
+ // $cfg['LoginCookieStore']
+ // LoginCookieValidity must be less or equal to LoginCookieStore
+ //
+ if ($cf->getValue('LoginCookieStore') != 0
+ && $cf->getValue('LoginCookieValidity') > $cf->getValue('LoginCookieStore')
+ ) {
+ messages_set(
+ 'error',
+ 'LoginCookieValidity',
+ PMA_lang(PMA_lang_name('LoginCookieValidity')),
+ PMA_lang($strLoginCookieValidityWarning3)
+ );
+ }
+
+ //
+ // $cfg['SaveDir']
+ // should not be world-accessible
+ //
+ if ($cf->getValue('SaveDir') != '') {
+ messages_set(
+ 'notice',
+ 'SaveDir',
+ PMA_lang(PMA_lang_name('SaveDir')),
+ PMA_lang($strDirectoryNotice)
+ );
+ }
+
+ //
+ // $cfg['TempDir']
+ // should not be world-accessible
+ //
+ if ($cf->getValue('TempDir') != '') {
+ messages_set(
+ 'notice',
+ 'TempDir',
+ PMA_lang(PMA_lang_name('TempDir')),
+ PMA_lang($strDirectoryNotice)
+ );
+ }
+
+ //
+ // $cfg['GZipDump']
+ // requires zlib functions
+ //
+ if ($cf->getValue('GZipDump')
+ && (@!function_exists('gzopen') || @!function_exists('gzencode'))
+ ) {
+ messages_set(
+ 'error',
+ 'GZipDump',
+ PMA_lang(PMA_lang_name('GZipDump')),
+ PMA_lang($strGZipDumpWarning, 'gzencode')
+ );
+ }
+
+ //
+ // $cfg['BZipDump']
+ // requires bzip2 functions
+ //
+ if ($cf->getValue('BZipDump')
+ && (!@function_exists('bzopen') || !@function_exists('bzcompress'))
+ ) {
+ $functions = @function_exists('bzopen')
+ ? '' :
+ 'bzopen';
+ $functions .= @function_exists('bzcompress')
+ ? ''
+ : ($functions ? ', ' : '') . 'bzcompress';
+ messages_set(
+ 'error',
+ 'BZipDump',
+ PMA_lang(PMA_lang_name('BZipDump')),
+ PMA_lang($strBZipDumpWarning, $functions)
+ );
+ }
+
+ //
+ // $cfg['ZipDump']
+ // requires zip_open in import
+ //
+ if ($cf->getValue('ZipDump') && !@function_exists('zip_open')) {
+ messages_set(
+ 'error',
+ 'ZipDump_import',
+ PMA_lang(PMA_lang_name('ZipDump')),
+ PMA_lang($strZipDumpImportWarning, 'zip_open')
+ );
+ }
+
+ //
+ // $cfg['ZipDump']
+ // requires gzcompress in export
+ //
+ if ($cf->getValue('ZipDump') && !@function_exists('gzcompress')) {
+ messages_set(
+ 'error',
+ 'ZipDump_export',
+ PMA_lang(PMA_lang_name('ZipDump')),
+ PMA_lang($strZipDumpExportWarning, 'gzcompress')
+ );
+ }
+}
+?>
diff --git a/hugo/setup/scripts.js b/hugo/setup/scripts.js
new file mode 100644
index 0000000..fe7f0e2
--- /dev/null
+++ b/hugo/setup/scripts.js
@@ -0,0 +1,204 @@
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Functions used in Setup configuration forms
+ */
+
+// show this window in top frame
+if (top != self) {
+ window.top.location.href = location;
+}
+
+// ------------------------------------------------------------------
+// Messages
+//
+
+// stores hidden message ids
+var hiddenMessages = [];
+
+$(function() {
+ var hidden = hiddenMessages.length;
+ for (var i = 0; i < hidden; i++) {
+ $('#'+hiddenMessages[i]).css('display', 'none');
+ }
+ if (hidden > 0) {
+ var link = $('#show_hidden_messages');
+ link.click(function(e) {
+ e.preventDefault();
+ for (var i = 0; i < hidden; i++) {
+ $('#'+hiddenMessages[i]).show(500);
+ }
+ $(this).remove();
+ });
+ link.html(link.html().replace('#MSG_COUNT', hidden));
+ link.css('display', '');
+ }
+});
+
+//
+// END: Messages
+// ------------------------------------------------------------------
+
+// ------------------------------------------------------------------
+// Form validation and field operations
+//
+
+/**
+ * Automatic form submission on change.
+ */
+$('.autosubmit').live('change', function(e) {
+ e.target.form.submit();
+});
+
+$.extend(true, validators, {
+ // field validators
+ _field: {
+ /**
+ * hide_db field
+ *
+ * @param {boolean} isKeyUp
+ */
+ hide_db: function(isKeyUp) {
+ if (!isKeyUp && this.value != '') {
+ var data = {};
+ data[this.id] = this.value;
+ ajaxValidate(this, 'Servers/1/hide_db', data);
+ }
+ return true;
+ },
+ /**
+ * TrustedProxies field
+ *
+ * @param {boolean} isKeyUp
+ */
+ TrustedProxies: function(isKeyUp) {
+ if (!isKeyUp && this.value != '') {
+ var data = {};
+ data[this.id] = this.value;
+ ajaxValidate(this, 'TrustedProxies', data);
+ }
+ return true;
+ }
+ },
+ // fieldset validators
+ _fieldset: {
+ /**
+ * Validates Server fieldset
+ *
+ * @param {boolean} isKeyUp
+ */
+ Server: function(isKeyUp) {
+ if (!isKeyUp) {
+ ajaxValidate(this, 'Server', getAllValues());
+ }
+ return true;
+ },
+ /**
+ * Validates Server_login_options fieldset
+ *
+ * @param {boolean} isKeyUp
+ */
+ Server_login_options: function(isKeyUp) {
+ return validators._fieldset.Server.apply(this, [isKeyUp]);
+ },
+ /**
+ * Validates Server_pmadb fieldset
+ *
+ * @param {boolean} isKeyUp
+ */
+ Server_pmadb: function(isKeyUp) {
+ if (isKeyUp) {
+ return true;
+ }
+
+ var prefix = getIdPrefix($(this).find('input'));
+ var pmadb_active = $('#' + prefix + 'pmadb').val() != '';
+ if (pmadb_active) {
+ ajaxValidate(this, 'Server_pmadb', getAllValues());
+ }
+
+ return true;
+ }
+ }
+});
+
+/**
+ * Calls server-side validation procedures
+ *
+ * @param {Element} parent input field in <fieldset> or <fieldset>
+ * @param {String} id validator id
+ * @param {Object} values values hash {element1_id: value, ...}
+ */
+function ajaxValidate(parent, id, values)
+{
+ parent = $(parent);
+ // ensure that parent is a fieldset
+ if (parent.attr('tagName') != 'FIELDSET') {
+ parent = parent.closest('fieldset');
+ if (parent.length == 0) {
+ return false;
+ }
+ }
+
+ if (parent.data('ajax') != null) {
+ parent.data('ajax').abort();
+ }
+
+ parent.data('ajax', $.ajax({
+ url: 'validate.php',
+ cache: false,
+ type: 'POST',
+ data: {
+ token: parent.closest('form').find('input[name=token]').val(),
+ id: id,
+ values: $.toJSON(values)
+ },
+ success: function(response) {
+ if (response == null) {
+ return;
+ }
+
+ var error = {};
+ if (typeof response != 'object') {
+ error[parent.id] = [response];
+ } else if (typeof response['error'] != 'undefined') {
+ error[parent.id] = [response['error']];
+ } else {
+ for (var key in response) {
+ var value = response[key];
+ error[key] = jQuery.isArray(value) ? value : [value];
+ }
+ }
+ displayErrors(error);
+ },
+ complete: function() {
+ parent.removeData('ajax');
+ }
+ }));
+
+ return true;
+}
+
+//
+// END: Form validation and field operations
+// ------------------------------------------------------------------
+
+// ------------------------------------------------------------------
+// User preferences allow/disallow UI
+//
+
+$(function() {
+ $('.userprefs-allow').click(function(e) {
+ if (this != e.target) {
+ return;
+ }
+ var el = $(this).find('input');
+ if (el.prop('disabled')) {
+ return;
+ }
+ el.prop('checked', !el.prop('checked'));
+ });
+});
+
+//
+// END: User preferences allow/disallow UI
+// ------------------------------------------------------------------
diff --git a/hugo/setup/styles.css b/hugo/setup/styles.css
new file mode 100644
index 0000000..9f2d2ec
--- /dev/null
+++ b/hugo/setup/styles.css
@@ -0,0 +1,631 @@
+/* global styles */
+
+body {
+ padding-bottom: 1em;
+ color: #444;
+ font: .8em sans-serif;
+ background: url(../themes/pmahomme/img/left_nav_bg.png) repeat-y 80px 0 #f3f3f3;
+}
+
+input,
+button,
+select,
+textarea,
+th,
+td {
+ font: 1em sans-serif;
+}
+
+img {
+ border: 0;
+}
+
+a,
+a:link,
+a:visited,
+a:active {
+ text-decoration: none;
+ color: #235a81;
+ cursor: pointer;
+ outline: none;
+
+}
+
+a:hover {
+ text-decoration: underline;
+ color: #235a81;
+}
+
+h1 {
+ font-size: 1.5em;
+}
+
+/* language selection box */
+
+#select_lang {
+ position: absolute;
+ right: 1em;
+ top: 1em;
+}
+
+/* menu */
+
+#menu {
+ float: left;
+ width: 220px;
+ font-size: 1.1em;
+}
+
+#menu ul {
+ margin: 1em 1em 1em .5em;
+ padding: 0;
+ list-style: none;
+}
+
+#menu li a {
+ padding: .5em .6em;
+ margin-right: .6em;
+ display: block;
+ color: #333;
+ text-decoration: none;
+ zoom: 1; /* IE fix */
+}
+
+#menu li a:hover, #menu li a:active {
+ background-color: #e4e4e4;
+}
+
+/* page contents and footer layout */
+
+#page {
+ margin-left: 220px;
+}
+
+#footer {
+ margin-top: 1em;
+}
+
+#footer a {
+ margin-right: 0.5em;
+ text-decoration: none;
+ font-size: small;
+}
+
+/* phpMyAdmin logo colors */
+
+.blue {
+ color: #7584B3;
+}
+
+.orange {
+ color: #FFAD17;
+}
+
+.red {
+ color: #C00;
+}
+
+/* main page messages */
+
+/* message boxes: error, confirmation */
+.success h4,
+.notice h4,
+div.error h4 {
+ border-bottom: 1px solid;
+ font-weight: bold;
+ margin: 0 0 .2em 0;
+}
+
+div.success,
+div.notice,
+div.error {
+ margin: .5em 0 1.3em 0;
+ border: 1px solid;
+ background-repeat: no-repeat;
+ background-position: 10px 10px;
+ padding: 10px 10px 10px 25px;
+
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+
+ -moz-box-shadow: 0 1px 1px #fff inset;
+ -webkit-box-shadow: 0 1px 1px #fff inset;
+ box-shadow: 0 1px 1px #fff inset;
+}
+
+.success a,
+.notice a,
+.error a {
+ text-decoration: underline;
+}
+
+.success {
+ color: #000;
+ background-color: #ebf8a4;
+}
+
+h1.success,
+div.success {
+ border-color: #a2d246;
+ background-image: url(../themes/pmahomme/img/s_success.png);
+ background-repeat: no-repeat;
+ background-position: 5px 10px;
+}
+.success h4 {
+ border-color: #00FF00;
+}
+
+.notice {
+ color: #000;
+ background-color: #e8eef1;
+}
+
+h1.notice,
+div.notice {
+ border-color: #3a6c7e;
+ background-image: url(../themes/pmahomme/img/s_notice.png);
+ background-repeat: no-repeat;
+ background-position: 5px 10px;
+}
+
+.notice h4 {
+ border-color: #ffb10a;
+}
+
+.error {
+ border: 1px solid maroon !important;
+ color: #000;
+ background: pink;
+}
+
+h1.error,
+div.error {
+ border-color: #333;
+ background-image: url(../themes/pmahomme/img/s_error.png);
+ background-repeat: no-repeat;
+ background-position: 5px 10px;
+}
+
+div.error h4 {
+ border-color: #ff0000;
+}
+
+div.notice[id^=version_check] {
+ border-color: #002DFF;
+ background-color: #EEF;
+}
+
+div.notice[id^=version_check] h4 {
+ border-color: #002DFF;
+}
+
+
+
+/* form tabs */
+
+ul.tabs {
+ margin: 1.1em .2em 0;
+ padding: 0 0 .3em 0;
+ list-style: none;
+ font-weight: bold;
+}
+
+ul.tabs li {
+ float: left;
+ margin-bottom: -1px;
+}
+
+ul.tabs li a {
+ display: block;
+ margin: .1em .2em 0;
+ white-space: nowrap;
+ text-decoration: none;
+ border: 1px solid #D5D5D5;
+ border-bottom: 1px solid #aaa;
+}
+
+ul.tabs li a {
+ padding: 7px 10px;
+ -webkit-border-radius: 5px 5px 0 0;
+ -moz-border-radius: 5px 5px 0 0;
+ border-radius: 5px 5px 0 0;
+ background: #f2f2f2;
+ color: #555;
+ text-shadow: 0 1px 0 #fff;
+}
+
+ul.tabs li a:hover,
+ul.tabs li a:active {
+ background: #e5e5e5;
+}
+
+ul.tabs li.active a {
+ background-color: #fff;
+ margin-top: 1px;
+ color: #000;
+ text-shadow: none;
+ border-color: #aaa;
+ border-bottom: 1px solid #fff;
+}
+
+.tabs_contents {
+ margin-top: 1em;
+}
+
+.tabs_contents fieldset {
+ margin-top: 0;
+}
+
+.tabs_contents legend {
+ display: none;
+}
+
+/* "restore default value" and "set value: foo" buttons */
+
+.restore-default img, .set-value img {
+ margin-bottom: -3px;
+}
+
+.userprefs-comment {
+ cursor: help;
+ float: right;
+}
+
+/* forms */
+
+fieldset {
+ margin-top: 1em;
+ border-radius: 4px 4px 0 0;
+ -moz-border-radius: 4px 4px 0 0;
+ -webkit-border-radius: 4px 4px 0 0;
+ border: #aaa solid 1px;
+ padding: 1.5em;
+ background: #eee;
+ text-shadow: 0 1px 0 #fff;
+ -moz-box-shadow: 1px 1px 2px #fff inset;
+ -webkit-box-shadow: 1px 1px 2px #fff inset;
+ box-shadow: 1px 1px 2px #fff inset;
+}
+
+fieldset.optbox {
+ padding: 0;
+}
+
+fieldset fieldset {
+ margin: .8em;
+ background: #fff;
+ border: 1px solid #aaa;
+ background: #E8E8E8;
+
+}
+
+fieldset legend {
+ font-weight: bold;
+ color: #444;
+ padding: 5px 10px;
+ border-radius: 2px;
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+ border: 1px solid #aaa;
+ background-color: #fff;
+ -moz-box-shadow: 3px 3px 15px #bbb;
+ -webkit-box-shadow: 3px 3px 15px #bbb;
+ box-shadow: 3px 3px 15px #bbb;
+}
+
+.form {
+ border: 2px #DEE1FF solid;
+}
+
+fieldset p {
+ margin: 0;
+ padding: .5em;
+ background: #fff;
+ border-top: 0;
+}
+
+fieldset .errors { /* form error list */
+ margin: 0 -2px 1em -2px;
+ padding: 0.5em 1.5em;
+ background: #FBEAD9;
+ border: 1px #C83838 solid;
+ border-width: 1px 0;
+ list-style: none;
+ font-family: sans-serif;
+ font-size: small;
+}
+
+fieldset .inline_errors { /* field error list */
+ margin: 0.3em 0.3em 0.3em 0;
+ padding: 0;
+ list-style: none;
+ color: #9A0000;
+ font-size: small;
+}
+
+table caption, table th, table td {
+ text-shadow: 0 1px 0 #FFFFFF;
+}
+
+fieldset th {
+ width: 40%;
+ min-width: 350px;
+ padding: 0.3em 0.3em 0.3em 0.5em;
+ text-align: left;
+ font-weight: bold;
+ vertical-align: top;
+}
+
+fieldset.simple th {
+ width: auto;
+ min-width: 0;
+}
+
+fieldset .doc {
+ margin-left: 1em;
+}
+
+fieldset td {
+ padding-top: 0.3em;
+ vertical-align: top;
+}
+
+fieldset td.userprefs-allow {
+ padding: 0;
+ vertical-align: middle;
+ text-align: center;
+ width: 3em;
+}
+
+fieldset td.userprefs-allow:hover {
+ cursor: pointer;
+ background-color: #EEE;
+}
+
+fieldset th small {
+ display: block;
+ font-weight: normal;
+ font-family: sans-serif;
+ font-size: x-small;
+ color: #666;
+}
+
+fieldset th, fieldset td, .form .lastrow {
+ border-top: 1px solid #D5D5D5;
+}
+
+fieldset .group-header th {
+ background: #EAEDFF;
+ border: none;
+}
+
+fieldset .group-field-1 th, fieldset .group-header-2 th {
+ padding-left: 1em;
+}
+
+fieldset .group-field-2 th, fieldset .group-header-3 th {
+ padding-left: 2em;
+}
+
+fieldset .group-field-3 th {
+ padding-left: 3em;
+}
+
+fieldset .lastrow, .form .lastrow {
+ border-top: 1px #000 solid;
+ background: #D3DCE3;
+ padding: .5em;
+ text-align: center;
+}
+
+input[type=text] {
+ border-radius: 2px;
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+
+ box-shadow: 0 1px 2px #ddd;
+ -moz-box-shadow: 0 1px 2px #ddd;
+ -webkit-box-shadow: 0 1px 2px #ddd;
+
+ background: white;
+ border: 1px solid #aaa;
+ color: #555;
+ padding: 4px;
+ margin: 6px;
+
+}
+
+input[type=password] {
+ border-radius: 2px;
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+
+ box-shadow: 0 1px 2px #ddd;
+ -moz-box-shadow: 0 1px 2px #ddd;
+ -webkit-box-shadow: 0 1px 2px #ddd;
+
+ background: white;
+ border: 1px solid #aaa;
+ color: #555;
+ padding: 4px;
+ margin: 6px;
+
+}
+
+input[type=submit],
+button[type=submit]:not(.mult_submit) {
+ font-weight: bold !important;
+}
+
+input[type=submit],
+button[type=submit]:not(.mult_submit),
+input[type=reset],
+input[name=submit_reset],
+input.button {
+ margin-left: 14px;
+ border: 1px solid #aaa;
+ padding: 3px 7px;
+ color: #111;
+ text-decoration: none;
+ background: #ddd;
+
+ border-radius: 12px;
+ -webkit-border-radius: 12px;
+ -moz-border-radius: 12px;
+
+ text-shadow: 0 1px 0 #fff;
+
+ background-image: url(../themes/svg_gradient.php?from=ffffff&to=cccccc);
+ background-size: 100% 100%;
+ background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#cccccc));
+ background: -webkit-linear-gradient(top, #ffffff, #cccccc);
+ background: -moz-linear-gradient(top, #ffffff, #cccccc);
+ background: -ms-linear-gradient(top, #ffffff, #cccccc);
+ background: -o-linear-gradient(top, #ffffff, #cccccc);
+}
+
+input[type=submit]:hover,
+button[type=submit]:not(.mult_submit):hover,
+input[type=reset]:hover,
+input[name=submit_reset]:hover,
+input.button:hover {
+ position: relative;
+ background-image: url(../themes/svg_gradient.php?from=cccccc&to=dddddd);
+ background-size: 100% 100%;
+ background: -webkit-gradient(linear, left top, left bottom, from(#cccccc), to(#dddddd));
+ background: -webkit-linear-gradient(top, #cccccc, #dddddd);
+ background: -moz-linear-gradient(top, #cccccc, #dddddd);
+ background: -ms-linear-gradient(top, #cccccc, #dddddd);
+ background: -o-linear-gradient(top, #cccccc, #dddddd);
+ cursor: pointer;
+}
+
+input[type=submit]:active,
+button[type=submit]:not(.mult_submit):active,
+input[type=reset]:active,
+input[name=submit_reset]:active,
+input.button:active {
+ position: relative;
+ top: 1px;
+ left: 1px;
+}
+
+input[type="checkbox"],
+input[type="radio"] {
+ vertical-align: -11%;
+}
+
+
+select {
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+
+ -moz-box-shadow: 0 1px 2px #ddd;
+ -webkit-box-shadow: 0 1px 2px #ddd;
+ box-shadow: 0 1px 2px #ddd;
+
+ border: 1px solid #aaa;
+ color: #333;
+ padding: 3px;
+ background: white;
+}
+
+fieldset.simple th, fieldset.simple td {
+ border-top: none;
+ border-bottom: 1px #555 dotted;
+}
+
+fieldset.simple .lastrow {
+ border: 0;
+}
+
+/* form elements */
+
+span.checkbox {
+ padding: 2px;
+ display: inline-block;
+}
+
+.custom { /* customized field */
+ background: #FFC;
+}
+
+.checkbox.custom {
+ padding: 1px;
+ border: 1px #EDEC90 solid;
+}
+
+.field-error {
+ border-color: #C11 !important;
+}
+
+.field-comment {
+
+ position: relative;
+}
+
+.field-comment-mark {
+ cursor: help;
+ padding: 0 0.2em;
+ font-weight: bold;
+ font-style: italic;
+}
+
+.field-comment-warning {
+ color: #A00;
+}
+
+.green { /* default form button */
+ color: #080 !important;
+}
+
+table.datatable {
+ margin: 0.5em 0 1em;
+}
+
+table.datatable th {
+ padding: 0 1em 0 0.5em;
+ border-bottom: 1px #999 solid;
+ text-align: left;
+}
+
+table.datatable td {
+ padding: 1px 0.5em;
+ border-bottom: 1px #DEE1FF solid;
+}
+
+/* textarea with config file's contents */
+
+#textconfig {
+ width: 100%;
+ border: 0;
+}
+
+/* error list */
+
+dd {
+ margin-left: 0.5em;
+}
+
+dd:before {
+ content: "\25B8 ";
+}
+
+/* links on failed validation page, when saving a form */
+
+a.btn {
+ padding: 1px 5px;
+ text-decoration: none;
+ background: #E2E8FF;
+ border: 1px #A6C8FF solid;
+ border-top-color: #AFD0FF;
+ border-left-color: #AFD0FF;
+ font-weight: bold;
+}
+
+a.btn:hover, a.btn:active {
+ background: #E6F5FF;
+ color: #004C96;
+}
diff --git a/hugo/setup/validate.php b/hugo/setup/validate.php
new file mode 100644
index 0000000..2cb8c93
--- /dev/null
+++ b/hugo/setup/validate.php
@@ -0,0 +1,30 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Validation callback.
+ *
+ * @package PhpMyAdmin-Setup
+ */
+
+/**
+ * Core libraries.
+ */
+require './lib/common.inc.php';
+
+$validators = array();
+require './libraries/config/validate.lib.php';
+
+header('Content-type: application/json');
+
+$vids = explode(',', filter_input(INPUT_POST, 'id'));
+$values = json_decode(filter_input(INPUT_POST, 'values'));
+if (!($values instanceof stdClass)) {
+ PMA_fatalError(__('Wrong data'));
+}
+$values = (array)$values;
+$result = PMA_config_validate($vids, $values, true);
+if ($result === false) {
+ $result = 'Wrong data or no validation for ' . $vids;
+}
+echo $result !== true ? json_encode($result) : '';
+?>