Add OK and Cancel button for grid editing
[phpmyadmin/arisferyanto.git] / setup / frames / index.inc.php
blobbbd631b2fa2af26b6bcf7a6aa92d6d353d8edbce
1 <?php
2 /**
3 * Overview (main page)
5 * @package PhpMyAdmin-setup
6 */
8 if (!defined('PHPMYADMIN')) {
9 exit;
12 /**
13 * Core libraries.
15 require_once './libraries/display_select_lang.lib.php';
16 require_once './libraries/config/FormDisplay.class.php';
17 require_once './setup/lib/index.lib.php';
19 // prepare unfiltered language list
20 $all_languages = PMA_langList();
21 uasort($all_languages, 'PMA_language_cmp');
23 $cf = ConfigFile::getInstance();
24 $separator = PMA_get_arg_separator('html');
26 // message handling
27 messages_begin();
30 // Check phpMyAdmin version
32 if (isset($_GET['version_check'])) {
33 PMA_version_check();
37 // Perform various security, compatibility and consistency checks
39 perform_config_checks();
42 // Check whether we can read/write configuration
44 $config_readable = false;
45 $config_writable = false;
46 $config_exists = false;
47 check_config_rw($config_readable, $config_writable, $config_exists);
48 if (!$config_writable || !$config_readable) {
49 messages_set('error', 'config_rw', __('Cannot load or save configuration'),
50 PMA_lang(__('Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [a@Documentation.html#setup_script]documentation[/a]. Otherwise you will be only able to download or display it.')));
53 // Check https connection
55 $is_https = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
56 if (!$is_https) {
57 $text = __('You are not using a secure connection; all data (including potentially sensitive information, like passwords) is transferred unencrypted!');
59 if (!empty($_SERVER['REQUEST_URI']) && !empty($_SERVER['HTTP_HOST'])) {
60 $link = 'https://' . htmlspecialchars($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
61 $strInsecureConnectionMsg2 = __('If your server is also configured to accept HTTPS requests follow [a@%s]this link[/a] to use a secure connection.');
62 $strInsecureConnectionMsg2 = sprintf($strInsecureConnectionMsg2, $link);
63 $text .= ' ' . PMA_lang($strInsecureConnectionMsg2);
65 messages_set('notice', 'no_https', __('Insecure connection'), $text);
69 <form id="select_lang" method="post" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']) ?>">
70 <?php echo PMA_generate_common_hidden_inputs() ?>
71 <bdo xml:lang="en" dir="ltr"><label for="lang">
72 <?php echo __('Language') . (__('Language') != 'Language' ? ' - Language' : '') ?>
73 </label></bdo><br />
74 <select id="lang" name="lang" class="autosubmit" xml:lang="en" dir="ltr">
75 <?php
76 // create language list
77 $lang_list = array();
78 foreach ($all_languages as $each_lang_key => $each_lang) {
79 $lang_name = PMA_langName($each_lang);
80 //Is current one active?
81 $selected = ($GLOBALS['lang'] == $each_lang_key) ? ' selected="selected"' : '';
82 echo '<option value="' . $each_lang_key . '"' . $selected . '>' . $lang_name
83 . '</option>' . "\n";
86 </select>
87 </form>
89 <?php
90 // Check for done action info and set notice message if present
91 switch ($action_done) {
92 case 'config_saved':
93 messages_set('notice', 'config_saved', __('Configuration saved.'),
94 PMA_lang(__('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.')));
95 break;
96 default:
97 break;
101 <h2><?php echo __('Overview') ?></h2>
103 <?php
104 // message handling
105 messages_end();
106 messages_show_html();
109 <a href="#" id="show_hidden_messages" style="display:none"><?php echo __('Show hidden messages (#MSG_COUNT)') ?></a>
111 <h3><?php echo __('Servers') ?></h3>
112 <?php
114 // Display server list
116 display_form_top('index.php', 'get', array(
117 'page' => 'servers',
118 'mode' => 'add'
121 <div class="form">
122 <?php if ($cf->getServerCount() > 0): ?>
123 <table cellspacing="0" class="datatable" style="table-layout: fixed">
124 <tr>
125 <th>#</th>
126 <th><?php echo __('Name') ?></th>
127 <th><?php echo __('Authentication type') ?></th>
128 <th colspan="2">DSN</th>
129 </tr>
130 <?php foreach ($cf->getServers() as $id => $server): ?>
131 <tr>
132 <td><?php echo $id ?></td>
133 <td><?php echo htmlspecialchars($cf->getServerName($id)) ?></td>
134 <td><?php echo htmlspecialchars($cf->getValue("Servers/$id/auth_type")) ?></td>
135 <td><?php echo htmlspecialchars($cf->getServerDSN($id)) ?></td>
136 <td style="white-space: nowrap">
137 <small>
138 <a href="<?php echo "?page=servers{$separator}mode=edit{$separator}id=$id" ?>"><?php echo __('Edit') ?></a>
139 | <a href="<?php echo "?page=servers{$separator}mode=remove{$separator}id=$id" ?>"><?php echo __('Delete') ?></a>
140 </small>
141 </td>
142 </tr>
143 <?php endforeach; ?>
144 </table>
145 <?php else: ?>
146 <table width="100%">
147 <tr>
148 <td>
149 <i><?php echo __('There are no configured servers') ?></i>
150 </td>
151 </tr>
152 </table>
153 <?php endif; ?>
154 <table width="100%">
155 <tr>
156 <td class="lastrow" style="text-align: left">
157 <input type="submit" name="submit" value="<?php echo __('New server') ?>" />
158 </td>
159 </tr>
160 </table>
161 </div>
162 <?php
163 display_form_bottom();
166 <h3><?php echo __('Configuration file') ?></h3>
167 <?php
169 // Display config file settings and load/save form
171 $form_display = new FormDisplay();
173 display_form_top('config.php');
174 display_fieldset_top('', '', null, array('class' => 'simple'));
176 // Display language list
177 $opts = array(
178 'doc' => $form_display->getDocLink('DefaultLang'),
179 'wiki' => $form_display->getWikiLink('DefaultLang'),
180 'values' => array(),
181 'values_escaped' => true);
182 foreach ($all_languages as $each_lang_key => $each_lang) {
183 $lang_name = PMA_langName($each_lang);
184 $opts['values'][$each_lang_key] = $lang_name;
186 display_input('DefaultLang', __('Default language'), '', 'select',
187 $cf->getValue('DefaultLang'), true, $opts);
189 // Display server list
190 $opts = array(
191 'doc' => $form_display->getDocLink('ServerDefault'),
192 'wiki' => $form_display->getWikiLink('ServerDefault'),
193 'values' => array(),
194 'values_disabled' => array());
195 if ($cf->getServerCount() > 0) {
196 $opts['values']['0'] = __('let the user choose');
197 $opts['values']['-'] = '------------------------------';
198 if ($cf->getServerCount() == 1) {
199 $opts['values_disabled'][] = '0';
201 $opts['values_disabled'][] = '-';
203 foreach ($cf->getServers() as $id => $server) {
204 $opts['values'][(string)$id] = $cf->getServerName($id) . " [$id]";
206 } else {
207 $opts['values']['1'] = __('- none -');
208 $opts['values_escaped'] = true;
210 display_input('ServerDefault', __('Default server'), '', 'select',
211 $cf->getValue('ServerDefault'), true, $opts);
213 // Display EOL list
214 $opts = array(
215 'values' => array(
216 'unix' => 'UNIX / Linux (\n)',
217 'win' => 'Windows (\r\n)'),
218 'values_escaped' => true);
219 $eol = PMA_ifSetOr($_SESSION['eol'], (PMA_IS_WINDOWS ? 'win' : 'unix'));
220 display_input('eol', __('End of line'), '', 'select',
221 $eol, true, $opts);
223 <tr>
224 <td colspan="2" class="lastrow" style="text-align: left">
225 <input type="submit" name="submit_display" value="<?php echo __('Display') ?>" />
226 <input type="submit" name="submit_download" value="<?php echo __('Download') ?>" />
227 &nbsp; &nbsp;
228 <input type="submit" name="submit_save" value="<?php echo __('Save') ?>"<?php if (!$config_writable) echo ' disabled="disabled"' ?> />
229 <input type="submit" name="submit_load" value="<?php echo __('Load') ?>"<?php if (!$config_exists) echo ' disabled="disabled"' ?> />
230 <input type="submit" name="submit_delete" value="<?php echo __('Delete') ?>"<?php if (!$config_exists || !$config_writable) echo ' disabled="disabled"' ?> />
231 &nbsp; &nbsp;
232 <input type="submit" name="submit_clear" value="<?php echo __('Clear') ?>" class="red" />
233 </td>
234 </tr>
235 <?php
236 display_fieldset_bottom_simple();
237 display_form_bottom();
239 <div id="footer">
240 <a href="http://phpmyadmin.net"><?php echo __('phpMyAdmin homepage') ?></a>
241 <a href="http://sourceforge.net/donate/index.php?group_id=23067"><?php echo __('Donate') ?></a>
242 <a href="?version_check=1<?php echo "{$separator}token=" . $_SESSION[' PMA_token '] ?>"><?php echo __('Check for latest version') ?></a>
243 </div>