Allow to skip the config step if config files already exist

release-0.6
thomascube 17 years ago
parent ead3d2a167
commit b3f9dfb54e

@ -1,3 +1,4 @@
<form action="index.php" method="get">
<?php <?php
$required_php_exts = array('PCRE' => 'pcre', 'Session' => 'session', 'Sockets' => 'sockets'); $required_php_exts = array('PCRE' => 'pcre', 'Session' => 'session', 'Sockets' => 'sockets');
@ -28,11 +29,9 @@ $source_urls = array(
'Mail_mime' => 'http://pear.php.net/package/Mail_mime' 'Mail_mime' => 'http://pear.php.net/package/Mail_mime'
); );
echo '<input type="hidden" name="_step" value="' . ($RCI->configured ? 2 : 3) . '" />';
?> ?>
<form action="index.php" method="get">
<input type="hidden" name="_step" value="2" />
<h3>Checking PHP version</h3> <h3>Checking PHP version</h3>
<?php <?php

@ -5,7 +5,7 @@
ini_set('display_errors', 1); ini_set('display_errors', 1);
require_once 'include/rcube_html.inc'; require_once 'include/rcube_html.inc';
$RCI->load_config(); // also load the default config to fill in the fields
$RCI->load_defaults(); $RCI->load_defaults();
if (!empty($_POST['submit'])) { if (!empty($_POST['submit'])) {
@ -235,12 +235,16 @@ echo $select_dbba->show($RCI->getprop('db_backend'));
<div id="defaulthostlist"> <div id="defaulthostlist">
<?php <?php
$default_hosts = array_unique((array)$RCI->getprop('default_host')); $default_hosts = (array)$RCI->getprop('default_host');
$text_imaphost = new textfield(array('name' => '_default_host[]', 'size' => 30)); $text_imaphost = new textfield(array('name' => '_default_host[]', 'size' => 30));
for ($i=0; $i < count($default_hosts); $i++) { $i = 0;
echo '<div id="defaulthostentry'.$i.'">' . $text_imaphost->show($default_hosts[$i]); foreach ($default_hosts as $key => $name) {
if ($i > 0) if (empty($name))
continue;
$host = is_numeric($key) ? $name : $key;
echo '<div id="defaulthostentry'.$i.'">' . $text_imaphost->show($host);
if ($i++ > 0)
echo '<a href="#" onclick="removehostfield(this.parentNode);return false" class="removelink" title="Remove this entry">remove</a>'; echo '<a href="#" onclick="removehostfield(this.parentNode);return false" class="removelink" title="Remove this entry">remove</a>';
echo '</div>'; echo '</div>';
} }
@ -249,7 +253,7 @@ for ($i=0; $i < count($default_hosts); $i++) {
</div> </div>
<div><a href="javascript:addhostfield()" class="addlink" title="Add another field">add</a></div> <div><a href="javascript:addhostfield()" class="addlink" title="Add another field">add</a></div>
<p class="hint">Leave blank to show a textbox at login</p> <p class="hint">Leave blank to show a textbox at login. To use SSL/IMAPS connection, type ssl://hostname</p>
</dd> </dd>
<dt class="propname">default_port</dt> <dt class="propname">default_port</dt>
@ -431,7 +435,7 @@ echo $input_locale->show($RCI->getprop('locale_string'));
<?php <?php
echo '<p><input type="submit" name="submit" value="UPDATE" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>'; echo '<p><input type="submit" name="submit" value="' . ($RCI->configured ? 'UPDATE' : 'CREATE') . ' CONFIG" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';
?> ?>
</form> </form>

@ -34,7 +34,8 @@
require_once 'rcube_install.php'; require_once 'rcube_install.php';
$RCI = rcube_install::get_instance(); $RCI = rcube_install::get_instance();
$RCI->load_config();
?> ?>
<ol id="progress"> <ol id="progress">
@ -42,7 +43,7 @@
foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) { foreach (array('Check environment', 'Create config', 'Test config') as $i => $item) {
$j = $i + 1; $j = $i + 1;
$link = $RCI->step > $j ? '<a href="./index.php?_step='.$j.'">' . Q($item) . '</a>' : Q($item); $link = ($RCI->step >= $j || $RCI->configured) ? '<a href="./index.php?_step='.$j.'">' . Q($item) . '</a>' : Q($item);
printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link); printf('<li class="step%d%s">%s</li>', $j+1, $RCI->step > $j ? ' passed' : ($RCI->step == $j ? ' current' : ''), $link);
} }
?> ?>

@ -26,6 +26,7 @@ class rcube_install
var $step; var $step;
var $failures = 0; var $failures = 0;
var $config = array(); var $config = array();
var $configured = false;
var $last_error = null; var $last_error = null;
var $email_pattern = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9])'; var $email_pattern = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9])';
@ -64,7 +65,9 @@ class rcube_install
*/ */
function load_config() function load_config()
{ {
$this->config = array();
$this->_load_config('.php'); $this->_load_config('.php');
$this->configured = !empty($this->config);
} }
/** /**

@ -88,19 +88,24 @@ body, td, th, div, p {
padding: 1em 5em 1em 0.2em; padding: 1em 5em 1em 0.2em;
} }
#progress li a {
color: #999;
text-decoration: none;
}
#progress li a:hover {
text-decoration: underline;
}
#progress li.current { #progress li.current {
color: #000; color: #000;
font-weight: bold; font-weight: bold;
} }
#progress li.passed, #progress li.passed,
#progress li.passed a { #progress li.passed a,
#progress li.current a {
color: #333; color: #333;
text-decoration: none;
}
#progress li.passed a:hover {
text-decoration: underline;
} }
fieldset { fieldset {

@ -3,9 +3,6 @@
<h3>Check config files</h3> <h3>Check config files</h3>
<?php <?php
// load local config files
$RCI->load_config();
$read_main = is_readable('../config/main.inc.php'); $read_main = is_readable('../config/main.inc.php');
$read_db = is_readable('../config/db.inc.php'); $read_db = is_readable('../config/db.inc.php');

Loading…
Cancel
Save