Mercurial > hg > rc1
comparison installer/index.php @ 0:1e000243b222
vanilla 1.3.3 distro, I hope
| author | Charlie Root |
|---|---|
| date | Thu, 04 Jan 2018 15:50:29 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:1e000243b222 |
|---|---|
| 1 <?php | |
| 2 | |
| 3 /** | |
| 4 +-------------------------------------------------------------------------+ | |
| 5 | Roundcube Webmail setup tool | | |
| 6 | Version 1.3.3 | | |
| 7 | | | |
| 8 | Copyright (C) 2009-2015, 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 | |
| 39 ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT)); | |
| 40 ini_set('display_errors', 1); | |
| 41 | |
| 42 define('INSTALL_PATH', realpath(__DIR__ . '/../').'/'); | |
| 43 define('RCUBE_INSTALL_PATH', INSTALL_PATH); | |
| 44 define('RCUBE_CONFIG_DIR', INSTALL_PATH . 'config/'); | |
| 45 | |
| 46 $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; | |
| 47 $include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR; | |
| 48 $include_path .= ini_get('include_path'); | |
| 49 | |
| 50 set_include_path($include_path); | |
| 51 | |
| 52 // include composer autoloader (if available) | |
| 53 if (@file_exists(INSTALL_PATH . 'vendor/autoload.php')) { | |
| 54 require INSTALL_PATH . 'vendor/autoload.php'; | |
| 55 } | |
| 56 | |
| 57 require_once 'Roundcube/bootstrap.php'; | |
| 58 | |
| 59 if (function_exists('session_start')) | |
| 60 session_start(); | |
| 61 | |
| 62 $RCI = rcmail_install::get_instance(); | |
| 63 $RCI->load_config(); | |
| 64 | |
| 65 if (isset($_GET['_getconfig'])) { | |
| 66 $filename = 'config.inc.php'; | |
| 67 if (!empty($_SESSION['config']) && $_GET['_getconfig'] == 2) { | |
| 68 $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename; | |
| 69 @unlink($path); | |
| 70 file_put_contents($path, $_SESSION['config']); | |
| 71 exit; | |
| 72 } | |
| 73 else if (!empty($_SESSION['config'])) { | |
| 74 header('Content-type: text/plain'); | |
| 75 header('Content-Disposition: attachment; filename="'.$filename.'"'); | |
| 76 echo $_SESSION['config']; | |
| 77 exit; | |
| 78 } | |
| 79 else { | |
| 80 header('HTTP/1.0 404 Not found'); | |
| 81 die("The requested configuration was not found. Please run the installer from the beginning."); | |
| 82 } | |
| 83 } | |
| 84 | |
| 85 if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) && | |
| 86 !empty($_GET['_mergeconfig'])) { | |
| 87 $filename = 'config.inc.php'; | |
| 88 | |
| 89 header('Content-type: text/plain'); | |
| 90 header('Content-Disposition: attachment; filename="'.$filename.'"'); | |
| 91 | |
| 92 $RCI->merge_config(); | |
| 93 echo $RCI->create_config(); | |
| 94 exit; | |
| 95 } | |
| 96 | |
| 97 // go to 'check env' step if we have a local configuration | |
| 98 if ($RCI->configured && empty($_REQUEST['_step'])) { | |
| 99 header("Location: ./?_step=1"); | |
| 100 exit; | |
| 101 } | |
| 102 | |
| 103 ?> | |
| 104 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
| 105 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| 106 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
| 107 <head> | |
| 108 <title>Roundcube Webmail Installer</title> | |
| 109 <meta name="Robots" content="noindex,nofollow" /> | |
| 110 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| 111 <link rel="stylesheet" type="text/css" href="styles.css" /> | |
| 112 <script type="text/javascript" src="client.js"></script> | |
| 113 </head> | |
| 114 | |
| 115 <body> | |
| 116 | |
| 117 <div id="banner"> | |
| 118 <div class="banner-bg"></div> | |
| 119 <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> | |
| 120 </div> | |
| 121 | |
| 122 <div id="topnav"> | |
| 123 <a href="https://github.com/roundcube/roundcubemail/wiki/Installation">How-to Wiki</a> | |
| 124 </div> | |
| 125 | |
| 126 <div id="content"> | |
| 127 | |
| 128 <?php | |
| 129 | |
| 130 // exit if installation is complete | |
| 131 if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) { | |
| 132 // header("HTTP/1.0 404 Not Found"); | |
| 133 if ($RCI->configured && $RCI->legacy_config) { | |
| 134 echo '<h2 class="error">Your configuration needs to be migrated!</h2>'; | |
| 135 echo '<p>We changed the configuration files structure and your installation needs to be updated accordingly.</p>'; | |
| 136 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>'; | |
| 137 echo ' in your RCUBE_CONFIG_DIR/main.inc.php to let the installer help you migrating it.</p>'; | |
| 138 } | |
| 139 else { | |
| 140 echo '<h2 class="error">The installer is disabled!</h2>'; | |
| 141 echo '<p>To enable it again, set <tt>$config[\'enable_installer\'] = true;</tt> in RCUBE_CONFIG_DIR/config.inc.php</p>'; | |
| 142 } | |
| 143 echo '</div></body></html>'; | |
| 144 exit; | |
| 145 } | |
| 146 | |
| 147 ?> | |
| 148 | |
| 149 <h1>Roundcube Webmail Installer</h1> | |
| 150 | |
| 151 <ol id="progress"> | |
| 152 <?php | |
| 153 $include_steps = array( | |
| 154 1 => './check.php', | |
| 155 2 => './config.php', | |
| 156 3 => './test.php', | |
| 157 ); | |
| 158 | |
| 159 if (!in_array($RCI->step, array_keys($include_steps))) { | |
| 160 $RCI->step = 1; | |
| 161 } | |
| 162 | |
| 163 foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) { | |
| 164 $j = $i + 1; | |
| 165 $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . rcube::Q($item) . '</a>' : rcube::Q($item); | |
| 166 printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link); | |
| 167 } | |
| 168 ?> | |
| 169 </ol> | |
| 170 | |
| 171 <?php | |
| 172 | |
| 173 include $include_steps[$RCI->step]; | |
| 174 | |
| 175 ?> | |
| 176 </div> | |
| 177 | |
| 178 <div id="footer"> | |
| 179 Installer by the Roundcube Dev Team. Copyright © 2008-2012 – Published under the GNU Public License; | |
| 180 Icons by <a href="http://famfamfam.com">famfamfam</a> | |
| 181 </div> | |
| 182 </body> | |
| 183 </html> |
