diff --git a/ChangeLog b/ChangeLog
index 58e4e0f51..ed4fb6292 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
+ BLOBstreaming support, thanks to Raj Kissu Rajandran (work in progress)
+ patch #2067462 [lang] link FAQ references in messages,
thanks to Thijs Kinkhorst - kink
++ new setup script, thanks to Piotr Przybylski (work in progress)
3.0.0.0 (not yet released)
+ [export] properly handle line breaks for YAML, thanks to Dan Barry -
diff --git a/Documentation.html b/Documentation.html
index 4c520d387..6005af70a 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -231,7 +231,7 @@ $cfg['Servers'][$i]['password'] = 'cbb74bc'; // use here your password
Configuration Section of this document.
Instead of manually editing
config.inc.php , you can use the
- Setup Script . First you must
+ Setup Script . First you must
manually create a folder config in the phpMyAdmin
directory. This is a security measure. On a Linux/Unix system you
can use the following commands:
@@ -249,7 +249,7 @@ chmod o+w config/config.inc.php # give it world writable permissions
web server has read and write access to it. FAQ
1.26 can help with this.
- Next, open scripts/setup.php
+ Next, open setup/
in your browser. Note that changes are not saved to
disk until explicitly choose Save from the
Configuration area of the screen. Normally the script saves
diff --git a/config.sample.inc.php b/config.sample.inc.php
index 5e3728f58..eedd3b308 100644
--- a/config.sample.inc.php
+++ b/config.sample.inc.php
@@ -2,7 +2,7 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin sample configuration, you can use it as base for
- * manual configuration. For easier setup you can use scripts/setup.php
+ * manual configuration. For easier setup you can use setup/
*
* All directives are explained in Documentation.html and on phpMyAdmin
* wiki .
diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php
index 42ace1beb..347d77165 100644
--- a/libraries/auth/config.auth.lib.php
+++ b/libraries/auth/config.auth.lib.php
@@ -103,7 +103,7 @@ function PMA_auth_fails()
} else {
// Check whether user has configured something
if ($_SESSION['PMA_Config']->source_mtime == 0) {
- echo '' . sprintf($GLOBALS['strAccessDeniedCreateConfig'], '', ' ') . '
' . "\n";
+ echo '' . sprintf($GLOBALS['strAccessDeniedCreateConfig'], '', ' ') . '
' . "\n";
} elseif (!isset($GLOBALS['errno']) || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) && $GLOBALS['errno'] != 2003) {
// if we display the "Server not responding" error, do not confuse users
// by telling them they have a settings problem
diff --git a/scripts/setup.php b/scripts/setup.php
deleted file mode 100644
index 075757c82..000000000
--- a/scripts/setup.php
+++ /dev/null
@@ -1,2027 +0,0 @@
-
- * @copyright 2006 Michal Čihař
- * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
- * @version $Id$
- */
-
-// Grab phpMyAdmin version
-define('PMA_MINIMUM_COMMON', TRUE);
-define('PMA_SETUP', TRUE);
-chdir('..');
-require_once './libraries/common.inc.php';
-
-// Grab configuration defaults
-// Do not use $PMA_Config, it interferes with the one in $_SESSION
-// on servers with register_globals enabled
-$PMA_Config_Setup = new PMA_Config();
-
-// Script information
-$script_info = 'phpMyAdmin ' . $PMA_Config_Setup->get('PMA_VERSION') . ' setup script by Michal Čihař ';
-$script_version = '$Id$';
-
-// Grab action
-if (isset($_POST['action'])) {
- $action = $_POST['action'];
-} else {
- $action = '';
-}
-
-// Grab wanted CRLF type
-if (isset($_POST['eoltype'])) {
- $eoltype = $_POST['eoltype'];
-} else {
- if (PMA_USR_OS == 'Win') {
- $eoltype = 'dos';
- } else {
- $eoltype = 'unix';
- }
-}
-
-// Detect which CRLF to use
-if ($eoltype == 'dos') {
- $crlf = "\r\n";
-} elseif ($eoltype == 'mac') {
- $crlf = "\r";
-} else {
- $crlf = "\n";
-}
-
-if (isset($_POST['configuration']) && $action != 'clear') {
- // Grab previous configuration, if it should not be cleared
- $configuration = unserialize($_POST['configuration']);
-} else {
- // Start with empty configuration
- $configuration = array();
-}
-
-// We rely on Servers array to exist, so create it here
-if (!isset($configuration['Servers']) || !is_array($configuration['Servers'])) {
- $configuration['Servers'] = array();
-}
-
-// Used later
-$now = gmdate('D, d M Y H:i:s') . ' GMT';
-
-// General header for no caching
-header('Expires: ' . $now); // rfc2616 - Section 14.21
-header('Last-Modified: ' . $now);
-header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
-header('Pragma: no-cache'); // HTTP/1.0
-
-// whether to show html header?
-if ($action != 'download') {
-
-// Define the charset to be used
-header('Content-Type: text/html; charset=utf-8');
-
-// this needs to be echoed otherwise php with short tags complains
-echo '' . "\n";
-?>
-
-
-
-
-
- phpMyAdmin get('PMA_VERSION'); ?> setup
-
-
-
-
-
-
-
-phpMyAdmin get('PMA_VERSION'); ?> setup
-' .
- '' .
- ' ' .
- ' ' .
- '' .
- ' ' .
- ' ' .
- ''
- ;
-}
-
-/**
- * Displays message
- *
- * @param string type of message (notice/warning/error)
- * @param string text of message
- * @param title optional title of message
- *
- * @return nothing
- */
-function message($type, $text, $title = '') {
- echo '' . "\n";
- if (!empty($title)) {
- echo '
';
- echo $title;
- echo ' ' . "\n";
- }
- echo $text . "\n";
- echo '' . "\n";
-}
-
-/**
- * Creates hidden input required for keeping current configuraion
- *
- * @return string HTML with hidden inputs
- */
-function get_hidden_cfg() {
- global $configuration, $eoltype;
-
- $ret = ' ' . "\n";
- $ret .= ' ' . "\n";
-
- return $ret;
-}
-
-/**
- * Returns needed hidden input for forms.
- *
- * @return string HTML with hidden inputs
- */
-function get_hidden_inputs() {
- return ' ';
-}
-
-/**
- * Creates form for some action
- *
- * @param string action name
- * @param string form title
- * @param string optional additional inputs
- *
- * @return string HTML with form
- */
-function get_action($name, $title, $added = '', $enabled = TRUE) {
- $ret = '';
- $ret .= '';
- $ret .= "\n";
- return $ret;
-}
-
-/**
- * Terminates script and ends HTML
- *
- * @return nothing
- */
-function footer() {
- echo '';
- echo '';
- exit;
-}
-
-/**
- * Creates string describing server authentication method
- *
- * @param array server configuration
- *
- * @return string authentication method description
- */
-function get_server_auth($val) {
- global $PMA_Config_Setup;
-
- if (isset($val['auth_type'])) {
- $auth = $val['auth_type'];
- } else {
- $auth = $PMA_Config_Setup->default_server['auth_type'];
- }
- $ret = $auth;
- if ($auth == 'config') {
- if (isset($val['user'])) {
- $ret .= ':' . $val['user'];
- } else {
- $ret .= ':' . $PMA_Config_Setup->default_server['user'];
- }
- }
- return $ret;
-}
-
-/**
- * Creates nice string with server name
- *
- * @param array server configuration
- * @param int optional server id
- *
- * @return string fancy server name
- */
-function get_server_name($val, $id = FALSE, $escape = true) {
- if (!empty($val['verbose'])) {
- $ret = $val['verbose'];
- } else {
- $ret = $val['host'];
- }
- $ret .= ' (' . get_server_auth($val) . ')';
- if ($id !== FALSE) {
- $ret .= ' [' . ($id + 1) . ']' ;
- }
- if ($escape) {
- return htmlspecialchars($ret);
- } else {
- return $ret;
- }
-}
-
-
-/**
- * Exports variable to PHP code, very limited version of var_export
- *
- * @param string data to export
- *
- * @see var_export
- *
- * @return string PHP code containing variable value
- */
-function PMA_var_export($input) {
- global $crlf;
-
- $output = '';
- if (is_null($input)) {
- $output .= 'NULL';
- } elseif (is_array($input)) {
- $output .= 'array (' . $crlf;
- foreach($input as $key => $value) {
- $output .= PMA_var_export($key) . ' => ' . PMA_var_export($value);
- $output .= ',' . $crlf;
- }
- $output .= ')';
- } elseif (is_string($input)) {
- $output .= '\'' . addslashes($input) . '\'';
- } elseif (is_int($input) || is_double($input)) {
- $output .= (string) $input;
- } elseif (is_bool($input)) {
- $output .= $input ? 'true' : 'false';
- } else {
- die('Unknown type for PMA_var_export: ' . $input);
- }
- return $output;
-}
-
-/**
- * Creates configuration code for one variable
- *
- * @param string variable name
- * @param mixed configuration
- *
- * @return string PHP code containing configuration
- */
-function get_cfg_val($name, $val) {
- global $crlf;
-
- $ret = '';
- if (is_array($val)) {
- $ret .= $crlf;
- foreach ($val as $k => $v) {
- if (!isset($type)) {
- if (is_string($k)) {
- $type = 'string';
- } elseif (is_int($k)) {
- $type = 'int';
- $ret .= $name . ' = array(' . $crlf;
- } else {
- // Something unknown...
- $ret .= $name. ' = ' . PMA_var_export($val) . ';' . $crlf;
- break;
- }
- }
- if ($type == 'string') {
- $ret .= get_cfg_val($name . "['$k']", $v);
- } elseif ($type == 'int') {
- $ret .= ' ' . PMA_var_export($v) . ',' . $crlf;
- }
- }
- if (!isset($type)) {
- /* Empty array */
- $ret .= $name . ' = array();' . $crlf;
- } elseif ($type == 'int') {
- $ret .= ');' . $crlf;
- }
- $ret .= $crlf;
- unset($type);
- } else {
- $ret .= $name . ' = ' . PMA_var_export($val) . ';' . $crlf;
- }
- return $ret;
-}
-
-/**
- * Creates configuration PHP code
- *
- * @param array configuration
- *
- * @return string PHP code containing configuration
- */
-function get_cfg_string($cfg) {
- global $script_info, $script_version, $now, $crlf;
-
- $c = $cfg;
- $ret = " 0) {
- $ret .= "/* Servers configuration */$crlf\$i = 0;" . $crlf;
- foreach ($c['Servers'] as $cnt => $srv) {
- $ret .= $crlf . '/* Server ' . strtr(get_server_name($srv, $cnt, false), '*', '-') . " */$crlf\$i++;" . $crlf;
- foreach ($srv as $key => $val) {
- $ret .= get_cfg_val("\$cfg['Servers'][\$i]['$key']", $val);
- }
- }
- $ret .= $crlf . '/* End of servers configuration */' . $crlf . $crlf;
- }
- unset($c['Servers']);
-
- foreach ($c as $key => $val) {
- $ret .= get_cfg_val("\$cfg['$key']", $val);
- }
-
- $ret .= '?>' . $crlf;
- return $ret;
-}
-
-/**
- * Compresses server configuration to be indexed from 0 and contain no gaps
- *
- * @param array configuration
- *
- * @return nothing
- */
-function compress_servers(&$cfg) {
- $ns = array();
- foreach ($cfg['Servers'] as $val) {
- if (!empty($val['host'])) {
- $ns[] = $val;
- }
- }
- $cfg['Servers'] = $ns;
-}
-
-/**
- * Grabs values from POST
- *
- * @param string list of values to grab, values are separated by ";",
- * each can have defined type separated by ":", if no type
- * is defined, string is assumed. Possible types: bool -
- * boolean value, serialized - serialized value, int -
- * integer, tristate - "TRUE"/"FALSE" converted to bool,
- * other strings are kept.
- *
- * @return array array with grabbed values
- */
-function grab_values($list)
-{
- $a = split(';', $list);
- $res = array();
- foreach ($a as $val) {
- $v = split(':', $val);
- if (!isset($v[1])) {
- $v[1] = '';
- }
- switch($v[1]) {
- case 'bool':
- $res[$v[0]] = isset($_POST[$v[0]]);
- break;
- case 'serialized':
- if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
- $res[$v[0]] = unserialize($_POST[$v[0]]);
- }
- break;
- case 'int':
- if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
- $res[$v[0]] = (int)$_POST[$v[0]];
- }
- break;
- case 'tristate':
- if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
- $cur = $_POST[$v[0]];
- if ($cur == 'TRUE') {
- $res[$v[0]] = TRUE;
- } elseif ($cur == 'FALSE') {
- $res[$v[0]] = FALSE;
- } else {
- $res[$v[0]] = $cur;
- }
- }
- break;
- case 'string':
- default:
- if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
- $res[$v[0]] = $_POST[$v[0]];
- }
- break;
- }
- }
- return $res;
-}
-
-/**
- * Displays overview
- *
- * @param string title of oveview
- * @param array list of values to display (each element is array of two
- * values - name and value)
- * @param string optional buttons to be displayed
- *
- * @return nothing
- */
-function show_overview($title, $list, $buttons = '') {
- echo '' . "\n";
- echo '' . $title . ' ' . "\n";
- foreach ($list as $val) {
- echo '';
- echo '
';
- echo $val[0];
- echo '
';
- echo '
';
- echo htmlspecialchars($val[1]);
- echo '
';
- echo '
' . "\n";
- }
- if (!empty($buttons)) {
- echo '' . "\n";
- }
- echo ' ' . "\n";
- echo "\n";
-}
-
-/**
- * Displays configuration, fallback defaults are taken from global $PMA_Config_Setup
- *
- * @param array list of values to display (each element is array of two or
- * three values - desription, name and optional type
- * indicator). Type is determined by type of this parameter,
- * array means select and array elements are items,
- * 'password' means password input.
- * @param string title of configuration
- * @param string help string for this configuration
- * @param array optional first level defaults
- * @param string optional title for save button
- * @param string optional prefix for documentation links
- *
- * @return nothing
- */
-function show_config_form($list, $legend, $help, $defaults = array(), $save = '', $prefix = '') {
- global $PMA_Config_Setup;
-
- if (empty($save)) {
- $save = 'Update';
- }
-
- echo '' . "\n";
- echo '' . $legend . ' ' . "\n";
- echo '' . $help . '
' . "\n";
- foreach ($list as $val) {
- echo '';
- $type = 'text';
- if (isset($val[3])) {
- if (is_array($val[3])) {
- $type = 'select';
- } elseif (is_bool($val[3])) {
- $type = 'check';
- } elseif ($val[3] == 'password') {
- $type = 'password';
- }
- }
- switch ($type) {
- case 'text':
- case 'password':
- echo '' . $val[0] . get_cfg_doc($prefix . $val[1]) . ' ';
- echo ' ';
- break;
- case 'check':
- echo ' get($val[1])) {
- echo ' checked="checked"';
- }
- }
- echo ' />';
- echo '' . $val[0] . get_cfg_doc($prefix . $val[1]) . ' ';
- break;
- case 'select':
- echo '' . $val[0] . get_cfg_doc($prefix . $val[1]) . ' ';
- echo '';
- foreach ($val[3] as $opt) {
- echo 'get($val[1]);
- if (is_bool($val)) {
- if (($def_val && $opt == 'TRUE') || (!$def_val && $opt == 'FALSE')) {
- echo ' selected="selected"';
- }
- } else {
- if ($def_val == $opt) {
- echo ' selected="selected"';
- }
- }
- unset($def_val);
- }
- echo '>' . $opt . ' ';
- }
- echo ' ';
- break;
- }
- echo '
' . "\n";
- }
- echo '' . "\n";
- echo ' ' . "\n";
- echo "\n";
-}
-
-/**
- * Shows security options configuration form
- *
- * @param array optional defaults
- *
- * @return nothing
- */
-function show_security_form($defaults = array()) {
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ';
- foreach ($cfg['Servers'] as $key => $val) {
- $ret .= '' . get_server_name($val, $key) . ' ';
- }
- $ret .= '';
- return $ret;
-}
-
-/**
- * Loads configuration from file
- *
- * @param string filename
- *
- * @return mixed FALSE on failure, new config array on success
- */
-function load_config($config_file) {
- if (file_exists($config_file)) {
- $success_apply_user_config = FALSE;
- $old_error_reporting = error_reporting(0);
- if (function_exists('file_get_contents')) {
- $success_apply_user_config = eval('?>' . trim(file_get_contents($config_file)));
- } else {
- $success_apply_user_config =
- eval('?>' . trim(implode("\n", file($config_file))));
- }
- error_reporting($old_error_reporting);
- unset($old_error_reporting);
- if ($success_apply_user_config === FALSE) {
- message('error', 'Error while parsing configuration file!');
- } elseif (!isset($cfg) || count($cfg) == 0) {
- message('error', 'Config file seems to contain no configuration!');
- } else {
- // This must be set
- if (!isset($cfg['Servers'])) {
- $cfg['Servers'] = array();
- }
- message('notice', 'Configuration loaded');
- compress_servers($cfg);
- return $cfg;
- }
- } else {
- message('error', 'Configuration file not found!');
- }
- return FALSE;
-}
-
-if ($action != 'download') {
- // Check whether we can write to configuration
- $fail_dir = FALSE;
- $fail_dir = $fail_dir || !is_dir('./config/');
- $fail_dir = $fail_dir || !is_writable('./config/');
- $fail_dir = $fail_dir || (file_exists('./config/config.inc.php') && !is_writable('./config/config.inc.php'));
- $config = @fopen('./config/config.inc.php', 'a');
- $fail_dir = $fail_dir || ($config === FALSE);
- @fclose($config);
-}
-
-/**
- * @var boolean whether to show configuration overview
- */
-$show_info = FALSE;
-
-// Do the main work depending on selected action
-switch ($action) {
- case 'download':
- header('Content-Type: text/plain');
- header('Content-Disposition: attachment; filename="config.inc.php"');
-
- echo get_cfg_string($configuration);
- exit;
- break;
- case 'display':
- echo '' . "\n";
- ?>
-
- default_server;
- unset($defaults['AllowDeny']); // Ignore this for now
- } else {
- $defaults = array();
- }
-
- // Guess MySQL extension to use, prefer mysqli
- if (function_exists('mysqli_get_client_info')) {
- $defaults['extension'] = 'mysqli';
- } elseif (function_exists('mysql_get_client_info')) {
- $defaults['extension'] = 'mysql';
- } else {
- message('warning', 'Could not load either mysql or mysqli extension, you might not be able to use phpMyAdmin! Check your PHP configuration.');
- }
- if (isset($defaults['extension'])) {
- message('notice', 'Autodetected MySQL extension to use: ' . $defaults['extension']);
- }
-
- // Display form
- show_server_form($defaults);
- break;
- case 'editserver':
- if (!isset($_POST['server'])) {
- footer();
- }
- show_server_form($configuration['Servers'][$_POST['server']], $_POST['server']);
- break;
- case 'deleteserver':
- if (!isset($_POST['server'])) {
- footer();
- }
- message('notice', 'Deleted server ' . get_server_name($configuration['Servers'][$_POST['server']], $_POST['server']));
- unset($configuration['Servers'][$_POST['server']]);
- compress_servers($configuration);
- $show_info = TRUE;
- break;
- case 'servers':
- if (count($configuration['Servers']) == 0) {
- message('notice', 'No servers defined, so none can be shown');
- } else {
- foreach ($configuration['Servers'] as $i => $srv) {
- $data = array();
- if (!empty($srv['verbose'])) {
- $data[] = array('Verbose name', $srv['verbose']);
- }
- $data[] = array('Host', $srv['host']);
- $data[] = array('MySQL extension', isset($srv['extension']) ? $srv['extension'] : $PMA_Config_Setup->default_server['extension']);
- $data[] = array('Authentication type', get_server_auth($srv));
- $data[] = array('phpMyAdmin advanced features', empty($srv['pmadb']) || empty($srv['controluser']) || empty($srv['controlpass']) ? 'disabled' : 'enabled, db: ' . $srv['pmadb'] . ', user: ' . $srv['controluser']);
- $buttons =
- get_action('deleteserver', 'Delete', ' ') .
- get_action('editserver', 'Edit', ' ');
- show_overview('Server ' . get_server_name($srv, $i), $data, $buttons);
- }
- }
- break;
-
- case 'feat_upload_real':
- if (isset($_POST['submit_save'])) {
- $dirs = grab_values('UploadDir;SaveDir');
- $err = FALSE;
- if (!empty($dirs['UploadDir']) && !is_dir($dirs['UploadDir'])) {
- message('error', 'Upload directory ' . htmlspecialchars($dirs['UploadDir']) . ' does not exist!');
- $err = TRUE;
- }
- if (!empty($dirs['SaveDir']) && !is_dir($dirs['SaveDir'])) {
- message('error', 'Save directory ' . htmlspecialchars($dirs['SaveDir']) . ' does not exist!');
- $err = TRUE;
- }
- if ($err) {
- show_upload_form($dirs);
- } else {
- $configuration = array_merge($configuration, $dirs);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'feat_upload':
- show_upload_form($configuration);
- break;
-
- case 'feat_security_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('blowfish_secret;ForceSSL:bool;ShowPhpInfo:bool;ShowChgPassword:bool;AllowArbitraryServer:bool;LoginCookieRecall:book;LoginCookieValidity:int');
- $err = FALSE;
- if (empty($vals['blowfish_secret'])) {
- message('warning', 'Blowfish secret is empty, you will not be able to use cookie authentication.');
- }
- if ($vals['AllowArbitraryServer']) {
- message('warning', 'Arbitrary server connection might be dangerous as it might allow access to internal servers that are not reachable from outside.');
- }
- if (isset($vals['LoginCookieValidity']) && $vals['LoginCookieValidity'] < 1) {
- message('error', 'Invalid cookie validity time');
- $err = TRUE;
- }
- if ($err) {
- show_security_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'feat_security':
- show_security_form($configuration);
- break;
-
- case 'feat_manual_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('MySQLManualBase;MySQLManualType');
- $err = FALSE;
- if ($vals['MySQLManualType'] != 'none' && empty($vals['MySQLManualBase'])) {
- message('error', 'You need to set manual base URL or choose type \'none\'.');
- $err = TRUE;
- }
- if ($err) {
- show_manual_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'feat_manual':
- show_manual_form($configuration);
- break;
-
- case 'feat_charset_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('AllowAnywhereRecoding:bool;DefaultCharset;RecodingEngine;IconvExtraParams');
- $err = FALSE;
- if ($err) {
- show_charset_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'feat_charset':
- $d = $configuration;
- if (!isset($d['RecodingEngine'])) {
- if (@extension_loaded('iconv')) {
- $d['RecodingEngine'] = 'iconv';
- } elseif (@extension_loaded('recode')) {
- $d['RecodingEngine'] = 'recode';
- } else {
- message('warning', 'Neither recode nor iconv could be loaded so charset conversion will most likely not work.');
- }
- if (isset($d['RecodingEngine'])) {
- message('notice', 'Autodetected recoding engine: ' . $d['RecodingEngine']);
- }
- }
- show_charset_form($d);
- unset($d);
- break;
-
- case 'feat_extensions_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('GD2Available');
- $err = FALSE;
- if ($err) {
- show_extensions_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'feat_extensions':
- $d = $configuration;
- if (!@extension_loaded('mbstring')) {
- message('warning', 'Could not find mbstring
extension, which is required for work with multibyte strings like UTF-8 ones. Please consider installing it.');
- }
- if (!isset($d['GD2Available'])) {
- if (PMA_IS_GD2 == 1) {
- message('notice', 'GD 2 or newer found.');
- $d['GD2Available'] = 'yes';
- } else {
- message('warning', 'GD 2 or newer is not present.');
- $d['GD2Available'] = 'no';
- }
- }
- show_extensions_form($d);
- unset($d);
- break;
-
- case 'feat_relation_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('QueryHistoryDB:bool;QueryHistoryMax:int;BrowseMIME:bool;PDFDefaultPageSize');
- $err = FALSE;
- if (isset($vals['QueryHistoryMax']) && $vals['QueryHistoryMax'] < 1) {
- message('error', 'Invalid value for query maximum history size!');
- $err = TRUE;
- }
- if ($err) {
- show_relation_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'feat_relation':
- show_relation_form($configuration);
- break;
-
- case 'lay_navigation_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('LeftFrameLight:bool;LeftFrameDBTree:bool;LeftFrameDBSeparator;LeftFrameTableSeparator;LeftFrameTableLevel:int;LeftDisplayLogo:bool;LeftDisplayServers:bool;DisplayServersList:bool;DisplayDatabasesList;LeftPointerEnable:bool');
- $err = FALSE;
- if (isset($vals['DisplayDatabasesList'])) {
- if ($vals['DisplayDatabasesList'] == 'yes') {
- $vals['DisplayDatabasesList'] = true;
- } elseif ($vals['DisplayDatabasesList'] == 'no') {
- $vals['DisplayDatabasesList'] = false;
- }
- }
- if (isset($vals['LeftFrameTableLevel']) && $vals['LeftFrameTableLevel'] < 1) {
- message('error', 'Invalid value for maximum table nesting level!');
- $err = TRUE;
- }
- if ($err) {
- show_left_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'lay_navigation':
- show_left_form($configuration);
- break;
-
- case 'lay_tabs_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('DefaultTabServer;DefaultTabDatabase;DefaultTabTable;LightTabs:bool');
- $err = FALSE;
- if ($err) {
- show_tabs_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'lay_tabs':
- show_tabs_form($configuration);
- break;
-
- case 'lay_icons_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('ErrorIconic:bool;MainPageIconic:bool;ReplaceHelpImg:bool;NavigationBarIconic:tristate;PropertiesIconic:tristate');
- $err = FALSE;
- if ($err) {
- show_icons_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'lay_icons':
- show_icons_form($configuration);
- break;
-
- case 'lay_browse_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('BrowsePointerEnable:bool;BrowseMarkerEnable:bool;ModifyDeleteAtRight:bool;ModifyDeleteAtLeft:bool;RepeatCells:int;DefaultDisplay');
- $err = FALSE;
- if (isset($vals['RepeatCells']) && $vals['RepeatCells'] < 1) {
- message('error', 'Invalid value for header repeating!');
- $err = TRUE;
- }
- if (!$vals['ModifyDeleteAtLeft'] && !$vals['ModifyDeleteAtRight']) {
- message('error', 'No action buttons enabled!');
- $err = TRUE;
- }
- if ($err) {
- show_browse_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'lay_browse':
- show_browse_form($configuration);
- break;
-
- case 'lay_edit_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('TextareaCols:int;TextareaRows:int;LongtextDoubleTextarea:bool;TextareaAutoSelect:bool;CharEditing;CharTextareaCols:int;CharTextareaRows:int;CtrlArrowsMoving:bool;DefaultPropDisplay;InsertRows:int');
- $err = FALSE;
- if (isset($vals['TextareaCols']) && $vals['TextareaCols'] < 1) {
- message('error', 'Invalid value for textarea columns!');
- $err = TRUE;
- }
- if (isset($vals['TextareaRows']) && $vals['TextareaRows'] < 1) {
- message('error', 'Invalid value for textarea rows!');
- $err = TRUE;
- }
- if (isset($vals['CharTextareaCols']) && $vals['CharTextareaCols'] < 1) {
- message('error', 'Invalid value for CHAR textarea columns!');
- $err = TRUE;
- }
- if (isset($vals['CharTextareaRows']) && $vals['CharTextareaRows'] < 1) {
- message('error', 'Invalid value for CHAR textarea rows!');
- $err = TRUE;
- }
- if (isset($vals['InsertRows']) && $vals['InsertRows'] < 1) {
- message('error', 'Invalid value for inserted rows count!');
- $err = TRUE;
- }
- if ($err) {
- show_edit_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'lay_edit':
- show_edit_form($configuration);
- break;
-
- case 'lay_window_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('EditInWindow:bool;QueryWindowHeight:int;QueryWindowWidth:int;QueryWindowDefTab');
- $err = FALSE;
- if (isset($vals['QueryWindowWidth']) && $vals['QueryWindowWidth'] < 1) {
- message('error', 'Invalid value for query window width!');
- $err = TRUE;
- }
- if (isset($vals['QueryWindowHeight']) && $vals['QueryWindowHeight'] < 1) {
- message('error', 'Invalid value for query window height');
- $err = TRUE;
- }
- if ($err) {
- show_window_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'lay_window':
- show_window_form($configuration);
- break;
-
-/* Template for new actions:
- case 'blah_real':
- if (isset($_POST['submit_save'])) {
- $vals = grab_values('value1:bool;value2');
- $err = FALSE;
- if (somechekcfails) {
- message('error', 'Invalid value for blah!');
- $err = TRUE;
- }
- if ($err) {
- show_blah_form($vals);
- } else {
- $configuration = array_merge($configuration, $vals);
- message('notice', 'Configuration changed');
- $show_info = TRUE;
- }
- } else {
- $show_info = TRUE;
- }
- break;
- case 'blah':
- show_blah_form($configuration);
- break;
-*/
- case 'versioncheck': // Check for latest available version
- $url = 'http://phpmyadmin.net/home_page/version.php';
- $data = '';
- $f = @fopen($url, 'r');
- if ($f === FALSE) {
- if (!function_exists('curl_init')) {
- message('error', 'Neither URL wrappers nor CURL are available. Version check is not possible.');
- break;
- }
- } else {
- $data = fread($f, 20);
- fclose($f);
- }
- if (empty($data) && function_exists('curl_init')) {
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_HEADER, FALSE);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- $data = curl_exec($ch);
- curl_close($ch);
- }
- if (empty($data)) {
- message('error', 'Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.');
- break;
- }
-
- /* Format: version\ndate\n(download\n)* */
- $data_list = split("\n", $data);
-
- if (count($data_list) > 0) {
- $version = $data_list[0];
- } else {
- $version = '';
- }
-
- $version_upstream = version_to_int($version);
- if ($version_upstream === FALSE) {
- message('error', 'Got invalid version string from server.');
- break;
- }
-
- $version_local = version_to_int($PMA_Config_Setup->get('PMA_VERSION'));
- if ($version_local === FALSE) {
- message('error', 'Unparsable version string.');
- break;
- }
-
- if ($version_upstream > $version_local) {
- message('notice', 'New version of phpMyAdmin is available, you should consider upgrade. New version is ' . htmlspecialchars($version) . '.');
- } else {
- if ($version_local % 100 == 0) {
- message('notice', 'You are using subversion version, run svn update
:-). However latest released version is ' . htmlspecialchars($version) . '.');
- } else {
- message('notice', 'No newer stable version is available.');
- }
- }
- break;
-
- case 'seteol':
- $eoltype = $_POST['neweol'];
- message('notice', 'End of line format changed.');
- case 'clear': // Actual clearing is done on beginning of this script
- case 'main':
- $show_info = TRUE;
- break;
-
- case '':
- message('notice', 'You want to configure phpMyAdmin using web interface. Please note that this only allows basic setup, please read documentation to see full description of all configuration directives.', 'Welcome');
-
- if ($fail_dir) {
- message('warning', 'Please create web server writable folder config in phpMyAdmin toplevel directory as described in documentation . Otherwise you will be only able to download or display it.', 'Can not load or save configuration');
- }
-
- if (empty($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') {
- if (empty($_SERVER['REQUEST_URI']) || empty($_SERVER['HTTP_HOST'])) {
- $redir = '';
- } else {
- $redir = ' If your server is also configured to accept HTTPS request'
- . ' follow this link to use secure connection.';
- }
- message('warning', 'You are not using secure connection, all data (including sensitive, like passwords) are transfered unencrypted!' . $redir, 'Not secure connection');
- }
- break;
-}
-
-// Should we show information?
-if ($show_info) {
- $servers = 'none';
- $servers_text = 'Servers';
- if (count($configuration['Servers']) == 0) {
- message('warning', 'No servers defined, you probably want to add one.');
- } else {
- $servers = '';
- $servers_text = 'Servers (' . count($configuration['Servers']) . ')';
-
- $sep = '';
- foreach ($configuration['Servers'] as $key => $val) {
- $servers .= $sep;
- $sep = ', ';
- $servers .= get_server_name($val, $key);
- }
- unset($sep);
- }
- show_overview('Current configuration overview',
- array(
- array($servers_text, $servers),
- array('SQL files upload', empty($configuration['UploadDir']) ? 'disabled' : 'enabled'),
- array('Exported files on server', empty($configuration['SaveDir']) ? 'disabled' : 'enabled'),
- array('Charset conversion', isset($configuration['AllowAnywhereRecoding']) && $configuration['AllowAnywhereRecoding'] ? 'enabled' : 'disabled'),
- ));
- unset($servers_text, $servers);
-}
-
-// And finally display all actions:
-echo 'Available global actions (please note that these will delete any changes you could have done above):
';
-
-echo 'Servers ' . "\n";
-echo get_action('addserver', 'Add');
-$servers = get_server_selection($configuration);
-if (!empty($servers)) {
- echo get_action('servers', 'List');
- echo get_action('deleteserver', 'Delete', $servers);
- echo get_action('editserver', 'Edit', $servers);
-}
-echo ' ' . "\n\n";
-
-echo 'Layout ' . "\n";
-echo get_action('lay_navigation', 'Navigation frame');
-echo get_action('lay_tabs', 'Tabs');
-echo get_action('lay_icons', 'Icons');
-echo get_action('lay_browse', 'Browsing');
-echo get_action('lay_edit', 'Editing');
-echo get_action('lay_window', 'Query window');
-echo ' ' . "\n\n";
-
-echo 'Features ' . "\n";
-echo get_action('feat_upload', 'Upload/Download');
-echo get_action('feat_security', 'Security');
-echo get_action('feat_manual', 'MySQL manual');
-echo get_action('feat_charset', 'Charsets');
-echo get_action('feat_extensions', 'Extensions');
-echo get_action('feat_relation', 'MIME/Relation/History');
-echo ' ' . "\n\n";
-
-echo 'Configuration ' . "\n";
-echo get_action('main', 'Overview');
-echo get_action('display', 'Display');
-echo get_action('download', 'Download');
-echo get_action('save', 'Save', '', !$fail_dir);
-echo get_action('load', 'Load', '', !$fail_dir);
-echo get_action('clear', 'Clear');
-echo get_action('seteol', 'Change end of line',
- '' .
- 'UNIX/Linux (\\n) ' .
- 'DOS/Windows (\\r\\n) ' .
- 'Macintosh (\\r) ' . '
- ');
-echo ' ' . "\n\n";
-
-echo 'Other actions ' . "\n";
-echo get_action('versioncheck', 'Check for latest version');
-echo get_url_action('http://www.phpmyadmin.net/', 'Go to homepage');
-echo get_url_action('https://sourceforge.net/donate/index.php', 'Donate to phpMyAdmin', array('group_id' => 23067));
-echo ' ' . "\n\n";
-
-footer();
-?>