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