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 if (!empty($_POST['submit'])) {
25 echo '<p class="notice">Copy the following configurations and save them in two files (names above the text box)';
26 echo ' within the <tt>config/</tt> directory of your RoundCube installation.</p>';
28 $textbox = new textarea(array('rows' => 16, 'cols' => 60, 'class' => "configfile"));
30 echo '<div><em>main.inc.php</em></div>';
31 echo $textbox->show($RCI->create_config('main'));
33 echo '<div style="margin-top:1em"><em>db.inc.php</em></div>';
34 echo $textbox->show($RCI->create_config('db'));
36 echo '<p class="hint">Of course there are more options to configure.
37 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>';
39 echo '<p><input type="button" onclick="location.href=\'./index.php?_step=3\'" value="CONTINUE" /></p>';
41 // echo '<style type="text/css"> .configblock { display:none } </style>';
42 echo "\n<hr style='margin-bottom:1.6em' />\n";
47 <legend>General configuration</legend>
48 <dl class="configblock">
50 <dt id="cgfblockgeneral" class="propname">debug_level</dt>
54 $value = $RCI->getprop('debug_level');
55 $check_debug = new checkbox(array('name' => '_debug_level[]'));
56 echo $check_debug->show(($value & 1) ? 1 : 0 , array('value' => 1, 'id' => 'cfgdebug1'));
57 echo '<label for="cfgdebug1">Log errors</label><br />';
59 echo $check_debug->show(($value & 4) ? 4 : 0, array('value' => 4, 'id' => 'cfgdebug4'));
60 echo '<label for="cfgdebug4">Display errors</label><br />';
62 echo $check_debug->show(($value & 8) ? 8 : 0, array('value' => 8, 'id' => 'cfgdebug8'));
63 echo '<label for="cfgdebug8">Verbose display</label><br />';
69 <dt class="propname">product_name</dt>
73 $input_prodname = new textfield(array('name' => '_product_name', 'size' => 30, 'id' => "cfgprodname"));
74 echo $input_prodname->show($RCI->getprop('product_name'));
77 <div>The name of your service (used to compose page titles)</div>
80 <dt class="propname">skin_path</dt>
84 $input_skinpath = new textfield(array('name' => '_skin_path', 'size' => 30, 'id' => "cfgskinpath"));
85 echo $input_skinpath->show($RCI->getprop('skin_path'));
88 <div>Relative path to the skin folder</div>
91 <dt class="propname">temp_dir</dt>
95 $input_tempdir = new textfield(array('name' => '_temp_dir', 'size' => 30, 'id' => "cfgtempdir"));
96 echo $input_tempdir->show($RCI->getprop('temp_dir'));
99 <div>Use this folder to store temp files (must be writebale for webserver)</div>
102 <dt class="propname">log_dir</dt>
106 $input_logdir = new textfield(array('name' => '_log_dir', 'size' => 30, 'id' => "cfglogdir"));
107 echo $input_logdir->show($RCI->getprop('log_dir'));
110 <div>Use this folder to store log files (must be writebale for webserver)</div>
113 <dt class="propname">ip_check</dt>
117 $check_ipcheck = new checkbox(array('name' => '_ip_check', 'id' => "cfgipcheck"));
118 echo $check_ipcheck->show(intval($RCI->getprop('ip_check')), array('value' => 1));
121 <label for="cfgipcheck">Check client IP in session authorization</label><br />
123 <p class="hint">This increases security but can cause sudden logouts when someone uses a proxy with changeing IPs.</p>
126 <dt class="propname">des_key</dt>
130 $input_deskey = new textfield(array('name' => '_des_key', 'size' => 30, 'id' => "cfgdeskey"));
131 echo $input_deskey->show($RCI->getprop('des_key'));
134 <div>This key is used to encrypt the users imap password before storing in the session record</div>
135 <p class="hint">It's a random generated string to ensure that every installation has it's own key.
136 If you enter it manually please provide a string of exactly 24 chars.</p>
139 <dt class="propname">enable_caching</dt>
143 $check_caching = new checkbox(array('name' => '_enable_caching', 'id' => "cfgcache"));
144 echo $check_caching->show(intval($RCI->getprop('enable_caching')), array('value' => 1));
147 <label for="cfgcache">Cache messages in local database</label><br />
150 <dt class="propname">enable_spellcheck</dt>
154 $check_caching = new checkbox(array('name' => '_enable_spellcheck', 'id' => "cfgspellcheck"));
155 echo $check_caching->show(intval($RCI->getprop('enable_spellcheck')), array('value' => 1));
158 <label for="cfgspellcheck">Make use of the built-in spell checker</label><br />
160 <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>
163 <dt class="propname">mdn_requests</dt>
167 $select_mdnreq = new select(array('name' => '_mdn_requests', 'id' => "cfgmdnreq"));
168 $select_mdnreq->add(array('ask the user', 'send automatically', 'ignore'), array(0, 1, 2));
169 echo $select_mdnreq->show(intval($RCI->getprop('mdn_requests')));
172 <div>Behavior if a received message requests a message delivery notification (read receipt)</div>
179 <legend>Database setup</legend>
180 <dl class="configblock" id="cgfblockdb">
181 <dt class="propname">db_dsnw</dt>
183 <p>Database settings for read/write operations:</p>
186 require_once 'DB.php';
188 $supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli',
189 'PgSQL' => 'pgsql', 'SQLite' => 'sqlite');
191 $select_dbtype = new select(array('name' => '_dbtype', 'id' => "cfgdbtype"));
192 foreach ($supported_dbs AS $database => $ext) {
193 if (extension_loaded($ext)) {
194 $select_dbtype->add($database, $ext);
198 $input_dbhost = new textfield(array('name' => '_dbhost', 'size' => 20, 'id' => "cfgdbhost"));
199 $input_dbname = new textfield(array('name' => '_dbname', 'size' => 20, 'id' => "cfgdbname"));
200 $input_dbuser = new textfield(array('name' => '_dbuser', 'size' => 20, 'id' => "cfgdbuser"));
201 $input_dbpass = new textfield(array('name' => '_dbpass', 'size' => 20, 'id' => "cfgdbpass"));
203 $dsnw = DB::parseDSN($RCI->getprop('db_dsnw'));
205 echo $select_dbtype->show($RCI->is_post ? $_POST['_dbtype'] : $dsnw['phptype']);
206 echo '<label for="cfgdbtype">Database type</label><br />';
207 echo $input_dbhost->show($RCI->is_post ? $_POST['_dbhost'] : $dsnw['hostspec']);
208 echo '<label for="cfgdbhost">Database server</label><br />';
209 echo $input_dbname->show($RCI->is_post ? $_POST['_dbname'] : $dsnw['database']);
210 echo '<label for="cfgdbname">Database name</label><br />';
211 echo $input_dbuser->show($RCI->is_post ? $_POST['_dbuser'] : $dsnw['username']);
212 echo '<label for="cfgdbuser">Database user name (needs write permissions)</label><br />';
213 echo $input_dbpass->show($RCI->is_post ? $_POST['_dbpass'] : $dsnw['password']);
214 echo '<label for="cfgdbpass">Database password</label><br />';
219 <dt class="propname">db_backend</dt>
223 // check for existing PEAR classes
224 @include_once 'DB.php';
225 @include_once 'MDB2.php';
227 $select_dbba = new select(array('name' => '_db_backend', 'id' => "cfgdbba"));
229 if (class_exists('DB'))
230 $select_dbba->add('DB', 'db');
231 if (class_exists('MDB2'))
232 $select_dbba->add('MDB2', 'mdb2');
234 echo $select_dbba->show($RCI->getprop('db_backend'));
237 <div>PEAR Database backend to use</div>
245 <legend>IMAP Settings</legend>
246 <dl class="configblock" id="cgfblockimap">
247 <dt class="propname">default_host</dt>
249 <div>The IMAP host(s) chosen to perform the log-in</div>
250 <div id="defaulthostlist">
253 $text_imaphost = new textfield(array('name' => '_default_host[]', 'size' => 30));
254 $default_hosts = $RCI->get_hostlist();
256 if (empty($default_hosts))
257 $default_hosts = array('');
260 foreach ($default_hosts as $host) {
261 echo '<div id="defaulthostentry'.$i.'">' . $text_imaphost->show($host);
263 echo '<a href="#" onclick="removehostfield(this.parentNode);return false" class="removelink" title="Remove this entry">remove</a>';
269 <div><a href="javascript:addhostfield()" class="addlink" title="Add another field">add</a></div>
271 <p class="hint">Leave blank to show a textbox at login. To use SSL/IMAPS connection, type ssl://hostname</p>
274 <dt class="propname">default_port</dt>
278 $text_imapport = new textfield(array('name' => '_default_port', 'size' => 6, 'id' => "cfgimapport"));
279 echo $text_imapport->show($RCI->getprop('default_port'));
282 <div>TCP port used for IMAP connections</div>
285 <dt class="propname">username_domain</dt>
289 $text_userdomain = new textfield(array('name' => '_username_domain', 'size' => 30, 'id' => "cfguserdomain"));
290 echo $text_userdomain->show($RCI->getprop('username_domain'));
293 <div>Automatically add this domain to user names for login</div>
295 <p class="hint">Only for IMAP servers that require full e-mail addresses for login</p>
298 <dt class="propname">auto_create_user</dt>
302 $check_autocreate = new checkbox(array('name' => '_auto_create_user', 'id' => "cfgautocreate"));
303 echo $check_autocreate->show(intval($RCI->getprop('auto_create_user')), array('value' => 1));
306 <label for="cfgautocreate">Automatically create a new RoundCube user when log-in the first time</label><br />
308 <p class="hint">A user is authenticated by the IMAP server but it requires a local record to store settings
309 and contacts. With this option enabled a new user record will automatically be created once the IMAP login succeeds.</p>
311 <p class="hint">If this option is disabled, the login only succeeds if there's a matching user-record in the local RoundCube database
312 what means that you have to create those records manually or disable this option after the first login.</p>
315 <dt class="propname">sent_mbox</dt>
319 $text_sentmbox = new textfield(array('name' => '_sent_mbox', 'size' => 20, 'id' => "cfgsentmbox"));
320 echo $text_sentmbox->show($RCI->getprop('sent_mbox'));
323 <div>Store sent messages is this folder</div>
325 <p class="hint">Leave blank if sent messages should not be stored</p>
328 <dt class="propname">trash_mbox</dt>
332 $text_trashmbox = new textfield(array('name' => '_trash_mbox', 'size' => 20, 'id' => "cfgtrashmbox"));
333 echo $text_trashmbox->show($RCI->getprop('trash_mbox'));
336 <div>Move messages to this folder when deleting them</div>
338 <p class="hint">Leave blank if they should be deleted directly</p>
341 <dt class="propname">drafts_mbox</dt>
345 $text_draftsmbox = new textfield(array('name' => '_drafts_mbox', 'size' => 20, 'id' => "cfgdraftsmbox"));
346 echo $text_draftsmbox->show($RCI->getprop('drafts_mbox'));
349 <div>Store draft messages is this folder</div>
357 <legend>SMTP Settings</legend>
358 <dl class="configblock" id="cgfblocksmtp">
359 <dt class="propname">smtp_server</dt>
363 $text_smtphost = new textfield(array('name' => '_smtp_server', 'size' => 30, 'id' => "cfgsmtphost"));
364 echo $text_smtphost->show($RCI->getprop('smtp_server'));
367 <div>Use this host for sending mails</div>
369 <p class="hint">To use SSL connection, set ssl://smtp.host.com. If left blank, the PHP mail() function is used</p>
372 <dt class="propname">smtp_port</dt>
376 $text_smtpport = new textfield(array('name' => '_smtp_port', 'size' => 6, 'id' => "cfgsmtpport"));
377 echo $text_smtpport->show($RCI->getprop('smtp_port'));
380 <div>SMTP port (default is 25; 465 for SSL)</div>
383 <dt class="propname">smtp_user/smtp_pass</dt>
387 $text_smtpuser = new textfield(array('name' => '_smtp_user', 'size' => 20, 'id' => "cfgsmtpuser"));
388 $text_smtppass = new textfield(array('name' => '_smtp_pass', 'size' => 20, 'id' => "cfgsmtppass"));
389 echo $text_smtpuser->show($RCI->getprop('smtp_user'));
390 echo $text_smtppass->show($RCI->getprop('smtp_pass'));
393 <div>SMTP username and password (if required)</div>
397 $check_smtpuser = new checkbox(array('name' => '_smtp_user_u', 'id' => "cfgsmtpuseru"));
398 echo $check_smtpuser->show($RCI->getprop('smtp_user') == '%u' || $_POST['_smtp_user_u'] ? 1 : 0, array('value' => 1));
401 <label for="cfgsmtpuseru">Use the current IMAP username and password for SMTP authentication</label>
405 <dt class="propname">smtp_auth_type</dt>
409 $select_smtpauth = new select(array('name' => '_smtp_auth_type', 'id' => "cfgsmtpauth"));
410 $select_smtpauth->add(array('(auto)', 'PLAIN', 'DIGEST-MD5', 'CRAM-MD5', 'LOGIN'), array('0', 'PLAIN', 'DIGEST-MD5', 'CRAM-MD5', 'LOGIN'));
411 echo $select_smtpauth->show(intval($RCI->getprop('smtp_auth_type')));
414 <div>Method to authenticate at the SMTP server. Choose (auto) if you don't know what this is</div>
417 <dt class="propname">smtp_log</dt>
421 $check_smtplog = new checkbox(array('name' => '_smtp_log', 'id' => "cfgsmtplog"));
422 echo $check_smtplog->show(intval($RCI->getprop('smtp_log')), array('value' => 1));
425 <label for="cfgsmtplog">Log sent messages in <tt>logs/sendmail</tt></label><br />
433 <legend>Display settings & user prefs</legend>
434 <dl class="configblock" id="cgfblockdisplay">
436 <dt class="propname">locale_string</dt>
440 $input_locale = new textfield(array('name' => '_locale_string', 'size' => 6, 'id' => "cfglocale"));
441 echo $input_locale->show($RCI->getprop('locale_string'));
444 <div>The default locale setting. This also defines the language of the login screen.</div>
445 <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>
448 <dt class="propname">pagesize <span class="userconf">*</span></dt>
452 $input_pagesize = new textfield(array('name' => '_pagesize', 'size' => 6, 'id' => "cfgpagesize"));
453 echo $input_pagesize->show($RCI->getprop('pagesize'));
456 <div>Show up to X items in list view.</div>
459 <dt class="propname">prefer_html <span class="userconf">*</span></dt>
463 $check_htmlview = new checkbox(array('name' => '_prefer_html', 'id' => "cfghtmlview", 'value' => 1));
464 echo $check_htmlview->show(intval($RCI->getprop('prefer_html')));
467 <label for="cfghtmlview">Prefer displaying HTML messages</label><br />
470 <dt class="propname">preview_pane <span class="userconf">*</span></dt>
474 $check_prevpane = new checkbox(array('name' => '_preview_pane', 'id' => "cfgprevpane", 'value' => 1));
475 echo $check_prevpane->show(intval($RCI->getprop('preview_pane')));
478 <label for="cfgprevpane">If preview pane is enabled</label><br />
481 <dt class="propname">htmleditor <span class="userconf">*</span></dt>
485 $check_htmlcomp = new checkbox(array('name' => '_htmleditor', 'id' => "cfghtmlcompose", 'value' => 1));
486 echo $check_htmlcomp->show(intval($RCI->getprop('htmleditor')));
489 <label for="cfghtmlcompose">Compose HTML formatted messages</label><br />
492 <dt class="propname">draft_autosave <span class="userconf">*</span></dt>
494 <label for="cfgautosave">Save compose message every</label>
497 $select_autosave = new select(array('name' => '_draft_autosave', 'id' => 'cfgautosave'));
498 $select_autosave->add('never', 0);
499 foreach (array(3, 5, 10) as $i => $min)
500 $select_autosave->add("$min min", $min*60);
502 echo $select_autosave->show(intval($RCI->getprop('draft_autosave')));
509 <p class="hint"><span class="userconf">*</span> These settings are defaults for the user preferences</p>
514 echo '<p><input type="submit" name="submit" value="' . ($RCI->configured ? 'UPDATE' : 'CREATE') . ' CONFIG" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';