Aleksander Machniak
2016-05-06 acf633c73bc8df9a5036bc52d7568f4213ab73c7
commit | author | age
8b8bcc 1 <?php
fee8c6 2
434869 3 /*
T 4  +-------------------------------------------------------------------------+
5  | Roundcube Webmail setup tool                                            |
b546b0 6  | Version 0.9-git                                                         |
434869 7  |                                                                         |
461a30 8  | Copyright (C) 2009-2013, The Roundcube Dev Team                         |
434869 9  |                                                                         |
7fe381 10  | This program is free software: you can redistribute it and/or modify    |
T 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.                                        |
434869 25  |                                                                         |
T 26  | This program is distributed in the hope that it will be useful,         |
27  | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
7fe381 28  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            |
434869 29  | GNU General Public License for more details.                            |
T 30  |                                                                         |
7fe381 31  | You should have received a copy of the GNU General Public License       |
T 32  | along with this program.  If not, see http://www.gnu.org/licenses/.     |
434869 33  |                                                                         |
T 34  +-------------------------------------------------------------------------+
35  | Author: Thomas Bruederli <roundcube@gmail.com>                          |
36  +-------------------------------------------------------------------------+
37 */
38
d13f32 39 ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT));
8b8bcc 40 ini_set('display_errors', 1);
T 41
47124c 42 define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/');
dc088e 43 define('RCUBE_INSTALL_PATH', INSTALL_PATH);
592668 44 define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config/');
bba657 45
afe50a 46 $include_path  = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
T 47 $include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR;
48 $include_path .= ini_get('include_path');
49
47124c 50 set_include_path($include_path);
T 51
dc088e 52 require_once 'Roundcube/bootstrap.php';
TB 53 require_once 'rcube_install.php';
0c2596 54 // deprecated aliases (to be removed)
dc088e 55 require_once 'bc.php';
47124c 56
dee0af 57 if (function_exists('session_start'))
TB 58   session_start();
c06067 59
S 60 $RCI = rcube_install::get_instance();
61 $RCI->load_config();
62
461a30 63 if (isset($_GET['_getconfig'])) {
AM 64   $filename = 'config.inc.php';
65   if (!empty($_SESSION['config'])) {
7d7f67 66     header('Content-type: text/plain');
T 67     header('Content-Disposition: attachment; filename="'.$filename.'"');
461a30 68     echo $_SESSION['config'];
7d7f67 69     exit;
T 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   }
c06067 75 }
S 76
32eb29 77 if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) &&
461a30 78     !empty($_GET['_mergeconfig'])) {
AM 79   $filename = 'config.inc.php';
e10712 80
T 81   header('Content-type: text/plain');
82   header('Content-Disposition: attachment; filename="'.$filename.'"');
403f0b 83
e10712 84   $RCI->merge_config();
461a30 85   echo $RCI->create_config();
e10712 86   exit;
T 87 }
88
b45aed 89 // go to 'check env' step if we have a local configuration
e10712 90 if ($RCI->configured && empty($_REQUEST['_step'])) {
b45aed 91   header("Location: ./?_step=1");
e10712 92   exit;
T 93 }
94
8b8bcc 95 ?>
354978 96 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
T 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>
e019f2 100 <title>Roundcube Webmail Installer</title>
b1c154 101 <meta name="Robots" content="noindex,nofollow" />
A 102 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
354978 103 <link rel="stylesheet" type="text/css" href="styles.css" />
c5042d 104 <script type="text/javascript" src="client.js"></script>
354978 105 </head>
T 106
107 <body>
108
109 <div id="banner">
e6bb83 110   <div class="banner-bg"></div>
c04b23 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>
e6bb83 112 </div>
T 113
114 <div id="topnav">
115   <a href="http://trac.roundcube.net/wiki/Howto_Install">How-to Wiki</a>
116 </div>
354978 117
T 118 <div id="content">
119
120 <?php
967b34 121
T 122   // exit if installation is complete
123   if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) {
e01084 124     // header("HTTP/1.0 404 Not Found");
9bacb2 125     if ($RCI->configured && $RCI->legacy_config) {
TB 126       echo '<h2 class="error">Your configuration needs to be migrated!</h2>';
127       echo '<p>We changed the configuration files structure and your installation needs to be updated accordingly.</p>';
bcedf0 128       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>';
9bacb2 129       echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.</p>';
TB 130     }
131     else {
132       echo '<h2 class="error">The installer is disabled!</h2>';
bcedf0 133       echo '<p>To enable it again, set <tt>$config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>';
9bacb2 134     }
967b34 135     echo '</div></body></html>';
T 136     exit;
137   }
5fed07 138
354978 139 ?>
T 140
e019f2 141 <h1>Roundcube Webmail Installer</h1>
967b34 142
354978 143 <ol id="progress">
T 144 <?php
5fed07 145   $include_steps = array(
AM 146     1 => './check.php',
147     2 => './config.php',
148     3 => './test.php',
149   );
150
151   if (!in_array($RCI->step, array_keys($include_steps))) {
152     $RCI->step = 1;
153   }
154
354978 155   foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) {
T 156     $j = $i + 1;
b3f9df 157     $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . Q($item) . '</a>' : Q($item);
354978 158     printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
T 159   }
160 ?>
161 </ol>
162
163 <?php
164
5fed07 165 include $include_steps[$RCI->step];
354978 166
T 167 ?>
168 </div>
169
170 <div id="footer">
c04b23 171   Installer by the Roundcube Dev Team. Copyright &copy; 2008-2012 – Published under the GNU Public License;&nbsp;
ad43e6 172   Icons by <a href="http://famfamfam.com">famfamfam</a>
354978 173 </div>
T 174 </body>
175 </html>