3 * Server create and edit view
5 * @package PhpMyAdmin-setup
8 if (!defined('PHPMYADMIN')) {
15 require_once './libraries/config/Form.class.php';
16 require_once './libraries/config/FormDisplay.class.php';
17 require_once './setup/lib/form_processing.lib.php';
19 require './libraries/config/setup.forms.php';
21 $mode = filter_input(INPUT_GET
, 'mode');
22 $id = filter_input(INPUT_GET
, 'id', FILTER_VALIDATE_INT
);
24 $cf = ConfigFile
::getInstance();
25 $server_exists = !empty($id) && $cf->get("Servers/$id") !== null;
27 if ($mode == 'edit' && $server_exists) {
28 $page_title = __('Edit server')
29 . ' ' . $id . ' <small>(' . htmlspecialchars($cf->getServerDSN($id)) . ')</small>';
30 } elseif ($mode == 'remove' && $server_exists) {
31 $cf->removeServer($id);
32 header('Location: index.php');
34 } elseif ($mode == 'revert' && $server_exists) {
35 // handled by process_formset()
37 $page_title = __('Add a new server');
40 if (isset($page_title)) {
41 echo '<h2>' . $page_title . '</h2>';
43 $form_display = new FormDisplay();
44 foreach ($forms['Servers'] as $form_name => $form) {
45 $form_display->registerForm($form_name, $form, $id);
47 process_formset($form_display);