| [1270] | 1 | <?php |
|---|
| [2020] | 2 | |
|---|
| [5152] | 3 | /* |
|---|
| 4 | +-------------------------------------------------------------------------+ |
|---|
| 5 | | Roundcube Webmail setup tool | |
|---|
| [5787] | 6 | | Version 0.8 | |
|---|
| [5152] | 7 | | | |
|---|
| [5787] | 8 | | Copyright (C) 2009-2012, The Roundcube Dev Team | |
|---|
| [5152] | 9 | | | |
|---|
| [5787] | 10 | | This program is free software: you can redistribute it and/or modify | |
|---|
| 11 | | it under the terms of the GNU General Public License (with exceptions | |
|---|
| 12 | | for skins & plugins) as published by the Free Software Foundation, | |
|---|
| 13 | | either version 3 of the License, or (at your option) any later version. | |
|---|
| [5152] | 14 | | | |
|---|
| [5787] | 15 | | This file forms part of the Roundcube Webmail Software for which the | |
|---|
| 16 | | following exception is added: Plugins and Skins which merely make | |
|---|
| 17 | | function calls to the Roundcube Webmail Software, and for that purpose | |
|---|
| 18 | | include it by reference shall not be considered modifications of | |
|---|
| 19 | | the software. | |
|---|
| 20 | | | |
|---|
| 21 | | If you wish to use this file in another project or create a modified | |
|---|
| 22 | | version that will not be part of the Roundcube Webmail Software, you | |
|---|
| 23 | | may remove the exception above and use this source code under the | |
|---|
| 24 | | original version of the license. | |
|---|
| 25 | | | |
|---|
| [5152] | 26 | | This program is distributed in the hope that it will be useful, | |
|---|
| 27 | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|---|
| [5787] | 28 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|---|
| [5152] | 29 | | GNU General Public License for more details. | |
|---|
| 30 | | | |
|---|
| [5787] | 31 | | You should have received a copy of the GNU General Public License | |
|---|
| 32 | | along with this program. If not, see http://www.gnu.org/licenses/. | |
|---|
| [5152] | 33 | | | |
|---|
| 34 | +-------------------------------------------------------------------------+ |
|---|
| 35 | | Author: Thomas Bruederli <roundcube@gmail.com> | |
|---|
| 36 | +-------------------------------------------------------------------------+ |
|---|
| 37 | |
|---|
| 38 | $Id$ |
|---|
| 39 | |
|---|
| 40 | */ |
|---|
| 41 | |
|---|
| [1270] | 42 | ini_set('error_reporting', E_ALL&~E_NOTICE); |
|---|
| 43 | ini_set('display_errors', 1); |
|---|
| 44 | |
|---|
| [1291] | 45 | define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/'); |
|---|
| [1854] | 46 | define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config'); |
|---|
| 47 | |
|---|
| [1426] | 48 | $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; |
|---|
| 49 | $include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR; |
|---|
| 50 | $include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR; |
|---|
| 51 | $include_path .= ini_get('include_path'); |
|---|
| 52 | |
|---|
| [1291] | 53 | set_include_path($include_path); |
|---|
| 54 | |
|---|
| [2020] | 55 | require_once 'utils.php'; |
|---|
| [2776] | 56 | require_once 'main.inc'; |
|---|
| [2020] | 57 | |
|---|
| [1270] | 58 | session_start(); |
|---|
| 59 | |
|---|
| [1511] | 60 | $RCI = rcube_install::get_instance(); |
|---|
| 61 | $RCI->load_config(); |
|---|
| 62 | |
|---|
| [1877] | 63 | if (isset($_GET['_getfile']) && in_array($_GET['_getfile'], array('main', 'db'))) { |
|---|
| 64 | $filename = $_GET['_getfile'] . '.inc.php'; |
|---|
| 65 | if (!empty($_SESSION[$filename])) { |
|---|
| 66 | header('Content-type: text/plain'); |
|---|
| 67 | header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|---|
| 68 | echo $_SESSION[$filename]; |
|---|
| 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 | } |
|---|
| [1511] | 75 | } |
|---|
| 76 | |
|---|
| [1979] | 77 | if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) && |
|---|
| 78 | isset($_GET['_mergeconfig']) && in_array($_GET['_mergeconfig'], array('main', 'db'))) { |
|---|
| [1933] | 79 | $filename = $_GET['_mergeconfig'] . '.inc.php'; |
|---|
| 80 | |
|---|
| 81 | header('Content-type: text/plain'); |
|---|
| 82 | header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|---|
| [4789] | 83 | |
|---|
| [1933] | 84 | $RCI->merge_config(); |
|---|
| 85 | echo $RCI->create_config($_GET['_mergeconfig'], true); |
|---|
| 86 | exit; |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| [2578] | 89 | // go to 'check env' step if we have a local configuration |
|---|
| [1933] | 90 | if ($RCI->configured && empty($_REQUEST['_step'])) { |
|---|
| [2578] | 91 | header("Location: ./?_step=1"); |
|---|
| [1933] | 92 | exit; |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| [1270] | 95 | ?> |
|---|
| [1118] | 96 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|---|
| 97 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 98 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|---|
| 99 | <head> |
|---|
| [3989] | 100 | <title>Roundcube Webmail Installer</title> |
|---|
| [2132] | 101 | <meta name="Robots" content="noindex,nofollow" /> |
|---|
| 102 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|---|
| [1118] | 103 | <link rel="stylesheet" type="text/css" href="styles.css" /> |
|---|
| [1139] | 104 | <script type="text/javascript" src="client.js"></script> |
|---|
| [1118] | 105 | </head> |
|---|
| 106 | |
|---|
| 107 | <body> |
|---|
| 108 | |
|---|
| 109 | <div id="banner"> |
|---|
| [4573] | 110 | <div class="banner-bg"></div> |
|---|
| [6036] | 111 | <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> |
|---|
| [4573] | 112 | </div> |
|---|
| [1118] | 113 | |
|---|
| [4573] | 114 | <div id="topnav"> |
|---|
| 115 | <a href="http://trac.roundcube.net/wiki/Howto_Install">How-to Wiki</a> |
|---|
| 116 | </div> |
|---|
| 117 | |
|---|
| [1118] | 118 | <div id="content"> |
|---|
| 119 | |
|---|
| 120 | <?php |
|---|
| [1127] | 121 | |
|---|
| [1222] | 122 | // exit if installation is complete |
|---|
| 123 | if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) { |
|---|
| [1271] | 124 | // header("HTTP/1.0 404 Not Found"); |
|---|
| [1222] | 125 | echo '<h2 class="error">The installer is disabled!</h2>'; |
|---|
| [1979] | 126 | echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCMAIL_CONFIG_DIR/main.inc.php</p>'; |
|---|
| [1222] | 127 | echo '</div></body></html>'; |
|---|
| 128 | exit; |
|---|
| 129 | } |
|---|
| [1144] | 130 | |
|---|
| [1118] | 131 | ?> |
|---|
| 132 | |
|---|
| [3989] | 133 | <h1>Roundcube Webmail Installer</h1> |
|---|
| [1222] | 134 | |
|---|
| [1118] | 135 | <ol id="progress"> |
|---|
| 136 | <?php |
|---|
| 137 | |
|---|
| 138 | foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) { |
|---|
| 139 | $j = $i + 1; |
|---|
| [1144] | 140 | $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . Q($item) . '</a>' : Q($item); |
|---|
| [1118] | 141 | printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link); |
|---|
| 142 | } |
|---|
| 143 | ?> |
|---|
| 144 | </ol> |
|---|
| 145 | |
|---|
| 146 | <?php |
|---|
| [6036] | 147 | $include_steps = array('', './check.php', './config.php', './test.php'); |
|---|
| [1118] | 148 | |
|---|
| 149 | if ($include_steps[$RCI->step]) { |
|---|
| 150 | include $include_steps[$RCI->step]; |
|---|
| 151 | } |
|---|
| 152 | else { |
|---|
| 153 | header("HTTP/1.0 404 Not Found"); |
|---|
| 154 | echo '<h2 class="error">Invalid step</h2>'; |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | ?> |
|---|
| 158 | </div> |
|---|
| 159 | |
|---|
| 160 | <div id="footer"> |
|---|
| [6036] | 161 | Installer by the Roundcube Dev Team. Copyright © 2008-2012 â Published under the GNU Public License; |
|---|
| [1142] | 162 | Icons by <a href="http://famfamfam.com">famfamfam</a> |
|---|
| [1118] | 163 | </div> |
|---|
| 164 | </body> |
|---|
| 165 | </html> |
|---|