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