1 <form action="index.php" method="post">
2 <input type="hidden" name="_step" value="2" />
5 ini_set('display_errors', 1);
6 require_once 'include/rcube_html.inc';
8 // also load the default config to fill in the fields
11 // register these boolean fields
12 $RCI->config_props = array(
14 'enable_caching' => 1,
15 'enable_spellcheck' => 1,
16 'auto_create_user' => 1,
23 // allow the current user to get to the next step
24 $_SESSION['allowinstaller'] = true;
26 if (!empty($_POST['submit'])) {
28 echo '<p class="notice">Copy the following configurations and save them in two files (names above the text box)';
29 echo ' within the <tt>config/</tt> directory of your RoundCube installation.<br/>';
30 echo ' Make sure that there are no characters outside the <tt><?php ?></tt> brackets when saving the files.</p>';
32 $textbox = new textarea(array('rows' => 16, 'cols' => 60, 'class' => "configfile"));
34 echo '<div><em>main.inc.php</em></div>';
35 echo $textbox->show($RCI->create_config('main'));
37 echo '<div style="margin-top:1em"><em>db.inc.php</em></div>';
38 echo $textbox->show($RCI->create_config('db'));
40 echo '<p class="hint">Of course there are more options to configure.
41 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>';
43 echo '<p><input type="button" onclick="location.href=\'./index.php?_step=3\'" value="CONTINUE" /></p>';
45 // echo '<style type="text/css"> .configblock { display:none } </style>';
46 echo "\n<hr style='margin-bottom:1.6em' />\n";
51 <legend>General configuration</legend>
52 <dl class="configblock">
54 <dt id="cgfblockgeneral" class="propname">debug_level</dt>
58 $value = $RCI->getprop('debug_level');
59 $check_debug = new checkbox(array('name' => '_debug_level[]'));
60 echo $check_debug->show(($value & 1) ? 1 : 0 , array('value' => 1, 'id' => 'cfgdebug1'));
61 echo '<label for="cfgdebug1">Log errors</label><br />';
63 echo $check_debug->show(($value & 4) ? 4 : 0, array('value' => 4, 'id' => 'cfgdebug4'));
64 echo '<label for="cfgdebug4">Display errors</label><br />';
66 echo $check_debug->show(($value & 8) ? 8 : 0, array('value' => 8, 'id' => 'cfgdebug8'));
67 echo '<label for="cfgdebug8">Verbose display</label><br />';
73 <dt class="propname">product_name</dt>
77 $input_prodname = new textfield(array('name' => '_product_name', 'size' => 30, 'id' => "cfgprodname"));
78 echo $input_prodname->show($RCI->getprop('product_name'));
81 <div>The name of your service (used to compose page titles)</div>
84 <dt class="propname">skin_path</dt>
88 $input_skinpath = new textfield(array('name' => '_skin_path', 'size' => 30, 'id' => "cfgskinpath"));
89 echo $input_skinpath->show($RCI->getprop('skin_path'));
92 <div>Relative path to the skin folder</div>
95 <dt class="propname">temp_dir</dt>
99 $input_tempdir = new textfield(array('name' => '_temp_dir', 'size' => 30, 'id' => "cfgtempdir"));
100 echo $input_tempdir->show($RCI->getprop('temp_dir'));
103 <div>Use this folder to store temp files (must be writebale for webserver)</div>
106 <dt class="propname">log_dir</dt>
110 $input_logdir = new textfield(array('name' => '_log_dir', 'size' => 30, 'id' => "cfglogdir"));
111 echo $input_logdir->show($RCI->getprop('log_dir'));
114 <div>Use this folder to store log files (must be writebale for webserver)</div>
117 <dt class="propname">ip_check</dt>
121 $check_ipcheck = new checkbox(array('name' => '_ip_check', 'id' => "cfgipcheck"));
122 echo $check_ipcheck->show(intval($RCI->getprop('ip_check')), array('value' => 1));
125 <label for="cfgipcheck">Check client IP in session authorization</label><br />
127 <p class="hint">This increases security but can cause sudden logouts when someone uses a proxy with changeing IPs.</p>
130 <dt class="propname">des_key</dt>
134 $input_deskey = new textfield(array('name' => '_des_key', 'size' => 30, 'id' => "cfgdeskey"));
135 echo $input_deskey->show($RCI->getprop('des_key'));
138 <div>This key is used to encrypt the users imap password before storing in the session record</div>
139 <p class="hint">It's a random generated string to ensure that every installation has it's own key.
140 If you enter it manually please provide a string of exactly 24 chars.</p>
143 <dt class="propname">enable_caching</dt>
147 $check_caching = new checkbox(array('name' => '_enable_caching', 'id' => "cfgcache"));
148 echo $check_caching->show(intval($RCI->getprop('enable_caching')), array('value' => 1));
151 <label for="cfgcache">Cache messages in local database</label><br />
154 <dt class="propname">enable_spellcheck</dt>
158 $check_caching = new checkbox(array('name' => '_enable_spellcheck', 'id' => "cfgspellcheck"));
159 echo $check_caching->show(intval($RCI->getprop('enable_spellcheck')), array('value' => 1));
162 <label for="cfgspellcheck">Make use of the built-in spell checker</label><br />
164 <p class="hint">It is based on GoogieSpell what implies that the message content will be sent to Google in order to check the spelling.</p>
167 <dt class="propname">mdn_requests</dt>
171 $select_mdnreq = new select(array('name' => '_mdn_requests', 'id' => "cfgmdnreq"));
172 $select_mdnreq->add(array('ask the user', 'send automatically', 'ignore'), array(0, 1, 2));
173 echo $select_mdnreq->show(intval($RCI->getprop('mdn_requests')));
176 <div>Behavior if a received message requests a message delivery notification (read receipt)</div>
183 <legend>Database setup</legend>
184 <dl class="configblock" id="cgfblockdb">
185 <dt class="propname">db_dsnw</dt>
187 <p>Database settings for read/write operations:</p>
190 require_once 'DB.php';
192 $supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli',
193 'PgSQL' => 'pgsql', 'SQLite' => 'sqlite');
195 $select_dbtype = new select(array('name' => '_dbtype', 'id' => "cfgdbtype"));
196 foreach ($supported_dbs AS $database => $ext) {
197 if (extension_loaded($ext)) {
198 $select_dbtype->add($database, $ext);
202 $input_dbhost = new textfield(array('name' => '_dbhost', 'size' => 20, 'id' => "cfgdbhost"));
203 $input_dbname = new textfield(array('name' => '_dbname', 'size' => 20, 'id' => "cfgdbname"));
204 $input_dbuser = new textfield(array('name' => '_dbuser', 'size' => 20, 'id' => "cfgdbuser"));
205 $input_dbpass = new textfield(array('name' => '_dbpass', 'size' => 20, 'id' => "cfgdbpass"));
207 $dsnw = DB::parseDSN($RCI->getprop('db_dsnw'));
209 echo $select_dbtype->show($RCI->is_post ? $_POST['_dbtype'] : $dsnw['phptype']);
210 echo '<label for="cfgdbtype">Database type</label><br />';
211 echo $input_dbhost->show($RCI->is_post ? $_POST['_dbhost'] : $dsnw['hostspec']);
212 echo '<label for="cfgdbhost">Database server</label><br />';
213 echo $input_dbname->show($RCI->is_post ? $_POST['_dbname'] : $dsnw['database']);
214 echo '<label for="cfgdbname">Database name</label><br />';
215 echo $input_dbuser->show($RCI->is_post ? $_POST['_dbuser'] : $dsnw['username']);
216 echo '<label for="cfgdbuser">Database user name (needs write permissions)</label><br />';
217 echo $input_dbpass->show($RCI->is_post ? $_POST['_dbpass'] : $dsnw['password']);
218 echo '<label for="cfgdbpass">Database password</label><br />';
223 <dt class="propname">db_backend</dt>
227 // check for existing PEAR classes
228 @include_once 'DB.php';
229 @include_once 'MDB2.php';
231 $select_dbba = new select(array('name' => '_db_backend', 'id' => "cfgdbba"));
233 if (class_exists('DB'))
234 $select_dbba->add('DB', 'db');
235 if (class_exists('MDB2'))
236 $select_dbba->add('MDB2', 'mdb2');
238 echo $select_dbba->show($RCI->getprop('db_backend'));
241 <div>PEAR Database backend to use</div>
249 <legend>IMAP Settings</legend>
250 <dl class="configblock" id="cgfblockimap">
251 <dt class="propname">default_host</dt>
253 <div>The IMAP host(s) chosen to perform the log-in</div>
254 <div id="defaulthostlist">
257 $text_imaphost = new textfield(array('name' => '_default_host[]', 'size' => 30));
258 $default_hosts = $RCI->get_hostlist();
260 if (empty($default_hosts))
261 $default_hosts = array('');
264 foreach ($default_hosts as $host) {
265 echo '<div id="defaulthostentry'.$i.'">' . $text_imaphost->show($host);
267 echo '<a href="#" onclick="removehostfield(this.parentNode);return false" class="removelink" title="Remove this entry">remove</a>';
273 <div><a href="javascript:addhostfield()" class="addlink" title="Add another field">add</a></div>
275 <p class="hint">Leave blank to show a textbox at login. To use SSL/IMAPS connection, type ssl://hostname</p>
278 <dt class="propname">default_port</dt>
282 $text_imapport = new textfield(array('name' => '_default_port', 'size' => 6, 'id' => "cfgimapport"));
283 echo $text_imapport->show($RCI->getprop('default_port'));
286 <div>TCP port used for IMAP connections</div>
289 <dt class="propname">username_domain</dt>
293 $text_userdomain = new textfield(array('name' => '_username_domain', 'size' => 30, 'id' => "cfguserdomain"));
294 echo $text_userdomain->show($RCI->getprop('username_domain'));
297 <div>Automatically add this domain to user names for login</div>
299 <p class="hint">Only for IMAP servers that require full e-mail addresses for login</p>
302 <dt class="propname">auto_create_user</dt>
306 $check_autocreate = new checkbox(array('name' => '_auto_create_user', 'id' => "cfgautocreate"));
307 echo $check_autocreate->show(intval($RCI->getprop('auto_create_user')), array('value' => 1));
310 <label for="cfgautocreate">Automatically create a new RoundCube user when log-in the first time</label><br />
312 <p class="hint">A user is authenticated by the IMAP server but it requires a local record to store settings
313 and contacts. With this option enabled a new user record will automatically be created once the IMAP login succeeds.</p>
315 <p class="hint">If this option is disabled, the login only succeeds if there's a matching user-record in the local RoundCube database
316 what means that you have to create those records manually or disable this option after the first login.</p>
319 <dt class="propname">sent_mbox</dt>
323 $text_sentmbox = new textfield(array('name' => '_sent_mbox', 'size' => 20, 'id' => "cfgsentmbox"));
324 echo $text_sentmbox->show($RCI->getprop('sent_mbox'));
327 <div>Store sent messages is this folder</div>
329 <p class="hint">Leave blank if sent messages should not be stored</p>
332 <dt class="propname">trash_mbox</dt>
336 $text_trashmbox = new textfield(array('name' => '_trash_mbox', 'size' => 20, 'id' => "cfgtrashmbox"));
337 echo $text_trashmbox->show($RCI->getprop('trash_mbox'));
340 <div>Move messages to this folder when deleting them</div>
342 <p class="hint">Leave blank if they should be deleted directly</p>
345 <dt class="propname">drafts_mbox</dt>
349 $text_draftsmbox = new textfield(array('name' => '_drafts_mbox', 'size' => 20, 'id' => "cfgdraftsmbox"));
350 echo $text_draftsmbox->show($RCI->getprop('drafts_mbox'));
353 <div>Store draft messages is this folder</div>
361 <legend>SMTP Settings</legend>
362 <dl class="configblock" id="cgfblocksmtp">
363 <dt class="propname">smtp_server</dt>
367 $text_smtphost = new textfield(array('name' => '_smtp_server', 'size' => 30, 'id' => "cfgsmtphost"));
368 echo $text_smtphost->show($RCI->getprop('smtp_server'));
371 <div>Use this host for sending mails</div>
373 <p class="hint">To use SSL connection, set ssl://smtp.host.com. If left blank, the PHP mail() function is used</p>
376 <dt class="propname">smtp_port</dt>
380 $text_smtpport = new textfield(array('name' => '_smtp_port', 'size' => 6, 'id' => "cfgsmtpport"));
381 echo $text_smtpport->show($RCI->getprop('smtp_port'));
384 <div>SMTP port (default is 25; 465 for SSL)</div>
387 <dt class="propname">smtp_user/smtp_pass</dt>
391 $text_smtpuser = new textfield(array('name' => '_smtp_user', 'size' => 20, 'id' => "cfgsmtpuser"));
392 $text_smtppass = new textfield(array('name' => '_smtp_pass', 'size' => 20, 'id' => "cfgsmtppass"));
393 echo $text_smtpuser->show($RCI->getprop('smtp_user'));
394 echo $text_smtppass->show($RCI->getprop('smtp_pass'));
397 <div>SMTP username and password (if required)</div>
401 $check_smtpuser = new checkbox(array('name' => '_smtp_user_u', 'id' => "cfgsmtpuseru"));
402 echo $check_smtpuser->show($RCI->getprop('smtp_user') == '%u' || $_POST['_smtp_user_u'] ? 1 : 0, array('value' => 1));
405 <label for="cfgsmtpuseru">Use the current IMAP username and password for SMTP authentication</label>
409 <dt class="propname">smtp_auth_type</dt>
413 $select_smtpauth = new select(array('name' => '_smtp_auth_type', 'id' => "cfgsmtpauth"));
414 $select_smtpauth->add(array('(auto)', 'PLAIN', 'DIGEST-MD5', 'CRAM-MD5', 'LOGIN'), array('0', 'PLAIN', 'DIGEST-MD5', 'CRAM-MD5', 'LOGIN'));
415 echo $select_smtpauth->show(intval($RCI->getprop('smtp_auth_type')));
418 <div>Method to authenticate at the SMTP server. Choose (auto) if you don't know what this is</div>
421 <dt class="propname">smtp_log</dt>
425 $check_smtplog = new checkbox(array('name' => '_smtp_log', 'id' => "cfgsmtplog"));
426 echo $check_smtplog->show(intval($RCI->getprop('smtp_log')), array('value' => 1));
429 <label for="cfgsmtplog">Log sent messages in <tt>logs/sendmail</tt></label><br />
437 <legend>Display settings & user prefs</legend>
438 <dl class="configblock" id="cgfblockdisplay">
440 <dt class="propname">locale_string</dt>
444 $input_locale = new textfield(array('name' => '_locale_string', 'size' => 6, 'id' => "cfglocale"));
445 echo $input_locale->show($RCI->getprop('locale_string'));
448 <div>The default locale setting. This also defines the language of the login screen.</div>
449 <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>
452 <dt class="propname">pagesize <span class="userconf">*</span></dt>
456 $input_pagesize = new textfield(array('name' => '_pagesize', 'size' => 6, 'id' => "cfgpagesize"));
457 echo $input_pagesize->show($RCI->getprop('pagesize'));
460 <div>Show up to X items in list view.</div>
463 <dt class="propname">prefer_html <span class="userconf">*</span></dt>
467 $check_htmlview = new checkbox(array('name' => '_prefer_html', 'id' => "cfghtmlview", 'value' => 1));
468 echo $check_htmlview->show(intval($RCI->getprop('prefer_html')));
471 <label for="cfghtmlview">Prefer displaying HTML messages</label><br />
474 <dt class="propname">preview_pane <span class="userconf">*</span></dt>
478 $check_prevpane = new checkbox(array('name' => '_preview_pane', 'id' => "cfgprevpane", 'value' => 1));
479 echo $check_prevpane->show(intval($RCI->getprop('preview_pane')));
482 <label for="cfgprevpane">If preview pane is enabled</label><br />
485 <dt class="propname">htmleditor <span class="userconf">*</span></dt>
489 $check_htmlcomp = new checkbox(array('name' => '_htmleditor', 'id' => "cfghtmlcompose", 'value' => 1));
490 echo $check_htmlcomp->show(intval($RCI->getprop('htmleditor')));
493 <label for="cfghtmlcompose">Compose HTML formatted messages</label><br />
496 <dt class="propname">draft_autosave <span class="userconf">*</span></dt>
498 <label for="cfgautosave">Save compose message every</label>
501 $select_autosave = new select(array('name' => '_draft_autosave', 'id' => 'cfgautosave'));
502 $select_autosave->add('never', 0);
503 foreach (array(3, 5, 10) as $i => $min)
504 $select_autosave->add("$min min", $min*60);
506 echo $select_autosave->show(intval($RCI->getprop('draft_autosave')));
513 <p class="hint"><span class="userconf">*</span> These settings are defaults for the user preferences</p>
518 echo '<p><input type="submit" name="submit" value="' . ($RCI->configured ? 'UPDATE' : 'CREATE') . ' CONFIG" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';