Skip to content

HTTPS clone URL

Subversion checkout URL

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