// Grab phpMyAdmin version and PMA_dl function $cfg['GD2Available'] = 'auto'; require('../libraries/defines.lib.php'); unset($cfg); // Script information $script_info = 'phpMyAdmin ' . PMA_VERSION . ' setup script by Michal Čihař '; $script_version = '$Id$'; // Grab configuration defaults require('../config.default.php'); $default_cfg = $cfg; unset($cfg); /** * Removes slashes from string if needed (eg. magic quotes are enabled) * * @param string prossibly escaped string * * @return string unsescaped string */ function remove_slashes($val) { if (get_magic_quotes_gpc()) { return stripslashes($val); } return $val; } // Grab action if (isset($_POST['action'])) { $action = $_POST['action']; } else { $action = ''; } if (isset($_POST['cfg']) && $action != 'clear' ) { // Grab previous configuration, if it should not be cleared $cfg = unserialize(remove_slashes($_POST['cfg'])); } else { // Start with empty configuration $cfg = array(); } // We rely on Servers array to exist, so create it here if (!isset($cfg['Servers']) || !is_array($cfg['Servers'])) { $cfg['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 <?php echo PMA_VERSION; ?> setup

phpMyAdmin setup

Documentation'; } /** * 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 $cfg; return '' . "\n"; } /** * 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 = '') { $ret = ''; $ret .= '
'; $ret .= ''; $ret .= $added; $ret .= ''; $ret .= get_hidden_cfg(); $ret .= '
'; $ret .= "\n"; return $ret; } /** * Terminates script and ends HTML * * @return nothing */ function footer() { echo ''; exit; } /** * Creates string describing server authentication method * * @param array server configuration * * @return string authentication method description */ function get_server_auth($val) { global $default_cfg; if (isset($val['auth_type'])) { $auth = $val['auth_type']; } else { $auth = $default_cfg['Servers'][1]['auth_type']; } $ret = $auth; if ($auth == 'config') { if (isset($val['user'])) { $ret .= ':' . $val['user']; } else { $ret .= ':' . $default_cfg['Servers'][1]['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) { if (!empty($val['verbose'])) { $ret = htmlspecialchars($val['verbose']); } else { $ret = htmlspecialchars($val['host']); } $ret .= ' (' . get_server_auth($val) . ')'; if ($id !== FALSE) { $ret .= ' [' . ($id + 1) . ']' ; } 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; $c = $cfg; $ret = " 0) { $ret .= "/* Servers configuration */\n\$i = 0;\n"; foreach($c['Servers'] as $cnt => $srv) { $ret .= "\n/* Server " . get_server_name($srv, $cnt) . " */\n\$i++;\n"; foreach($srv as $key => $val) { $ret .= "\$cfg['Servers'][\$i]['$key'] = '$val';\n"; } } $ret .= "\n/* End of servers configration */\n\n"; } unset($c['Servers']); foreach($c as $key => $val) { if (is_array($val)) { $ret .= "\n"; foreach($val as $k => $v) { if (!isset($type)) { if (is_string($k)) { $type = 'string'; } elseif (is_int($k)) { $type = 'int'; $ret .= "\$cfg['$key'] = array(\n"; } else { // Something unknown... $ret .= "\$cfg['$key'] = " . var_export($val, TRUE) . ";\n"; break; } } if ($type == 'string') { $ret .= "\$cfg['$key']['$k'] = " . var_export($v, TRUE) . ";\n"; } elseif ($type == 'int') { $ret .= " " . var_export($v, TRUE) . ";\n"; } } if ($type == 'int') { $ret .= ");\n"; } $ret .= "\n"; unset($type); } else { $ret .= "\$cfg['$key'] = " . var_export($val, TRUE) . ";\n"; } } $ret .= "?>\n"; return $ret; } /** * Comresses 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(remove_slashes($_POST[$v[0]])); } break; case 'int': if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) { $res[$v[0]] = (int)remove_slashes($_POST[$v[0]]); } break; case 'tristate': if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) { $cur = remove_slashes($_POST[$v[0]]); if ($cur == 'TRUE') { $res[$v[0]] = TRUE; } else if ($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]] = remove_slashes($_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 $val[1]; echo '
'; echo '
' . "\n"; } if (!empty($buttons)) { echo '
'; echo '
Actions:
'; echo $buttons; echo '
' . "\n"; } echo '
' . "\n"; echo "\n"; } /** * Displays configration, fallback defaults are taken from global $default_cfg * * @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 $default_cfg; 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 ''; echo ''; break; case 'check': echo ''; echo ''; break; case 'select': echo ''; echo ''; break; } echo '
' . "\n"; } echo '
'; echo '
Actions:
'; echo ''; echo ''; echo '
' . "\n"; echo '
' . "\n"; echo "\n"; } /** * Shows security options configuration form * * @param array optional defaults * * @return nothing */ function show_security_form($defaults = array()) { ?>
viewable type and http://dev.mysql.com/doc/refman as manual base URL.', $defaults); ?>
'; } $hi = array ('bookmarktable', 'relation', 'table_info', 'table_coords', 'pdf_pages', 'column_info', 'history', 'AllowDeny'); foreach($hi as $k) { if (isset($defaults[$k])) { echo ''; } } show_config_form(array( array('Server hostname', 'host', 'Hostname where MySQL server is running'), array('Server port', 'port', 'Port on which MySQL server is listening, leave empty if don\'t know'), array('Server socked', 'socket', 'Socket on which MySQL server is listening, leave empty if don\'t know'), array('Connection type', 'connect_type', 'How to connect to server, keep tcp if don\'t know', array('tcp', 'socket')), array('PHP extension to use', 'extension', 'What PHP extension to use, use mysqli if supported', array('mysql', 'mysqli')), array('Compress connection', 'compress', 'Whether to compress connection to MySQL server', FALSE), array('Authentication type', 'auth_type', 'Authentication method to use', array('cookie', 'http', 'config')), array('User for config auth', 'user', 'Leave empty if not using config auth'), array('Password for config auth', 'password', 'Leave empty if not using config auth', 'password'), array('Only database to show', 'only_db', 'Limit listing of databases in left frame to this one'), array('Verbose name of this server', 'verbose', 'Name to display in server selection'), array('phpMyAdmin control user', 'controluser', 'User which phpMyAdmin can use for various actions'), array('phpMyAdmin control user password', 'controlpass', 'Password for user which phpMyAdmin can use for various actions', 'password'), array('phpMyAdmin database for advanced features', 'pmadb', 'phpMyAdmin will allow much more when you enable this. Table names are filled in automatically.'), ), 'Configure server', ($number === FALSE) ? 'Enter new server connection parameters.' : 'Editing server ' . get_server_name($defaults, $number), $defaults, $number === FALSE ? 'Add' : '', 'Servers_'); ?>
'; foreach ($cfg['Servers'] as $key => $val) { $ret .= ''; } $ret .= ''; return $ret; } 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/config.inc.php'); $config = @fopen('../config/config.inc.php', 'a'); $fail_dir = $fail_dir || ($config === FALSE); @fclose($config); 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 write configuration'); } } /** * @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($cfg); exit; break; case 'display': echo '
' . "\n"; ?> ' . file_get_contents( $config_file ) ); } else { $success_apply_user_config = eval( '?>' . 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 configuraton file!'); $cfg = $bck_cfg; } elseif (count($cfg) == 0 || (isset($cfg['Servers']) && count($cfg) == 1 || count($cfg['Servers']) == 0)) { message('error', 'Config file seems to contain no configuration!'); $cfg = $bck_cfg; } else { message('notice', 'Configuration loaded'); compress_servers($cfg); } } else { message('error', 'Configuration file not found!'); $cfg = $bck_cfg; } $show_info = TRUE; break; case 'addserver_real': if (isset($_POST['submit_save'])) { $new_server = grab_values('host;port;socket;connect_type;compress:bool;controluser;controlpass;auth_type;user;password;only_db;verbose;pmadb;bookmarktable:serialized;relation:serialized;table_info:serialized;table_coords:serialized;pdf_pages:serialized;column_info:serialized;history:serialized;AllowDeny:serialized'); $err = FALSE; if (empty($new_server['host'])) { message('error', 'Empty hostname!'); $err = TRUE; } if ($new_server['connect_type'] == 'socket' && empty($new_server['socket'])) { message('error', 'Empty socket with socket connection seleted!'); $err = TRUE; } if ($new_server['auth_type'] == 'config' && empty($new_server['user'])) { message('error', 'Empty username while using config authentication method!'); $err = TRUE; } if (!empty($new_server['pmadb'])) { // Just use defaults, should be okay for most users $pmadb = array(); $pmadb['bookmarktable'] = 'pma_bookmark'; $pmadb['relation'] = 'pma_relation'; $pmadb['table_info'] = 'pma_table_info'; $pmadb['table_coords'] = 'pma_table_coords'; $pmadb['pdf_pages'] = 'pma_pdf_pages'; $pmadb['column_info'] = 'pma_column_info'; $pmadb['history'] = 'pma_history'; $new_server = array_merge($pmadb, $new_server); unset($pmadb); if (empty($new_server['controluser'])) { message('error', 'Empty phpMyAdmin control user while using pmadb!'); $err = TRUE; } if (empty($new_server['controlpass'])) { message('error', 'Empty phpMyAdmin control user password while using pmadb!'); $err = TRUE; } } else { message('warning', 'You didn\'t set phpMyAdmin database, so you can not use all phpMyAdmin features.'); } if ($new_server['auth_type'] == 'config') { message('warning', 'Remember to protect your installation while using config authentication method!'); } else { // Not needed: unset($new_server['user']); unset($new_server['password']); } if ($err) { show_server_form($new_server, isset($_POST['server']) ? $_POST['server'] : FALSE); } else { if (isset($_POST['server'])) { $cfg['Servers'][$_POST['server']] = $new_server; message('notice', 'Changed server ' . get_server_name($new_server, $_POST['server'])); } else { $cfg['Servers'][] = $new_server; message('notice', 'New server added'); } $show_info = TRUE; if ($new_server['auth_type'] == 'cookie' && empty($cfg['blowfish_secret'])) { message('notice', 'You did not have configured blowfish secret and you want to use cookie authentication so I generated blowfish secret for you. It is used to encrypt cookies.', 'Blowfist secret generated'); $cfg['blowfish_secret'] = uniqid('', TRUE); } } unset($new_server); } else { $show_info = TRUE; } break; case 'addserver': if (count($cfg['Servers']) == 0) { // First server will use defaults as in config.default.php $defaults = $default_cfg['Servers'][1]; } else { $defaults = array(); } // Guess MySQL extension to use, prefer mysqli if (!function_exists('mysql_get_client_info')) { PMA_dl('mysql'); } if (!function_exists('mysqli_get_client_info')) { PMA_dl('mysqli'); } if (function_exists('mysqli_get_client_info')) { $defaults['extension'] = 'mysqli'; } else if (function_exists('mysql_get_client_info')) { $defaults['extension'] = 'mysql'; } else { message('warning', 'Could not load neither mysql nor mysqli extension, you might not be able to use phpMyAdmin!'); } 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($cfg['Servers'][$_POST['server']], $_POST['server']); break; case 'deleteserver': if (!isset($_POST['server'])) footer(); message('notice', 'Deleted server ' . get_server_name($cfg['Servers'][$_POST['server']], $_POST['server'])); unset($cfg['Servers'][$_POST['server']]); compress_servers($cfg); $show_info = TRUE; break; case 'servers': if (count($cfg['Servers']) == 0) { message('notice', 'No servers defined, so none can not be shown'); } else { foreach($cfg['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'] : $default_cfg['Servers'][1]['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;docSQLDir'); chdir('..'); // to allow checking directories $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 (!empty($dirs['docSQLDir']) && !is_dir($dirs['docSQLDir'])) { message('error', 'docSQL directory ' . htmlspecialchars($dirs['docSQLDir']) . ' does not exist!'); $err = TRUE; } if ($err) { show_upload_form($dirs); } else { $cfg = array_merge($cfg, $dirs); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'feat_upload': show_upload_form($cfg); 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'feat_security': show_security_form($cfg); 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 choone none type.'); $err = TRUE; } if ($err) { show_manual_form($vals); } else { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'feat_manual': show_manual_form($cfg); 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'feat_charset': $d = $cfg; if (!isset($d['RecodingEngine'])) { if (@extension_loaded('iconv')) { $d['RecodingEngine'] = 'iconv'; } else if (@extension_loaded('recode')) { $d['RecodingEngine'] = 'recode'; } else { PMA_dl('iconv'); if (!@extension_loaded('iconv')) { PMA_dl('recode'); if (!@extension_loaded('recode')) { message('warning', 'Could not load neither recode nor iconv so charset conversion will most likely not work.'); } else { $d['RecodingEngine'] = 'recode'; } } else { $d['RecodingEngine'] = 'iconv'; } } 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'feat_extensions': $d = $cfg; if (!@extension_loaded('mbstring')) { PMA_dl('mbstring'); } if (!@extension_loaded('mbstring')) { message('warning', 'Could not load 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 maximal history size!'); $err = TRUE; } if ($err) { show_relation_form($vals); } else { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'feat_relation': show_relation_form($cfg); break; case 'lay_left_real': if (isset($_POST['submit_save'])) { $vals = grab_values('LeftFrameLight:bool;LeftFrameDBTree:bool;LeftFrameDBSeparator;LeftFrameTableSeparator;LeftFrameTableLevel:int;LeftDisplayLogo:bool;LeftDusplayServers:bool;LeftPointerEnable:bool'); $err = 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'lay_left': show_left_form($cfg); 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'lay_tabs': show_tabs_form($cfg); 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'lay_icons': show_icons_form($cfg); 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'lay_browse': show_browse_form($cfg); 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'lay_edit': show_edit_form($cfg); 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'lay_window': show_window_form($cfg); 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 { $cfg = array_merge($cfg, $vals); message('notice', 'Configuration changed'); $show_info = TRUE; } } else { $show_info = TRUE; } break; case 'blah': show_blah_form($cfg); break; */ 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 (PMA_PHP_INT_VERSION < 40100) { message('warning', 'Please upgrade to PHP 4.1.0, it is required for phpMyAdmin.'); } 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($cfg['Servers']) == 0) { message('warning', 'No servers defined, you probably want to add one.'); } else { $servers = ''; $servers_text = 'Servers (' . count($cfg['Servers']) . ')'; $sep = ''; foreach ($cfg['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($cfg['UploadDir']) ? 'disabled' : 'enabled'), array('Exported files on server', empty($cfg['SaveDir']) ? 'disabled' : 'enabled'), array('Charset conversion', isset($cfg['AllowAnywhereRecoding']) && $cfg['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($cfg); 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_left', 'Left 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'); if (!$fail_dir) { echo get_action('save', 'Save'); echo get_action('load', 'Load'); } echo get_action('clear', 'Clear'); echo '
' . "\n\n"; footer(); ?>