| [8b8bccf] | 1 | <?php |
|---|
| [fee8c6c] | 2 | |
|---|
| [4348692] | 3 | /* |
|---|
| 4 | +-------------------------------------------------------------------------+ |
|---|
| 5 | | Roundcube Webmail setup tool | |
|---|
| [b546b0d] | 6 | | Version 0.9-git | |
|---|
| [4348692] | 7 | | | |
|---|
| [7fe3811] | 8 | | Copyright (C) 2009-2012, The Roundcube Dev Team | |
|---|
| [4348692] | 9 | | | |
|---|
| [7fe3811] | 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. | |
|---|
| 14 | | | |
|---|
| 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. | |
|---|
| [4348692] | 25 | | | |
|---|
| 26 | | This program is distributed in the hope that it will be useful, | |
|---|
| 27 | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|---|
| [7fe3811] | 28 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|---|
| [4348692] | 29 | | GNU General Public License for more details. | |
|---|
| 30 | | | |
|---|
| [7fe3811] | 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/. | |
|---|
| [4348692] | 33 | | | |
|---|
| 34 | +-------------------------------------------------------------------------+ |
|---|
| 35 | | Author: Thomas Bruederli <roundcube@gmail.com> | |
|---|
| 36 | +-------------------------------------------------------------------------+ |
|---|
| 37 | |
|---|
| 38 | $Id$ |
|---|
| 39 | |
|---|
| 40 | */ |
|---|
| 41 | |
|---|
| [d13f329] | 42 | ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT)); |
|---|
| [8b8bccf] | 43 | ini_set('display_errors', 1); |
|---|
| 44 | |
|---|
| [47124c22] | 45 | define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/'); |
|---|
| [bba657e] | 46 | define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config'); |
|---|
| [d13f329] | 47 | define('RCMAIL_CHARSET', 'UTF-8'); |
|---|
| [bba657e] | 48 | |
|---|
| [afe50ae] | 49 | $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; |
|---|
| 50 | $include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR; |
|---|
| 51 | $include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR; |
|---|
| 52 | $include_path .= ini_get('include_path'); |
|---|
| 53 | |
|---|
| [47124c22] | 54 | set_include_path($include_path); |
|---|
| 55 | |
|---|
| [fee8c6c] | 56 | require_once 'utils.php'; |
|---|
| [0c25968] | 57 | require_once 'rcube_shared.inc'; |
|---|
| 58 | // deprecated aliases (to be removed) |
|---|
| [1aceb9c] | 59 | require_once 'rcube_bc.inc'; |
|---|
| [8b8bccf] | 60 | |
|---|
| [fee8c6c] | 61 | session_start(); |
|---|
| [c060677] | 62 | |
|---|
| 63 | $RCI = rcube_install::get_instance(); |
|---|
| 64 | $RCI->load_config(); |
|---|
| 65 | |
|---|
| [7d7f67d] | 66 | if (isset($_GET['_getfile']) && in_array($_GET['_getfile'], array('main', 'db'))) { |
|---|
| 67 | $filename = $_GET['_getfile'] . '.inc.php'; |
|---|
| 68 | if (!empty($_SESSION[$filename])) { |
|---|
| 69 | header('Content-type: text/plain'); |
|---|
| 70 | header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|---|
| 71 | echo $_SESSION[$filename]; |
|---|
| 72 | exit; |
|---|
| 73 | } |
|---|
| 74 | else { |
|---|
| 75 | header('HTTP/1.0 404 Not found'); |
|---|
| 76 | die("The requested configuration was not found. Please run the installer from the beginning."); |
|---|
| 77 | } |
|---|
| [c060677] | 78 | } |
|---|
| 79 | |
|---|
| [32eb29f] | 80 | if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) && |
|---|
| 81 | isset($_GET['_mergeconfig']) && in_array($_GET['_mergeconfig'], array('main', 'db'))) { |
|---|
| [e107123] | 82 | $filename = $_GET['_mergeconfig'] . '.inc.php'; |
|---|
| 83 | |
|---|
| 84 | header('Content-type: text/plain'); |
|---|
| 85 | header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|---|
| [403f0bf] | 86 | |
|---|
| [e107123] | 87 | $RCI->merge_config(); |
|---|
| 88 | echo $RCI->create_config($_GET['_mergeconfig'], true); |
|---|
| 89 | exit; |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| [b45aedd] | 92 | // go to 'check env' step if we have a local configuration |
|---|
| [e107123] | 93 | if ($RCI->configured && empty($_REQUEST['_step'])) { |
|---|
| [b45aedd] | 94 | header("Location: ./?_step=1"); |
|---|
| [e107123] | 95 | exit; |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| [8b8bccf] | 98 | ?> |
|---|
| [3549785] | 99 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|---|
| 100 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 101 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|---|
| 102 | <head> |
|---|
| [e019f2d] | 103 | <title>Roundcube Webmail Installer</title> |
|---|
| [b1c15414] | 104 | <meta name="Robots" content="noindex,nofollow" /> |
|---|
| 105 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|---|
| [3549785] | 106 | <link rel="stylesheet" type="text/css" href="styles.css" /> |
|---|
| [c5042d4] | 107 | <script type="text/javascript" src="client.js"></script> |
|---|
| [3549785] | 108 | </head> |
|---|
| 109 | |
|---|
| 110 | <body> |
|---|
| 111 | |
|---|
| 112 | <div id="banner"> |
|---|
| [e6bb836] | 113 | <div class="banner-bg"></div> |
|---|
| [c04b23a] | 114 | <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> |
|---|
| [e6bb836] | 115 | </div> |
|---|
| 116 | |
|---|
| 117 | <div id="topnav"> |
|---|
| 118 | <a href="http://trac.roundcube.net/wiki/Howto_Install">How-to Wiki</a> |
|---|
| 119 | </div> |
|---|
| [3549785] | 120 | |
|---|
| 121 | <div id="content"> |
|---|
| 122 | |
|---|
| 123 | <?php |
|---|
| [6557d30] | 124 | |
|---|
| [967b342] | 125 | // exit if installation is complete |
|---|
| 126 | if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) { |
|---|
| [e010845] | 127 | // header("HTTP/1.0 404 Not Found"); |
|---|
| [967b342] | 128 | echo '<h2 class="error">The installer is disabled!</h2>'; |
|---|
| [32eb29f] | 129 | echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCMAIL_CONFIG_DIR/main.inc.php</p>'; |
|---|
| [967b342] | 130 | echo '</div></body></html>'; |
|---|
| 131 | exit; |
|---|
| 132 | } |
|---|
| [5fed074] | 133 | |
|---|
| [3549785] | 134 | ?> |
|---|
| 135 | |
|---|
| [e019f2d] | 136 | <h1>Roundcube Webmail Installer</h1> |
|---|
| [967b342] | 137 | |
|---|
| [3549785] | 138 | <ol id="progress"> |
|---|
| 139 | <?php |
|---|
| [5fed074] | 140 | $include_steps = array( |
|---|
| 141 | 1 => './check.php', |
|---|
| 142 | 2 => './config.php', |
|---|
| 143 | 3 => './test.php', |
|---|
| 144 | ); |
|---|
| 145 | |
|---|
| 146 | if (!in_array($RCI->step, array_keys($include_steps))) { |
|---|
| 147 | $RCI->step = 1; |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| [3549785] | 150 | foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) { |
|---|
| 151 | $j = $i + 1; |
|---|
| [b3f9dfb] | 152 | $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . Q($item) . '</a>' : Q($item); |
|---|
| [3549785] | 153 | printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link); |
|---|
| 154 | } |
|---|
| 155 | ?> |
|---|
| 156 | </ol> |
|---|
| 157 | |
|---|
| 158 | <?php |
|---|
| 159 | |
|---|
| [5fed074] | 160 | include $include_steps[$RCI->step]; |
|---|
| [3549785] | 161 | |
|---|
| 162 | ?> |
|---|
| 163 | </div> |
|---|
| 164 | |
|---|
| 165 | <div id="footer"> |
|---|
| [c04b23a] | 166 | Installer by the Roundcube Dev Team. Copyright © 2008-2012 â Published under the GNU Public License; |
|---|
| [ad43e63] | 167 | Icons by <a href="http://famfamfam.com">famfamfam</a> |
|---|
| [3549785] | 168 | </div> |
|---|
| 169 | </body> |
|---|
| 170 | </html> |
|---|