ffe93ac67833e8532b00a829589dc0a4e48574c0
[squirrelmail.git] / config / conf.pl
1 #!/usr/bin/env perl
2 # conf.pl
3 # Luke Ehresman (luke@squirrelmail.org)
4 #
5 # A simple configure script to configure squirrelmail
6 #
7 # $Id$
8 ############################################################
9 $conf_pl_version = "1.2.0";
10
11 ############################################################
12 # Check what directory we're supposed to be running in, and
13 # change there if necessary. File::Basename has been in
14 # Perl since at least 5.003_7, and nobody sane runs anything
15 # before that, but just in case.
16 ############################################################
17
18 if ( eval q{require "File/Basename.pm"} ) {
19 my $dir = File::Basename::dirname($0);
20 chdir($dir);
21 }
22
23 ############################################################
24 # Some people try to run this as a CGI. That's wrong!
25 ############################################################
26 if ( defined( $ENV{'PATH_INFO'} )
27 || defined( $ENV{'QUERY_STRING'} )
28 || defined( $ENV{'REQUEST_METHOD'} ) ) {
29 print "Content-Type: text/html\n\n";
30 print "You must run this script from the command line.";
31 exit;
32 }
33
34 ############################################################
35 # First, lets read in the data already in there...
36 ############################################################
37 if ( -e "config.php" ) {
38 open( FILE, "config.php" );
39 while ( $line = <FILE> ) {
40 $line =~ s/^\s+//;
41 $line =~ s/^\$//;
42 $var = $line;
43
44 $var =~ s/=/EQUALS/;
45 if ( $var =~ /^([a-z]|[A-Z])/ ) {
46 @o = split ( /\s*EQUALS\s*/, $var );
47 if ( $o[0] eq "config_version" ) {
48 $o[1] =~ s/[\n|\r]//g;
49 $o[1] =~ s/[\'|\"];\s*$//;
50 $o[1] =~ s/;$//;
51 $o[1] =~ s/^[\'|\"]//;
52
53 $config_version = $o[1];
54 close(FILE);
55 }
56 }
57 }
58 close(FILE);
59
60 if ( $config_version ne $conf_pl_version ) {
61 system "clear";
62 print $WHT. "WARNING:\n" . $NRM;
63 print " The file \"config/config.php\" was found, but it is for\n";
64 print " an older version of SquirrelMail. It is possible to still\n";
65 print " read the defaults from this file but be warned that many\n";
66 print " preferences change between versions. It is recommended that\n";
67 print " you start with a clean config.php for each upgrade that you\n";
68 print " do. To do this, just move config/config.php out of the way.\n";
69 print "\n";
70 print "Continue loading with the old config.php [y/N]? ";
71 $ctu = <STDIN>;
72
73 if ( ( $ctu !~ /^y\n/i ) || ( $ctu =~ /^\n/ ) ) {
74 exit;
75 }
76
77 print "\nDo you want me to stop warning you [y/N]? ";
78 $ctu = <STDIN>;
79 if ( $ctu =~ /^y\n/i ) {
80 $print_config_version = $conf_pl_version;
81 } else {
82 $print_config_version = $config_version;
83 }
84 } else {
85 $print_config_version = $config_version;
86 }
87
88 $config = 1;
89 open( FILE, "config.php" );
90 } elsif ( -e "config_default.php" ) {
91 open( FILE, "config_default.php" );
92 while ( $line = <FILE> ) {
93 $line =~ s/^\s+//;
94 $line =~ s/^\$//;
95 $var = $line;
96
97 $var =~ s/=/EQUALS/;
98 if ( $var =~ /^([a-z]|[A-Z])/ ) {
99 @o = split ( /\s*EQUALS\s*/, $var );
100 if ( $o[0] eq "config_version" ) {
101 $o[1] =~ s/[\n|\r]//g;
102 $o[1] =~ s/[\'|\"];\s*$//;
103 $o[1] =~ s/;$//;
104 $o[1] =~ s/^[\'|\"]//;
105
106 $config_version = $o[1];
107 close(FILE);
108 }
109 }
110 }
111 close(FILE);
112
113 if ( $config_version ne $conf_pl_version ) {
114 system "clear";
115 print $WHT. "WARNING:\n" . $NRM;
116 print " You are trying to use a 'config_default.php' from an older\n";
117 print " version of SquirrelMail. This is HIGHLY unrecommended. You\n";
118 print " should get the 'config_default.php' that matches the version\n";
119 print " of SquirrelMail that you are running. You can get this from\n";
120 print " the SquirrelMail web page by going to the following URL:\n";
121 print " http://www.squirrelmail.org.\n";
122 print "\n";
123 print "Continue loading with old config_default.php (a bad idea) [y/N]? ";
124 $ctu = <STDIN>;
125
126 if ( ( $ctu !~ /^y\n/i ) || ( $ctu =~ /^\n/ ) ) {
127 exit;
128 }
129
130 print "\nDo you want me to stop warning you [y/N]? ";
131 $ctu = <STDIN>;
132 if ( $ctu =~ /^y\n/i ) {
133 $print_config_version = $conf_pl_version;
134 } else {
135 $print_config_version = $config_version;
136 }
137 } else {
138 $print_config_version = $config_version;
139 }
140 $config = 2;
141 open( FILE, "config_default.php" );
142 } else {
143 print "No configuration file found. Please get config_default.php\n";
144 print "or config.php before running this again. This program needs\n";
145 print "a default config file to get default values.\n";
146 exit;
147 }
148
149 # Read and parse the current configuration file
150 # (either config.php or config_default.php).
151 while ( $line = <FILE> ) {
152 $line =~ s/^\s+//;
153 $line =~ s/^\$//;
154 $var = $line;
155
156 $var =~ s/=/EQUALS/;
157 if ( $var =~ /^([a-z]|[A-Z])/ ) {
158 @options = split ( /\s*EQUALS\s*/, $var );
159 $options[1] =~ s/[\n|\r]//g;
160 $options[1] =~ s/[\'|\"];\s*$//;
161 $options[1] =~ s/;$//;
162 $options[1] =~ s/^[\'|\"]//;
163
164 if ( $options[0] =~ /^theme\[[0-9]+\]\[['|"]PATH['|"]\]/ ) {
165 $sub = $options[0];
166 $sub =~ s/\]\[['|"]PATH['|"]\]//;
167 $sub =~ s/.*\[//;
168 if ( -e "../themes" ) {
169 $options[1] =~ s/^\.\.\/config/\.\.\/themes/;
170 }
171 $theme_path[$sub] = $options[1];
172 } elsif ( $options[0] =~ /^theme\[[0-9]+\]\[['|"]NAME['|"]\]/ ) {
173 $sub = $options[0];
174 $sub =~ s/\]\[['|"]NAME['|"]\]//;
175 $sub =~ s/.*\[//;
176 $theme_name[$sub] = $options[1];
177 } elsif ( $options[0] =~ /^plugins\[[0-9]+\]/ ) {
178 $sub = $options[0];
179 $sub =~ s/\]//;
180 $sub =~ s/^plugins\[//;
181 $plugins[$sub] = $options[1];
182 } elsif ( $options[0] =~ /^ldap_server\[[0-9]+\]/ ) {
183 $sub = $options[0];
184 $sub =~ s/\]//;
185 $sub =~ s/^ldap_server\[//;
186 $continue = 0;
187 while ( ( $tmp = <FILE> ) && ( $continue != 1 ) ) {
188 if ( $tmp =~ /\);\s*$/ ) {
189 $continue = 1;
190 }
191
192 if ( $tmp =~ /^\s*[\'|\"]host[\'|\"]/i ) {
193 $tmp =~ s/^\s*[\'|\"]host[\'|\"]\s*=>\s*[\'|\"]//i;
194 $tmp =~ s/[\'|\"],?\s*$//;
195 $tmp =~ s/[\'|\"]\);\s*$//;
196 $host = $tmp;
197 } elsif ( $tmp =~ /^\s*[\'|\"]base[\'|\"]/i ) {
198 $tmp =~ s/^\s*[\'|\"]base[\'|\"]\s*=>\s*[\'|\"]//i;
199 $tmp =~ s/[\'|\"],?\s*$//;
200 $tmp =~ s/[\'|\"]\);\s*$//;
201 $base = $tmp;
202 } elsif ( $tmp =~ /^\s*[\'|\"]charset[\'|\"]/i ) {
203 $tmp =~ s/^\s*[\'|\"]charset[\'|\"]\s*=>\s*[\'|\"]//i;
204 $tmp =~ s/[\'|\"],?\s*$//;
205 $tmp =~ s/[\'|\"]\);\s*$//;
206 $charset = $tmp;
207 } elsif ( $tmp =~ /^\s*[\'|\"]port[\'|\"]/i ) {
208 $tmp =~ s/^\s*[\'|\"]port[\'|\"]\s*=>\s*[\'|\"]//i;
209 $tmp =~ s/[\'|\"],?\s*$//;
210 $tmp =~ s/[\'|\"]\);\s*$//;
211 $port = $tmp;
212 } elsif ( $tmp =~ /^\s*[\'|\"]maxrows[\'|\"]/i ) {
213 $tmp =~ s/^\s*[\'|\"]maxrows[\'|\"]\s*=>\s*[\'|\"]//i;
214 $tmp =~ s/[\'|\"],?\s*$//;
215 $tmp =~ s/[\'|\"]\);\s*$//;
216 $maxrows = $tmp;
217 } elsif ( $tmp =~ /^\s*[\'|\"]name[\'|\"]/i ) {
218 $tmp =~ s/^\s*[\'|\"]name[\'|\"]\s*=>\s*[\'|\"]//i;
219 $tmp =~ s/[\'|\"],?\s*$//;
220 $tmp =~ s/[\'|\"]\);\s*$//;
221 $name = $tmp;
222 }
223 }
224 $ldap_host[$sub] = $host;
225 $ldap_base[$sub] = $base;
226 $ldap_name[$sub] = $name;
227 $ldap_port[$sub] = $port;
228 $ldap_maxrows[$sub] = $maxrows;
229 $ldap_charset[$sub] = $charset;
230 } else {
231 ${ $options[0] } = $options[1];
232 }
233 }
234 }
235 close FILE;
236 if ( $useSendmail ne "true" ) {
237 $useSendmail = "false";
238 }
239 if ( !$sendmail_path ) {
240 $sendmail_path = "/usr/sbin/sendmail";
241 }
242 if ( !$default_unseen_notify ) {
243 $default_unseen_notify = 2;
244 }
245 if ( !$default_unseen_type ) {
246 $default_unseen_type = 1;
247 }
248 if ( !$config_use_color ) {
249 $config_use_color = 0;
250 }
251 if ( !$invert_time ) {
252 $invert_time = "false";
253 }
254 if ( !$force_username_lowercase ) {
255 $force_username_lowercase = "false";
256 }
257 if ( !$optional_delimiter ) {
258 $optional_delimiter = "detect";
259 }
260 if ( !$use_authenticated_smtp ) {
261 $use_authenticated_smtp = "false";
262 }
263 if ( !$auto_create_special ) {
264 $auto_create_special = "false";
265 }
266 if ( !$default_use_priority ) {
267 $default_use_priority = "true";
268 }
269 if ( !$hide_sm_attributions ) {
270 $hide_sm_attributions = "false";
271 }
272 if ( !$default_use_mdn ) {
273 $default_use_mdn = "true";
274 }
275 if ( !$delete_folder ) {
276 $delete_folder = "false";
277 }
278 if ( !$frame_top ) {
279 $frame_top = "_top";
280 }
281 if ( !$edit_identity ) {
282 $edit_identity = "true";
283 }
284 if ( !$edit_name ) {
285 $edit_name = "true";
286 }
287 if ( !$allow_thread_sort ) {
288 $allow_thread_sort = 'false';
289 }
290 if ( !$allow_server_sort ) {
291 $allow_server_sort = 'false';
292 }
293 if ( !$prefs_user_field ) {
294 $prefs_user_field = 'user';
295 }
296 if ( !$prefs_key_field ) {
297 $prefs_key_field = 'prefkey';
298 }
299 if ( !$prefs_val_field ) {
300 $prefs_val_field = 'prefval';
301 }
302
303 if ( $ARGV[0] eq '--install-plugin' ) {
304 print "Activating plugin " . $ARGV[1] . "\n";
305 push @plugins, $ARGV[1];
306 save_data();
307 exit(0);
308 } elsif ( $ARGV[0] eq '--remove-plugin' ) {
309 print "Removing plugin " . $ARGV[1] . "\n";
310 foreach $plugin (@plugins) {
311 if ( $plugin ne $ARGV[1] ) {
312 push @newplugins, $plugin;
313 }
314 }
315 @plugins = @newplugins;
316 save_data();
317 exit(0);
318 }
319
320 #####################################################################################
321 if ( $config_use_color == 1 ) {
322 $WHT = "\x1B[37;1m";
323 $NRM = "\x1B[0m";
324 } else {
325 $WHT = "";
326 $NRM = "";
327 $config_use_color = 2;
328 }
329
330 while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
331 system "clear";
332 print $WHT. "SquirrelMail Configuration : " . $NRM;
333 if ( $config == 1 ) { print "Read: config.php"; }
334 elsif ( $config == 2 ) { print "Read: config_default.php"; }
335 print " ($print_config_version)\n";
336 print "---------------------------------------------------------\n";
337
338 if ( $menu == 0 ) {
339 print $WHT. "Main Menu --\n" . $NRM;
340 print "1. Organization Preferences\n";
341 print "2. Server Settings\n";
342 print "3. Folder Defaults\n";
343 print "4. General Options\n";
344 print "5. Themes\n";
345 print "6. Address Books (LDAP)\n";
346 print "7. Message of the Day (MOTD)\n";
347 print "8. Plugins\n";
348 print "9. Database\n";
349 print "\n";
350 print "D. Set pre-defined settings for specific IMAP servers\n";
351 print "\n";
352 } elsif ( $menu == 1 ) {
353 print $WHT. "Organization Preferences\n" . $NRM;
354 print "1. Organization Name : $WHT$org_name$NRM\n";
355 print "2. Organization Logo : $WHT$org_logo$NRM\n";
356 print "3. Org. Logo Width/Height : $WHT($org_logo_width/$org_logo_height)$NRM\n";
357 print "4. Organization Title : $WHT$org_title$NRM\n";
358 print "5. Signout Page : $WHT$signout_page$NRM\n";
359 print "6. Default Language : $WHT$squirrelmail_default_language$NRM\n";
360 print "7. Top Frame : $WHT$frame_top$NRM\n";
361 print "\n";
362 print "R Return to Main Menu\n";
363 } elsif ( $menu == 2 ) {
364 print $WHT. "Server Settings\n" . $NRM;
365 print "1. Domain : $WHT$domain$NRM\n";
366 print "2. IMAP Server : $WHT$imapServerAddress$NRM\n";
367 print "3. IMAP Port : $WHT$imapPort$NRM\n";
368 print "4. Use Sendmail/SMTP : $WHT";
369 if ( lc($useSendmail) eq "true" ) {
370 print "Sendmail";
371 } else {
372 print "SMTP";
373 }
374 print "$NRM\n";
375 if ( lc($useSendmail) eq "true" ) {
376 print "5. Sendmail Path : $WHT$sendmail_path$NRM\n";
377 } else {
378 print "6. SMTP Server : $WHT$smtpServerAddress$NRM\n";
379 print "7. SMTP Port : $WHT$smtpPort$NRM\n";
380 print "8. Authenticated SMTP : $WHT$use_authenticated_smtp$NRM\n";
381 }
382 print "9. Server : $WHT$imap_server_type$NRM\n";
383 print "10. Invert Time : $WHT$invert_time$NRM\n";
384 print "11. Delimiter : $WHT$optional_delimiter$NRM\n";
385 print "\n";
386 print "R Return to Main Menu\n";
387 } elsif ( $menu == 3 ) {
388 print $WHT. "Folder Defaults\n" . $NRM;
389 print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n";
390 print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n";
391 print "3. Trash Folder : $WHT$trash_folder$NRM\n";
392 print "4. Sent Folder : $WHT$sent_folder$NRM\n";
393 print "5. Drafts Folder : $WHT$draft_folder$NRM\n";
394 print "6. By default, move to trash : $WHT$default_move_to_trash$NRM\n";
395 print "7. By default, move to sent : $WHT$default_move_to_sent$NRM\n";
396 print "8. By default, save as draft : $WHT$default_save_as_draft$NRM\n";
397 print "9. List Special Folders First : $WHT$list_special_folders_first$NRM\n";
398 print "10. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n";
399 print "11. Auto Expunge : $WHT$auto_expunge$NRM\n";
400 print "12. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n";
401 print "13. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n";
402 print "14. Default Unseen Notify : $WHT$default_unseen_notify$NRM\n";
403 print "15. Default Unseen Type : $WHT$default_unseen_type$NRM\n";
404 print "16. Auto Create Special Folders : $WHT$auto_create_special$NRM\n";
405 print "17. Don't move folders into Trash : $WHT$delete_folder$NRM\n";
406 print "\n";
407 print "R Return to Main Menu\n";
408 } elsif ( $menu == 4 ) {
409 print $WHT. "General Options\n" . $NRM;
410 print "1. Default Charset : $WHT$default_charset$NRM\n";
411 print "2. Data Directory : $WHT$data_dir$NRM\n";
412 print "3. Attachment Directory : $WHT$attachment_dir$NRM\n";
413 print "4. Directory Hash Level : $WHT$dir_hash_level$NRM\n";
414 print "5. Default Left Size : $WHT$default_left_size$NRM\n";
415 print "6. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n";
416 print "7. Allow use of priority : $WHT$default_use_priority$NRM\n";
417 print "8. Hide SM attributions : $WHT$hide_sm_attributions$NRM\n";
418 print "9. Allow use of receipts : $WHT$default_use_mdn$NRM\n";
419 print "10. Allow editing of identity : $WHT$edit_identity$NRM\n";
420 print "11. Allow server thread sort : $WHT$allow_thread_sort$NRM\n";
421 print "12. Allow server-side sorting : $WHT$allow_server_sort$NRM\n";
422 if ( lc($edit_identity) eq "false" ) {
423 print "13. Allow editing of name : $WHT$edit_name$NRM\n";
424 }
425 print "\n";
426 print "R Return to Main Menu\n";
427 } elsif ( $menu == 5 ) {
428 print $WHT. "Themes\n" . $NRM;
429 print "1. Change Themes\n";
430 for ( $count = 0 ; $count <= $#theme_name ; $count++ ) {
431 print " > $theme_name[$count]\n";
432 }
433 print "2. CSS File : $WHT$theme_css$NRM\n";
434 print "\n";
435 print "R Return to Main Menu\n";
436 } elsif ( $menu == 6 ) {
437 print $WHT. "Address Books (LDAP)\n" . $NRM;
438 print "1. Change Servers\n";
439 for ( $count = 0 ; $count <= $#ldap_host ; $count++ ) {
440 print " > $ldap_host[$count]\n";
441 }
442 print
443 "2. Use Javascript Address Book Search : $WHT$default_use_javascript_addr_book$NRM\n";
444 print "\n";
445 print "R Return to Main Menu\n";
446 } elsif ( $menu == 7 ) {
447 print $WHT. "Message of the Day (MOTD)\n" . $NRM;
448 print "\n$motd\n";
449 print "\n";
450 print "1 Edit the MOTD\n";
451 print "\n";
452 print "R Return to Main Menu\n";
453 } elsif ( $menu == 8 ) {
454 print $WHT. "Plugins\n" . $NRM;
455 print " Installed Plugins\n";
456 $num = 0;
457 for ( $count = 0 ; $count <= $#plugins ; $count++ ) {
458 $num = $count + 1;
459 print " $num. $plugins[$count]\n";
460 }
461 print "\n Available Plugins:\n";
462 opendir( DIR, "../plugins" );
463 @files = readdir(DIR);
464 $pos = 0;
465 @unused_plugins = ();
466 for ( $i = 0 ; $i <= $#files ; $i++ ) {
467 if ( -d "../plugins/" . $files[$i] && $files[$i] !~ /^\./ && $files[$i] ne "CVS" ) {
468 $match = 0;
469 for ( $k = 0 ; $k <= $#plugins ; $k++ ) {
470 if ( $plugins[$k] eq $files[$i] ) {
471 $match = 1;
472 }
473 }
474 if ( $match == 0 ) {
475 $unused_plugins[$pos] = $files[$i];
476 $pos++;
477 }
478 }
479 }
480
481 for ( $i = 0 ; $i <= $#unused_plugins ; $i++ ) {
482 $num = $num + 1;
483 print " $num. $unused_plugins[$i]\n";
484 }
485 closedir DIR;
486
487 print "\n";
488 print "A Sanitize all plugins for use with Squirrelmail 1.2\n";
489 print "\n";
490 print "R Return to Main Menu\n";
491 } elsif ( $menu == 9 ) {
492 print $WHT. "Database\n" . $NRM;
493 print "1. DSN for Address Book : $WHT$addrbook_dsn$NRM\n";
494 print "2. Table for Address Book : $WHT$addrbook_table$NRM\n";
495 print "\n";
496 print "3. DSN for Preferences : $WHT$prefs_dsn$NRM\n";
497 print "4. Table for Preferences : $WHT$prefs_table$NRM\n";
498 print "5. Field for username : $WHT$prefs_user_field$NRM\n";
499 print "6. Field for prefs key : $WHT$prefs_key_field$NRM\n";
500 print "7. Field for prefs value : $WHT$prefs_val_field$NRM\n";
501 print "\n";
502 print "S Save data\n";
503 print "R Return to Main Menu\n";
504 }
505 if ( $config_use_color == 1 ) {
506 print "C. Turn color off\n";
507 } else {
508 print "C. Turn color on\n";
509 }
510 print "S Save data\n";
511 print "Q Quit\n";
512
513 print "\n";
514 print "Command >> " . $WHT;
515 $command = <STDIN>;
516 $command =~ s/[\n|\r]//g;
517 $command =~ tr/A-Z/a-z/;
518 print "$NRM\n";
519
520 # Read the commands they entered.
521 if ( $command eq "r" ) {
522 $menu = 0;
523 } elsif ( $command eq "s" ) {
524 save_data();
525 print "Press enter to continue...";
526 $tmp = <STDIN>;
527 $saved = 1;
528 } elsif ( ( $command eq "q" ) && ( $saved == 0 ) ) {
529 print "You have not saved your data.\n";
530 print "Save? [" . $WHT . "Y" . $NRM . "/n]: ";
531 $save = <STDIN>;
532 if ( ( $save =~ /^y/i ) || ( $save =~ /^\s*$/ ) ) {
533 save_data();
534 }
535 } elsif ( $command eq "c" ) {
536 if ( $config_use_color == 1 ) {
537 $config_use_color = 2;
538 $WHT = "";
539 $NRM = "";
540 } else {
541 $config_use_color = 1;
542 $WHT = "\x1B[37;1m";
543 $NRM = "\x1B[0m";
544 }
545 } elsif ( $command eq "d" && $menu == 0 ) {
546 set_defaults();
547 } else {
548 $saved = 0;
549 if ( $menu == 0 ) {
550 if ( ( $command > 0 ) && ( $command < 10 ) ) {
551 $menu = $command;
552 }
553 } elsif ( $menu == 1 ) {
554 if ( $command == 1 ) { $org_name = command1(); }
555 elsif ( $command == 2 ) { $org_logo = command2(); }
556 elsif ( $command == 3 ) { ($org_logo_width,$org_logo_height) = command2a(); }
557 elsif ( $command == 4 ) { $org_title = command3(); }
558 elsif ( $command == 5 ) { $signout_page = command4(); }
559 elsif ( $command == 6 ) { $squirrelmail_default_language = command5(); }
560 elsif ( $command == 7 ) { $frame_top = command6(); }
561 } elsif ( $menu == 2 ) {
562 if ( $command == 1 ) { $domain = command11(); }
563 elsif ( $command == 2 ) { $imapServerAddress = command12(); }
564 elsif ( $command == 3 ) { $imapPort = command13(); }
565 elsif ( $command == 4 ) { $useSendmail = command14(); }
566 elsif ( $command == 5 ) { $sendmail_path = command15(); }
567 elsif ( $command == 6 ) { $smtpServerAddress = command16(); }
568 elsif ( $command == 7 ) { $smtpPort = command17(); }
569 elsif ( $command == 8 ) { $use_authenticated_smtp = command18(); }
570 elsif ( $command == 9 ) { $imap_server_type = command19(); }
571 elsif ( $command == 10 ) { $invert_time = command110(); }
572 elsif ( $command == 11 ) { $optional_delimiter = command111(); }
573 } elsif ( $menu == 3 ) {
574 if ( $command == 1 ) { $default_folder_prefix = command21(); }
575 elsif ( $command == 2 ) { $show_prefix_option = command22(); }
576 elsif ( $command == 3 ) { $trash_folder = command23a(); }
577 elsif ( $command == 4 ) { $sent_folder = command23b(); }
578 elsif ( $command == 5 ) { $draft_folder = command23c(); }
579 elsif ( $command == 6 ) { $default_move_to_trash = command24a(); }
580 elsif ( $command == 7 ) { $default_move_to_sent = command24b(); }
581 elsif ( $command == 8 ) { $default_save_as_draft = command24c(); }
582 elsif ( $command == 9 ) { $list_special_folders_first = command27(); }
583 elsif ( $command == 10 ) { $use_special_folder_color = command28(); }
584 elsif ( $command == 11 ) { $auto_expunge = command29(); }
585 elsif ( $command == 12 ) { $default_sub_of_inbox = command210(); }
586 elsif ( $command == 13 ) { $show_contain_subfolders_option = command211(); }
587 elsif ( $command == 14 ) { $default_unseen_notify = command212(); }
588 elsif ( $command == 15 ) { $default_unseen_type = command213(); }
589 elsif ( $command == 16 ) { $auto_create_special = command214(); }
590 elsif ( $command == 17 ) { $delete_folder = command215(); }
591 } elsif ( $menu == 4 ) {
592 if ( $command == 1 ) { $default_charset = command31(); }
593 elsif ( $command == 2 ) { $data_dir = command33a(); }
594 elsif ( $command == 3 ) { $attachment_dir = command33b(); }
595 elsif ( $command == 4 ) { $dir_hash_level = command33c(); }
596 elsif ( $command == 5 ) { $default_left_size = command35(); }
597 elsif ( $command == 6 ) { $force_username_lowercase = command36(); }
598 elsif ( $command == 7 ) { $default_use_priority = command37(); }
599 elsif ( $command == 8 ) { $hide_sm_attributions = command38(); }
600 elsif ( $command == 9 ) { $default_use_mdn = command39(); }
601 elsif ( $command == 10 ) { $edit_identity = command310(); }
602 elsif ( $command == 11 ) { $allow_thread_sort = command312(); }
603 elsif ( $command == 12 ) { $allow_server_sort = command313(); }
604 elsif ( $command == 13 ) { $edit_name = command311(); }
605 } elsif ( $menu == 5 ) {
606 if ( $command == 1 ) { command41(); }
607 elsif ( $command == 2 ) { $theme_css = command42(); }
608 } elsif ( $menu == 6 ) {
609 if ( $command == 1 ) { command61(); }
610 elsif ( $command == 2 ) { command62(); }
611 } elsif ( $menu == 7 ) {
612 if ( $command == 1 ) { $motd = command71(); }
613 } elsif ( $menu == 8 ) {
614 if ( $command =~ /^[0-9]+/ ) { @plugins = command81(); }
615 elsif ( $command eq "a" ) { command8s(); }
616 } elsif ( $menu == 9 ) {
617 if ( $command == 1 ) { $addrbook_dsn = command91(); }
618 elsif ( $command == 2 ) { $addrbook_table = command92(); }
619 elsif ( $command == 3 ) { $prefs_dsn = command93(); }
620 elsif ( $command == 4 ) { $prefs_table = command94(); }
621 elsif ( $command == 5 ) { $prefs_user_field = command95(); }
622 elsif ( $command == 6 ) { $prefs_key_field = command96(); }
623 elsif ( $command == 7 ) { $prefs_val_field = command97(); }
624 }
625 }
626 }
627
628 ####################################################################################
629
630 # org_name
631 sub command1 {
632 print "We have tried to make the name SquirrelMail as transparent as\n";
633 print "possible. If you set up an organization name, most places where\n";
634 print "SquirrelMail would take credit will be credited to your organization.\n";
635 print "\n";
636 print "[$WHT$org_name$NRM]: $WHT";
637 $new_org_name = <STDIN>;
638 if ( $new_org_name eq "\n" ) {
639 $new_org_name = $org_name;
640 } else {
641 $new_org_name =~ s/[\r|\n]//g;
642 }
643 return $new_org_name;
644 }
645
646 # org_logo
647 sub command2 {
648 print "Your organization's logo is an image that will be displayed at\n";
649 print "different times throughout SquirrelMail. This is asking for the\n";
650 print "literal (/usr/local/squirrelmail/images/logo.jpg) or relative\n";
651 print "(../images/logo.jpg) path to your logo.\n";
652 print "\n";
653 print "[$WHT$org_logo$NRM]: $WHT";
654 $new_org_logo = <STDIN>;
655 if ( $new_org_logo eq "\n" ) {
656 $new_org_logo = $org_logo;
657 } else {
658 $new_org_logo =~ s/[\r|\n]//g;
659 }
660 return $new_org_logo;
661 }
662
663 # org_logo_width
664 sub command2a {
665 print "Your organization's logo is an image that will be displayed at\n";
666 print "different times throughout SquirrelMail. Width\n";
667 print "and Height of your logo image. Use '0' to disable.\n";
668 print "\n";
669 print "Width: [$WHT$org_logo_width$NRM]: $WHT";
670 $new_org_logo_width = <STDIN>;
671 $new_org_logo_width =~ tr/0-9//cd; # only want digits!
672 if ( $new_org_logo_width eq '' ) {
673 $new_org_logo_width = $org_logo_width;
674 }
675 if ( $new_org_logo_width > 0 ) {
676 print "Height: [$WHT$org_logo_height$NRM]: $WHT";
677 $new_org_logo_height = <STDIN>;
678 $new_org_logo_height =~ tr/0-9//cd; # only want digits!
679 if( $new_org_logo_height eq '' ) {
680 $new_org_logo_height = $org_logo_height;
681 }
682 } else {
683 $new_org_logo_height = 0;
684 }
685 return ($new_org_logo_width, $new_org_logo_height);
686 }
687
688 # org_title
689 sub command3 {
690 print "A title is what is displayed at the top of the browser window in\n";
691 print "the titlebar. Usually this will end up looking something like:\n";
692 print "\"Netscape: $org_title\"\n";
693 print "\n";
694 print "[$WHT$org_title$NRM]: $WHT";
695 $new_org_title = <STDIN>;
696 if ( $new_org_title eq "\n" ) {
697 $new_org_title = $org_title;
698 } else {
699 $new_org_title =~ s/[\r|\n]//g;
700 }
701 return $new_org_title;
702 }
703
704 # signout_page
705 sub command4 {
706 print "When users click the Sign Out button they will be logged out and\n";
707 print "then sent to signout_page. If signout_page is left empty,\n";
708 print "(hit space and then return) they will be taken, as normal,\n";
709 print "to the default and rather sparse SquirrelMail signout page.\n";
710 print "\n";
711 print "[$WHT$signout_page$NRM]: $WHT";
712 $new_signout_page = <STDIN>;
713 if ( $new_signout_page eq "\n" ) {
714 $new_signout_page = $signout_page;
715 } else {
716 $new_signout_page =~ s/[\r|\n]//g;
717 $new_signout_page =~ s/^\s+$//g;
718 }
719 return $new_signout_page;
720 }
721
722 # Default language
723 sub command5 {
724 print "SquirrelMail attempts to set the language in many ways. If it\n";
725 print "can not figure it out in another way, it will default to this\n";
726 print "language. Please use the two-letter code for the desired language.\n";
727 print "\n";
728 print "[$WHT$squirrelmail_default_language$NRM]: $WHT";
729 $new_signout_page = <STDIN>;
730 if ( $new_signout_page eq "\n" ) {
731 $new_signout_page = $squirrelmail_default_language;
732 } else {
733 $new_signout_page =~ s/[\r|\n]//g;
734 $new_signout_page =~ s/^\s+$//g;
735 }
736 return $new_signout_page;
737 }
738
739 # Default top frame
740 sub command6 {
741 print "SquirrelMail defaults to using the whole of the browser window.\n";
742 print "This allows you to keep it within a specified frame. The default\n";
743 print "is '_top'\n";
744 print "\n";
745 print "[$WHT$frame_top$NRM]: $WHT";
746 $new_frame_top = <STDIN>;
747 if ( $new_frame_top eq "\n" ) {
748 $new_frame_top = '_top';
749 } else {
750 $new_frame_top =~ s/[\r|\n]//g;
751 $new_frame_top =~ s/^\s+$//g;
752 }
753 return $new_frame_top;
754 }
755
756 ####################################################################################
757
758 # domain
759 sub command11 {
760 print "The domain name is the suffix at the end of all email messages. If\n";
761 print "for example, your email address is jdoe\@myorg.com, then your domain\n";
762 print "would be myorg.com.\n";
763 print "\n";
764 print "[$WHT$domain$NRM]: $WHT";
765 $new_domain = <STDIN>;
766 if ( $new_domain eq "\n" ) {
767 $new_domain = $domain;
768 } else {
769 $new_domain =~ s/[\r|\n]//g;
770 }
771 return $new_domain;
772 }
773
774 # imapServerAddress
775 sub command12 {
776 print "This is the address where your IMAP server resides.\n";
777 print "[$WHT$imapServerAddress$NRM]: $WHT";
778 $new_imapServerAddress = <STDIN>;
779 if ( $new_imapServerAddress eq "\n" ) {
780 $new_imapServerAddress = $imapServerAddress;
781 } else {
782 $new_imapServerAddress =~ s/[\r|\n]//g;
783 }
784 return $new_imapServerAddress;
785 }
786
787 # imapPort
788 sub command13 {
789 print "This is the port that your IMAP server is on. Usually this is 143.\n";
790 print "[$WHT$imapPort$NRM]: $WHT";
791 $new_imapPort = <STDIN>;
792 if ( $new_imapPort eq "\n" ) {
793 $new_imapPort = $imapPort;
794 } else {
795 $new_imapPort =~ s/[\r|\n]//g;
796 }
797 return $new_imapPort;
798 }
799
800 # useSendmail
801 sub command14 {
802 print "You now need to choose the method that you will use for sending\n";
803 print "messages in SquirrelMail. You can either connect to an SMTP server\n";
804 print "or use sendmail directly.\n";
805 if ( lc($useSendmail) eq "true" ) {
806 $default_value = "1";
807 } else {
808 $default_value = "2";
809 }
810 print "\n";
811 print " 1. Sendmail\n";
812 print " 2. SMTP\n";
813 print "Your choice [1/2] [$WHT$default_value$NRM]: $WHT";
814 $use_sendmail = <STDIN>;
815 if ( ( $use_sendmail =~ /^1\n/i )
816 || ( ( $use_sendmail =~ /^\n/ ) && ( $default_value eq "1" ) ) ) {
817 $useSendmail = "true";
818 } else {
819 $useSendmail = "false";
820 }
821 return $useSendmail;
822 }
823
824 # sendmail_path
825 sub command15 {
826 if ( $sendmail_path[0] !~ /./ ) {
827 $sendmail_path = "/usr/sbin/sendmail";
828 }
829 print "Specify where the sendmail executable is located. Usually /usr/sbin/sendmail\n";
830 print "[$WHT$sendmail_path$NRM]: $WHT";
831 $new_sendmail_path = <STDIN>;
832 if ( $new_sendmail_path eq "\n" ) {
833 $new_sendmail_path = $sendmail_path;
834 } else {
835 $new_sendmail_path =~ s/[\r|\n]//g;
836 }
837 return $new_sendmail_path;
838 }
839
840 # smtpServerAddress
841 sub command16 {
842 print "This is the location of your SMTP server.\n";
843 print "[$WHT$smtpServerAddress$NRM]: $WHT";
844 $new_smtpServerAddress = <STDIN>;
845 if ( $new_smtpServerAddress eq "\n" ) {
846 $new_smtpServerAddress = $smtpServerAddress;
847 } else {
848 $new_smtpServerAddress =~ s/[\r|\n]//g;
849 }
850 return $new_smtpServerAddress;
851 }
852
853 # smtpPort
854 sub command17 {
855 print "This is the port to connect to for SMTP. Usually 25.\n";
856 print "[$WHT$smtpPort$NRM]: $WHT";
857 $new_smtpPort = <STDIN>;
858 if ( $new_smtpPort eq "\n" ) {
859 $new_smtpPort = $smtpPort;
860 } else {
861 $new_smtpPort =~ s/[\r|\n]//g;
862 }
863 return $new_smtpPort;
864 }
865
866 # authenticated server
867 sub command18 {
868 print "Do you wish to use an authenticated SMTP server? Your server must\n";
869 print "support this in order for SquirrelMail to work with it. We implemented\n";
870 print "it according to RFC 2554.\n";
871
872 $YesNo = 'n';
873 $YesNo = 'y' if ( lc($use_authenticated_smtp) eq "true" );
874
875 print "Use authenticated SMTP server (y/n) [$WHT$YesNo$NRM]: $WHT";
876
877 $new_use_authenticated_smtp = <STDIN>;
878 $new_use_authenticated_smtp =~ tr/yn//cd;
879 return "true" if ( $new_use_authenticated_smtp eq "y" );
880 return "false" if ( $new_use_authenticated_smtp eq "n" );
881 return $use_authenticated_smtp;
882 }
883
884 # imap_server_type
885 sub command19 {
886 print "Each IMAP server has its own quirks. As much as we tried to stick\n";
887 print "to standards, it doesn't help much if the IMAP server doesn't follow\n";
888 print "the same principles. We have made some work-arounds for some of\n";
889 print "these servers. If you would like to use them, please select your\n";
890 print "IMAP server. If you do not wish to use these work-arounds, you can\n";
891 print "set this to \"other\", and none will be used.\n";
892 print " cyrus = Cyrus IMAP server\n";
893 print " uw = University of Washington's IMAP server\n";
894 print " exchange = Microsoft Exchange IMAP server\n";
895 print " courier = Courier IMAP server\n";
896 print " other = Not one of the above servers\n";
897 print "[$WHT$imap_server_type$NRM]: $WHT";
898 $new_imap_server_type = <STDIN>;
899
900 if ( $new_imap_server_type eq "\n" ) {
901 $new_imap_server_type = $imap_server_type;
902 } else {
903 $new_imap_server_type =~ s/[\r|\n]//g;
904 }
905 return $new_imap_server_type;
906 }
907
908 # invert_time
909 sub command110 {
910 print "Sometimes the date of messages sent is messed up (off by a few hours\n";
911 print "on some machines). Typically this happens if the system doesn't support\n";
912 print "tm_gmtoff. It will happen only if your time zone is \"negative\".\n";
913 print "This most often occurs on Solaris 7 machines in the United States.\n";
914 print "By default, this is off. It should be kept off unless problems surface\n";
915 print "about the time that messages are sent.\n";
916 print " no = Do NOT fix time -- almost always correct\n";
917 print " yes = Fix the time for this system\n";
918
919 $YesNo = 'n';
920 $YesNo = 'y' if ( lc($invert_time) eq "true" );
921
922 print "Fix the time for this system (y/n) [$WHT$YesNo$NRM]: $WHT";
923
924 $new_invert_time = <STDIN>;
925 $new_invert_time =~ tr/yn//cd;
926 return "true" if ( $new_invert_time eq "y" );
927 return "false" if ( $new_invert_time eq "n" );
928 return $invert_time;
929 }
930
931 sub command111 {
932 print "This is the delimiter that your IMAP server uses to distinguish between\n";
933 print "folders. For example, Cyrus uses '.' as the delimiter and a complete\n";
934 print "folder would look like 'INBOX.Friends.Bob', while UW uses '/' and would\n";
935 print "look like 'INBOX/Friends/Bob'. Normally this should be left at 'detect'\n";
936 print "but if you are sure you know what delimiter your server uses, you can\n";
937 print "specify it here.\n";
938 print "\nTo have it autodetect the delimiter, set it to 'detect'.\n\n";
939 print "[$WHT$optional_delimiter$NRM]: $WHT";
940 $new_optional_delimiter = <STDIN>;
941
942 if ( $new_optional_delimiter eq "\n" ) {
943 $new_optional_delimiter = $optional_delimiter;
944 } else {
945 $new_optional_delimiter =~ s/[\r|\n]//g;
946 }
947 return $new_optional_delimiter;
948 }
949
950 # MOTD
951 sub command71 {
952 print "\nYou can now create the welcome message that is displayed\n";
953 print "every time a user logs on. You can use HTML or just plain\n";
954 print
955 "text. If you do not wish to have one, just make it blank.\n\n(Type @ on a blank line to exit)\n";
956
957 $new_motd = "";
958 do {
959 print "] ";
960 $line = <STDIN>;
961 $line =~ s/[\r|\n]//g;
962 if ( $line ne "@" ) {
963 $line =~ s/ /\&nbsp;\&nbsp;/g;
964 $line =~ s/\t/\&nbsp;\&nbsp;\&nbsp;\&nbsp;/g;
965 $line =~ s/$/ /;
966 $line =~ s/\'/\\\'/g;
967
968 $new_motd = $new_motd . $line;
969 }
970 } while ( $line ne "@" );
971 return $new_motd;
972 }
973
974 ################# PLUGINS ###################
975
976 sub command81 {
977 $command =~ s/[\s|\n|\r]*//g;
978 if ( $command > 0 ) {
979 $command = $command - 1;
980 if ( $command <= $#plugins ) {
981 @newplugins = ();
982 $ct = 0;
983 while ( $ct <= $#plugins ) {
984 if ( $ct != $command ) {
985 @newplugins = ( @newplugins, $plugins[$ct] );
986 }
987 $ct++;
988 }
989 @plugins = @newplugins;
990 } elsif ( $command <= $#plugins + $#unused_plugins + 1 ) {
991 $num = $command - $#plugins - 1;
992 @newplugins = @plugins;
993 $ct = 0;
994 while ( $ct <= $#unused_plugins ) {
995 if ( $ct == $num ) {
996 @newplugins = ( @newplugins, $unused_plugins[$ct] );
997
998 # sanitize the plugin
999 $dir = $unused_plugins[$ct];
1000 if (-d "../plugins/$dir") {
1001 `./ri_once.pl ../plugins/$dir`;
1002 } else {
1003 print "Could not locate ../plugins/$dir\n" ;
1004 print "The plugin $dir could *not* be sanitized!\n" ;
1005 print "If you want to try to do this manually, please run\n" ;
1006 print "config/ri_once.pl with the full path to the $dir plugin.\n" ;
1007 }
1008 }
1009 $ct++;
1010 }
1011 @plugins = @newplugins;
1012 }
1013 }
1014 return @plugins;
1015 }
1016
1017 sub command8s {
1018 print "This command will sanitize all plugins for use with\n";
1019 print "Squirrelmail 1.2. That is, it will rewrite some php-\n";
1020 print "constructs that are *incompatible* with the 1.2 design\n";
1021 print "into ones that are *compatible*\n";
1022 print "Do you wish to issue this command [y/N]? ";
1023 $ctu = <STDIN>;
1024 if ( $ctu =~ /^y\n/i ) {
1025 `./ri_once.pl ../plugins`;
1026 }
1027 }
1028
1029 ################# FOLDERS ###################
1030
1031 # default_folder_prefix
1032 sub command21 {
1033 print "Some IMAP servers (UW, for example) store mail and folders in\n";
1034 print "your user space in a separate subdirectory. This is where you\n";
1035 print "specify what that directory is.\n";
1036 print "\n";
1037 print "EXAMPLE: mail/";
1038 print "\n";
1039 print "NOTE: If you use Cyrus, or some server that would not use this\n";
1040 print " option, you must set this to 'none'.\n";
1041 print "\n";
1042 print "[$WHT$default_folder_prefix$NRM]: $WHT";
1043 $new_default_folder_prefix = <STDIN>;
1044
1045 if ( $new_default_folder_prefix eq "\n" ) {
1046 $new_default_folder_prefix = $default_folder_prefix;
1047 } else {
1048 $new_default_folder_prefix =~ s/[\r\n]//g;
1049 }
1050 if ( ( $new_default_folder_prefix =~ /^\s*$/ ) || ( $new_default_folder_prefix =~ m/^none$/i ) ) {
1051 $new_default_folder_prefix = "";
1052 } else {
1053 # add the trailing delimiter only if we know what the server is.
1054 if ($optional_delimiter and $optional_delimiter ne 'detect') {
1055 $new_default_folder_prefix =~ s/${optional_delimiter}*$/$optional_delimiter/;
1056 } elsif ($imap_server_type eq 'cyrus' or
1057 $imap_server_type eq 'courier') {
1058 $new_default_folder_prefix =~ s/\.*$/\./;
1059 } elsif ($imap_server_type eq 'uw') {
1060 $new_default_folder_prefix =~ s/\/*$/\//;
1061 }
1062 }
1063 return $new_default_folder_prefix;
1064 }
1065
1066 # Show Folder Prefix
1067 sub command22 {
1068 print "It is possible to set up the default folder prefix as a user\n";
1069 print "specific option, where each user can specify what their mail\n";
1070 print "folder is. If you set this to false, they will never see the\n";
1071 print "option, but if it is true, this option will appear in the\n";
1072 print "'options' section.\n";
1073 print "\n";
1074 print "NOTE: You set the default folder prefix in option '1' of this\n";
1075 print " section. That will be the default if the user doesn't\n";
1076 print " specify anything different.\n";
1077 print "\n";
1078
1079 if ( lc($show_prefix_option) eq "true" ) {
1080 $default_value = "y";
1081 } else {
1082 $default_value = "n";
1083 }
1084 print "\n";
1085 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
1086 $new_show = <STDIN>;
1087 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1088 $show_prefix_option = "true";
1089 } else {
1090 $show_prefix_option = "false";
1091 }
1092 return $show_prefix_option;
1093 }
1094
1095 # Trash Folder
1096 sub command23a {
1097 print "You can now specify where the default trash folder is located.\n";
1098 print "On servers where you do not want this, you can set it to anything\n";
1099 print "and set option 6 to false.\n";
1100 print "\n";
1101 print "This is relative to where the rest of your email is kept. You do\n";
1102 print "not need to worry about their mail directory. If this folder\n";
1103 print "would be ~/mail/trash on the filesystem, you only need to specify\n";
1104 print "that this is 'trash', and be sure to put 'mail/' in option 1.\n";
1105 print "\n";
1106
1107 print "[$WHT$trash_folder$NRM]: $WHT";
1108 $new_trash_folder = <STDIN>;
1109 if ( $new_trash_folder eq "\n" ) {
1110 $new_trash_folder = $trash_folder;
1111 } else {
1112 $new_trash_folder =~ s/[\r|\n]//g;
1113 }
1114 return $new_trash_folder;
1115 }
1116
1117 # Sent Folder
1118 sub command23b {
1119 print "This is where messages that are sent will be stored. SquirrelMail\n";
1120 print "by default puts a copy of all outgoing messages in this folder.\n";
1121 print "\n";
1122 print "This is relative to where the rest of your email is kept. You do\n";
1123 print "not need to worry about their mail directory. If this folder\n";
1124 print "would be ~/mail/sent on the filesystem, you only need to specify\n";
1125 print "that this is 'sent', and be sure to put 'mail/' in option 1.\n";
1126 print "\n";
1127
1128 print "[$WHT$sent_folder$NRM]: $WHT";
1129 $new_sent_folder = <STDIN>;
1130 if ( $new_sent_folder eq "\n" ) {
1131 $new_sent_folder = $sent_folder;
1132 } else {
1133 $new_sent_folder =~ s/[\r|\n]//g;
1134 }
1135 return $new_sent_folder;
1136 }
1137
1138 # Draft Folder
1139 sub command23c {
1140 print "You can now specify where the default draft folder is located.\n";
1141 print "On servers where you do not want this, you can set it to anything\n";
1142 print "and set option 9 to false.\n";
1143 print "\n";
1144 print "This is relative to where the rest of your email is kept. You do\n";
1145 print "not need to worry about their mail directory. If this folder\n";
1146 print "would be ~/mail/drafts on the filesystem, you only need to specify\n";
1147 print "that this is 'drafts', and be sure to put 'mail/' in option 1.\n";
1148 print "\n";
1149
1150 print "[$WHT$draft_folder$NRM]: $WHT";
1151 $new_draft_folder = <STDIN>;
1152 if ( $new_draft_folder eq "\n" ) {
1153 $new_draft_folder = $draft_folder;
1154 } else {
1155 $new_draft_folder =~ s/[\r|\n]//g;
1156 }
1157 return $new_draft_folder;
1158 }
1159
1160 # default move to trash
1161 sub command24a {
1162 print "By default, should messages get moved to the trash folder? You\n";
1163 print "can specify the default trash folder in option 3. If this is set\n";
1164 print "to false, messages will get deleted immediately without moving\n";
1165 print "to the trash folder.\n";
1166 print "\n";
1167 print "Trash folder is currently: $trash_folder\n";
1168 print "\n";
1169
1170 if ( lc($default_move_to_trash) eq "true" ) {
1171 $default_value = "y";
1172 } else {
1173 $default_value = "n";
1174 }
1175 print "By default, move to trash (y/n) [$WHT$default_value$NRM]: $WHT";
1176 $new_show = <STDIN>;
1177 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1178 $default_move_to_trash = "true";
1179 } else {
1180 $default_move_to_trash = "false";
1181 }
1182 return $default_move_to_trash;
1183 }
1184
1185 # default move to sent
1186 sub command24b {
1187 print "By default, should messages get moved to the sent folder? You\n";
1188 print "can specify the default sent folder in option 4. If this is set\n";
1189 print "to false, messages will get sent and no copy will be made.\n";
1190 print "\n";
1191 print "Sent folder is currently: $sent_folder\n";
1192 print "\n";
1193
1194 if ( lc($default_move_to_sent) eq "true" ) {
1195 $default_value = "y";
1196 } else {
1197 $default_value = "n";
1198 }
1199 print "By default, move to sent (y/n) [$WHT$default_value$NRM]: $WHT";
1200 $new_show = <STDIN>;
1201 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1202 $default_move_to_sent = "true";
1203 } else {
1204 $default_move_to_sent = "false";
1205 }
1206 return $default_move_to_sent;
1207 }
1208
1209 # default save as draft
1210 sub command24c {
1211 print "By default, should the save to draft option be shown? You can\n";
1212 print "specify the default drafts folder in option 5. If this is set\n";
1213 print "to false, users will not be shown the save to draft option.\n";
1214 print "\n";
1215 print "Drafts folder is currently: $draft_folder\n";
1216 print "\n";
1217
1218 if ( lc($default_move_to_draft) eq "true" ) {
1219 $default_value = "y";
1220 } else {
1221 $default_value = "n";
1222 }
1223 print "By default, save as draft (y/n) [$WHT$default_value$NRM]: $WHT";
1224 $new_show = <STDIN>;
1225 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1226 $default_save_as_draft = "true";
1227 } else {
1228 $default_save_as_draft = "false";
1229 }
1230 return $default_save_as_draft;
1231 }
1232
1233 # List special folders first
1234 sub command27 {
1235 print "SquirrelMail has what we call 'special folders' that are not\n";
1236 print "manipulated and viewed like normal folders. Some examples of\n";
1237 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
1238 print "Simply asks if you want these folders listed first in the folder\n";
1239 print "listing.\n";
1240 print "\n";
1241
1242 if ( lc($list_special_folders_first) eq "true" ) {
1243 $default_value = "y";
1244 } else {
1245 $default_value = "n";
1246 }
1247 print "\n";
1248 print "List first (y/n) [$WHT$default_value$NRM]: $WHT";
1249 $new_show = <STDIN>;
1250 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1251 $list_special_folders_first = "true";
1252 } else {
1253 $list_special_folders_first = "false";
1254 }
1255 return $list_special_folders_first;
1256 }
1257
1258 # Show special folders color
1259 sub command28 {
1260 print "SquirrelMail has what we call 'special folders' that are not\n";
1261 print "manipulated and viewed like normal folders. Some examples of\n";
1262 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
1263 print "wants to know if we should display special folders in a\n";
1264 print "color than the other folders.\n";
1265 print "\n";
1266
1267 if ( lc($use_special_folder_color) eq "true" ) {
1268 $default_value = "y";
1269 } else {
1270 $default_value = "n";
1271 }
1272 print "\n";
1273 print "Show color (y/n) [$WHT$default_value$NRM]: $WHT";
1274 $new_show = <STDIN>;
1275 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1276 $use_special_folder_color = "true";
1277 } else {
1278 $use_special_folder_color = "false";
1279 }
1280 return $use_special_folder_color;
1281 }
1282
1283 # Auto expunge
1284 sub command29 {
1285 print "The way that IMAP handles deleting messages is as follows. You\n";
1286 print "mark the message as deleted, and then to 'really' delete it, you\n";
1287 print "expunge it. This option asks if you want to just have messages\n";
1288 print "marked as deleted, or if you want SquirrelMail to expunge the \n";
1289 print "messages too.\n";
1290 print "\n";
1291
1292 if ( lc($auto_expunge) eq "true" ) {
1293 $default_value = "y";
1294 } else {
1295 $default_value = "n";
1296 }
1297 print "Auto expunge (y/n) [$WHT$default_value$NRM]: $WHT";
1298 $new_show = <STDIN>;
1299 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1300 $auto_expunge = "true";
1301 } else {
1302 $auto_expunge = "false";
1303 }
1304 return $auto_expunge;
1305 }
1306
1307 # Default sub of inbox
1308 sub command210 {
1309 print "Some IMAP servers (Cyrus) have all folders as subfolders of INBOX.\n";
1310 print "This can cause some confusion in folder creation for users when\n";
1311 print "they try to create folders and don't put it as a subfolder of INBOX\n";
1312 print "and get permission errors. This option asks if you want folders\n";
1313 print "to be subfolders of INBOX by default.\n";
1314 print "\n";
1315
1316 if ( lc($default_sub_of_inbox) eq "true" ) {
1317 $default_value = "y";
1318 } else {
1319 $default_value = "n";
1320 }
1321 print "Default sub of INBOX (y/n) [$WHT$default_value$NRM]: $WHT";
1322 $new_show = <STDIN>;
1323 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1324 $default_sub_of_inbox = "true";
1325 } else {
1326 $default_sub_of_inbox = "false";
1327 }
1328 return $default_sub_of_inbox;
1329 }
1330
1331 # Show contain subfolder option
1332 sub command211 {
1333 print "Some IMAP servers (UW) make it so that there are two types of\n";
1334 print "folders. Those that contain messages, and those that contain\n";
1335 print "subfolders. If this is the case for your server, set this to\n";
1336 print "true, and it will ask the user whether the folder they are\n";
1337 print "creating contains subfolders or messages.\n";
1338 print "\n";
1339
1340 if ( lc($show_contain_subfolders_option) eq "true" ) {
1341 $default_value = "y";
1342 } else {
1343 $default_value = "n";
1344 }
1345 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
1346 $new_show = <STDIN>;
1347 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1348 $show_contain_subfolders_option = "true";
1349 } else {
1350 $show_contain_subfolders_option = "false";
1351 }
1352 return $show_contain_subfolders_option;
1353 }
1354
1355 # Default Unseen Notify
1356 sub command212 {
1357 print "This option specifies where the users will receive notification\n";
1358 print "about unseen messages by default. This is of course an option that\n";
1359 print "can be changed on a user level.\n";
1360 print " 1 = No notification\n";
1361 print " 2 = Only on the INBOX\n";
1362 print " 3 = On all folders\n";
1363 print "\n";
1364
1365 print "Which one should be default (1,2,3)? [$WHT$default_unseen_notify$NRM]: $WHT";
1366 $new_show = <STDIN>;
1367 if ( $new_show =~ /^[1|2|3]\n/i ) {
1368 $default_unseen_notify = $new_show;
1369 }
1370 $default_unseen_notify =~ s/[\r|\n]//g;
1371 return $default_unseen_notify;
1372 }
1373
1374 # Default Unseen Type
1375 sub command213 {
1376 print "Here you can define the default way that unseen messages will be displayed\n";
1377 print "to the user in the folder listing on the left side.\n";
1378 print " 1 = Only unseen messages (4)\n";
1379 print " 2 = Unseen and Total messages (4/27)\n";
1380 print "\n";
1381
1382 print "Which one should be default (1,2)? [$WHT$default_unseen_type$NRM]: $WHT";
1383 $new_show = <STDIN>;
1384 if ( $new_show =~ /^[1|2]\n/i ) {
1385 $default_unseen_type = $new_show;
1386 }
1387 $default_unseen_type =~ s/[\r|\n]//g;
1388 return $default_unseen_type;
1389 }
1390
1391 # Auto create special folders
1392 sub command214 {
1393 print "Would you like the Sent, Trash, and Drafts folders to be created\n";
1394 print "automatically print for you when a user logs in? If the user\n";
1395 print "accidentally deletes their special folders, this option will\n";
1396 print "automatically create it again for them.\n";
1397 print "\n";
1398
1399 if ( lc($auto_create_special) eq "true" ) {
1400 $default_value = "y";
1401 } else {
1402 $default_value = "n";
1403 }
1404 print "Auto create special folders? (y/n) [$WHT$default_value$NRM]: $WHT";
1405 $new_show = <STDIN>;
1406 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1407 $auto_create_special = "true";
1408 } else {
1409 $auto_create_special = "false";
1410 }
1411 return $auto_create_special;
1412 }
1413
1414 # Auto create special folders
1415 sub command215 {
1416 print "Would you like to automatically completely delete any deleted\n";
1417 print "folders? If not then they will be moved to the Trash folder\n";
1418 print "and can be deleted from there\n";
1419 print "\n";
1420
1421 if ( lc($delete_folder) eq "true" ) {
1422 $default_value = "y";
1423 } else {
1424 $default_value = "n";
1425 }
1426 print "Auto delete folders? (y/n) [$WHT$default_value$NRM]: $WHT";
1427 $new_delete = <STDIN>;
1428 if ( ( $new_delete =~ /^y\n/i ) || ( ( $new_delete =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1429 $delete_folder = "true";
1430 } else {
1431 $delete_folder = "false";
1432 }
1433 return $delete_folder;
1434 }
1435
1436 ############# GENERAL OPTIONS #####################
1437
1438 # Default Charset
1439 sub command31 {
1440 print "This option controls what character set is used when sending\n";
1441 print "mail and when sending HTML to the browser. Do not set this\n";
1442 print "to US-ASCII, use ISO-8859-1 instead. For cyrillic, it is best\n";
1443 print "to use KOI8-R, since this implementation is faster than most\n";
1444 print "of the alternatives\n";
1445 print "\n";
1446
1447 print "[$WHT$default_charset$NRM]: $WHT";
1448 $new_default_charset = <STDIN>;
1449 if ( $new_default_charset eq "\n" ) {
1450 $new_default_charset = $default_charset;
1451 } else {
1452 $new_default_charset =~ s/[\r|\n]//g;
1453 }
1454 return $new_default_charset;
1455 }
1456
1457 # Data directory
1458 sub command33a {
1459 print "It is a possible security hole to have a writable directory\n";
1460 print "under the web server's root directory (ex: /home/httpd/html).\n";
1461 print "For this reason, it is possible to put the data directory\n";
1462 print "anywhere you would like. The path name can be absolute or\n";
1463 print "relative (to the config directory). It doesn't matter. Here\n";
1464 print "are two examples:\n";
1465 print " Absolute: /usr/local/squirrelmail/data/\n";
1466 print " Relative: ../data/\n";
1467 print "\n";
1468
1469 print "[$WHT$data_dir$NRM]: $WHT";
1470 $new_data_dir = <STDIN>;
1471 if ( $new_data_dir eq "\n" ) {
1472 $new_data_dir = $data_dir;
1473 } else {
1474 $new_data_dir =~ s/[\r|\n]//g;
1475 }
1476 if ( $new_data_dir =~ /^\s*$/ ) {
1477 $new_data_dir = "";
1478 } else {
1479 $new_data_dir =~ s/\/*$//g;
1480 $new_data_dir =~ s/$/\//g;
1481 }
1482 return $new_data_dir;
1483 }
1484
1485 # Attachment directory
1486 sub command33b {
1487 print "Path to directory used for storing attachments while a mail is\n";
1488 print "being sent. There are a few security considerations regarding this\n";
1489 print "directory:\n";
1490 print " 1. It should have the permission 733 (rwx-wx-wx) to make it\n";
1491 print " impossible for a random person with access to the webserver\n";
1492 print " to list files in this directory. Confidential data might\n";
1493 print " be laying around in there.\n";
1494 print " 2. Since the webserver is not able to list the files in the\n";
1495 print " content is also impossible for the webserver to delete files\n";
1496 print " lying around there for too long.\n";
1497 print " 3. It should probably be another directory than the data\n";
1498 print " directory specified in option 3.\n";
1499 print "\n";
1500
1501 print "[$WHT$attachment_dir$NRM]: $WHT";
1502 $new_attachment_dir = <STDIN>;
1503 if ( $new_attachment_dir eq "\n" ) {
1504 $new_attachment_dir = $attachment_dir;
1505 } else {
1506 $new_attachment_dir =~ s/[\r|\n]//g;
1507 }
1508 if ( $new_attachment_dir =~ /^\s*$/ ) {
1509 $new_attachment_dir = "";
1510 } else {
1511 $new_attachment_dir =~ s/\/*$//g;
1512 $new_attachment_dir =~ s/$/\//g;
1513 }
1514 return $new_attachment_dir;
1515 }
1516
1517 sub command33c {
1518 print "The directory hash level setting allows you to configure the level\n";
1519 print "of hashing that Squirremail employs in your data and attachment\n";
1520 print "directories. This value must be an integer ranging from 0 to 4.\n";
1521 print "When this value is set to 0, Squirrelmail will simply store all\n";
1522 print "files as normal in the data and attachment directories. However,\n";
1523 print "when set to a value from 1 to 4, a simple hashing scheme will be\n";
1524 print "used to organize the files in this directory. In short, the crc32\n";
1525 print "value for a username will be computed. Then, up to the first 4\n";
1526 print "digits of the hash, as set by this configuration value, will be\n";
1527 print "used to directory hash the files for that user in the data and\n";
1528 print "attachment directory. This allows for better performance on\n";
1529 print "servers with larger numbers of users.\n";
1530 print "\n";
1531
1532 print "[$WHT$dir_hash_level$NRM]: $WHT";
1533 $new_dir_hash_level = <STDIN>;
1534 if ( $new_dir_hash_level eq "\n" ) {
1535 $new_dir_hash_level = $dir_hash_level;
1536 } else {
1537 $new_dir_hash_level =~ s/[\r|\n]//g;
1538 }
1539 if ( ( int($new_dir_hash_level) < 0 )
1540 || ( int($new_dir_hash_level) > 4 )
1541 || !( int($new_dir_hash_level) eq $new_dir_hash_level ) ) {
1542 print "Invalid Directory Hash Level.\n";
1543 print "Value must be an integer ranging from 0 to 4\n";
1544 print "Hit enter to continue.\n";
1545 $enter_key = <STDIN>;
1546
1547 $new_dir_hash_level = $dir_hash_level;
1548 }
1549
1550 return $new_dir_hash_level;
1551 }
1552
1553 sub command35 {
1554 print "This is the default size (in pixels) of the left folder list.\n";
1555 print "Default is 200, but you can set it to whatever you wish. This\n";
1556 print "is a user preference, so this will only show up as their default.\n";
1557 print "\n";
1558 print "[$WHT$default_left_size$NRM]: $WHT";
1559 $new_default_left_size = <STDIN>;
1560 if ( $new_default_left_size eq "\n" ) {
1561 $new_default_left_size = $default_left_size;
1562 } else {
1563 $new_default_left_size =~ s/[\r|\n]//g;
1564 }
1565 return $new_default_left_size;
1566 }
1567
1568 sub command36 {
1569 print "Some IMAP servers only have lowercase letters in the usernames\n";
1570 print "but they still allow people with uppercase to log in. This\n";
1571 print "causes a problem with the user's preference files. This option\n";
1572 print "transparently changes all usernames to lowercase.";
1573 print "\n";
1574
1575 if ( lc($force_username_lowercase) eq "true" ) {
1576 $default_value = "y";
1577 } else {
1578 $default_value = "n";
1579 }
1580 print "Convert usernames to lowercase (y/n) [$WHT$default_value$NRM]: $WHT";
1581 $new_show = <STDIN>;
1582 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1583 return "true";
1584 }
1585 return "false";
1586 }
1587
1588 sub command37 {
1589 print "";
1590 print "\n";
1591
1592 if ( lc($default_use_priority) eq "true" ) {
1593 $default_value = "y";
1594 } else {
1595 $default_value = "n";
1596 }
1597
1598 print "Allow users to specify priority of outgoing mail (y/n) [$WHT$default_value$NRM]: $WHT";
1599 $new_show = <STDIN>;
1600 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1601 return "true";
1602 }
1603 return "false";
1604 }
1605
1606 sub command38 {
1607 print "";
1608 print "\n";
1609
1610 if ( lc($default_hide_attribution) eq "true" ) {
1611 $default_value = "y";
1612 } else {
1613 $default_value = "n";
1614 }
1615
1616 print "Hide SM attributions (y/n) [$WHT$default_value$NRM]: $WHT";
1617 $new_show = <STDIN>;
1618 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1619 return "true";
1620 }
1621 return "false";
1622 }
1623
1624 sub command39 {
1625 print "";
1626 print "\n";
1627
1628 if ( lc($default_use_mdn) eq "true" ) {
1629 $default_value = "y";
1630 } else {
1631 $default_value = "n";
1632 }
1633
1634 print "Enable support for read/delivery receipt support (y/n) [$WHT$default_value$NRM]: $WHT";
1635 $new_show = <STDIN>;
1636 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1637 return "true";
1638 }
1639 return "false";
1640 }
1641
1642 sub command310 {
1643 print "This allows you to prevent the editing of the users name and";
1644 print "email address. This is mainly useful when used with the";
1645 print "retrieveuserdata plugin\n";
1646 print "\n";
1647
1648 if ( lc($edit_identity) eq "true" ) {
1649 $default_value = "y";
1650 } else {
1651 $default_value = "n";
1652 }
1653 print "Allow editing? (y/n) [$WHT$default_value$NRM]: $WHT";
1654 $new_edit = <STDIN>;
1655 if ( ( $new_edit =~ /^y\n/i ) || ( ( $new_edit =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1656 $edit_identity = "true";
1657 } else {
1658 $edit_identity = "false";
1659 }
1660 return $edit_identity;
1661 }
1662
1663 sub command311 {
1664 print "This option allows you to choose if the user can edit their full name";
1665 print "even when you don't want them to change their username\n";
1666 print "\n";
1667
1668 if ( lc($edit_name) eq "true" ) {
1669 $default_value = "y";
1670 } else {
1671 $default_value = "n";
1672 }
1673 print "Allow editing of the users full name? (y/n) [$WHT$default_value$NRM]: $WHT";
1674 $new_edit = <STDIN>;
1675 if ( ( $new_edit =~ /^y\n/i ) || ( ( $new_edit =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1676 $edit_name = "true";
1677 } else {
1678 $edit_name = "false";
1679 }
1680 return $edit_name;
1681 }
1682
1683 sub command312 {
1684 print "This option allows you to choose if users can use thread sorting\n";
1685 print "Your IMAP server must support the THREAD command for this to work\n";
1686 print "PHP versions later than 4.0.3 recommended\n";
1687 print "\n";
1688
1689 if ( lc($allow_thread_sort) eq "true" ) {
1690 $default_value = "y";
1691 } else {
1692 $default_value = "n";
1693 }
1694 print "Allow server side thread sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
1695 $allow_thread_sort = <STDIN>;
1696 if ( ( $allow_thread_sort =~ /^y\n/i ) || ( ( $allow_thread_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1697 $allow_thread_sort = "true";
1698 } else {
1699 $allow_thread_sort = "false";
1700 }
1701 return $allow_thread_sort;
1702 }
1703
1704 sub command313 {
1705 print "This option allows you to choose if SM uses server-side sorting\n";
1706 print "Your IMAP server must support the SORT command for this to work\n";
1707 print "\n";
1708
1709 if ( lc($allow_server_sort) eq "true" ) {
1710 $default_value = "y";
1711 } else {
1712 $default_value = "n";
1713 }
1714 print "Allow server-side sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
1715 $allow_server_sort = <STDIN>;
1716 if ( ( $allow_server_sort =~ /^y\n/i ) || ( ( $allow_server_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1717 $allow_server_sort = "true";
1718 } else {
1719 $allow_server_sort = "false";
1720 }
1721 return $allow_server_sort;
1722 }
1723
1724 sub command41 {
1725 print "\nNow we will define the themes that you wish to use. If you have added\n";
1726 print "a theme of your own, just follow the instructions (?) about how to add\n";
1727 print "them. You can also change the default theme.\n";
1728 print "[theme] command (?=help) > ";
1729 $input = <STDIN>;
1730 $input =~ s/[\r|\n]//g;
1731 while ( $input ne "d" ) {
1732 if ( $input =~ /^\s*l\s*/i ) {
1733 $count = 0;
1734 while ( $count <= $#theme_name ) {
1735 if ( $count == $theme_default ) {
1736 print " *";
1737 } else {
1738 print " ";
1739 }
1740 $name = $theme_name[$count];
1741 $num_spaces = 25 - length($name);
1742 for ( $i = 0 ; $i < $num_spaces ; $i++ ) {
1743 $name = $name . " ";
1744 }
1745
1746 print " $count. $name";
1747 print "($theme_path[$count])\n";
1748
1749 $count++;
1750 }
1751 } elsif ( $input =~ /^\s*m\s*[0-9]+/i ) {
1752 $old_def = $theme_default;
1753 $theme_default = $input;
1754 $theme_default =~ s/^\s*m\s*//;
1755 if ( ( $theme_default > $#theme_name ) || ( $theme_default < 0 ) ) {
1756 print "Cannot set default theme to $theme_default. That theme does not exist.\n";
1757 $theme_default = $old_def;
1758 }
1759 } elsif ( $input =~ /^\s*\+/ ) {
1760 print "What is the name of this theme: ";
1761 $name = <STDIN>;
1762 $name =~ s/[\r|\n]//g;
1763 $theme_name[ $#theme_name + 1 ] = $name;
1764 print "Be sure to put ../themes/ before the filename.\n";
1765 print "What file is this stored in (ex: ../themes/default_theme.php): ";
1766 $name = <STDIN>;
1767 $name =~ s/[\r|\n]//g;
1768 $theme_path[ $#theme_path + 1 ] = $name;
1769 } elsif ( $input =~ /^\s*-\s*[0-9]?/ ) {
1770 if ( $input =~ /[0-9]+\s*$/ ) {
1771 $rem_num = $input;
1772 $rem_num =~ s/^\s*-\s*//g;
1773 $rem_num =~ s/\s*$//;
1774 } else {
1775 $rem_num = $#theme_name;
1776 }
1777 if ( $rem_num == $theme_default ) {
1778 print "You cannot remove the default theme!\n";
1779 } else {
1780 $count = 0;
1781 @new_theme_name = ();
1782 @new_theme_path = ();
1783 while ( $count <= $#theme_name ) {
1784 if ( $count != $rem_num ) {
1785 @new_theme_name = ( @new_theme_name, $theme_name[$count] );
1786 @new_theme_path = ( @new_theme_path, $theme_path[$count] );
1787 }
1788 $count++;
1789 }
1790 @theme_name = @new_theme_name;
1791 @theme_path = @new_theme_path;
1792 if ( $theme_default > $rem_num ) {
1793 $theme_default--;
1794 }
1795 }
1796 } elsif ( $input =~ /^\s*t\s*/i ) {
1797 print "\nStarting detection...\n\n";
1798
1799 opendir( DIR, "../themes" );
1800 @files = grep { /\.php$/i } readdir(DIR);
1801 $cnt = 0;
1802 while ( $cnt <= $#files ) {
1803 $filename = "../themes/" . $files[$cnt];
1804 if ( $filename ne "../themes/index.php" ) {
1805 $found = 0;
1806 for ( $x = 0 ; $x <= $#theme_path ; $x++ ) {
1807 if ( $theme_path[$x] eq $filename ) {
1808 $found = 1;
1809 }
1810 }
1811 if ( $found != 1 ) {
1812 print "** Found theme: $filename\n";
1813 print " What is its name? ";
1814 $nm = <STDIN>;
1815 $nm =~ s/[\n|\r]//g;
1816 $theme_name[ $#theme_name + 1 ] = $nm;
1817 $theme_path[ $#theme_path + 1 ] = $filename;
1818 }
1819 }
1820 $cnt++;
1821 }
1822 print "\n";
1823 for ( $cnt = 0 ; $cnt <= $#theme_path ; $cnt++ ) {
1824 $filename = $theme_path[$cnt];
1825 if ( !( -e $filename ) ) {
1826 print " Removing $filename (file not found)\n";
1827 $offset = 0;
1828 @new_theme_name = ();
1829 @new_theme_path = ();
1830 for ( $x = 0 ; $x < $#theme_path ; $x++ ) {
1831 if ( $theme_path[$x] eq $filename ) {
1832 $offset = 1;
1833 }
1834 if ( $offset == 1 ) {
1835 $new_theme_name[$x] = $theme_name[ $x + 1 ];
1836 $new_theme_path[$x] = $theme_path[ $x + 1 ];
1837 } else {
1838 $new_theme_name[$x] = $theme_name[$x];
1839 $new_theme_path[$x] = $theme_path[$x];
1840 }
1841 }
1842 @theme_name = @new_theme_name;
1843 @theme_path = @new_theme_path;
1844 }
1845 }
1846 print "\nDetection complete!\n\n";
1847
1848 closedir DIR;
1849 } elsif ( $input =~ /^\s*\?\s*/ ) {
1850 print ".-------------------------.\n";
1851 print "| t (detect themes) |\n";
1852 print "| + (add theme) |\n";
1853 print "| - N (remove theme) |\n";
1854 print "| m N (mark default) |\n";
1855 print "| l (list themes) |\n";
1856 print "| d (done) |\n";
1857 print "`-------------------------'\n";
1858 }
1859 print "[theme] command (?=help) > ";
1860 $input = <STDIN>;
1861 $input =~ s/[\r|\n]//g;
1862 }
1863 }
1864
1865 # Theme - CSS file
1866 sub command42 {
1867 print "You may specify a cascading style-sheet (CSS) file to be included\n";
1868 print "on each html page generated by SquirrelMail. The CSS file is useful\n";
1869 print "for specifying a site-wide font. If you're not familiar with CSS\n";
1870 print "files, leave this blank.\n";
1871 print "\n";
1872 print "To clear out an existing value, just type a space for the input.\n";
1873 print "\n";
1874 print "[$WHT$theme_css$NRM]: $WHT";
1875 $new_theme_css = <STDIN>;
1876
1877 if ( $new_theme_css eq "\n" ) {
1878 $new_theme_css = $theme_css;
1879 } else {
1880 $new_theme_css =~ s/[\r|\n]//g;
1881 }
1882 $new_theme_css =~ s/^\s*//;
1883 return $new_theme_css;
1884 }
1885
1886 sub command61 {
1887 print "You can now define different LDAP servers.\n";
1888 print "[ldap] command (?=help) > ";
1889 $input = <STDIN>;
1890 $input =~ s/[\r|\n]//g;
1891 while ( $input ne "d" ) {
1892 if ( $input =~ /^\s*l\s*/i ) {
1893 $count = 0;
1894 while ( $count <= $#ldap_host ) {
1895 print "$count. $ldap_host[$count]\n";
1896 print " base: $ldap_base[$count]\n";
1897 if ( $ldap_charset[$count] ) {
1898 print " charset: $ldap_charset[$count]\n";
1899 }
1900 if ( $ldap_port[$count] ) {
1901 print " port: $ldap_port[$count]\n";
1902 }
1903 if ( $ldap_name[$count] ) {
1904 print " name: $ldap_name[$count]\n";
1905 }
1906 if ( $ldap_maxrows[$count] ) {
1907 print " maxrows: $ldap_maxrows[$count]\n";
1908 }
1909 print "\n";
1910 $count++;
1911 }
1912 } elsif ( $input =~ /^\s*\+/ ) {
1913 $sub = $#ldap_host + 1;
1914
1915 print "First, we need to have the hostname or the IP address where\n";
1916 print "this LDAP server resides. Example: ldap.bigfoot.com\n";
1917 print "hostname: ";
1918 $name = <STDIN>;
1919 $name =~ s/[\r|\n]//g;
1920 $ldap_host[$sub] = $name;
1921
1922 print "\n";
1923
1924 print "Next, we need the server root (base dn). For this, an empty\n";
1925 print "string is allowed.\n";
1926 print "Example: ou=member_directory,o=netcenter.com\n";
1927 print "base: ";
1928 $name = <STDIN>;
1929 $name =~ s/[\r|\n]//g;
1930 $ldap_base[$sub] = $name;
1931
1932 print "\n";
1933
1934 print "This is the TCP/IP port number for the LDAP server. Default\n";
1935 print "port is 389. This is optional. Press ENTER for default.\n";
1936 print "port: ";
1937 $name = <STDIN>;
1938 $name =~ s/[\r|\n]//g;
1939 $ldap_port[$sub] = $name;
1940
1941 print "\n";
1942
1943 print "This is the charset for the server. Default is utf-8. This\n";
1944 print "is also optional. Press ENTER for default.\n";
1945 print "charset: ";
1946 $name = <STDIN>;
1947 $name =~ s/[\r|\n]//g;
1948 $ldap_charset[$sub] = $name;
1949
1950 print "\n";
1951
1952 print "This is the name for the server, used to tag the results of\n";
1953 print "the search. Default it \"LDAP: hostname\". Press ENTER for default\n";
1954 print "name: ";
1955 $name = <STDIN>;
1956 $name =~ s/[\r|\n]//g;
1957 $ldap_name[$sub] = $name;
1958
1959 print "\n";
1960
1961 print "You can specify the maximum number of rows in the search result.\n";
1962 print "Default is unlimited. Press ENTER for default.\n";
1963 print "maxrows: ";
1964 $name = <STDIN>;
1965 $name =~ s/[\r|\n]//g;
1966 $ldap_maxrows[$sub] = $name;
1967
1968 print "\n";
1969
1970 } elsif ( $input =~ /^\s*-\s*[0-9]?/ ) {
1971 if ( $input =~ /[0-9]+\s*$/ ) {
1972 $rem_num = $input;
1973 $rem_num =~ s/^\s*-\s*//g;
1974 $rem_num =~ s/\s*$//;
1975 } else {
1976 $rem_num = $#ldap_host;
1977 }
1978 $count = 0;
1979 @new_ldap_host = ();
1980 @new_ldap_base = ();
1981 @new_ldap_port = ();
1982 @new_ldap_name = ();
1983 @new_ldap_charset = ();
1984 @new_ldap_maxrows = ();
1985
1986 while ( $count <= $#ldap_host ) {
1987 if ( $count != $rem_num ) {
1988 @new_ldap_host = ( @new_ldap_host, $ldap_host[$count] );
1989 @new_ldap_base = ( @new_ldap_base, $ldap_base[$count] );
1990 @new_ldap_port = ( @new_ldap_port, $ldap_port[$count] );
1991 @new_ldap_name = ( @new_ldap_name, $ldap_name[$count] );
1992 @new_ldap_charset = ( @new_ldap_charset, $ldap_charset[$count] );
1993 @new_ldap_maxrows = ( @new_ldap_maxrows, $ldap_maxrows[$count] );
1994 }
1995 $count++;
1996 }
1997 @ldap_host = @new_ldap_host;
1998 @ldap_base = @new_ldap_base;
1999 @ldap_port = @new_ldap_port;
2000 @ldap_name = @new_ldap_name;
2001 @ldap_charset = @new_ldap_charset;
2002 @ldap_maxrows = @new_ldap_maxrows;
2003 } elsif ( $input =~ /^\s*\?\s*/ ) {
2004 print ".-------------------------.\n";
2005 print "| + (add host) |\n";
2006 print "| - N (remove host) |\n";
2007 print "| l (list hosts) |\n";
2008 print "| d (done) |\n";
2009 print "`-------------------------'\n";
2010 }
2011 print "[ldap] command (?=help) > ";
2012 $input = <STDIN>;
2013 $input =~ s/[\r|\n]//g;
2014 }
2015 }
2016
2017 sub command62 {
2018 print "Some of our developers have come up with very good javascript interface\n";
2019 print "for searching through address books, however, our original goals said\n";
2020 print "that we would be 100% HTML. In order to make it possible to use their\n";
2021 print "interface, and yet stick with our goals, we have also written a plain\n";
2022 print "HTML version of the search. Here, you can choose which version to use.\n";
2023 print "\n";
2024 print "This is just the default value. It is also a user option that each\n";
2025 print "user can configure individually\n";
2026 print "\n";
2027
2028 if ( lc($default_use_javascript_addr_book) eq "true" ) {
2029 $default_value = "y";
2030 } else {
2031 $default_use_javascript_addr_book = "false";
2032 $default_value = "n";
2033 }
2034 print "Use javascript version by default (y/n) [$WHT$default_value$NRM]: $WHT";
2035 $new_show = <STDIN>;
2036 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2037 $default_use_javascript_addr_book = "true";
2038 } else {
2039 $default_use_javascript_addr_book = "false";
2040 }
2041 return $default_use_javascript_addr_book;
2042 }
2043
2044 sub command91 {
2045 print "If you want to store your users address book details in a database then\n";
2046 print "you need to set this DSN to a valid value. The format for this is:\n";
2047 print "mysql://user:pass\@hostname/dbname\n";
2048 print "Where mysql can be one of the databases PHP supports, the most common\n";
2049 print "of these are mysql, msql and pgsql\n";
2050 print "If the DSN is left empty (hit space and then return) the database\n";
2051 print "related code for address books will not be used\n";
2052 print "\n";
2053
2054 if ( $addrbook_dsn eq "" ) {
2055 $default_value = "Disabled";
2056 } else {
2057 $default_value = $addrbook_dsn;
2058 }
2059 print "[$WHT$addrbook_dsn$NRM]: $WHT";
2060 $new_dsn = <STDIN>;
2061 if ( $new_dsn eq "\n" ) {
2062 $new_dsn = "";
2063 } else {
2064 $new_dsn =~ s/[\r|\n]//g;
2065 $new_dsn =~ s/^\s+$//g;
2066 }
2067 return $new_dsn;
2068 }
2069
2070 sub command92 {
2071 print "This is the name of the table you want to store the address book\n";
2072 print "data in, it defaults to 'address'\n";
2073 print "\n";
2074 print "[$WHT$addrbook_table$NRM]: $WHT";
2075 $new_table = <STDIN>;
2076 if ( $new_table eq "\n" ) {
2077 $new_table = $addrbook_table;
2078 } else {
2079 $new_table =~ s/[\r|\n]//g;
2080 }
2081 return $new_table;
2082 }
2083
2084 sub command93 {
2085 print "If you want to store your users preferences in a database then\n";
2086 print "you need to set this DSN to a valid value. The format for this is:\n";
2087 print "mysql://user:pass\@hostname/dbname\n";
2088 print "Where mysql can be one of the databases PHP supports, the most common\n";
2089 print "of these are mysql, msql and pgsql\n";
2090 print "If the DSN is left empty (hit space and then return) the database\n";
2091 print "related code for address books will not be used\n";
2092 print "\n";
2093
2094 if ( $prefs_dsn eq "" ) {
2095 $default_value = "Disabled";
2096 } else {
2097 $default_value = $prefs_dsn;
2098 }
2099 print "[$WHT$prefs_dsn$NRM]: $WHT";
2100 $new_dsn = <STDIN>;
2101 if ( $new_dsn eq "\n" ) {
2102 $new_dsn = "";
2103 } else {
2104 $new_dsn =~ s/[\r|\n]//g;
2105 $new_dsn =~ s/^\s+$//g;
2106 }
2107 return $new_dsn;
2108 }
2109
2110 sub command94 {
2111 print "This is the name of the table you want to store the preferences\n";
2112 print "data in, it defaults to 'userprefs'\n";
2113 print "\n";
2114 print "[$WHT$prefs_table$NRM]: $WHT";
2115 $new_table = <STDIN>;
2116 if ( $new_table eq "\n" ) {
2117 $new_table = $prefs_table;
2118 } else {
2119 $new_table =~ s/[\r|\n]//g;
2120 }
2121 return $new_table;
2122 }
2123
2124 sub command95 {
2125 print "This is the name of the field in which you want to store the\n";
2126 print "username of the person the prefs are for. It default to 'user'\n";
2127 print "which clashes with a reserved keyword in PostgreSQL so this\n";
2128 print "will need to be changed for that database at least\n";
2129 print "\n";
2130 print "[$WHT$prefs_user_field$NRM]: $WHT";
2131 $new_field = <STDIN>;
2132 if ( $new_field eq "\n" ) {
2133 $new_field = $prefs_user_field;
2134 } else {
2135 $new_field =~ s/[\r|\n]//g;
2136 }
2137 return $new_field;
2138 }
2139
2140 sub command96 {
2141 print "This is the name of the field in which you want to store the\n";
2142 print "preferences keyword. It defaults to 'prefkey'\n";
2143 print "\n";
2144 print "[$WHT$prefs_key_field$NRM]: $WHT";
2145 $new_field = <STDIN>;
2146 if ( $new_field eq "\n" ) {
2147 $new_field = $prefs_key_field;
2148 } else {
2149 $new_field =~ s/[\r|\n]//g;
2150 }
2151 return $new_field;
2152 }
2153
2154 sub command97 {
2155 print "This is the name of the field in which you want to store the\n";
2156 print "preferences value. It defaults to 'prefval'\n";
2157 print "\n";
2158 print "[$WHT$prefs_val_field$NRM]: $WHT";
2159 $new_field = <STDIN>;
2160 if ( $new_field eq "\n" ) {
2161 $new_field = $prefs_val_field;
2162 } else {
2163 $new_field =~ s/[\r|\n]//g;
2164 }
2165 return $new_field;
2166 }
2167
2168 sub save_data {
2169 $tab = " ";
2170 if ( open( CF, ">config.php" ) ) {
2171 print CF "<?php\n";
2172 print CF "\n";
2173
2174 print CF "/**\n";
2175 print CF " * SquirrelMail Configuration File\n";
2176 print CF " * Created using the configure script, conf.pl\n";
2177 print CF " */\n";
2178 print CF "\n";
2179
2180 if ($print_config_version) {
2181 print CF "\$config_version = '$print_config_version';\n";
2182 }
2183 print CF "\$config_use_color = $config_use_color;\n";
2184 print CF "\n";
2185
2186 print CF "\$org_name = \"$org_name\";\n";
2187 print CF "\$org_logo = '$org_logo';\n";
2188 $org_logo_width |= 0;
2189 $org_logo_height |= 0;
2190 print CF "\$org_logo_width = $org_logo_width;\n";
2191 print CF "\$org_logo_height = $org_logo_height;\n";
2192 print CF "\$org_title = \"$org_title\";\n";
2193 print CF "\$signout_page = '$signout_page';\n";
2194 print CF "\$frame_top = '$frame_top';\n";
2195 print CF "\n";
2196
2197 print CF "\$motd = '$motd';\n";
2198 print CF "\n";
2199
2200 print CF "\$squirrelmail_default_language = '$squirrelmail_default_language';\n";
2201 print CF "\n";
2202
2203 print CF "\$domain = '$domain';\n";
2204 print CF "\$imapServerAddress = '$imapServerAddress';\n";
2205 print CF "\$imapPort = $imapPort;\n";
2206 print CF "\$useSendmail = $useSendmail;\n";
2207 print CF "\$smtpServerAddress = '$smtpServerAddress';\n";
2208 print CF "\$smtpPort = $smtpPort;\n";
2209 print CF "\$sendmail_path = '$sendmail_path';\n";
2210 print CF "\$use_authenticated_smtp = $use_authenticated_smtp;\n";
2211 print CF "\$imap_server_type = '$imap_server_type';\n";
2212 print CF "\$invert_time = $invert_time;\n";
2213 print CF "\$optional_delimiter = '$optional_delimiter';\n";
2214 print CF "\n";
2215
2216 print CF "\$default_folder_prefix = '$default_folder_prefix';\n";
2217 print CF "\$trash_folder = '$trash_folder';\n";
2218 print CF "\$sent_folder = '$sent_folder';\n";
2219 print CF "\$draft_folder = '$draft_folder';\n";
2220 print CF "\$default_move_to_trash = $default_move_to_trash;\n";
2221 print CF "\$default_move_to_sent = $default_move_to_sent;\n";
2222 print CF "\$default_save_as_draft = $default_save_as_draft;\n";
2223 print CF "\$show_prefix_option = $show_prefix_option;\n";
2224 print CF "\$list_special_folders_first = $list_special_folders_first;\n";
2225 print CF "\$use_special_folder_color = $use_special_folder_color;\n";
2226 print CF "\$auto_expunge = $auto_expunge;\n";
2227 print CF "\$default_sub_of_inbox = $default_sub_of_inbox;\n";
2228 print CF "\$show_contain_subfolders_option = $show_contain_subfolders_option;\n";
2229 print CF "\$default_unseen_notify = $default_unseen_notify;\n";
2230 print CF "\$default_unseen_type = $default_unseen_type;\n";
2231 print CF "\$auto_create_special = $auto_create_special;\n";
2232 print CF "\$delete_folder = $delete_folder;\n";
2233 print CF "\n";
2234
2235 print CF "\$default_charset = '$default_charset';\n";
2236 print CF "\$data_dir = '$data_dir';\n";
2237 print CF "\$attachment_dir = \"$attachment_dir\";\n";
2238 print CF "\$dir_hash_level = $dir_hash_level;\n";
2239 print CF "\$default_left_size = $default_left_size;\n";
2240 print CF "\$force_username_lowercase = $force_username_lowercase;\n";
2241 print CF "\$default_use_priority = $default_use_priority;\n";
2242 print CF "\$hide_sm_attributions = $hide_sm_attributions;\n";
2243 print CF "\$default_use_mdn = $default_use_mdn;\n";
2244 print CF "\$edit_identity = $edit_identity;\n";
2245 print CF "\$edit_name = $edit_name;\n";
2246 print CF "\$allow_thread_sort = $allow_thread_sort;\n";
2247 print CF "\$allow_server_sort = $allow_server_sort;\n";
2248 print CF "\n";
2249
2250 for ( $ct = 0 ; $ct <= $#plugins ; $ct++ ) {
2251 print CF "\$plugins[$ct] = '$plugins[$ct]';\n";
2252 }
2253 print CF "\n";
2254
2255 print CF "\$theme_css = '$theme_css';\n";
2256 for ( $count = 0 ; $count <= $#theme_name ; $count++ ) {
2257 print CF "\$theme[$count]['PATH'] = '$theme_path[$count]';\n";
2258 print CF "\$theme[$count]['NAME'] = '$theme_name[$count]';\n";
2259 }
2260 print CF "\n";
2261
2262 if ( $default_use_javascript_addr_book ne "true" ) {
2263 $default_use_javascript_addr_book = "false";
2264 }
2265 print CF "\$default_use_javascript_addr_book = $default_use_javascript_addr_book;\n";
2266 for ( $count = 0 ; $count <= $#ldap_host ; $count++ ) {
2267 print CF "\$ldap_server[$count] = array(\n";
2268 print CF " 'host' => '$ldap_host[$count]',\n";
2269 print CF " 'base' => '$ldap_base[$count]'";
2270 if ( $ldap_name[$count] ) {
2271 print CF ",\n";
2272 print CF " 'name' => '$ldap_name[$count]'";
2273 }
2274 if ( $ldap_port[$count] ) {
2275 print CF ",\n";
2276 print CF " 'port' => '$ldap_port[$count]'";
2277 }
2278 if ( $ldap_charset[$count] ) {
2279 print CF ",\n";
2280 print CF " 'charset' => '$ldap_charset[$count]'";
2281 }
2282 if ( $ldap_maxrows[$count] ) {
2283 print CF ",\n";
2284 print CF " 'maxrows' => '$ldap_maxrows[$count]'";
2285 }
2286 print CF "\n";
2287 print CF ");\n";
2288 print CF "\n";
2289 }
2290
2291 print CF "\$addrbook_dsn = '$addrbook_dsn';\n";
2292 print CF "\$addrbook_table = '$addrbook_table';\n\n";
2293 print CF "\$prefs_dsn = '$prefs_dsn';\n";
2294 print CF "\$prefs_table = '$prefs_table';\n";
2295 print CF "\$prefs_user_field = '$prefs_user_field';\n";
2296 print CF "\$prefs_key_field = '$prefs_key_field';\n";
2297 print CF "\$prefs_val_field = '$prefs_val_field';\n";
2298 print CF "\n";
2299
2300 print CF "/**\n";
2301 print CF " * Make sure there are no characters after the PHP closing\n";
2302 print CF " * tag below (including newline characters and whitespace).\n";
2303 print CF " * Otherwise, that character will cause the headers to be\n";
2304 print CF " * sent and regular output to begin, which will majorly screw\n";
2305 print CF " * things up when we try to send more headers later.\n";
2306 print CF " */\n";
2307 print CF "?>";
2308
2309 close CF;
2310
2311 print "Data saved in config.php\n";
2312 } else {
2313 print "Error saving config.php: $!\n";
2314 }
2315 }
2316
2317 sub set_defaults {
2318 system "clear";
2319 print $WHT. "SquirrelMail Configuration : " . $NRM;
2320 if ( $config == 1 ) { print "Read: config.php"; }
2321 elsif ( $config == 2 ) { print "Read: config_default.php"; }
2322 print "\n";
2323 print "---------------------------------------------------------\n";
2324
2325 print "While we have been building SquirrelMail, we have discovered some\n";
2326 print "preferences that work better with some servers that don't work so\n";
2327 print "well with others. If you select your IMAP server, this option will\n";
2328 print "set some pre-defined settings for that server.\n";
2329 print "\n";
2330 print "Please note that you will still need to go through and make sure\n";
2331 print "everything is correct. This does not change everything. There are\n";
2332 print "only a few settings that this will change.\n";
2333 print "\n";
2334
2335 $continue = 0;
2336 while ( $continue != 1 ) {
2337 print "Please select your IMAP server:\n";
2338 print " cyrus = Cyrus IMAP server\n";
2339 print " uw = University of Washington's IMAP server\n";
2340 print " exchange = Microsoft Exchange IMAP server\n";
2341 print " courier = Courier IMAP server\n";
2342 print " quit = Do not change anything\n";
2343 print "Command >> ";
2344 $server = <STDIN>;
2345 $server =~ s/[\r|\n]//g;
2346
2347 print "\n";
2348 if ( $server eq "cyrus" ) {
2349 $imap_server_type = "cyrus";
2350 $default_folder_prefix = "";
2351 $trash_folder = "INBOX.Trash";
2352 $sent_folder = "INBOX.Sent";
2353 $draft_folder = "INBOX.Drafts";
2354 $show_prefix_option = false;
2355 $default_sub_of_inbox = true;
2356 $show_contain_subfolders_option = false;
2357 $optional_delimiter = ".";
2358 $disp_default_folder_prefix = "<none>";
2359
2360 $continue = 1;
2361 } elsif ( $server eq "uw" ) {
2362 $imap_server_type = "uw";
2363 $default_folder_prefix = "mail/";
2364 $trash_folder = "Trash";
2365 $sent_folder = "Sent";
2366 $draft_folder = "Drafts";
2367 $show_prefix_option = true;
2368 $default_sub_of_inbox = false;
2369 $show_contain_subfolders_option = true;
2370 $optional_delimiter = "/";
2371 $disp_default_folder_prefix = $default_folder_prefix;
2372
2373 $continue = 1;
2374 } elsif ( $server eq "exchange" ) {
2375 $imap_server_type = "exchange";
2376 $default_folder_prefix = "";
2377 $default_sub_of_inbox = true;
2378 $trash_folder = "INBOX/Deleted Items";
2379 $sent_folder = "INBOX/Sent Items";
2380 $drafts_folder = "INBOX/Drafts";
2381 $show_prefix_option = false;
2382 $show_contain_subfolders_option = false;
2383 $optional_delimiter = "detect";
2384 $disp_default_folder_prefix = "<none>";
2385
2386 $continue = 1;
2387 } elsif ( $server eq "courier" ) {
2388 $imap_server_type = "courier";
2389 $default_folder_prefix = "INBOX.";
2390 $trash_folder = "Trash";
2391 $sent_folder = "Sent";
2392 $draft_folder = "Drafts";
2393 $show_prefix_option = false;
2394 $default_sub_of_inbox = false;
2395 $show_contain_subfolders_option = false;
2396 $optional_delimiter = ".";
2397 $disp_default_folder_prefix = $default_folder_prefix;
2398
2399 $continue = 1;
2400 } elsif ( $server eq "quit" ) {
2401 $continue = 1;
2402 } else {
2403 $disp_default_folder_prefix = $default_folder_prefix;
2404 print "Unrecognized server: $server\n";
2405 print "\n";
2406 }
2407
2408 print " imap_server_type = $imap_server_type\n";
2409 print " default_folder_prefix = $disp_default_folder_prefix\n";
2410 print " trash_folder = $trash_folder\n";
2411 print " sent_folder = $sent_folder\n";
2412 print " draft_folder = $draft_folder\n";
2413 print " show_prefix_option = $show_prefix_option\n";
2414 print " default_sub_of_inbox = $default_sub_of_inbox\n";
2415 print "show_contain_subfolders_option = $show_contain_subfolders_option\n";
2416 print " optional_delimiter = $optional_delimiter\n";
2417 }
2418 print "\nPress any key to continue...";
2419 $tmp = <STDIN>;
2420 }