]> git.donarmstrong.com Git - roundcube.git/blob - installer/config.php
Merge commit 'upstream/0.1'
[roundcube.git] / installer / config.php
1 <form action="index.php" method="post">
2 <input type="hidden" name="_step" value="2" />
3 <?php
4
5 ini_set('display_errors', 1);
6 require_once 'include/rcube_html.inc';
7
8 // also load the default config to fill in the fields
9 $RCI->load_defaults();
10
11 // register these boolean fields
12 $RCI->config_props = array(
13   'ip_check' => 1,
14   'enable_caching' => 1,
15   'enable_spellcheck' => 1,
16   'auto_create_user' => 1,
17   'smtp_log' => 1,
18   'prefer_html' => 1,
19   'preview_pane' => 1,
20   'htmleditor' => 1,
21 );
22
23 if (!empty($_POST['submit'])) {
24   
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>';
27   
28   $textbox = new textarea(array('rows' => 16, 'cols' => 60, 'class' => "configfile"));
29   
30   echo '<div><em>main.inc.php</em></div>';
31   echo $textbox->show($RCI->create_config('main'));
32   
33   echo '<div style="margin-top:1em"><em>db.inc.php</em></div>';
34   echo $textbox->show($RCI->create_config('db'));
35
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>';
38
39   echo '<p><input type="button" onclick="location.href=\'./index.php?_step=3\'" value="CONTINUE" /></p>';
40   
41   // echo '<style type="text/css"> .configblock { display:none } </style>';
42   echo "\n<hr style='margin-bottom:1.6em' />\n";
43 }
44
45 ?>
46 <fieldset>
47 <legend>General configuration</legend>
48 <dl class="configblock">
49 <!--
50 <dt id="cgfblockgeneral" class="propname">debug_level</dt>
51 <dd>
52 <?php
53 /*
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 />';
58
59 echo $check_debug->show(($value & 4) ? 4 : 0, array('value' => 4, 'id' => 'cfgdebug4'));
60 echo '<label for="cfgdebug4">Display errors</label><br />';
61
62 echo $check_debug->show(($value & 8) ? 8 : 0, array('value' => 8, 'id' => 'cfgdebug8'));
63 echo '<label for="cfgdebug8">Verbose display</label><br />';
64 */
65 ?>
66 </dd>
67 -->
68
69 <dt class="propname">product_name</dt>
70 <dd>
71 <?php
72
73 $input_prodname = new textfield(array('name' => '_product_name', 'size' => 30, 'id' => "cfgprodname"));
74 echo $input_prodname->show($RCI->getprop('product_name'));
75
76 ?>
77 <div>The name of your service (used to compose page titles)</div>
78 </dd>
79
80 <dt class="propname">skin_path</dt>
81 <dd>
82 <?php
83
84 $input_skinpath = new textfield(array('name' => '_skin_path', 'size' => 30, 'id' => "cfgskinpath"));
85 echo $input_skinpath->show($RCI->getprop('skin_path'));
86
87 ?>
88 <div>Relative path to the skin folder</div>
89 </dd>
90
91 <dt class="propname">temp_dir</dt>
92 <dd>
93 <?php
94
95 $input_tempdir = new textfield(array('name' => '_temp_dir', 'size' => 30, 'id' => "cfgtempdir"));
96 echo $input_tempdir->show($RCI->getprop('temp_dir'));
97
98 ?>
99 <div>Use this folder to store temp files (must be writebale for webserver)</div>
100 </dd>
101
102 <dt class="propname">log_dir</dt>
103 <dd>
104 <?php
105
106 $input_logdir = new textfield(array('name' => '_log_dir', 'size' => 30, 'id' => "cfglogdir"));
107 echo $input_logdir->show($RCI->getprop('log_dir'));
108
109 ?>
110 <div>Use this folder to store log files (must be writebale for webserver)</div>
111 </dd>
112
113 <dt class="propname">ip_check</dt>
114 <dd>
115 <?php
116
117 $check_ipcheck = new checkbox(array('name' => '_ip_check', 'id' => "cfgipcheck"));
118 echo $check_ipcheck->show(intval($RCI->getprop('ip_check')), array('value' => 1));
119
120 ?>
121 <label for="cfgipcheck">Check client IP in session authorization</label><br />
122
123 <p class="hint">This increases security but can cause sudden logouts when someone uses a proxy with changeing IPs.</p>
124 </dd>
125
126 <dt class="propname">des_key</dt>
127 <dd>
128 <?php
129
130 $input_deskey = new textfield(array('name' => '_des_key', 'size' => 30, 'id' => "cfgdeskey"));
131 echo $input_deskey->show($RCI->getprop('des_key'));
132
133 ?>
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>
137 </dd>
138
139 <dt class="propname">enable_caching</dt>
140 <dd>
141 <?php
142
143 $check_caching = new checkbox(array('name' => '_enable_caching', 'id' => "cfgcache"));
144 echo $check_caching->show(intval($RCI->getprop('enable_caching')), array('value' => 1));
145
146 ?>
147 <label for="cfgcache">Cache messages in local database</label><br />
148 </dd>
149
150 <dt class="propname">enable_spellcheck</dt>
151 <dd>
152 <?php
153
154 $check_caching = new checkbox(array('name' => '_enable_spellcheck', 'id' => "cfgspellcheck"));
155 echo $check_caching->show(intval($RCI->getprop('enable_spellcheck')), array('value' => 1));
156
157 ?>
158 <label for="cfgspellcheck">Make use of the built-in spell checker</label><br />
159
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>
161 </dd>
162
163 <dt class="propname">mdn_requests</dt>
164 <dd>
165 <?php
166
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')));
170
171 ?>
172 <div>Behavior if a received message requests a message delivery notification (read receipt)</div>
173 </dd>
174
175 </dl>
176 </fieldset>
177
178 <fieldset>
179 <legend>Database setup</legend>
180 <dl class="configblock" id="cgfblockdb">
181 <dt class="propname">db_dsnw</dt>
182 <dd>
183 <p>Database settings for read/write operations:</p>
184 <?php
185
186 require_once 'DB.php';
187
188 $supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli',
189     'PgSQL' => 'pgsql', 'SQLite' => 'sqlite');
190
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);
195     }
196 }
197
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"));
202
203 $dsnw = DB::parseDSN($RCI->getprop('db_dsnw'));
204
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 />';
215
216 ?>
217 </dd>
218
219 <dt class="propname">db_backend</dt>
220 <dd>
221 <?php
222
223 // check for existing PEAR classes
224 @include_once 'DB.php';
225 @include_once 'MDB2.php';
226
227 $select_dbba = new select(array('name' => '_db_backend', 'id' => "cfgdbba"));
228
229 if (class_exists('DB'))
230   $select_dbba->add('DB', 'db');
231 if (class_exists('MDB2'))
232   $select_dbba->add('MDB2', 'mdb2');
233
234 echo $select_dbba->show($RCI->getprop('db_backend'));
235
236 ?>
237 <div>PEAR Database backend to use</div>
238 </dd>
239
240 </dl>
241 </fieldset>
242
243
244 <fieldset>
245 <legend>IMAP Settings</legend>
246 <dl class="configblock" id="cgfblockimap">
247 <dt class="propname">default_host</dt>
248 <dd>
249 <div>The IMAP host(s) chosen to perform the log-in</div>
250 <div id="defaulthostlist">
251 <?php
252
253 $text_imaphost = new textfield(array('name' => '_default_host[]', 'size' => 30));
254 $default_hosts = $RCI->get_hostlist();
255
256 if (empty($default_hosts))
257   $default_hosts = array('');
258
259 $i = 0;
260 foreach ($default_hosts as $host) {
261   echo '<div id="defaulthostentry'.$i.'">' . $text_imaphost->show($host);
262   if ($i++ > 0)
263     echo '<a href="#" onclick="removehostfield(this.parentNode);return false" class="removelink" title="Remove this entry">remove</a>';
264   echo '</div>';
265 }
266
267 ?>
268 </div>
269 <div><a href="javascript:addhostfield()" class="addlink" title="Add another field">add</a></div>
270
271 <p class="hint">Leave blank to show a textbox at login. To use SSL/IMAPS connection, type ssl://hostname</p>
272 </dd>
273
274 <dt class="propname">default_port</dt>
275 <dd>
276 <?php
277
278 $text_imapport = new textfield(array('name' => '_default_port', 'size' => 6, 'id' => "cfgimapport"));
279 echo $text_imapport->show($RCI->getprop('default_port'));
280
281 ?>
282 <div>TCP port used for IMAP connections</div>
283 </dd>
284
285 <dt class="propname">username_domain</dt>
286 <dd>
287 <?php
288
289 $text_userdomain = new textfield(array('name' => '_username_domain', 'size' => 30, 'id' => "cfguserdomain"));
290 echo $text_userdomain->show($RCI->getprop('username_domain'));
291
292 ?>
293 <div>Automatically add this domain to user names for login</div>
294
295 <p class="hint">Only for IMAP servers that require full e-mail addresses for login</p>
296 </dd>
297
298 <dt class="propname">auto_create_user</dt>
299 <dd>
300 <?php
301
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));
304
305 ?>
306 <label for="cfgautocreate">Automatically create a new RoundCube user when log-in the first time</label><br />
307
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>
310
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>
313 </dd>
314
315 <dt class="propname">sent_mbox</dt>
316 <dd>
317 <?php
318
319 $text_sentmbox = new textfield(array('name' => '_sent_mbox', 'size' => 20, 'id' => "cfgsentmbox"));
320 echo $text_sentmbox->show($RCI->getprop('sent_mbox'));
321
322 ?>
323 <div>Store sent messages is this folder</div>
324
325 <p class="hint">Leave blank if sent messages should not be stored</p>
326 </dd>
327
328 <dt class="propname">trash_mbox</dt>
329 <dd>
330 <?php
331
332 $text_trashmbox = new textfield(array('name' => '_trash_mbox', 'size' => 20, 'id' => "cfgtrashmbox"));
333 echo $text_trashmbox->show($RCI->getprop('trash_mbox'));
334
335 ?>
336 <div>Move messages to this folder when deleting them</div>
337
338 <p class="hint">Leave blank if they should be deleted directly</p>
339 </dd>
340
341 <dt class="propname">drafts_mbox</dt>
342 <dd>
343 <?php
344
345 $text_draftsmbox = new textfield(array('name' => '_drafts_mbox', 'size' => 20, 'id' => "cfgdraftsmbox"));
346 echo $text_draftsmbox->show($RCI->getprop('drafts_mbox'));
347
348 ?>
349 <div>Store draft messages is this folder</div>
350 </dd>
351
352 </dl>
353 </fieldset>
354
355
356 <fieldset>
357 <legend>SMTP Settings</legend>
358 <dl class="configblock" id="cgfblocksmtp">
359 <dt class="propname">smtp_server</dt>
360 <dd>
361 <?php
362
363 $text_smtphost = new textfield(array('name' => '_smtp_server', 'size' => 30, 'id' => "cfgsmtphost"));
364 echo $text_smtphost->show($RCI->getprop('smtp_server'));
365
366 ?>
367 <div>Use this host for sending mails</div>
368
369 <p class="hint">To use SSL connection, set ssl://smtp.host.com. If left blank, the PHP mail() function is used</p>
370 </dd>
371
372 <dt class="propname">smtp_port</dt>
373 <dd>
374 <?php
375
376 $text_smtpport = new textfield(array('name' => '_smtp_port', 'size' => 6, 'id' => "cfgsmtpport"));
377 echo $text_smtpport->show($RCI->getprop('smtp_port'));
378
379 ?>
380 <div>SMTP port (default is 25; 465 for SSL)</div>
381 </dd>
382
383 <dt class="propname">smtp_user/smtp_pass</dt>
384 <dd>
385 <?php
386
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'));
391
392 ?>
393 <div>SMTP username and password (if required)</div>
394 <p>
395 <?php
396
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));
399
400 ?>
401 <label for="cfgsmtpuseru">Use the current IMAP username and password for SMTP authentication</label>
402 </p>
403 </dd>
404 <!--
405 <dt class="propname">smtp_auth_type</dt>
406 <dd>
407 <?php
408 /*
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')));
412 */
413 ?>
414 <div>Method to authenticate at the SMTP server. Choose (auto) if you don't know what this is</div>
415 </dd>
416 -->
417 <dt class="propname">smtp_log</dt>
418 <dd>
419 <?php
420
421 $check_smtplog = new checkbox(array('name' => '_smtp_log', 'id' => "cfgsmtplog"));
422 echo $check_smtplog->show(intval($RCI->getprop('smtp_log')), array('value' => 1));
423
424 ?>
425 <label for="cfgsmtplog">Log sent messages in <tt>logs/sendmail</tt></label><br />
426 </dd>
427
428 </dl>
429 </fieldset>
430
431
432 <fieldset>
433 <legend>Display settings &amp; user prefs</legend>
434 <dl class="configblock" id="cgfblockdisplay">
435
436 <dt class="propname">locale_string</dt>
437 <dd>
438 <?php
439
440 $input_locale = new textfield(array('name' => '_locale_string', 'size' => 6, 'id' => "cfglocale"));
441 echo $input_locale->show($RCI->getprop('locale_string'));
442
443 ?>
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>
446 </dd>
447
448 <dt class="propname">pagesize <span class="userconf">*</span></dt>
449 <dd>
450 <?php
451
452 $input_pagesize = new textfield(array('name' => '_pagesize', 'size' => 6, 'id' => "cfgpagesize"));
453 echo $input_pagesize->show($RCI->getprop('pagesize'));
454
455 ?>
456 <div>Show up to X items in list view.</div>
457 </dd>
458
459 <dt class="propname">prefer_html <span class="userconf">*</span></dt>
460 <dd>
461 <?php
462
463 $check_htmlview = new checkbox(array('name' => '_prefer_html', 'id' => "cfghtmlview", 'value' => 1));
464 echo $check_htmlview->show(intval($RCI->getprop('prefer_html')));
465
466 ?>
467 <label for="cfghtmlview">Prefer displaying HTML messages</label><br />
468 </dd>
469
470 <dt class="propname">preview_pane <span class="userconf">*</span></dt>
471 <dd>
472 <?php
473
474 $check_prevpane = new checkbox(array('name' => '_preview_pane', 'id' => "cfgprevpane", 'value' => 1));
475 echo $check_prevpane->show(intval($RCI->getprop('preview_pane')));
476
477 ?>
478 <label for="cfgprevpane">If preview pane is enabled</label><br />
479 </dd>
480
481 <dt class="propname">htmleditor <span class="userconf">*</span></dt>
482 <dd>
483 <?php
484
485 $check_htmlcomp = new checkbox(array('name' => '_htmleditor', 'id' => "cfghtmlcompose", 'value' => 1));
486 echo $check_htmlcomp->show(intval($RCI->getprop('htmleditor')));
487
488 ?>
489 <label for="cfghtmlcompose">Compose HTML formatted messages</label><br />
490 </dd>
491
492 <dt class="propname">draft_autosave <span class="userconf">*</span></dt>
493 <dd>
494 <label for="cfgautosave">Save compose message every</label>
495 <?php
496
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);
501
502 echo $select_autosave->show(intval($RCI->getprop('draft_autosave')));
503
504 ?>
505 </dd>
506
507 </dl>
508
509 <p class="hint"><span class="userconf">*</span>&nbsp; These settings are defaults for the user preferences</p>
510 </fieldset>
511
512 <?php
513
514 echo '<p><input type="submit" name="submit" value="' . ($RCI->configured ? 'UPDATE' : 'CREATE') . ' CONFIG" ' . ($RCI->failures ? 'disabled' : '') . ' /></p>';
515
516 ?>
517 </form>