* 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 display_form_top('config.php'); ?> <input type="hidden" name="eol" value="<?php echo htmlspecialchars(PMA_ifSetOr($_GET['eol'], 'unix')); ?> " /> <?php display_fieldset_top('', '', null, array('class' => 'simple')); ?> <tr> <td> <textarea cols="50" rows="20" name="textconfig" id="textconfig" spellcheck="false"><?php echo htmlspecialchars(ConfigGenerator::getConfigFile()); ?> </textarea> </td>
/** * Outputs HTML for forms * * @param bool $tabbed_form * @param bool $show_restore_default whether show "restore default" button besides the input field */ public function display($tabbed_form = false, $show_restore_default = false) { static $js_lang_sent = false; $js = array(); $js_default = array(); $tabbed_form = $tabbed_form && count($this->forms) > 1; $validators = ConfigFile::getInstance()->getDbEntry('_validators'); display_form_top(); if ($tabbed_form) { $tabs = array(); foreach ($this->forms as $form) { $tabs[$form->name] = PMA_lang("Form_{$form->name}"); } display_tabs_top($tabs); } // valdiate only when we aren't displaying a "new server" form $is_new_server = false; foreach ($this->forms as $form) { /* @var $form Form */ if ($form->index === 0) { $is_new_server = true; break; } } if (!$is_new_server) { $this->_validate(); } // display forms foreach ($this->forms as $form) { /* @var $form Form */ $form_desc = isset($GLOBALS["strSetupForm_{$form->name}_desc"]) ? PMA_lang("Form_{$form->name}_desc") : ''; $form_errors = isset($this->errors[$form->name]) ? $this->errors[$form->name] : null; display_fieldset_top(PMA_lang("Form_{$form->name}"), $form_desc, $form_errors, array('id' => $form->name)); foreach ($form->fields as $field => $path) { $work_path = array_search($path, $this->system_paths); $translated_path = $this->translated_paths[$work_path]; // display input $this->_displayFieldInput($form, $field, $path, $work_path, $translated_path, $show_restore_default, $js_default); // register JS validators for this field if (isset($validators[$path])) { js_validate($translated_path, $validators[$path], $js); } } display_fieldset_bottom(); } if ($tabbed_form) { display_tabs_bottom(); } display_form_bottom(); // if not already done, send strings used for valdiation to JavaScript if (!$js_lang_sent) { $js_lang_sent = true; $js_lang = array(); foreach ($this->js_lang_strings as $str) { $lang = isset($GLOBALS["strSetup{$str}"]) ? $GLOBALS["strSetup{$str}"] : filter_input($GLOBALS["str{$str}"]); // null if not set $js_lang[] = "'{$str}': '" . PMA_jsFormat($lang, false) . '\''; } $js[] = '$extend(PMA_messages, {' . implode(",\n\t", $js_lang) . '})'; } $js[] = '$extend(defaultValues, {' . implode(",\n\t", $js_default) . '})'; display_js($js); }
/** * Outputs HTML for forms * * @uses ConfigFile::getInstance() * @uses ConfigFile::get() * @uses display_fieldset_bottom() * @uses display_fieldset_top() * @uses display_form_bottom() * @uses display_form_top() * @uses display_js() * @uses display_tabs_bottom() * @uses display_tabs_top() * @uses js_validate() * @uses PMA_config_get_validators() * @uses PMA_jsFormat() * @uses PMA_lang() * @param bool $tabbed_form * @param bool $show_restore_default whether show "restore default" button besides the input field */ public function display($tabbed_form = false, $show_restore_default = false) { static $js_lang_sent = false; $js = array(); $js_default = array(); $tabbed_form = $tabbed_form && count($this->forms) > 1; $validators = PMA_config_get_validators(); display_form_top(); if ($tabbed_form) { $tabs = array(); foreach ($this->forms as $form) { $tabs[$form->name] = PMA_lang("Form_{$form->name}"); } display_tabs_top($tabs); } // valdiate only when we aren't displaying a "new server" form $is_new_server = false; foreach ($this->forms as $form) { /* @var $form Form */ if ($form->index === 0) { $is_new_server = true; break; } } if (!$is_new_server) { $this->_validate(); } // user preferences $this->_loadUserprefsInfo(); // display forms foreach ($this->forms as $form) { /* @var $form Form */ $form_desc = isset($GLOBALS["strConfigForm_{$form->name}_desc"]) ? PMA_lang("Form_{$form->name}_desc") : ''; $form_errors = isset($this->errors[$form->name]) ? $this->errors[$form->name] : null; display_fieldset_top(PMA_lang("Form_{$form->name}"), $form_desc, $form_errors, array('id' => $form->name)); foreach ($form->fields as $field => $path) { $work_path = array_search($path, $this->system_paths); $translated_path = $this->translated_paths[$work_path]; // always true/false for user preferences display // otherwise null $userprefs_allow = isset($this->userprefs_keys[$path]) ? !isset($this->userprefs_disallow[$path]) : null; // display input $this->_displayFieldInput($form, $field, $path, $work_path, $translated_path, $show_restore_default, $userprefs_allow, $js_default); // register JS validators for this field if (isset($validators[$path])) { js_validate($translated_path, $validators[$path], $js); } } display_fieldset_bottom(); } if ($tabbed_form) { display_tabs_bottom(); } display_form_bottom(); // if not already done, send strings used for valdiation to JavaScript if (!$js_lang_sent) { $js_lang_sent = true; $js_lang = array(); foreach ($this->js_lang_strings as $strName => $strValue) { $js_lang[] = "'{$strName}': '" . PMA_jsFormat($strValue, false) . '\''; } $js[] = "\$.extend(PMA_messages, {\n\t" . implode(",\n\t", $js_lang) . '})'; } $js[] = "\$.extend(defaultValues, {\n\t" . implode(",\n\t", $js_default) . '})'; display_js($js); }
if (!defined('PHPMYADMIN')) { exit; } require_once './setup/lib/FormDisplay.class.php'; require_once './setup/lib/index.lib.php'; $config_readable = false; $config_writable = false; $config_exists = false; check_config_rw($config_readable, $config_writable, $config_exists); ?> <h2><?php echo $GLOBALS['strSetupConfigurationFile']; ?> </h2> <?php display_form_top('config.php?type=post'); ?> <input type="hidden" name="eol" value="<?php echo htmlspecialchars(PMA_ifSetOr($_GET['eol'], 'unix')); ?> " /> <?php display_fieldset_top('', '', null, array('class' => 'simple')); ?> <tr> <td> <textarea cols="50" rows="20" name="textconfig" id="textconfig" spellcheck="false"><?php echo htmlspecialchars(ConfigFile::getInstance()->getConfigFile()); ?> </textarea> </td>