You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.php 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?php
  2. /**
  3. +-------------------------------------------------------------------------+
  4. | Roundcube Webmail setup tool |
  5. | Version 1.3.6 |
  6. | |
  7. | Copyright (C) 2009-2015, 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('display_errors', 1);
  38. define('INSTALL_PATH', realpath(__DIR__ . '/../').'/');
  39. require INSTALL_PATH . 'program/include/iniset.php';
  40. if (function_exists('session_start'))
  41. session_start();
  42. $RCI = rcmail_install::get_instance();
  43. $RCI->load_config();
  44. if (isset($_GET['_getconfig'])) {
  45. $filename = 'config.inc.php';
  46. if (!empty($_SESSION['config']) && $_GET['_getconfig'] == 2) {
  47. $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename;
  48. @unlink($path);
  49. file_put_contents($path, $_SESSION['config']);
  50. exit;
  51. }
  52. else if (!empty($_SESSION['config'])) {
  53. header('Content-type: text/plain');
  54. header('Content-Disposition: attachment; filename="'.$filename.'"');
  55. echo $_SESSION['config'];
  56. exit;
  57. }
  58. else {
  59. header('HTTP/1.0 404 Not found');
  60. die("The requested configuration was not found. Please run the installer from the beginning.");
  61. }
  62. }
  63. if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) &&
  64. !empty($_GET['_mergeconfig'])) {
  65. $filename = 'config.inc.php';
  66. header('Content-type: text/plain');
  67. header('Content-Disposition: attachment; filename="'.$filename.'"');
  68. $RCI->merge_config();
  69. echo $RCI->create_config();
  70. exit;
  71. }
  72. // go to 'check env' step if we have a local configuration
  73. if ($RCI->configured && empty($_REQUEST['_step'])) {
  74. header("Location: ./?_step=1");
  75. exit;
  76. }
  77. ?>
  78. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  79. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  80. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  81. <head>
  82. <title>Roundcube Webmail Installer</title>
  83. <meta name="Robots" content="noindex,nofollow" />
  84. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  85. <link rel="stylesheet" type="text/css" href="styles.css" />
  86. <script type="text/javascript" src="client.js"></script>
  87. </head>
  88. <body>
  89. <div id="banner">
  90. <div class="banner-bg"></div>
  91. <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>
  92. </div>
  93. <div id="topnav">
  94. <a href="https://github.com/roundcube/roundcubemail/wiki/Installation">How-to Wiki</a>
  95. </div>
  96. <div id="content">
  97. <?php
  98. // exit if installation is complete
  99. if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) {
  100. // header("HTTP/1.0 404 Not Found");
  101. if ($RCI->configured && $RCI->legacy_config) {
  102. echo '<h2 class="error">Your configuration needs to be migrated!</h2>';
  103. echo '<p>We changed the configuration files structure and your installation needs to be updated accordingly.</p>';
  104. 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>';
  105. echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.</p>';
  106. }
  107. else {
  108. echo '<h2 class="error">The installer is disabled!</h2>';
  109. echo '<p>To enable it again, set <tt>$config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>';
  110. }
  111. echo '</div></body></html>';
  112. exit;
  113. }
  114. ?>
  115. <h1>Roundcube Webmail Installer</h1>
  116. <ol id="progress">
  117. <?php
  118. $include_steps = array(
  119. 1 => './check.php',
  120. 2 => './config.php',
  121. 3 => './test.php',
  122. );
  123. if (!in_array($RCI->step, array_keys($include_steps))) {
  124. $RCI->step = 1;
  125. }
  126. foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) {
  127. $j = $i + 1;
  128. $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . rcube::Q($item) . '</a>' : rcube::Q($item);
  129. printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
  130. }
  131. ?>
  132. </ol>
  133. <?php
  134. include $include_steps[$RCI->step];
  135. ?>
  136. </div>
  137. <div id="footer">
  138. Installer by the Roundcube Dev Team. Copyright &copy; 2008-2012 – Published under the GNU Public License;&nbsp;
  139. Icons by <a href="http://famfamfam.com">famfamfam</a>
  140. </div>
  141. </body>
  142. </html>