commit | author | age
|
8b8bcc
|
1 |
<?php |
fee8c6
|
2 |
|
a95874
|
3 |
/** |
434869
|
4 |
+-------------------------------------------------------------------------+ |
T |
5 |
| Roundcube Webmail setup tool | |
d2e2a8
|
6 |
| Version 1.2.0 | |
434869
|
7 |
| | |
d2e2a8
|
8 |
| Copyright (C) 2009-2016, 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 |
|
0ea079
|
42 |
define('INSTALL_PATH', realpath(__DIR__ . '/../').'/'); |
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 |
|
a98a4f
|
52 |
// include composer autoloader (if available) |
TB |
53 |
if (@file_exists(INSTALL_PATH . 'vendor/autoload.php')) { |
|
54 |
require INSTALL_PATH . 'vendor/autoload.php'; |
|
55 |
} |
|
56 |
|
dc088e
|
57 |
require_once 'Roundcube/bootstrap.php'; |
0c2596
|
58 |
// deprecated aliases (to be removed) |
dc088e
|
59 |
require_once 'bc.php'; |
47124c
|
60 |
|
dee0af
|
61 |
if (function_exists('session_start')) |
TB |
62 |
session_start(); |
c06067
|
63 |
|
eea11e
|
64 |
$RCI = rcmail_install::get_instance(); |
c06067
|
65 |
$RCI->load_config(); |
S |
66 |
|
461a30
|
67 |
if (isset($_GET['_getconfig'])) { |
AM |
68 |
$filename = 'config.inc.php'; |
f8f91a
|
69 |
if (!empty($_SESSION['config']) && $_GET['_getconfig'] == 2) { |
AM |
70 |
$path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename; |
|
71 |
@unlink($path); |
|
72 |
file_put_contents($path, $_SESSION['config']); |
|
73 |
exit; |
|
74 |
} |
|
75 |
else if (!empty($_SESSION['config'])) { |
7d7f67
|
76 |
header('Content-type: text/plain'); |
T |
77 |
header('Content-Disposition: attachment; filename="'.$filename.'"'); |
461a30
|
78 |
echo $_SESSION['config']; |
7d7f67
|
79 |
exit; |
T |
80 |
} |
|
81 |
else { |
|
82 |
header('HTTP/1.0 404 Not found'); |
|
83 |
die("The requested configuration was not found. Please run the installer from the beginning."); |
|
84 |
} |
c06067
|
85 |
} |
S |
86 |
|
32eb29
|
87 |
if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) && |
461a30
|
88 |
!empty($_GET['_mergeconfig'])) { |
AM |
89 |
$filename = 'config.inc.php'; |
e10712
|
90 |
|
T |
91 |
header('Content-type: text/plain'); |
|
92 |
header('Content-Disposition: attachment; filename="'.$filename.'"'); |
403f0b
|
93 |
|
e10712
|
94 |
$RCI->merge_config(); |
461a30
|
95 |
echo $RCI->create_config(); |
e10712
|
96 |
exit; |
T |
97 |
} |
|
98 |
|
b45aed
|
99 |
// go to 'check env' step if we have a local configuration |
e10712
|
100 |
if ($RCI->configured && empty($_REQUEST['_step'])) { |
b45aed
|
101 |
header("Location: ./?_step=1"); |
e10712
|
102 |
exit; |
T |
103 |
} |
|
104 |
|
8b8bcc
|
105 |
?> |
354978
|
106 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
T |
107 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
108 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
109 |
<head> |
e019f2
|
110 |
<title>Roundcube Webmail Installer</title> |
b1c154
|
111 |
<meta name="Robots" content="noindex,nofollow" /> |
A |
112 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
354978
|
113 |
<link rel="stylesheet" type="text/css" href="styles.css" /> |
c5042d
|
114 |
<script type="text/javascript" src="client.js"></script> |
354978
|
115 |
</head> |
T |
116 |
|
|
117 |
<body> |
|
118 |
|
|
119 |
<div id="banner"> |
e6bb83
|
120 |
<div class="banner-bg"></div> |
c04b23
|
121 |
<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
|
122 |
</div> |
T |
123 |
|
|
124 |
<div id="topnav"> |
|
125 |
<a href="http://trac.roundcube.net/wiki/Howto_Install">How-to Wiki</a> |
|
126 |
</div> |
354978
|
127 |
|
T |
128 |
<div id="content"> |
|
129 |
|
|
130 |
<?php |
967b34
|
131 |
|
T |
132 |
// exit if installation is complete |
|
133 |
if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) { |
e01084
|
134 |
// header("HTTP/1.0 404 Not Found"); |
9bacb2
|
135 |
if ($RCI->configured && $RCI->legacy_config) { |
TB |
136 |
echo '<h2 class="error">Your configuration needs to be migrated!</h2>'; |
|
137 |
echo '<p>We changed the configuration files structure and your installation needs to be updated accordingly.</p>'; |
bcedf0
|
138 |
echo '<p>Please run the <tt>bin/update.sh</tt> script from the command line or set <p> <tt>$rcube_config[\'enable_installer\'] = true;</tt></p>'; |
9bacb2
|
139 |
echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.</p>'; |
TB |
140 |
} |
|
141 |
else { |
|
142 |
echo '<h2 class="error">The installer is disabled!</h2>'; |
bcedf0
|
143 |
echo '<p>To enable it again, set <tt>$config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>'; |
9bacb2
|
144 |
} |
967b34
|
145 |
echo '</div></body></html>'; |
T |
146 |
exit; |
|
147 |
} |
5fed07
|
148 |
|
354978
|
149 |
?> |
T |
150 |
|
e019f2
|
151 |
<h1>Roundcube Webmail Installer</h1> |
967b34
|
152 |
|
354978
|
153 |
<ol id="progress"> |
T |
154 |
<?php |
5fed07
|
155 |
$include_steps = array( |
AM |
156 |
1 => './check.php', |
|
157 |
2 => './config.php', |
|
158 |
3 => './test.php', |
|
159 |
); |
|
160 |
|
|
161 |
if (!in_array($RCI->step, array_keys($include_steps))) { |
|
162 |
$RCI->step = 1; |
|
163 |
} |
|
164 |
|
354978
|
165 |
foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) { |
T |
166 |
$j = $i + 1; |
74ce01
|
167 |
$link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . rcube::Q($item) . '</a>' : rcube::Q($item); |
354978
|
168 |
printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link); |
T |
169 |
} |
|
170 |
?> |
|
171 |
</ol> |
|
172 |
|
|
173 |
<?php |
|
174 |
|
5fed07
|
175 |
include $include_steps[$RCI->step]; |
354978
|
176 |
|
T |
177 |
?> |
|
178 |
</div> |
|
179 |
|
|
180 |
<div id="footer"> |
c04b23
|
181 |
Installer by the Roundcube Dev Team. Copyright © 2008-2012 – Published under the GNU Public License; |
ad43e6
|
182 |
Icons by <a href="http://famfamfam.com">famfamfam</a> |
354978
|
183 |
</div> |
T |
184 |
</body> |
|
185 |
</html> |