From 27564f1a22d42cdcdb1d2972ca79cc537876c44c Mon Sep 17 00:00:00 2001
From: thomascube
Date: Thu, 28 Feb 2008 21:52:57 +0000
Subject: Add IMAP test and some more options to installer script
---
CHANGELOG | 7 ++++
installer/config.php | 78 ++++++++++++++++++++++++++++++++++++++-
installer/rcube_install.php | 10 +++--
installer/styles.css | 5 +++
installer/test.php | 84 ++++++++++++++++++++++++++++++++++++++++--
program/include/rcube_html.inc | 2 +-
6 files changed, 177 insertions(+), 9 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 0114bd097..1a0f68729 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,13 @@
CHANGELOG RoundCube Webmail
---------------------------
+2008/02/28 (thomasb)
+----------
+- Fix folder adding/renaming inspired by #1484800
+- Applied patch by Emanuele Rocca to make LDAP filters work with or without brackets
+- Fix quirky message selection
+- Completed installer
+
2008/02/20 (thomasb)
----------
- Localize folder name in page title (#1484785)
diff --git a/installer/config.php b/installer/config.php
index 2719cdb87..97052c8da 100644
--- a/installer/config.php
+++ b/installer/config.php
@@ -8,6 +8,18 @@ require_once 'include/rcube_html.inc';
// also load the default config to fill in the fields
$RCI->load_defaults();
+// register these boolean fields
+$RCI->config_props = array(
+ 'ip_check' => 1,
+ 'enable_caching' => 1,
+ 'enable_spellcheck' => 1,
+ 'auto_create_user' => 1,
+ 'smtp_log' => 1,
+ 'prefer_html' => 1,
+ 'preview_pane' => 1,
+ 'htmleditor' => 1,
+);
+
if (!empty($_POST['submit'])) {
echo 'Copy the following configurations and save them in two files (names above the text box)';
@@ -21,6 +33,9 @@ if (!empty($_POST['submit'])) {
echo '
db.inc.php
';
echo $textbox->show($RCI->create_config('db'));
+ echo 'Of course there are more options to configure.
+ Have a look at the config files or visit Howto_Config to find out.
';
+
echo '';
// echo '';
@@ -415,7 +430,7 @@ echo $check_smtplog->show(intval($RCI->getprop('smtp_log')), array('value' => 1)
config[$name];
+ $value = $_SERVER['REQUEST_METHOD'] == 'POST' ? $_POST["_$name"] : $this->config[$name];
if ($name == 'des_key' && !isset($_REQUEST["_$name"]))
$value = self::random_key(24);
@@ -121,7 +122,7 @@ class rcube_install
return '[Warning: could not read the template file]';
foreach ($this->config as $prop => $default) {
- $value = $_POST["_$prop"] ? $_POST["_$prop"] : $default;
+ $value = (isset($_POST["_$prop"]) || $this->config_props[$prop]) ? $_POST["_$prop"] : $default;
// convert some form data
if ($prop == 'debug_level' && is_array($value)) {
@@ -148,7 +149,10 @@ class rcube_install
$value = '%p';
}
else if (is_bool($default)) {
- $value = is_numeric($value) ? (bool)$value : $value;
+ $value = (bool)$value;
+ }
+ else if (is_numeric($value)) {
+ $value = intval($value);
}
// skip this property
diff --git a/installer/styles.css b/installer/styles.css
index 1e91ec2c0..ed64ff001 100644
--- a/installer/styles.css
+++ b/installer/styles.css
@@ -224,3 +224,8 @@ a.removelink {
background-color: #ef9398;
border: 2px solid #dc5757;
}
+
+.userconf {
+ color: #00c;
+ font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
+}
diff --git a/installer/test.php b/installer/test.php
index 8a8b3457d..62535ac33 100644
--- a/installer/test.php
+++ b/installer/test.php
@@ -136,7 +136,7 @@ if ($RCI->getprop('smtp_server')) {
if ($user == '%u') {
$user_field = new textfield(array('name' => '_user'));
- $user = $user_field->show();
+ $user = $user_field->show($_POST['_user']);
}
if ($pass == '%p') {
$pass_field = new passwordfield(array('name' => '_pass'));
@@ -147,6 +147,9 @@ if ($RCI->getprop('smtp_server')) {
echo "Password: $pass
";
}
+$from_field = new textfield(array('name' => '_from', 'id' => 'sendmailfrom'));
+$to_field = new textfield(array('name' => '_to', 'id' => 'sendmailto'));
+
?>
@@ -217,18 +220,91 @@ echo '';
-[@todo Add tests for IMAP settings]
+Test IMAP configuration
+
+getprop('default_host');
+$select_imaphost = new select(array('name' => '_host', 'id' => 'imaphost'));
+$select_imaphost->add(array_values($default_hosts));
+
+$user_field = new textfield(array('name' => '_user', 'id' => 'imapuser'));
+$pass_field = new passwordfield(array('name' => '_pass', 'id' => 'imappass'));
+
+?>
+
+
+
+
+ |
+ show($_POST['_host'] ? $_POST['_host'] : '0'); ?> |
+
+
+ Port |
+ getprop('default_port'); ?> |
+
+
+ |
+ show($_POST['_user']); ?> |
+
+
+ |
+ show(); ?> |
+
+
+
+
+Connecting to ' . Q($_POST['_host']) . '...
';
+
+ $a_host = parse_url($_POST['_host']);
+ if ($a_host['host']) {
+ $imap_host = $a_host['host'];
+ $imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null;
+ $imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : $CONFIG['default_port']);
+ }
+ else {
+ $imap_host = trim($_POST['_host']);
+ $imap_port = $RCI->getprop('default_port');
+ }
+
+ $imap = new rcube_imap(null);
+ if ($imap->connect($imap_host, $_POST['_user'], $_POST['_pass'], $imap_port, $imap_ssl)) {
+ $RCI->pass('IMAP connect', 'SORT capability: ' . ($imap->get_capability('SORT') ? 'yes' : 'no'));
+ $imap->close();
+ }
+ else {
+ $RCI->fail('IMAP connect', $RCI->get_error());
+ }
+}
+
+?>
+
+
+
+
After completing the installation and the final tests please remove the whole
diff --git a/program/include/rcube_html.inc b/program/include/rcube_html.inc
index 18983a15a..7c5c214ab 100644
--- a/program/include/rcube_html.inc
+++ b/program/include/rcube_html.inc
@@ -647,7 +647,7 @@ class select extends rcube_form_element
$options_str .= sprintf("<%s%s%s>%s%s>\n",
$this->_conv_case('option', 'tag'),
- !empty($option['value']) ? sprintf($value_str, Q($option['value'])) : '',
+ isset($option['value']) ? sprintf($value_str, Q($option['value'])) : '',
$selected,
Q($option['text'], 'strict', FALSE),
$this->_conv_case('option', 'tag'));
--
cgit v1.2.3