remove todo, after upgrade PHPExcel
[phpmyadmin/arisferyanto.git] / setup / frames / index.inc.php
blob1c93aee40afa3fdbfd65b8bbe7e5dc4f97d9ce14
1 <?php
2 /**
3 * Overview (main page)
5 * @package phpMyAdmin-setup
6 * @author Piotr Przybylski <piotrprz@gmail.com>
7 * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
8 * @version $Id$
9 */
11 if (!defined('PHPMYADMIN')) {
12 exit;
15 /**
16 * Core libraries.
18 require_once './libraries/display_select_lang.lib.php';
19 require_once './setup/lib/FormDisplay.class.php';
20 require_once './setup/lib/index.lib.php';
22 // prepare unfiltered language list
23 $all_languages = PMA_langList();
24 uasort($all_languages, 'PMA_language_cmp');
26 $cf = ConfigFile::getInstance();
27 $separator = PMA_get_arg_separator('html');
29 // message handling
30 messages_begin();
33 // Check phpMyAdmin version
35 if (isset($_GET['version_check'])) {
36 PMA_version_check();
40 // Perform various security, compatibility and consistency checks
42 perform_config_checks();
45 // Check whether we can read/write configuration
47 $config_readable = false;
48 $config_writable = false;
49 $config_exists = false;
50 check_config_rw($config_readable, $config_writable, $config_exists);
51 if (!$config_writable || !$config_readable) {
52 messages_set('error', 'config_rw', 'CannotLoadConfig', PMA_lang('CannotLoadConfigMsg'));
55 // Check https connection
57 $is_https = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
58 if (!$is_https) {
59 $text = $GLOBALS['strSetupInsecureConnectionMsg1'];
60 if (!empty($_SERVER['REQUEST_URI']) && !empty($_SERVER['HTTP_HOST'])) {
61 $text .= ' ' . PMA_lang('InsecureConnectionMsg2',
62 'https://' . htmlspecialchars($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']));
64 messages_set('warning', 'no_https', 'InsecureConnection', $text);
68 <form id="select_lang" method="post" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']) ?>">
69 <?php echo PMA_generate_common_hidden_inputs() ?>
70 <bdo xml:lang="en" dir="ltr"><label for="lang">
71 <?php echo $GLOBALS['strLanguage'] . ($GLOBALS['strLanguage'] != 'Language' ? ' - Language' : '') ?>
72 </label></bdo><br />
73 <select id="lang" name="lang" onchange="this.form.submit();" xml:lang="en" dir="ltr">
74 <?php
75 // create language list
76 $lang_list = array();
77 foreach ($all_languages as $each_lang_key => $each_lang) {
78 if (!file_exists($GLOBALS['lang_path'] . $each_lang[1] . '.inc.php')) {
79 continue;
82 $lang_name = ucfirst(substr(strrchr($each_lang[0], '|'), 1));
83 // Include native name if non empty
84 if (!empty($each_lang[3])) {
85 $lang_name = $each_lang[3] . ' - ' . $lang_name;
88 //Is current one active?
89 $selected = ($GLOBALS['lang'] == $each_lang_key) ? ' selected="selected"' : '';
90 echo '<option value="' . $each_lang_key . '"' . $selected . '>' . $lang_name
91 . '</option>' . "\n";
94 </select>
95 </form>
97 <h2><?php echo $GLOBALS['strSetupOverview'] ?></h2>
99 <?php
100 // message handling
101 messages_end();
102 messages_show_html();
105 <a href="#" id="show_hidden_messages" style="display:none"><?php echo $GLOBALS['strSetupShowHiddenMessages'] ?></a>
107 <h3><?php echo $GLOBALS['strServers'] ?></h3>
108 <?php
110 // Display server list
112 display_form_top('index.php', 'get', array(
113 'page' => 'servers',
114 'mode' => 'add'
117 <div class="form">
118 <?php if ($cf->getServerCount() > 0): ?>
119 <table cellspacing="0" class="datatable" style="table-layout: fixed">
120 <tr>
121 <th>#</th>
122 <th><?php echo $GLOBALS['strName'] ?></th>
123 <th>Authentication type</th>
124 <th colspan="2">DSN</th>
125 </tr>
126 <?php foreach ($_SESSION['ConfigFile']['Servers'] as $id => $server): ?>
127 <tr>
128 <td><?php echo $id ?></td>
129 <td><?php echo $cf->getServerName($id) ?></td>
130 <td><?php echo htmlspecialchars($cf->getValue("Servers/$id/auth_type")) ?></td>
131 <td><?php echo htmlspecialchars($cf->getServerDSN($id)) ?></td>
132 <td style="white-space: nowrap">
133 <small>
134 <a href="<?php echo "?page=servers{$separator}mode=edit{$separator}id=$id" ?>"><?php echo $GLOBALS['strEdit'] ?></a>
135 | <a href="<?php echo "?page=servers{$separator}mode=remove{$separator}id=$id" ?>"><?php echo $GLOBALS['strDelete'] ?></a>
136 </small>
137 </td>
138 </tr>
139 <?php endforeach; ?>
140 </table>
141 <?php else: ?>
142 <table width="100%">
143 <tr>
144 <td>
145 <i><?php echo $GLOBALS['strSetupNoServers'] ?></i>
146 </td>
147 </tr>
148 </table>
149 <?php endif; ?>
150 <table width="100%">
151 <tr>
152 <td class="lastrow" style="text-align: left">
153 <input type="submit" name="submit" value="<?php echo $GLOBALS['strSetupNewServer'] ?>" />
154 </td>
155 </tr>
156 </table>
157 </div>
158 <?php
159 display_form_bottom();
162 <h3><?php echo $GLOBALS['strSetupConfigurationFile'] ?></h3>
163 <?php
165 // Display config file settings and load/save form
167 $form_display = new FormDisplay();
169 display_form_top('config.php');
170 display_fieldset_top('', '', null, array('class' => 'simple'));
172 // Display language list
173 $opts = array(
174 'doc' => $form_display->getDocLink('DefaultLang'),
175 'wiki' => $form_display->getWikiLink('DefaultLang'),
176 'values' => array(),
177 'values_escaped' => true);
178 foreach ($all_languages as $each_lang_key => $each_lang) {
179 if (!file_exists($GLOBALS['lang_path'] . $each_lang[1] . '.inc.php')) {
180 continue;
182 $lang_name = ucfirst(substr(strrchr($each_lang[0], '|'), 1));
183 // Include native name if non empty
184 if (!empty($each_lang[3])) {
185 $lang_name = $each_lang[3] . ' - ' . $lang_name;
187 $opts['values'][$each_lang_key] = $lang_name;
189 display_input('DefaultLang', $GLOBALS['strSetupDefaultLanguage'], '', 'select',
190 $cf->getValue('DefaultLang'), true, $opts);
192 // Display server list
193 $opts = array(
194 'doc' => $form_display->getDocLink('ServerDefault'),
195 'wiki' => $form_display->getWikiLink('ServerDefault'),
196 'values' => array(),
197 'values_disabled' => array());
198 if ($cf->getServerCount() > 0) {
199 $opts['values']['0'] = $GLOBALS['strSetupLetUserChoose'];
200 $opts['values']['-'] = '------------------------------';
201 if ($cf->getServerCount() == 1) {
202 $opts['values_disabled'][] = '0';
204 $opts['values_disabled'][] = '-';
206 foreach ($_SESSION['ConfigFile']['Servers'] as $id => $server) {
207 $opts['values'][(string)$id] = $cf->getServerName($id) . " [$id]";
209 } else {
210 $opts['values']['1'] = $GLOBALS['strSetupOptionNone'];
211 $opts['values_escaped'] = true;
213 display_input('ServerDefault', $GLOBALS['strSetupDefaultServer'], '', 'select',
214 $cf->getValue('ServerDefault'), true, $opts);
216 // Display EOL list
217 $opts = array(
218 'values' => array(
219 'unix' => 'UNIX / Linux (\n)',
220 'win' => 'Windows (\r\n)'),
221 'values_escaped' => true);
222 $eol = PMA_ifSetOr($_SESSION['eol'], (PMA_IS_WINDOWS ? 'win' : 'unix'));
223 display_input('eol', $GLOBALS['strSetupEndOfLine'], '', 'select',
224 $eol, true, $opts);
226 <tr>
227 <td colspan="2" class="lastrow" style="text-align: left">
228 <input type="submit" name="submit_display" value="<?php echo $GLOBALS['strSetupDisplay'] ?>" />
229 <input type="submit" name="submit_download" value="<?php echo $GLOBALS['strSetupDownload'] ?>" />
230 &nbsp; &nbsp;
231 <input type="submit" name="submit_save" value="<?php echo $GLOBALS['strSave'] ?>"<?php if (!$config_writable) echo ' disabled="disabled"' ?> />
232 <input type="submit" name="submit_load" value="<?php echo $GLOBALS['strSetupLoad'] ?>"<?php if (!$config_exists) echo ' disabled="disabled"' ?> />
233 <input type="submit" name="submit_delete" value="<?php echo $GLOBALS['strDelete'] ?>"<?php if (!$config_exists || !$config_writable) echo ' disabled="disabled"' ?> />
234 &nbsp; &nbsp;
235 <input type="submit" name="submit_clear" value="<?php echo $GLOBALS['strSetupClear'] ?>" class="red" />
236 </td>
237 </tr>
238 <?php
239 display_fieldset_bottom_simple();
240 display_form_bottom();
242 <div id="footer">
243 <a href="http://phpmyadmin.net"><?php echo $GLOBALS['strSetupHomepageLink'] ?></a>
244 <a href="http://sourceforge.net/donate/index.php?group_id=23067"><?php echo $GLOBALS['strSetupDonateLink'] ?></a>
245 <a href="?version_check=1<?php echo "{$separator}token=" . $_SESSION[' PMA_token '] ?>"><?php echo $GLOBALS['strSetupVersionCheckLink'] ?></a>
246 </div>