source: subversion/trunk/roundcubemail/installer/index.php @ 6091

Last change on this file since 6091 was 6091, checked in by alec, 14 months ago
  • Framework refactoring (I hope it's the last one): rcube,rcmail,rcube_ui -> rcube,rcmail,rcube_utils renamed main.inc into rcube_bc.inc
File size: 6.4 KB
Line 
1<?php
2
3/*
4 +-------------------------------------------------------------------------+
5 | Roundcube Webmail setup tool                                            |
6 | Version 0.8                                                             |
7 |                                                                         |
8 | Copyright (C) 2009-2012, The Roundcube Dev Team                         |
9 |                                                                         |
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.                                        |
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          |
28 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            |
29 | GNU General Public License for more details.                            |
30 |                                                                         |
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/.     |
33 |                                                                         |
34 +-------------------------------------------------------------------------+
35 | Author: Thomas Bruederli <roundcube@gmail.com>                          |
36 +-------------------------------------------------------------------------+
37
38 $Id$
39
40*/
41
42ini_set('error_reporting', E_ALL&~E_NOTICE);
43ini_set('display_errors', 1);
44
45define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/');
46define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
47
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
53set_include_path($include_path);
54
55require_once 'utils.php';
56require_once 'rcube_shared.inc';
57// deprecated aliases (to be removed)
58require_once 'rcube_bc.inc';
59
60session_start();
61
62$RCI = rcube_install::get_instance();
63$RCI->load_config();
64
65if (isset($_GET['_getfile']) && in_array($_GET['_getfile'], array('main', 'db'))) {
66  $filename = $_GET['_getfile'] . '.inc.php';
67  if (!empty($_SESSION[$filename])) {
68    header('Content-type: text/plain');
69    header('Content-Disposition: attachment; filename="'.$filename.'"');
70    echo $_SESSION[$filename];
71    exit;
72  }
73  else {
74    header('HTTP/1.0 404 Not found');
75    die("The requested configuration was not found. Please run the installer from the beginning.");
76  }
77}
78
79if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) &&
80    isset($_GET['_mergeconfig']) && in_array($_GET['_mergeconfig'], array('main', 'db'))) {
81  $filename = $_GET['_mergeconfig'] . '.inc.php';
82
83  header('Content-type: text/plain');
84  header('Content-Disposition: attachment; filename="'.$filename.'"');
85
86  $RCI->merge_config();
87  echo $RCI->create_config($_GET['_mergeconfig'], true);
88  exit;
89}
90
91// go to 'check env' step if we have a local configuration
92if ($RCI->configured && empty($_REQUEST['_step'])) {
93  header("Location: ./?_step=1");
94  exit;
95}
96
97?>
98<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
99        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
100<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
101<head>
102<title>Roundcube Webmail Installer</title>
103<meta name="Robots" content="noindex,nofollow" />
104<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
105<link rel="stylesheet" type="text/css" href="styles.css" />
106<script type="text/javascript" src="client.js"></script>
107</head>
108
109<body>
110
111<div id="banner">
112  <div class="banner-bg"></div>
113  <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>
114</div>
115
116<div id="topnav">
117  <a href="http://trac.roundcube.net/wiki/Howto_Install">How-to Wiki</a>
118</div>
119
120<div id="content">
121
122<?php
123
124  // exit if installation is complete
125  if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) {
126    // header("HTTP/1.0 404 Not Found");
127    echo '<h2 class="error">The installer is disabled!</h2>';
128    echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCMAIL_CONFIG_DIR/main.inc.php</p>';
129    echo '</div></body></html>';
130    exit;
131  }
132 
133?>
134
135<h1>Roundcube Webmail Installer</h1>
136
137<ol id="progress">
138<?php
139 
140  foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) {
141    $j = $i + 1;
142    $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . Q($item) . '</a>' : Q($item);
143    printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
144  }
145?>
146</ol>
147
148<?php
149$include_steps = array('', './check.php', './config.php', './test.php');
150
151if ($include_steps[$RCI->step]) {
152  include $include_steps[$RCI->step];
153}
154else {
155  header("HTTP/1.0 404 Not Found");
156  echo '<h2 class="error">Invalid step</h2>';
157}
158
159?>
160</div>
161
162<div id="footer">
163  Installer by the Roundcube Dev Team. Copyright &copy; 2008-2012 – Published under the GNU Public License;&nbsp;
164  Icons by <a href="http://famfamfam.com">famfamfam</a>
165</div>
166</body>
167</html>
Note: See TracBrowser for help on using the repository browser.