?? setup.php
字號:
* @param array optional defaults * * @return nothing */function show_tabs_form($defaults = array()) { ?><form method="post" action=""> <?php echo get_hidden_inputs();?> <input type="hidden" name="action" value="lay_tabs_real" /> <?php echo get_hidden_cfg(); show_config_form(array( array('Default tab for server', 'DefaultTabServer', 'Tab that is displayed when entering server', array('main.php', 'server_databases.php', 'server_status.php', 'server_variables.php', 'server_privileges.php', 'server_processlist.php')), array('Default tab for database', 'DefaultTabDatabase', 'Tab that is displayed when entering database', array('db_structure.php', 'db_sql.php', 'db_search.php', 'db_operations.php')), array('Default tab for table', 'DefaultTabTable', 'Tab that is displayed when entering table', array('tbl_structure.php', 'sql.php', 'tbl_sql.php', 'tbl_select.php', 'tbl_change.php')), array('Use lighter tabs', 'LightTabs', 'If you want simpler tabs enable this', FALSE), ), 'Configure tabs', 'Choose how you want tabs to work.', $defaults); ?></form> <?php}/** * Shows icons configuration form * * @param array optional defaults * * @return nothing */function show_icons_form($defaults = array()) { ?><form method="post" action=""> <?php echo get_hidden_inputs();?> <input type="hidden" name="action" value="lay_icons_real" /> <?php echo get_hidden_cfg(); show_config_form(array( array('Icons on errors', 'ErrorIconic', 'Whether to use icons in error messages.', TRUE), array('Icons on main page', 'MainPageIconic', 'Whether to use icons on main page.', TRUE), array('Icons as help links', 'ReplaceHelpImg', 'Whether to use icons as help links.', TRUE), array('Navigation with icons', 'NavigationBarIconic', 'Whether to display navigation (eg. tabs) with icons.', array('TRUE', 'FALSE', 'both')), array('Properties pages with icons', 'PropertiesIconic', 'Whether to display properties (eg. table lists and structure) with icons.', array('TRUE', 'FALSE', 'both')), ), 'Configure icons', 'Select whether you prefer text or icons. Both means that text and icons will be displayed.', $defaults); ?></form> <?php}/** * Shows browsing configuration form * * @param array optional defaults * * @return nothing */function show_browse_form($defaults = array()) { ?><form method="post" action=""> <?php echo get_hidden_inputs();?> <input type="hidden" name="action" value="lay_browse_real" /> <?php echo get_hidden_cfg(); show_config_form(array( array('Display of values', 'DefaultDisplay', 'How to list values while browsing', array('horizontal', 'vertical', 'horizontalflipped')), array('Hightlight pointer', 'BrowsePointerEnable', 'Whether to highlight row under mouse.', TRUE), array('Use row marker', 'BrowseMarkerEnable', 'Whether to highlight selected row.', TRUE), array('Action buttons on left', 'ModifyDeleteAtLeft', 'Show action buttons on left side of listing?', TRUE), array('Action buttons on right', 'ModifyDeleteAtRight', 'Show action buttons on right side of listing?', FALSE), array('Repeat heading', 'RepeatCells', 'After how many rows heading should be repeated.'), ), 'Configure browsing', 'Select desired browsing look and feel.', $defaults); ?></form> <?php}/** * Shows editing options configuration form * * @param array optional defaults * * @return nothing */function show_edit_form($defaults = array()) { ?><form method="post" action=""> <?php echo get_hidden_inputs();?> <input type="hidden" name="action" value="lay_edit_real" /> <?php echo get_hidden_cfg(); show_config_form(array( array('Display of properties while editing', 'DefaultPropDisplay', 'How to list properties (table structure or values) while editing', array('horizontal', 'vertical')), array('Number of inserted rows', 'InsertRows', 'How many rows can be inserted at once'), array('Move using Ctrl+arrows', 'CtrlArrowsMoving', 'Whether to enable moving using Ctrl+Arrows', TRUE), array('Autoselect text in textarea', 'TextareaAutoSelect', 'Whether to automatically select text in textarea on focus.', TRUE), array('Textarea columns', 'TextareaCols', 'Number of columns in textarea while editing TEXT fields'), array('Textarea rows', 'TextareaRows', 'Number of rows in textarea while editing TEXT fields'), array('Double textarea for LONGTEXT', 'LongtextDoubleTextarea', 'Whether to double textarea size for LONGTEXT fields', TRUE), array('Edit CHAR fields in textarea', 'CharEditing', 'Whether to edit CHAR fields in textarea', array('input', 'textarea')), array('CHAR textarea columns', 'CharTextareaCols', 'Number of columns in textarea while editing CHAR fields (must be enabled above)'), array('CHAR textarea rows', 'CharTextareaRows', 'Number of rows in textarea while editing CHAR fields (must be enabled above)'), ), 'Configure editing', 'Select desired editing look and feel.', $defaults); ?></form> <?php}/** * Shows query window configuration form * * @param array optional defaults * * @return nothing */function show_window_form($defaults = array()) { ?><form method="post" action=""> <?php echo get_hidden_inputs();?> <input type="hidden" name="action" value="lay_window_real" /> <?php echo get_hidden_cfg(); show_config_form(array( array('Edit SQL in window', 'EditInWindow', 'Whether edit links will edit in query window.', TRUE), array('Query window height', 'QueryWindowHeight', 'Height of query window'), array('Query window width', 'QueryWindowWidth', 'Width of query window'), array('Default tab', 'QueryWindowDefTab', 'Default tab on query window', array('sql', 'files', 'history', 'full')), ), 'Configure query window', 'Select desired query window look and feel.', $defaults); ?></form> <?php}/** * Creates selection with servers * * @param array configuraion * * @return string HTML for server selection */function get_server_selection($cfg) { if (count($cfg['Servers']) == 0) { return ''; } $ret = '<select name="server">'; foreach ($cfg['Servers'] as $key => $val) { $ret .= '<option value="' . $key . '">' . get_server_name($val, $key) . '</option>'; } $ret .= '</select>'; 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 actionswitch ($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 '<form method="none" action=""><textarea name="config" cols="50" rows="20" id="textconfig" wrap="off">' . "\n"; echo htmlspecialchars(get_cfg_string($configuration)); echo '</textarea></form>' . "\n"; ?><script type="text/javascript" language="javascript">//<![CDATA[ var bodyWidth=null; var bodyHeight=null; if (document.getElementById('textconfig')) { bodyWidth = self.innerWidth; bodyHeight = self.innerHeight; if(!bodyWidth && !bodyHeight){ if (document.compatMode && document.compatMode == "BackCompat") { bodyWidth = document.body.clientWidth; bodyHeight = document.body.clientHeight; } else if (document.compatMode && document.compatMode == "CSS1Compat") { bodyWidth = document.documentElement.clientWidth; bodyHeight = document.documentElement.clientHeight; } } document.getElementById('textconfig').style.width=(bodyWidth-50) + 'px'; document.getElementById('textconfig').style.height=(bodyHeight-100) + 'px'; }//]]></script> <?php break; case 'save': $config = @fopen('./config/config.inc.php', 'w'); if ($config === FALSE) { message('error', 'Could not open config file for writing! Bad permissions?'); break; } $s = get_cfg_string($configuration); $r = fwrite($config, $s); if (!$r || $r != strlen($s)) { message('error', 'Could not write to config file! Not enough space?'); break; } else { message('notice', '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.', 'File saved'); } unset($r, $s); fclose($config); break; case 'load': if ($fail_dir) { message('error', 'Reading of configuration disabled because of permissions.'); break; } $new_cfg = load_config('./config/config.inc.php'); if (!($new_cfg === FALSE)) { $configuration = $new_cfg; } $show_info = TRUE; break; case 'addserver_real': if (isset($_POST['submit_save'])) { $new_server = grab_values('host;extension;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;designer_coords:serialized;history:serialized;AllowDeny:serialized;SignonSession;SignonURL;LogoutURL'); $err = FALSE; if (empty($new_server['host'])) { message('error', 'Empty hostname!'); $err = TRUE; } if ($new_server['auth_type'] == 'config' && empty($new_server['user'])) { message('error', 'Empty username while using config authentication method!'); $err = TRUE; } if ($new_server['auth_type'] == 'signon' && empty($new_server['SignonSession'])) { message('error', 'Empty signon session name while using signon authentication method!'); $err = TRUE; } if ($new_server['auth_type'] == 'signon' && empty($new_server['SignonURL'])) { message('error', 'Empty signon URL while using signon authentication method!'); $err = TRUE; } if ( isset($new_server['pmadb']) && strlen($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['designer_coords'] = 'pma_designer_coords'; $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'])) { $configuration['Servers'][$_POST['server']] = $new_server; message('notice', 'Changed server ' . get_server_name($new_server, $_POST['server'])); } else { $configuration['Servers'][] = $new_server; message('notice', 'New server added'); } $show_info = TRUE; if ($new_server['auth_type'] == 'cookie' && empty($configuration['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.', 'Blowfish secret generated'); $configuration['blowfish_secret'] = uniqid('', TRUE); } } unset($new_server);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -