diff options
author | thomascube <thomas@roundcube.net> | 2008-02-28 22:59:02 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-02-28 22:59:02 +0000 |
commit | 112c54ffbbfd65d2d76ce2526b77407f7fb067b8 (patch) | |
tree | 1de27f56d95eb86e6084b10d9b3dbf56800424e0 /installer | |
parent | 4a2765a42066e1d30895ebe986a64d55b63ddafa (diff) |
Fix imap host selection in install script
Diffstat (limited to 'installer')
-rw-r--r-- | installer/config.php | 6 | ||||
-rw-r--r-- | installer/rcube_install.php | 22 | ||||
-rw-r--r-- | installer/test.php | 13 |
3 files changed, 31 insertions, 10 deletions
diff --git a/installer/config.php b/installer/config.php index 97052c8da..9d22c28dd 100644 --- a/installer/config.php +++ b/installer/config.php @@ -250,14 +250,10 @@ echo $select_dbba->show($RCI->getprop('db_backend')); <div id="defaulthostlist"> <?php -$default_hosts = (array)$RCI->getprop('default_host'); $text_imaphost = new textfield(array('name' => '_default_host[]', 'size' => 30)); $i = 0; -foreach ($default_hosts as $key => $name) { - if (empty($name)) - continue; - $host = is_numeric($key) ? $name : $key; +foreach ($RCI->get_hostlist() as $host) { 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>'; diff --git a/installer/rcube_install.php b/installer/rcube_install.php index e02ee75ad..35054a19e 100644 --- a/installer/rcube_install.php +++ b/installer/rcube_install.php @@ -98,7 +98,8 @@ class rcube_install */ function getprop($name, $default = '') { - $value = $_SERVER['REQUEST_METHOD'] == 'POST' ? $_POST["_$name"] : $this->config[$name]; + $value = $_SERVER['REQUEST_METHOD'] == 'POST' && + (isset($_POST["_$name"]) || $this->config_props[$name]) ? $_POST["_$name"] : $this->config[$name]; if ($name == 'des_key' && !isset($_REQUEST["_$name"])) $value = self::random_key(24); @@ -182,6 +183,25 @@ class rcube_install /** + * Return a list with all imap hosts configured + * + * @return array Clean list with imap hosts + */ + function get_hostlist() + { + $default_hosts = (array)$this->getprop('default_host'); + $out = array(); + + foreach ($default_hosts as $key => $name) { + if (!empty($name)) + $out[] = is_numeric($key) ? $name : $key; + } + + return $out; + } + + + /** * Display OK status * * @param string Test name diff --git a/installer/test.php b/installer/test.php index 62535ac33..d83534bb3 100644 --- a/installer/test.php +++ b/installer/test.php @@ -238,9 +238,14 @@ echo '</p>'; <?php -$default_hosts = (array)$RCI->getprop('default_host'); -$select_imaphost = new select(array('name' => '_host', 'id' => 'imaphost')); -$select_imaphost->add(array_values($default_hosts)); +$default_hosts = $RCI->get_hostlist(); +if (!empty($default_hosts)) { + $host_field = new select(array('name' => '_host', 'id' => 'imaphost')); + $host_field->add($default_hosts); +} +else { + $host_field = new textfield(array('name' => '_host', 'id' => 'imaphost')); +} $user_field = new textfield(array('name' => '_user', 'id' => 'imapuser')); $pass_field = new passwordfield(array('name' => '_pass', 'id' => 'imappass')); @@ -251,7 +256,7 @@ $pass_field = new passwordfield(array('name' => '_pass', 'id' => 'imappass')); <tbody> <tr> <td><label for="imaphost">Server</label></td> - <td><?php echo $select_imaphost->show($_POST['_host'] ? $_POST['_host'] : '0'); ?></td> + <td><?php echo $host_field->show($_POST['_host']); ?></td> </tr> <tr> <td>Port</td> |