Add IMAP test and some more options to installer script
| | |
| | | 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) |
| | |
| | | // 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 '<p class="notice">Copy the following configurations and save them in two files (names above the text box)'; |
| | |
| | | |
| | | echo '<div style="margin-top:1em"><em>db.inc.php</em></div>'; |
| | | echo $textbox->show($RCI->create_config('db')); |
| | | |
| | | echo '<p class="hint">Of course there are more options to configure. |
| | | Have a look at the config files or visit <a href="http://trac.roundcube.net/wiki/Howto_Config">Howto_Config</a> to find out.</p>'; |
| | | |
| | | echo '<p><input type="button" onclick="location.href=\'./index.php?_step=3\'" value="CONTINUE" /></p>'; |
| | | |
| | |
| | | |
| | | |
| | | <fieldset> |
| | | <legend>Display settings</legend> |
| | | <legend>Display settings & user prefs</legend> |
| | | <dl class="configblock" id="cgfblockdisplay"> |
| | | |
| | | <dt class="propname">locale_string</dt> |
| | |
| | | <p class="hint">Enter a <a href="http://www.faqs.org/rfcs/rfc1766">RFC1766</a> formatted locale name. Examples: en_US, de, de_CH, fr, pt_BR</p> |
| | | </dd> |
| | | |
| | | <dt class="propname">pagesize <span class="userconf">*</span></dt> |
| | | <dd> |
| | | <?php |
| | | |
| | | $input_pagesize = new textfield(array('name' => '_pagesize', 'size' => 6, 'id' => "cfgpagesize")); |
| | | echo $input_pagesize->show($RCI->getprop('pagesize')); |
| | | |
| | | ?> |
| | | <div>Show up to X items in list view.</div> |
| | | </dd> |
| | | |
| | | <dt class="propname">prefer_html <span class="userconf">*</span></dt> |
| | | <dd> |
| | | <?php |
| | | |
| | | $check_htmlview = new checkbox(array('name' => '_prefer_html', 'id' => "cfghtmlview", 'value' => 1)); |
| | | echo $check_htmlview->show(intval($RCI->getprop('prefer_html'))); |
| | | |
| | | ?> |
| | | <label for="cfghtmlview">Prefer displaying HTML messages</label><br /> |
| | | </dd> |
| | | |
| | | <dt class="propname">preview_pane <span class="userconf">*</span></dt> |
| | | <dd> |
| | | <?php |
| | | |
| | | $check_prevpane = new checkbox(array('name' => '_preview_pane', 'id' => "cfgprevpane", 'value' => 1)); |
| | | echo $check_prevpane->show(intval($RCI->getprop('preview_pane'))); |
| | | |
| | | ?> |
| | | <label for="cfgprevpane">If preview pane is enabled</label><br /> |
| | | </dd> |
| | | |
| | | <dt class="propname">htmleditor <span class="userconf">*</span></dt> |
| | | <dd> |
| | | <?php |
| | | |
| | | $check_htmlcomp = new checkbox(array('name' => '_htmleditor', 'id' => "cfghtmlcompose", 'value' => 1)); |
| | | echo $check_htmlcomp->show(intval($RCI->getprop('htmleditor'))); |
| | | |
| | | ?> |
| | | <label for="cfghtmlcompose">Compose HTML formatted messages</label><br /> |
| | | </dd> |
| | | |
| | | <dt class="propname">draft_autosave <span class="userconf">*</span></dt> |
| | | <dd> |
| | | <label for="cfgautosave">Save compose message every</label> |
| | | <?php |
| | | |
| | | $select_autosave = new select(array('name' => '_draft_autosave', 'id' => 'cfgautosave')); |
| | | $select_autosave->add('never', 0); |
| | | foreach (array(3, 5, 10) as $i => $min) |
| | | $select_autosave->add("$min min", $min*60); |
| | | |
| | | echo $select_autosave->show(intval($RCI->getprop('draft_autosave'))); |
| | | |
| | | ?> |
| | | </dd> |
| | | |
| | | </dl> |
| | | |
| | | <p class="hint"><span class="userconf">*</span> These settings are defaults for the user preferences</p> |
| | | </fieldset> |
| | | |
| | | <?php |
| | |
| | | var $configured = false; |
| | | var $last_error = null; |
| | | var $email_pattern = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9])'; |
| | | var $config_props = array(); |
| | | |
| | | /** |
| | | * Constructor |
| | |
| | | */ |
| | | function getprop($name, $default = '') |
| | | { |
| | | $value = isset($_REQUEST["_$name"]) ? $_REQUEST["_$name"] : $this->config[$name]; |
| | | $value = $_SERVER['REQUEST_METHOD'] == 'POST' ? $_POST["_$name"] : $this->config[$name]; |
| | | |
| | | if ($name == 'des_key' && !isset($_REQUEST["_$name"])) |
| | | $value = self::random_key(24); |
| | |
| | | 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)) { |
| | |
| | | $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 |
| | |
| | | background-color: #ef9398; |
| | | border: 2px solid #dc5757; |
| | | } |
| | | |
| | | .userconf { |
| | | color: #00c; |
| | | font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; |
| | | } |
| | |
| | | |
| | | 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')); |
| | |
| | | echo "User: $user<br />"; |
| | | echo "Password: $pass<br />"; |
| | | } |
| | | |
| | | $from_field = new textfield(array('name' => '_from', 'id' => 'sendmailfrom')); |
| | | $to_field = new textfield(array('name' => '_to', 'id' => 'sendmailto')); |
| | | |
| | | ?> |
| | | </p> |
| | |
| | | |
| | | <table> |
| | | <tbody> |
| | | <tr><td><label for="sendmailfrom">Sender</label></td><td><input type="text" name="_from" value="" id="sendmailfrom" /></td></tr> |
| | | <tr><td><label for="sendmailto">Recipient</label></td><td><input type="text" name="_to" value="" id="sendmailto" /></td></tr> |
| | | <tr> |
| | | <td><label for="sendmailfrom">Sender</label></td> |
| | | <td><?php echo $from_field->show($_POST['_from']); ?></td> |
| | | </tr> |
| | | <tr> |
| | | <td><label for="sendmailto">Recipient</label></td> |
| | | <td><?php echo $to_field->show($_POST['_to']); ?></td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | |
| | | <p><input type="submit" name="sendmail" value="Send test mail" /></p> |
| | | |
| | | |
| | | <p>[@todo Add tests for IMAP settings]</p> |
| | | <h3>Test IMAP configuration</h3> |
| | | |
| | | <?php |
| | | |
| | | $default_hosts = (array)$RCI->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')); |
| | | |
| | | ?> |
| | | |
| | | <table> |
| | | <tbody> |
| | | <tr> |
| | | <td><label for="imaphost">Server</label></td> |
| | | <td><?php echo $select_imaphost->show($_POST['_host'] ? $_POST['_host'] : '0'); ?></td> |
| | | </tr> |
| | | <tr> |
| | | <td>Port</td> |
| | | <td><?php echo $RCI->getprop('default_port'); ?></td> |
| | | </tr> |
| | | <tr> |
| | | <td><label for="imapuser">Username</label></td> |
| | | <td><?php echo $user_field->show($_POST['_user']); ?></td> |
| | | </tr> |
| | | <tr> |
| | | <td><label for="imappass">Password</label></td> |
| | | <td><?php echo $pass_field->show(); ?></td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | |
| | | <?php |
| | | |
| | | if (isset($_POST['imaptest']) && !empty($_POST['_host']) && !empty($_POST['_user'])) { |
| | | |
| | | require_once 'include/rcube_imap.inc'; |
| | | |
| | | echo '<p>Connecting to ' . Q($_POST['_host']) . '...<br />'; |
| | | |
| | | $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()); |
| | | } |
| | | } |
| | | |
| | | ?> |
| | | |
| | | <p><input type="submit" name="imaptest" value="Check login" /></p> |
| | | |
| | | </form> |
| | | |
| | | <hr /> |
| | | |
| | | <p class="warning"> |
| | | |
| | | After completing the installation and the final tests please <b>remove</b> the whole |
| | |
| | | |
| | | $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')); |