index.inc.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Overview (main page)
  5. *
  6. * @package PhpMyAdmin-Setup
  7. */
  8. if (!defined('PHPMYADMIN')) {
  9. exit;
  10. }
  11. /**
  12. * Core libraries.
  13. */
  14. require_once './libraries/display_select_lang.lib.php';
  15. require_once './libraries/config/FormDisplay.class.php';
  16. require_once './setup/lib/index.lib.php';
  17. // prepare unfiltered language list
  18. $all_languages = PMA_langList();
  19. uasort($all_languages, 'PMA_languageCmp');
  20. $cf = ConfigFile::getInstance();
  21. $separator = PMA_get_arg_separator('html');
  22. // message handling
  23. messages_begin();
  24. //
  25. // Check phpMyAdmin version
  26. //
  27. if (isset($_GET['version_check'])) {
  28. PMA_version_check();
  29. }
  30. //
  31. // Perform various security, compatibility and consistency checks
  32. //
  33. perform_config_checks();
  34. //
  35. // Check https connection
  36. //
  37. $is_https = !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
  38. if (!$is_https) {
  39. $text = __('You are not using a secure connection; all data (including potentially sensitive information, like passwords) is transferred unencrypted!');
  40. $text .= ' <a href="#" onclick="window.location.href = \'https:\' + window.location.href.substring(window.location.protocol.length);">';
  41. // Temporary workaround to use tranlated message in older releases
  42. $text .= str_replace(
  43. array('[a@%s]', '[/a]'),
  44. array('', ''),
  45. __('If your server is also configured to accept HTTPS requests follow [a@%s]this link[/a] to use a secure connection.')
  46. );
  47. $text .= '</a>';
  48. messages_set('notice', 'no_https', __('Insecure connection'), $text);
  49. }
  50. ?>
  51. <form id="select_lang" method="post">
  52. <?php echo PMA_generate_common_hidden_inputs() ?>
  53. <bdo lang="en" dir="ltr"><label for="lang">
  54. <?php echo __('Language') . (__('Language') != 'Language' ? ' - Language' : '') ?>
  55. </label></bdo><br />
  56. <select id="lang" name="lang" class="autosubmit" lang="en" dir="ltr">
  57. <?php
  58. // create language list
  59. $lang_list = array();
  60. foreach ($all_languages as $each_lang_key => $each_lang) {
  61. $lang_name = PMA_langName($each_lang);
  62. //Is current one active?
  63. $selected = ($GLOBALS['lang'] == $each_lang_key) ? ' selected="selected"' : '';
  64. echo '<option value="' . $each_lang_key . '"' . $selected . '>' . $lang_name
  65. . '</option>' . "\n";
  66. }
  67. ?>
  68. </select>
  69. </form>
  70. <?php
  71. // Check for done action info and set notice message if present
  72. switch ($action_done) {
  73. case 'config_saved':
  74. /* Use uniqid to display this message every time configuration is saved */
  75. messages_set(
  76. 'notice', uniqid('config_saved'), __('Configuration saved.'),
  77. 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.'))
  78. );
  79. break;
  80. case 'config_not_saved':
  81. /* Use uniqid to display this message every time configuration is saved */
  82. PMA_messagesSet(
  83. 'notice', uniqid('config_not_saved'), __('Configuration not saved!'),
  84. PMA_sanitize(
  85. __(
  86. 'Please create web server writable folder [em]config[/em] in '
  87. . 'phpMyAdmin top level directory as described in '
  88. . '[doc@setup_script]documentation[/doc]. Otherwise you will be '
  89. . 'only able to download or display it.'
  90. )
  91. )
  92. );
  93. break;
  94. default:
  95. break;
  96. }
  97. ?>
  98. <h2><?php echo __('Overview') ?></h2>
  99. <?php
  100. // message handling
  101. messages_end();
  102. messages_show_html();
  103. ?>
  104. <a href="#" id="show_hidden_messages" style="display:none"><?php echo __('Show hidden messages (#MSG_COUNT)') ?></a>
  105. <fieldset class="simple"><legend><?php echo __('Servers') ?></legend>
  106. <?php
  107. //
  108. // Display server list
  109. //
  110. PMA_displayFormTop(
  111. 'index.php', 'get',
  112. array(
  113. 'page' => 'servers',
  114. 'mode' => 'add'
  115. )
  116. );
  117. ?>
  118. <div class="form">
  119. <?php if ($cf->getServerCount() > 0) { ?>
  120. <table cellspacing="0" class="datatable" style="table-layout: fixed">
  121. <tr>
  122. <th>#</th>
  123. <th><?php echo __('Name') ?></th>
  124. <th><?php echo __('Authentication type') ?></th>
  125. <th colspan="2">DSN</th>
  126. </tr>
  127. <?php foreach ($cf->getServers() as $id => $server) { ?>
  128. <tr>
  129. <td><?php echo $id ?></td>
  130. <td><?php echo htmlspecialchars($cf->getServerName($id)) ?></td>
  131. <td><?php echo htmlspecialchars($cf->getValue("Servers/$id/auth_type")) ?></td>
  132. <td><?php echo htmlspecialchars($cf->getServerDSN($id)) ?></td>
  133. <td style="white-space: nowrap">
  134. <small>
  135. <a href="<?php echo "?" . PMA_generate_common_url() . $separator . "page=servers{$separator}mode=edit{$separator}id=$id" ?>"><?php echo __('Edit') ?></a>
  136. | <a href="<?php echo "?" . PMA_generate_common_url() . $separator . "page=servers{$separator}mode=remove{$separator}id=$id" ?>"><?php echo __('Delete') ?></a>
  137. </small>
  138. </td>
  139. </tr>
  140. <?php } ?>
  141. </table>
  142. <?php } else { ?>
  143. <table width="100%">
  144. <tr>
  145. <td>
  146. <i><?php echo __('There are no configured servers') ?></i>
  147. </td>
  148. </tr>
  149. </table>
  150. <?php } ?>
  151. <table width="100%">
  152. <tr>
  153. <td class="lastrow" style="text-align: left">
  154. <input type="submit" name="submit" value="<?php echo __('New server') ?>" />
  155. </td>
  156. </tr>
  157. </table>
  158. </div>
  159. <?php
  160. PMA_displayFormBottom();
  161. ?>
  162. </fieldset>
  163. <fieldset class="simple"><legend><?php echo __('Configuration file') ?></legend>
  164. <?php
  165. //
  166. // Display config file settings and load/save form
  167. //
  168. $form_display = new FormDisplay();
  169. PMA_displayFormTop('config.php');
  170. ?>
  171. <table width="100%" cellspacing="0">
  172. <?php
  173. // Display language list
  174. $opts = array(
  175. 'doc' => $form_display->getDocLink('DefaultLang'),
  176. 'wiki' => $form_display->getWikiLink('DefaultLang'),
  177. 'values' => array(),
  178. 'values_escaped' => true);
  179. foreach ($all_languages as $each_lang_key => $each_lang) {
  180. $lang_name = PMA_langName($each_lang);
  181. $opts['values'][$each_lang_key] = $lang_name;
  182. }
  183. PMA_displayInput(
  184. 'DefaultLang', __('Default language'), 'select',
  185. $cf->getValue('DefaultLang'), '', true, $opts
  186. );
  187. // Display server list
  188. $opts = array(
  189. 'doc' => $form_display->getDocLink('ServerDefault'),
  190. 'wiki' => $form_display->getWikiLink('ServerDefault'),
  191. 'values' => array(),
  192. 'values_disabled' => array());
  193. if ($cf->getServerCount() > 0) {
  194. $opts['values']['0'] = __('let the user choose');
  195. $opts['values']['-'] = '------------------------------';
  196. if ($cf->getServerCount() == 1) {
  197. $opts['values_disabled'][] = '0';
  198. }
  199. $opts['values_disabled'][] = '-';
  200. foreach ($cf->getServers() as $id => $server) {
  201. $opts['values'][(string)$id] = $cf->getServerName($id) . " [$id]";
  202. }
  203. } else {
  204. $opts['values']['1'] = __('- none -');
  205. $opts['values_escaped'] = true;
  206. }
  207. PMA_displayInput(
  208. 'ServerDefault', __('Default server'), 'select',
  209. $cf->getValue('ServerDefault'), '', true, $opts
  210. );
  211. // Display EOL list
  212. $opts = array(
  213. 'values' => array(
  214. 'unix' => 'UNIX / Linux (\n)',
  215. 'win' => 'Windows (\r\n)'),
  216. 'values_escaped' => true);
  217. $eol = PMA_ifSetOr($_SESSION['eol'], (PMA_IS_WINDOWS ? 'win' : 'unix'));
  218. PMA_displayInput(
  219. 'eol', __('End of line'), 'select',
  220. $eol, '', true, $opts
  221. );
  222. ?>
  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_clear" value="<?php echo __('Clear')
  229. ?>" class="red" />
  230. </td>
  231. </tr>
  232. </table>
  233. <?php
  234. PMA_displayFormBottom();
  235. ?>
  236. </fieldset>
  237. <div id="footer">
  238. <a href="../url.php?url=https://www.phpmyadmin.net/"><?php echo __('phpMyAdmin homepage') ?></a>
  239. <a href="../url.php?url=https://www.phpmyadmin.net/donate/"><?php
  240. echo __('Donate') ?></a>
  241. <a href="?version_check=1<?php
  242. echo "{$separator}token="
  243. . $_SESSION[' PMA_token '] ?>"><?php echo __('Check for latest version') ?></a>
  244. </div>