Add OK and Cancel button for grid editing
[phpmyadmin/arisferyanto.git] / setup / frames / servers.inc.php
blobd208c0d2c3fb7e946f3f31986027e3deb0c443aa
1 <?php
2 /**
3 * Server create and edit view
5 * @package PhpMyAdmin-setup
6 */
8 if (!defined('PHPMYADMIN')) {
9 exit;
12 /**
13 * Core libraries.
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');
33 exit;
34 } elseif ($mode == 'revert' && $server_exists) {
35 // handled by process_formset()
36 } else {
37 $page_title = __('Add a new server');
38 $id = 0;
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);