| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | ini_set('error_reporting', E_ALL&~E_NOTICE); |
|---|
| 4 | ini_set('display_errors', 1); |
|---|
| 5 | |
|---|
| 6 | define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/'); |
|---|
| 7 | define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config'); |
|---|
| 8 | |
|---|
| 9 | $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; |
|---|
| 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 | |
|---|
| 14 | set_include_path($include_path); |
|---|
| 15 | |
|---|
| 16 | require_once 'rcube_shared.inc'; |
|---|
| 17 | require_once 'utils.php'; |
|---|
| 18 | |
|---|
| 19 | session_start(); |
|---|
| 20 | |
|---|
| 21 | $RCI = rcube_install::get_instance(); |
|---|
| 22 | $RCI->load_config(); |
|---|
| 23 | |
|---|
| 24 | if (isset($_GET['_getfile']) && in_array($_GET['_getfile'], array('main', 'db'))) { |
|---|
| 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 | } |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | if ($RCI->configured && ($RCI->getprop('enable_installer') || $_SESSION['allowinstaller']) && |
|---|
| 39 | isset($_GET['_mergeconfig']) && in_array($_GET['_mergeconfig'], array('main', 'db'))) { |
|---|
| 40 | $filename = $_GET['_mergeconfig'] . '.inc.php'; |
|---|
| 41 | |
|---|
| 42 | header('Content-type: text/plain'); |
|---|
| 43 | header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|---|
| 44 | |
|---|
| 45 | $RCI->merge_config(); |
|---|
| 46 | echo $RCI->create_config($_GET['_mergeconfig'], true); |
|---|
| 47 | exit; |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | // go to 'test' step if we have a local configuration |
|---|
| 51 | if ($RCI->configured && empty($_REQUEST['_step'])) { |
|---|
| 52 | header("Location: ./?_step=3"); |
|---|
| 53 | exit; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | ?> |
|---|
| 57 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|---|
| 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> |
|---|
| 61 | <title>RoundCube Webmail Installer</title> |
|---|
| 62 | <meta name="Robots" content="noindex,nofollow" /> |
|---|
| 63 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|---|
| 64 | <link rel="stylesheet" type="text/css" href="styles.css" /> |
|---|
| 65 | <script type="text/javascript" src="client.js"></script> |
|---|
| 66 | </head> |
|---|
| 67 | |
|---|
| 68 | <body> |
|---|
| 69 | |
|---|
| 70 | <div id="banner"> |
|---|
| 71 | <div id="header"> |
|---|
| 72 | <div class="banner-logo"><a href="http://www.roundcube.net"><img src="images/banner_logo.gif" width="200" height="56" border="0" alt="RoundCube Webmal Project" /></a></div> |
|---|
| 73 | <div class="banner-right"><img src="images/banner_right.gif" width="10" height="56" alt="" /></div> |
|---|
| 74 | </div> |
|---|
| 75 | <div id="topnav"> |
|---|
| 76 | <a href="http://trac.roundcube.net/wiki/Howto_Install">How-to Wiki</a> |
|---|
| 77 | </div> |
|---|
| 78 | </div> |
|---|
| 79 | |
|---|
| 80 | <div id="content"> |
|---|
| 81 | |
|---|
| 82 | <?php |
|---|
| 83 | |
|---|
| 84 | // exit if installation is complete |
|---|
| 85 | if ($RCI->configured && !$RCI->getprop('enable_installer') && !$_SESSION['allowinstaller']) { |
|---|
| 86 | // header("HTTP/1.0 404 Not Found"); |
|---|
| 87 | echo '<h2 class="error">The installer is disabled!</h2>'; |
|---|
| 88 | echo '<p>To enable it again, set <tt>$rcmail_config[\'enable_installer\'] = true;</tt> in RCMAIL_CONFIG_DIR/main.inc.php</p>'; |
|---|
| 89 | echo '</div></body></html>'; |
|---|
| 90 | exit; |
|---|
| 91 | } |
|---|
| 92 | |
|---|
| 93 | ?> |
|---|
| 94 | |
|---|
| 95 | <h1>RoundCube Webmail Installer</h1> |
|---|
| 96 | |
|---|
| 97 | <ol id="progress"> |
|---|
| 98 | <?php |
|---|
| 99 | |
|---|
| 100 | foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) { |
|---|
| 101 | $j = $i + 1; |
|---|
| 102 | $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . Q($item) . '</a>' : Q($item); |
|---|
| 103 | printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link); |
|---|
| 104 | } |
|---|
| 105 | ?> |
|---|
| 106 | </ol> |
|---|
| 107 | |
|---|
| 108 | <?php |
|---|
| 109 | $include_steps = array('./welcome.html', './check.php', './config.php', './test.php'); |
|---|
| 110 | |
|---|
| 111 | if ($include_steps[$RCI->step]) { |
|---|
| 112 | include $include_steps[$RCI->step]; |
|---|
| 113 | } |
|---|
| 114 | else { |
|---|
| 115 | header("HTTP/1.0 404 Not Found"); |
|---|
| 116 | echo '<h2 class="error">Invalid step</h2>'; |
|---|
| 117 | } |
|---|
| 118 | |
|---|
| 119 | ?> |
|---|
| 120 | </div> |
|---|
| 121 | |
|---|
| 122 | <div id="footer"> |
|---|
| 123 | Installer by the RoundCube Dev Team. Copyright © 2008 - Published under the GNU Public License; |
|---|
| 124 | Icons by <a href="http://famfamfam.com">famfamfam</a> |
|---|
| 125 | </div> |
|---|
| 126 | </body> |
|---|
| 127 | </html> |
|---|