alecpl
2011-05-19 403f0bf771d022964412bb646532c19431710d65
commit | author | age
8b8bcc 1 <?php
fee8c6 2
8b8bcc 3 ini_set('error_reporting', E_ALL&~E_NOTICE);
T 4 ini_set('display_errors', 1);
5
47124c 6 define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/');
bba657 7 define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
T 8
afe50a 9 $include_path  = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
T 10 $include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR;
11 $include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR;
12 $include_path .= ini_get('include_path');
13
47124c 14 set_include_path($include_path);
T 15
fee8c6 16 require_once 'utils.php';
2c3d81 17 require_once 'main.inc';
47124c 18
fee8c6 19 session_start();
c06067 20
S 21 $RCI = rcube_install::get_instance();
22 $RCI->load_config();
23
7d7f67 24 if (isset($_GET['_getfile']) && in_array($_GET['_getfile'], array('main', 'db'))) {
T 25   $filename = $_GET['_getfile'] . '.inc.php';
26   if (!empty($_SESSION[$filename])) {
27     header('Content-type: text/plain');
28     header('Content-Disposition: attachment; filename="'.$filename.'"');
29     echo $_SESSION[$filename];
30     exit;
31   }
32   else {
33     header('HTTP/1.0 404 Not found');
34     die("The requested configuration was not found. Please run the installer from the beginning.");
35   }
c06067 36 }
S 37
32eb29 38 if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) &&
T 39     isset($_GET['_mergeconfig']) && in_array($_GET['_mergeconfig'], array('main', 'db'))) {
e10712 40   $filename = $_GET['_mergeconfig'] . '.inc.php';
T 41
42   header('Content-type: text/plain');
43   header('Content-Disposition: attachment; filename="'.$filename.'"');
403f0b 44
e10712 45   $RCI->merge_config();
T 46   echo $RCI->create_config($_GET['_mergeconfig'], true);
47   exit;
48 }
49
b45aed 50 // go to 'check env' step if we have a local configuration
e10712 51 if ($RCI->configured && empty($_REQUEST['_step'])) {
b45aed 52   header("Location: ./?_step=1");
e10712 53   exit;
T 54 }
55
8b8bcc 56 ?>
354978 57 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
T 58     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
59 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
60 <head>
e019f2 61 <title>Roundcube Webmail Installer</title>
b1c154 62 <meta name="Robots" content="noindex,nofollow" />
A 63 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
354978 64 <link rel="stylesheet" type="text/css" href="styles.css" />
c5042d 65 <script type="text/javascript" src="client.js"></script>
354978 66 </head>
T 67
68 <body>
69
70 <div id="banner">
e6bb83 71   <div class="banner-bg"></div>
T 72   <div class="banner-logo"><a href="http://roundcube.net"><img src="images/rcube_logo.gif" width="210" height="55" border="0" alt="Roundcube - Open source webmail project" /></a></div>
73 </div>
74
75 <div id="topnav">
76   <a href="http://trac.roundcube.net/wiki/Howto_Install">How-to Wiki</a>
77 </div>
354978 78
T 79 <div id="content">
80
81 <?php
967b34 82
T 83   // exit if installation is complete
84   if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) {
e01084 85     // header("HTTP/1.0 404 Not Found");
967b34 86     echo '<h2 class="error">The installer is disabled!</h2>';
32eb29 87     echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCMAIL_CONFIG_DIR/main.inc.php</p>';
967b34 88     echo '</div></body></html>';
T 89     exit;
90   }
b3f9df 91   
354978 92 ?>
T 93
e019f2 94 <h1>Roundcube Webmail Installer</h1>
967b34 95
354978 96 <ol id="progress">
T 97 <?php
98   
99   foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) {
100     $j = $i + 1;
b3f9df 101     $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . Q($item) . '</a>' : Q($item);
354978 102     printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
T 103   }
104 ?>
105 </ol>
106
107 <?php
0ff635 108 $include_steps = array('./welcome.html', './check.php', './config.php', './test.php');
354978 109
T 110 if ($include_steps[$RCI->step]) {
111   include $include_steps[$RCI->step];
112 }
113 else {
114   header("HTTP/1.0 404 Not Found");
115   echo '<h2 class="error">Invalid step</h2>';
116 }
117
118 ?>
119 </div>
120
121 <div id="footer">
e6bb83 122   Installer by the Roundcube Dev Team. Copyright &copy; 2008-2011 - Published under the GNU Public License;&nbsp;
ad43e6 123   Icons by <a href="http://famfamfam.com">famfamfam</a>
354978 124 </div>
T 125 </body>
126 </html>