您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

index.php 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?php
  2. /**
  3. +-------------------------------------------------------------------------+
  4. | Roundcube Webmail setup tool |
  5. | Version 1.2.2 |
  6. | |
  7. | Copyright (C) 2009-2016, The Roundcube Dev Team |
  8. | |
  9. | This program is free software: you can redistribute it and/or modify |
  10. | it under the terms of the GNU General Public License (with exceptions |
  11. | for skins & plugins) as published by the Free Software Foundation, |
  12. | either version 3 of the License, or (at your option) any later version. |
  13. | |
  14. | This file forms part of the Roundcube Webmail Software for which the |
  15. | following exception is added: Plugins and Skins which merely make |
  16. | function calls to the Roundcube Webmail Software, and for that purpose |
  17. | include it by reference shall not be considered modifications of |
  18. | the software. |
  19. | |
  20. | If you wish to use this file in another project or create a modified |
  21. | version that will not be part of the Roundcube Webmail Software, you |
  22. | may remove the exception above and use this source code under the |
  23. | original version of the license. |
  24. | |
  25. | This program is distributed in the hope that it will be useful, |
  26. | but WITHOUT ANY WARRANTY; without even the implied warranty of |
  27. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
  28. | GNU General Public License for more details. |
  29. | |
  30. | You should have received a copy of the GNU General Public License |
  31. | along with this program. If not, see http://www.gnu.org/licenses/. |
  32. | |
  33. +-------------------------------------------------------------------------+
  34. | Author: Thomas Bruederli <roundcube@gmail.com> |
  35. +-------------------------------------------------------------------------+
  36. */
  37. ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT));
  38. ini_set('display_errors', 1);
  39. define('INSTALL_PATH', realpath(__DIR__ . '/../').'/');
  40. define('RCUBE_INSTALL_PATH', INSTALL_PATH);
  41. define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config/');
  42. $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
  43. $include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR;
  44. $include_path .= ini_get('include_path');
  45. set_include_path($include_path);
  46. // include composer autoloader (if available)
  47. if (@file_exists(INSTALL_PATH . 'vendor/autoload.php')) {
  48. require INSTALL_PATH . 'vendor/autoload.php';
  49. }
  50. require_once 'Roundcube/bootstrap.php';
  51. // deprecated aliases (to be removed)
  52. require_once 'bc.php';
  53. if (function_exists('session_start'))
  54. session_start();
  55. $RCI = rcmail_install::get_instance();
  56. $RCI->load_config();
  57. if (isset($_GET['_getconfig'])) {
  58. $filename = 'config.inc.php';
  59. if (!empty($_SESSION['config']) && $_GET['_getconfig'] == 2) {
  60. $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename;
  61. @unlink($path);
  62. file_put_contents($path, $_SESSION['config']);
  63. exit;
  64. }
  65. else if (!empty($_SESSION['config'])) {
  66. header('Content-type: text/plain');
  67. header('Content-Disposition: attachment; filename="'.$filename.'"');
  68. echo $_SESSION['config'];
  69. exit;
  70. }
  71. else {
  72. header('HTTP/1.0 404 Not found');
  73. die("The requested configuration was not found. Please run the installer from the beginning.");
  74. }
  75. }
  76. if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) &&
  77. !empty($_GET['_mergeconfig'])) {
  78. $filename = 'config.inc.php';
  79. header('Content-type: text/plain');
  80. header('Content-Disposition: attachment; filename="'.$filename.'"');
  81. $RCI->merge_config();
  82. echo $RCI->create_config();
  83. exit;
  84. }
  85. // go to 'check env' step if we have a local configuration
  86. if ($RCI->configured && empty($_REQUEST['_step'])) {
  87. header("Location: ./?_step=1");
  88. exit;
  89. }
  90. ?>
  91. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  92. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  93. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  94. <head>
  95. <title>Roundcube Webmail Installer</title>
  96. <meta name="Robots" content="noindex,nofollow" />
  97. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  98. <link rel="stylesheet" type="text/css" href="styles.css" />
  99. <script type="text/javascript" src="client.js"></script>
  100. </head>
  101. <body>
  102. <div id="banner">
  103. <div class="banner-bg"></div>
  104. <div class="banner-logo"><a href="http://roundcube.net"><img src="images/roundcube_logo.png" width="210" height="55" border="0" alt="Roundcube - open source webmail software" /></a></div>
  105. </div>
  106. <div id="topnav">
  107. <a href="http://trac.roundcube.net/wiki/Howto_Install">How-to Wiki</a>
  108. </div>
  109. <div id="content">
  110. <?php
  111. // exit if installation is complete
  112. if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) {
  113. // header("HTTP/1.0 404 Not Found");
  114. if ($RCI->configured && $RCI->legacy_config) {
  115. echo '<h2 class="error">Your configuration needs to be migrated!</h2>';
  116. echo '<p>We changed the configuration files structure and your installation needs to be updated accordingly.</p>';
  117. echo '<p>Please run the <tt>bin/update.sh</tt> script from the command line or set <p>&nbsp; <tt>$rcube_config[\'enable_installer\'] = true;</tt></p>';
  118. echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.</p>';
  119. }
  120. else {
  121. echo '<h2 class="error">The installer is disabled!</h2>';
  122. echo '<p>To enable it again, set <tt>$config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>';
  123. }
  124. echo '</div></body></html>';
  125. exit;
  126. }
  127. ?>
  128. <h1>Roundcube Webmail Installer</h1>
  129. <ol id="progress">
  130. <?php
  131. $include_steps = array(
  132. 1 => './check.php',
  133. 2 => './config.php',
  134. 3 => './test.php',
  135. );
  136. if (!in_array($RCI->step, array_keys($include_steps))) {
  137. $RCI->step = 1;
  138. }
  139. foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) {
  140. $j = $i + 1;
  141. $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . rcube::Q($item) . '</a>' : rcube::Q($item);
  142. printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
  143. }
  144. ?>
  145. </ol>
  146. <?php
  147. include $include_steps[$RCI->step];
  148. ?>
  149. </div>
  150. <div id="footer">
  151. Installer by the Roundcube Dev Team. Copyright &copy; 2008-2012 – Published under the GNU Public License;&nbsp;
  152. Icons by <a href="http://famfamfam.com">famfamfam</a>
  153. </div>
  154. </body>
  155. </html>