Upgraded phpmyadmin to 4.0.4 (All Languages) - No modifications yet
[openemr.git] / phpmyadmin / setup / frames / index.inc.php
blobddc6af5265f19ac0f0f7dd86fd6c851f008d96b0
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Overview (main page)
6 * @package PhpMyAdmin-Setup
7 */
9 if (!defined('PHPMYADMIN')) {
10 exit;
13 /**
14 * Core libraries.
16 require_once './libraries/display_select_lang.lib.php';
17 require_once './libraries/config/FormDisplay.class.php';
18 require_once './setup/lib/index.lib.php';
20 // prepare unfiltered language list
21 $all_languages = PMA_langList();
22 uasort($all_languages, 'PMA_languageCmp');
24 $cf = ConfigFile::getInstance();
25 $separator = PMA_get_arg_separator('html');
27 // message handling
28 messages_begin();
31 // Check phpMyAdmin version
33 if (isset($_GET['version_check'])) {
34 PMA_version_check();
38 // Perform various security, compatibility and consistency checks
40 perform_config_checks();
43 // Check whether we can read/write configuration
45 $config_readable = false;
46 $config_writable = false;
47 $config_exists = false;
48 check_config_rw($config_readable, $config_writable, $config_exists);
49 if (!$config_writable || !$config_readable) {
50 messages_set(
51 'error', 'config_rw', __('Cannot load or save configuration'),
52 PMA_lang(__('Please create web server writable folder [em]config[/em] in phpMyAdmin top level directory as described in [doc@setup_script]documentation[/doc]. Otherwise you will be only able to download or display it.'))
56 // Check https connection
58 $is_https = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
59 if (!$is_https) {
60 $text = __('You are not using a secure connection; all data (including potentially sensitive information, like passwords) is transferred unencrypted!');
62 if (!empty($_SERVER['REQUEST_URI']) && !empty($_SERVER['HTTP_HOST'])) {
63 $link = 'https://' . htmlspecialchars($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
64 $strInsecureConnectionMsg2 = __('If your server is also configured to accept HTTPS requests follow [a@%s]this link[/a] to use a secure connection.');
65 $strInsecureConnectionMsg2 = sprintf($strInsecureConnectionMsg2, $link);
66 $text .= ' ' . PMA_lang($strInsecureConnectionMsg2);
68 messages_set('notice', 'no_https', __('Insecure connection'), $text);
72 <form id="select_lang" method="post" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']) ?>">
73 <?php echo PMA_generate_common_hidden_inputs() ?>
74 <bdo lang="en" dir="ltr"><label for="lang">
75 <?php echo __('Language') . (__('Language') != 'Language' ? ' - Language' : '') ?>
76 </label></bdo><br />
77 <select id="lang" name="lang" class="autosubmit" lang="en" dir="ltr">
78 <?php
79 // create language list
80 $lang_list = array();
81 foreach ($all_languages as $each_lang_key => $each_lang) {
82 $lang_name = PMA_langName($each_lang);
83 //Is current one active?
84 $selected = ($GLOBALS['lang'] == $each_lang_key) ? ' selected="selected"' : '';
85 echo '<option value="' . $each_lang_key . '"' . $selected . '>' . $lang_name
86 . '</option>' . "\n";
89 </select>
90 </form>
92 <?php
93 // Check for done action info and set notice message if present
94 switch ($action_done) {
95 case 'config_saved':
96 /* Use uniqid to display this message every time configuration is saved */
97 messages_set(
98 'notice', uniqid('config_saved'), __('Configuration saved.'),
99 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.'))
101 break;
102 default:
103 break;
107 <h2><?php echo __('Overview') ?></h2>
109 <?php
110 // message handling
111 messages_end();
112 messages_show_html();
115 <a href="#" id="show_hidden_messages" style="display:none"><?php echo __('Show hidden messages (#MSG_COUNT)') ?></a>
117 <fieldset class="simple"><legend><?php echo __('Servers') ?></legend>
118 <?php
120 // Display server list
122 PMA_displayFormTop(
123 'index.php', 'get',
124 array(
125 'page' => 'servers',
126 'mode' => 'add'
130 <div class="form">
131 <?php if ($cf->getServerCount() > 0) { ?>
132 <table cellspacing="0" class="datatable" style="table-layout: fixed">
133 <tr>
134 <th>#</th>
135 <th><?php echo __('Name') ?></th>
136 <th><?php echo __('Authentication type') ?></th>
137 <th colspan="2">DSN</th>
138 </tr>
139 <?php foreach ($cf->getServers() as $id => $server) { ?>
140 <tr>
141 <td><?php echo $id ?></td>
142 <td><?php echo htmlspecialchars($cf->getServerName($id)) ?></td>
143 <td><?php echo htmlspecialchars($cf->getValue("Servers/$id/auth_type")) ?></td>
144 <td><?php echo htmlspecialchars($cf->getServerDSN($id)) ?></td>
145 <td style="white-space: nowrap">
146 <small>
147 <a href="<?php echo "?page=servers{$separator}mode=edit{$separator}id=$id" ?>"><?php echo __('Edit') ?></a>
148 | <a href="<?php echo "?page=servers{$separator}mode=remove{$separator}id=$id" ?>"><?php echo __('Delete') ?></a>
149 </small>
150 </td>
151 </tr>
152 <?php } ?>
153 </table>
154 <?php } else { ?>
155 <table width="100%">
156 <tr>
157 <td>
158 <i><?php echo __('There are no configured servers') ?></i>
159 </td>
160 </tr>
161 </table>
162 <?php } ?>
163 <table width="100%">
164 <tr>
165 <td class="lastrow" style="text-align: left">
166 <input type="submit" name="submit" value="<?php echo __('New server') ?>" />
167 </td>
168 </tr>
169 </table>
170 </div>
171 <?php
172 PMA_displayFormBottom();
174 </fieldset>
176 <fieldset class="simple"><legend><?php echo __('Configuration file') ?></legend>
177 <?php
179 // Display config file settings and load/save form
181 $form_display = new FormDisplay();
183 PMA_displayFormTop('config.php');
185 <table width="100%" cellspacing="0">
186 <?php
188 // Display language list
189 $opts = array(
190 'doc' => $form_display->getDocLink('DefaultLang'),
191 'wiki' => $form_display->getWikiLink('DefaultLang'),
192 'values' => array(),
193 'values_escaped' => true);
194 foreach ($all_languages as $each_lang_key => $each_lang) {
195 $lang_name = PMA_langName($each_lang);
196 $opts['values'][$each_lang_key] = $lang_name;
198 PMA_displayInput(
199 'DefaultLang', __('Default language'), 'select',
200 $cf->getValue('DefaultLang'), '', true, $opts
203 // Display server list
204 $opts = array(
205 'doc' => $form_display->getDocLink('ServerDefault'),
206 'wiki' => $form_display->getWikiLink('ServerDefault'),
207 'values' => array(),
208 'values_disabled' => array());
209 if ($cf->getServerCount() > 0) {
210 $opts['values']['0'] = __('let the user choose');
211 $opts['values']['-'] = '------------------------------';
212 if ($cf->getServerCount() == 1) {
213 $opts['values_disabled'][] = '0';
215 $opts['values_disabled'][] = '-';
217 foreach ($cf->getServers() as $id => $server) {
218 $opts['values'][(string)$id] = $cf->getServerName($id) . " [$id]";
220 } else {
221 $opts['values']['1'] = __('- none -');
222 $opts['values_escaped'] = true;
224 PMA_displayInput(
225 'ServerDefault', __('Default server'), 'select',
226 $cf->getValue('ServerDefault'), '', true, $opts
229 // Display EOL list
230 $opts = array(
231 'values' => array(
232 'unix' => 'UNIX / Linux (\n)',
233 'win' => 'Windows (\r\n)'),
234 'values_escaped' => true);
235 $eol = PMA_ifSetOr($_SESSION['eol'], (PMA_IS_WINDOWS ? 'win' : 'unix'));
236 PMA_displayInput(
237 'eol', __('End of line'), 'select',
238 $eol, '', true, $opts
241 <tr>
242 <td colspan="2" class="lastrow" style="text-align: left">
243 <input type="submit" name="submit_display" value="<?php echo __('Display') ?>" />
244 <input type="submit" name="submit_download" value="<?php echo __('Download') ?>" />
245 &nbsp; &nbsp;
246 <input type="submit" name="submit_save" value="<?php echo __('Save') ?>"<?php
247 if (!$config_writable) {
248 echo ' disabled="disabled"';
249 } ?> />
250 <input type="submit" name="submit_load" value="<?php echo __('Load') ?>"<?php
251 if (!$config_exists) {
252 echo ' disabled="disabled"';
253 } ?> />
254 <input type="submit" name="submit_delete" value="<?php echo __('Delete')
255 ?>"<?php
256 if (!$config_exists || !$config_writable) {
257 echo ' disabled="disabled"';
258 } ?> />
259 &nbsp; &nbsp;
260 <input type="submit" name="submit_clear" value="<?php echo __('Clear')
261 ?>" class="red" />
262 </td>
263 </tr>
264 </table>
265 <?php
266 PMA_displayFormBottom();
268 </fieldset>
269 <div id="footer">
270 <a href="http://phpmyadmin.net"><?php echo __('phpMyAdmin homepage') ?></a>
271 <a href="http://sourceforge.net/donate/index.php?group_id=23067"><?php
272 echo __('Donate') ?></a>
273 <a href="?version_check=1<?php
274 echo "{$separator}token="
275 . $_SESSION[' PMA_token '] ?>"><?php echo __('Check for latest version') ?></a>
276 </div>