me bad. loose but lossy.
[squirrelmail.git] / config / conf.pl
1 #!/usr/bin/env perl
2 # conf.pl
3 #
4 # Copyright (c) 1999-2003 The SquirrelMail Project Team
5 # Licensed under the GNU GPL. For full terms see COPYING.
6 #
7 # A simple configure script to configure SquirrelMail
8 #
9 # $Id$
10 ############################################################
11 $conf_pl_version = "1.4.0";
12
13 ############################################################
14 # Check what directory we're supposed to be running in, and
15 # change there if necessary. File::Basename has been in
16 # Perl since at least 5.003_7, and nobody sane runs anything
17 # before that, but just in case.
18 ############################################################
19 my $dir;
20 if ( eval q{require "File/Basename.pm"} ) {
21 $dir = File::Basename::dirname($0);
22 chdir($dir);
23 }
24
25 ############################################################
26 # Some people try to run this as a CGI. That's wrong!
27 ############################################################
28 if ( defined( $ENV{'PATH_INFO'} )
29 || defined( $ENV{'QUERY_STRING'} )
30 || defined( $ENV{'REQUEST_METHOD'} ) ) {
31 print "Content-Type: text/html\n\n";
32 print "You must run this script from the command line.";
33 exit;
34 }
35
36 ############################################################
37 # If we got here, use Cwd to get the full directory path
38 # (the Basename stuff above will sometimes return '.' as
39 # the base directory, which is not helpful here).
40 ############################################################
41 use Cwd;
42 $dir = cwd();
43
44
45 ############################################################
46 # First, lets read in the data already in there...
47 ############################################################
48 if ( -e "config.php" ) {
49 open( FILE, "config.php" );
50 while ( $line = <FILE> ) {
51 $line =~ s/^\s+//;
52 $line =~ s/^\$//;
53 $var = $line;
54
55 $var =~ s/=/EQUALS/;
56 if ( $var =~ /^([a-z])/i ) {
57 @o = split ( /\s*EQUALS\s*/, $var );
58 if ( $o[0] eq "config_version" ) {
59 $o[1] =~ s/[\n\r]//g;
60 $o[1] =~ s/[\'\"];\s*$//;
61 $o[1] =~ s/;$//;
62 $o[1] =~ s/^[\'\"]//;
63
64 $config_version = $o[1];
65 close(FILE);
66 }
67 }
68 }
69 close(FILE);
70
71 if ( $config_version ne $conf_pl_version ) {
72 clear_screen();
73 print $WHT. "WARNING:\n" . $NRM;
74 print " The file \"config/config.php\" was found, but it is for\n";
75 print " an older version of SquirrelMail. It is possible to still\n";
76 print " read the defaults from this file but be warned that many\n";
77 print " preferences change between versions. It is recommended that\n";
78 print " you start with a clean config.php for each upgrade that you\n";
79 print " do. To do this, just move config/config.php out of the way.\n";
80 print "\n";
81 print "Continue loading with the old config.php [y/N]? ";
82 $ctu = <STDIN>;
83
84 if ( ( $ctu !~ /^y\n/i ) || ( $ctu =~ /^\n/ ) ) {
85 exit;
86 }
87
88 print "\nDo you want me to stop warning you [y/N]? ";
89 $ctu = <STDIN>;
90 if ( $ctu =~ /^y\n/i ) {
91 $print_config_version = $conf_pl_version;
92 } else {
93 $print_config_version = $config_version;
94 }
95 } else {
96 $print_config_version = $config_version;
97 }
98
99 $config = 1;
100 open( FILE, "config.php" );
101 } elsif ( -e "config_default.php" ) {
102 open( FILE, "config_default.php" );
103 while ( $line = <FILE> ) {
104 $line =~ s/^\s+//;
105 $line =~ s/^\$//;
106 $var = $line;
107
108 $var =~ s/=/EQUALS/;
109 if ( $var =~ /^([a-z])/i ) {
110 @o = split ( /\s*EQUALS\s*/, $var );
111 if ( $o[0] eq "config_version" ) {
112 $o[1] =~ s/[\n\r]//g;
113 $o[1] =~ s/[\'\"];\s*$//;
114 $o[1] =~ s/;$//;
115 $o[1] =~ s/^[\'\"]//;
116
117 $config_version = $o[1];
118 close(FILE);
119 }
120 }
121 }
122 close(FILE);
123
124 if ( $config_version ne $conf_pl_version ) {
125 clear_screen();
126 print $WHT. "WARNING:\n" . $NRM;
127 print " You are trying to use a 'config_default.php' from an older\n";
128 print " version of SquirrelMail. This is HIGHLY unrecommended. You\n";
129 print " should get the 'config_default.php' that matches the version\n";
130 print " of SquirrelMail that you are running. You can get this from\n";
131 print " the SquirrelMail web page by going to the following URL:\n";
132 print " http://www.squirrelmail.org.\n";
133 print "\n";
134 print "Continue loading with old config_default.php (a bad idea) [y/N]? ";
135 $ctu = <STDIN>;
136
137 if ( ( $ctu !~ /^y\n/i ) || ( $ctu =~ /^\n/ ) ) {
138 exit;
139 }
140
141 print "\nDo you want me to stop warning you [y/N]? ";
142 $ctu = <STDIN>;
143 if ( $ctu =~ /^y\n/i ) {
144 $print_config_version = $conf_pl_version;
145 } else {
146 $print_config_version = $config_version;
147 }
148 } else {
149 $print_config_version = $config_version;
150 }
151 $config = 2;
152 open( FILE, "config_default.php" );
153 } else {
154 print "No configuration file found. Please get config_default.php\n";
155 print "or config.php before running this again. This program needs\n";
156 print "a default config file to get default values.\n";
157 exit;
158 }
159
160 # Read and parse the current configuration file
161 # (either config.php or config_default.php).
162 while ( $line = <FILE> ) {
163 $line =~ s/^\s+//;
164 $line =~ s/^\$//;
165 $var = $line;
166
167 $var =~ s/=/EQUALS/;
168 if ( $var =~ /^([a-z])/i ) {
169 @options = split ( /\s*EQUALS\s*/, $var );
170 $options[1] =~ s/[\n\r]//g;
171 $options[1] =~ s/[\'\"];\s*$//;
172 $options[1] =~ s/;$//;
173 $options[1] =~ s/^[\'\"]//;
174 # de-escape escaped strings
175 $options[1] =~ s/\\'/'/g;
176 $options[1] =~ s/\\\\/\\/g;
177
178 if ( $options[0] =~ /^theme\[[0-9]+\]\[['"]PATH['"]\]/ ) {
179 $sub = $options[0];
180 $sub =~ s/\]\[['"]PATH['"]\]//;
181 $sub =~ s/.*\[//;
182 if ( -e "../themes" ) {
183 $options[1] =~ s/^\.\.\/config/\.\.\/themes/;
184 }
185 $theme_path[$sub] = &change_to_rel_path($options[1]);
186 } elsif ( $options[0] =~ /^theme\[[0-9]+\]\[['"]NAME['"]\]/ ) {
187 $sub = $options[0];
188 $sub =~ s/\]\[['"]NAME['"]\]//;
189 $sub =~ s/.*\[//;
190 $theme_name[$sub] = $options[1];
191 } elsif ( $options[0] =~ /^plugins\[[0-9]+\]/ ) {
192 $sub = $options[0];
193 $sub =~ s/\]//;
194 $sub =~ s/^plugins\[//;
195 $plugins[$sub] = $options[1];
196 } elsif ( $options[0] =~ /^ldap_server\[[0-9]+\]/ ) {
197 $sub = $options[0];
198 $sub =~ s/\]//;
199 $sub =~ s/^ldap_server\[//;
200 $continue = 0;
201 while ( ( $tmp = <FILE> ) && ( $continue != 1 ) ) {
202 if ( $tmp =~ /\);\s*$/ ) {
203 $continue = 1;
204 }
205
206 if ( $tmp =~ /^\s*[\'\"]host[\'\"]/i ) {
207 $tmp =~ s/^\s*[\'\"]host[\'\"]\s*=>\s*[\'\"]//i;
208 $tmp =~ s/[\'\"],?\s*$//;
209 $tmp =~ s/[\'\"]\);\s*$//;
210 $host = $tmp;
211 } elsif ( $tmp =~ /^\s*[\'\"]base[\'\"]/i ) {
212 $tmp =~ s/^\s*[\'\"]base[\'\"]\s*=>\s*[\'\"]//i;
213 $tmp =~ s/[\'\"],?\s*$//;
214 $tmp =~ s/[\'\"]\);\s*$//;
215 $base = $tmp;
216 } elsif ( $tmp =~ /^\s*[\'\"]charset[\'\"]/i ) {
217 $tmp =~ s/^\s*[\'\"]charset[\'\"]\s*=>\s*[\'\"]//i;
218 $tmp =~ s/[\'\"],?\s*$//;
219 $tmp =~ s/[\'\"]\);\s*$//;
220 $charset = $tmp;
221 } elsif ( $tmp =~ /^\s*[\'\"]port[\'\"]/i ) {
222 $tmp =~ s/^\s*[\'\"]port[\'\"]\s*=>\s*[\'\"]?//i;
223 $tmp =~ s/[\'\"]?,?\s*$//;
224 $tmp =~ s/[\'\"]?\);\s*$//;
225 $port = $tmp;
226 } elsif ( $tmp =~ /^\s*[\'\"]maxrows[\'\"]/i ) {
227 $tmp =~ s/^\s*[\'\"]maxrows[\'\"]\s*=>\s*[\'\"]?//i;
228 $tmp =~ s/[\'\"]?,?\s*$//;
229 $tmp =~ s/[\'\"]?\);\s*$//;
230 $maxrows = $tmp;
231 } elsif ( $tmp =~ /^\s*[\'\"]name[\'\"]/i ) {
232 $tmp =~ s/^\s*[\'\"]name[\'\"]\s*=>\s*[\'\"]//i;
233 $tmp =~ s/[\'\"],?\s*$//;
234 $tmp =~ s/[\'\"]\);\s*$//;
235 $name = $tmp;
236 } elsif ( $tmp =~ /^\s*[\'\"]binddn[\'\"]/i ) {
237 $tmp =~ s/^\s*[\'\"]binddn[\'\"]\s*=>\s*[\'\"]//i;
238 $tmp =~ s/[\'\"],?\s*$//;
239 $tmp =~ s/[\'\"]\);\s*$//;
240 $binddn = $tmp;
241 } elsif ( $tmp =~ /^\s*[\'\"]bindpw[\'\"]/i ) {
242 $tmp =~ s/^\s*[\'\"]bindpw[\'\"]\s*=>\s*[\'\"]//i;
243 $tmp =~ s/[\'\"],?\s*$//;
244 $tmp =~ s/[\'\"]\);\s*$//;
245 $bindpw = $tmp;
246 } elsif ( $tmp =~ /^\s*[\'\"]protocol[\'\"]/i ) {
247 $tmp =~ s/^\s*[\'\"]protocol[\'\"]\s*=>\s*[\'\"]?//i;
248 $tmp =~ s/[\'\"]?,?\s*$//;
249 $tmp =~ s/[\'\"]?\);\s*$//;
250 $protocol = $tmp;
251 }
252 }
253 $ldap_host[$sub] = $host;
254 $ldap_base[$sub] = $base;
255 $ldap_name[$sub] = $name;
256 $ldap_port[$sub] = $port;
257 $ldap_maxrows[$sub] = $maxrows;
258 $ldap_charset[$sub] = $charset;
259 $ldap_binddn[$sub] = $binddn;
260 $ldap_bindpw[$sub] = $bindpw;
261 $ldap_protocol[$sub] = $protocol;
262 } elsif ( $options[0] =~ /^(data_dir|attachment_dir|theme_css|org_logo|signout_page)$/ ) {
263 ${ $options[0] } = &change_to_rel_path($options[1]);
264 } else {
265 ${ $options[0] } = $options[1];
266 }
267 }
268 }
269 close FILE;
270
271 $useSendmail = 'false' if ( lc($useSendmail) ne 'true' );
272 $sendmail_path = "/usr/sbin/sendmail" if ( !$sendmail_path );
273 $pop_before_smtp = 'false' if ( !$pop_before_smtp );
274 $default_unseen_notify = 2 if ( !$default_unseen_notify );
275 $default_unseen_type = 1 if ( !$default_unseen_type );
276 $config_use_color = 0 if ( !$config_use_color );
277 $invert_time = 'false' if ( !$invert_time );
278 $force_username_lowercase = 'false' if ( !$force_username_lowercase );
279 $optional_delimiter = "detect" if ( !$optional_delimiter );
280 $auto_create_special = 'false' if ( !$auto_create_special );
281 $default_use_priority = 'true' if ( !$default_use_priority );
282 $hide_sm_attributions = 'false' if ( !$hide_sm_attributions );
283 $default_use_mdn = 'true' if ( !$default_use_mdn );
284 $delete_folder = 'false' if ( !$delete_folder );
285 $noselect_fix_enable = 'false' if ( !$noselect_fix_enable );
286 $frame_top = "_top" if ( !$frame_top );
287 $provider_uri = '' if ( !$provider_uri );
288 $provider_name = '' if ( !$provider_name );
289 $edit_identity = 'true' if ( !$edit_identity );
290 $edit_name = 'true' if ( !$edit_name );
291 $allow_thread_sort = 'false' if ( !$allow_thread_sort );
292 $allow_server_sort = 'false' if ( !$allow_server_sort );
293 $no_list_for_subscribe = 'false' if ( !$no_list_for_subscribe );
294 $allow_charset_search = 'true' if ( !$allow_charset_search );
295 $allow_advanced_search = 0 if ( !$allow_advanced_search) ;
296 $prefs_user_field = 'user' if ( !$prefs_user_field );
297 $prefs_key_field = 'prefkey' if ( !$prefs_key_field );
298 $prefs_val_field = 'prefval' if ( !$prefs_val_field );
299 $addrbook_global_table = 'global_abook' if ( !$addrbook_global_table );
300 $addrbook_global_writeable = 'false' if ( !$addrbook_global_writeable );
301 $addrbook_global_listing = 'false' if ( !$addrbook_global_listing );
302 $use_smtp_tls= 'false' if ( !$use_smtp_tls);
303 $smtp_auth_mech = 'none' if ( !$smtp_auth_mech );
304 $use_imap_tls = 'false' if ( !$use_imap_tls );
305 $imap_auth_mech = 'login' if ( !$imap_auth_mech );
306 $session_name = 'SQMSESSID' if ( !$session_name );
307 $show_alternative_names = 'false' if ( !$show_alternative_names );
308 $available_languages = 'all' if ( !$available_languages );
309 $aggressive_decoding = 'false' if ( !$aggressive_decoding );
310 $lossy_encoding = 'false' if ( !$lossy_encoding );
311 $advanced_tree = 'false' if ( !$advanced_tree );
312 $oldway = 'false' if ( !$oldway );
313 $use_icons = 'false' if ( !$use_icons );
314 $use_php_recode = 'false' if ( !$use_php_recode );
315 $use_php_iconv = 'false' if ( !$use_php_iconv );
316 $skip_SM_header = 'false' if ( !$skip_SM_header );
317
318 if ( $ARGV[0] eq '--install-plugin' ) {
319 print "Activating plugin " . $ARGV[1] . "\n";
320 push @plugins, $ARGV[1];
321 save_data();
322 exit(0);
323 } elsif ( $ARGV[0] eq '--remove-plugin' ) {
324 print "Removing plugin " . $ARGV[1] . "\n";
325 foreach $plugin (@plugins) {
326 if ( $plugin ne $ARGV[1] ) {
327 push @newplugins, $plugin;
328 }
329 }
330 @plugins = @newplugins;
331 save_data();
332 exit(0);
333 }
334
335 #####################################################################################
336 if ( $config_use_color == 1 ) {
337 $WHT = "\x1B[37;1m";
338 $NRM = "\x1B[0m";
339 } else {
340 $WHT = "";
341 $NRM = "";
342 $config_use_color = 2;
343 }
344
345 while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
346 clear_screen();
347 print $WHT. "SquirrelMail Configuration : " . $NRM;
348 if ( $config == 1 ) { print "Read: config.php"; }
349 elsif ( $config == 2 ) { print "Read: config_default.php"; }
350 print " ($print_config_version)\n";
351 print "---------------------------------------------------------\n";
352
353 if ( $menu == 0 ) {
354 print $WHT. "Main Menu --\n" . $NRM;
355 print "1. Organization Preferences\n";
356 print "2. Server Settings\n";
357 print "3. Folder Defaults\n";
358 print "4. General Options\n";
359 print "5. Themes\n";
360 print "6. Address Books (LDAP)\n";
361 print "7. Message of the Day (MOTD)\n";
362 print "8. Plugins\n";
363 print "9. Database\n";
364 print "10. Language settings\n";
365 print "11. Tweaks\n";
366 print "\n";
367 print "D. Set pre-defined settings for specific IMAP servers\n";
368 print "\n";
369 } elsif ( $menu == 1 ) {
370 print $WHT. "Organization Preferences\n" . $NRM;
371 print "1. Organization Name : $WHT$org_name$NRM\n";
372 print "2. Organization Logo : $WHT$org_logo$NRM\n";
373 print "3. Org. Logo Width/Height : $WHT($org_logo_width/$org_logo_height)$NRM\n";
374 print "4. Organization Title : $WHT$org_title$NRM\n";
375 print "5. Signout Page : $WHT$signout_page$NRM\n";
376 print "6. Top Frame : $WHT$frame_top$NRM\n";
377 print "7. Provider link : $WHT$provider_uri$NRM\n";
378 print "8. Provider name : $WHT$provider_name$NRM\n";
379
380 print "\n";
381 print "R Return to Main Menu\n";
382 } elsif ( $menu == 2 ) {
383 print $WHT. "Server Settings\n\n" . $NRM;
384 print $WHT . "General" . $NRM . "\n";
385 print "-------\n";
386 print "1. Domain : $WHT$domain$NRM\n";
387 print "2. Invert Time : $WHT$invert_time$NRM\n";
388 print "3. Sendmail or SMTP : $WHT";
389 if ( lc($useSendmail) eq 'true' ) {
390 print "Sendmail";
391 } else {
392 print "SMTP";
393 }
394 print "$NRM\n";
395 print "\n";
396
397 if ( $show_imap_settings ) {
398 print $WHT . "IMAP Settings". $NRM . "\n--------------\n";
399 print "4. IMAP Server : $WHT$imapServerAddress$NRM\n";
400 print "5. IMAP Port : $WHT$imapPort$NRM\n";
401 print "6. Authentication type : $WHT$imap_auth_mech$NRM\n";
402 print "7. Secure IMAP (TLS) : $WHT$use_imap_tls$NRM\n";
403 print "8. Server software : $WHT$imap_server_type$NRM\n";
404 print "9. Delimiter : $WHT$optional_delimiter$NRM\n";
405 print "\n";
406 } elsif ( $show_smtp_settings ) {
407 if ( lc($useSendmail) eq 'true' ) {
408 print $WHT . "Sendmail" . $NRM . "\n--------\n";
409 print "4. Sendmail Path : $WHT$sendmail_path$NRM\n";
410 print "5. Suppress SM header : $WHT$skip_SM_header$NRM\n";
411 print "\n";
412 } else {
413 print $WHT . "SMTP Settings" . $NRM . "\n-------------\n";
414 print "4. SMTP Server : $WHT$smtpServerAddress$NRM\n";
415 print "5. SMTP Port : $WHT$smtpPort$NRM\n";
416 print "6. POP before SMTP : $WHT$pop_before_smtp$NRM\n";
417 print "7. SMTP Authentication : $WHT$smtp_auth_mech$NRM\n";
418 print "8. Secure SMTP (TLS) : $WHT$use_smtp_tls$NRM\n";
419 print "9. Suppress SM header : $WHT$skip_SM_header$NRM\n";
420 print "\n";
421 }
422 }
423
424 if ($show_imap_settings == 0) {
425 print "A. Update IMAP Settings : ";
426 print "$WHT$imapServerAddress$NRM:";
427 print "$WHT$imapPort$NRM ";
428 print "($WHT$imap_server_type$NRM)\n";
429 }
430 if ($show_smtp_settings == 0) {
431 if ( lc($useSendmail) eq 'true' ) {
432 print "B. Change Sendmail Config : $WHT$sendmail_path$NRM\n";
433 } else {
434 print "B. Update SMTP Settings : ";
435 print "$WHT$smtpServerAddress$NRM:";
436 print "$WHT$smtpPort$NRM\n";
437 }
438 }
439 if ( $show_smtp_settings || $show_imap_settings )
440 {
441 print "H. Hide " .
442 ($show_imap_settings ? "IMAP Server" :
443 (lc($useSendmail) eq 'true') ? "Sendmail" : "SMTP") . " Settings\n";
444 }
445
446 print "\n";
447 print "R Return to Main Menu\n";
448 } elsif ( $menu == 3 ) {
449 print $WHT. "Folder Defaults\n" . $NRM;
450 print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n";
451 print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n";
452 print "3. Trash Folder : $WHT$trash_folder$NRM\n";
453 print "4. Sent Folder : $WHT$sent_folder$NRM\n";
454 print "5. Drafts Folder : $WHT$draft_folder$NRM\n";
455 print "6. By default, move to trash : $WHT$default_move_to_trash$NRM\n";
456 print "7. By default, move to sent : $WHT$default_move_to_sent$NRM\n";
457 print "8. By default, save as draft : $WHT$default_save_as_draft$NRM\n";
458 print "9. List Special Folders First : $WHT$list_special_folders_first$NRM\n";
459 print "10. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n";
460 print "11. Auto Expunge : $WHT$auto_expunge$NRM\n";
461 print "12. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n";
462 print "13. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n";
463 print "14. Default Unseen Notify : $WHT$default_unseen_notify$NRM\n";
464 print "15. Default Unseen Type : $WHT$default_unseen_type$NRM\n";
465 print "16. Auto Create Special Folders : $WHT$auto_create_special$NRM\n";
466 print "17. Folder Delete Bypasses Trash : $WHT$delete_folder$NRM\n";
467 print "18. Enable /NoSelect folder fix : $WHT$noselect_fix_enable$NRM\n";
468 print "\n";
469 print "R Return to Main Menu\n";
470 } elsif ( $menu == 4 ) {
471 print $WHT. "General Options\n" . $NRM;
472 print "1. Data Directory : $WHT$data_dir$NRM\n";
473 print "2. Attachment Directory : $WHT$attachment_dir$NRM\n";
474 print "3. Directory Hash Level : $WHT$dir_hash_level$NRM\n";
475 print "4. Default Left Size : $WHT$default_left_size$NRM\n";
476 print "5. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n";
477 print "6. Allow use of priority : $WHT$default_use_priority$NRM\n";
478 print "7. Hide SM attributions : $WHT$hide_sm_attributions$NRM\n";
479 print "8. Allow use of receipts : $WHT$default_use_mdn$NRM\n";
480 print "9. Allow editing of identity : $WHT$edit_identity$NRM/$WHT$edit_name$NRM\n";
481 print "10. Allow server thread sort : $WHT$allow_thread_sort$NRM\n";
482 print "11. Allow server-side sorting : $WHT$allow_server_sort$NRM\n";
483 print "12. Allow server charset search : $WHT$allow_charset_search$NRM\n";
484 print "13. Allow advanced search : $WHT$allow_advanced_search$NRM\n";
485 print "14. PHP session name : $WHT$session_name$NRM\n";
486 print "\n";
487 print "R Return to Main Menu\n";
488 } elsif ( $menu == 5 ) {
489 print $WHT. "Themes\n" . $NRM;
490 print "1. Change Themes\n";
491 for ( $count = 0 ; $count <= $#theme_name/2 ; $count++ ) {
492 $temp_name = $theme_name[$count*2];
493 printf " %s%*s %s\n", $temp_name,
494 40 - length($temp_name), " ",
495 $theme_name[($count*2)+1];
496 }
497 print "2. CSS File : $WHT$theme_css$NRM\n";
498 print "\n";
499 print "R Return to Main Menu\n";
500 } elsif ( $menu == 6 ) {
501 print $WHT. "Address Books (LDAP)\n" . $NRM;
502 print "1. Change Servers\n";
503 for ( $count = 0 ; $count <= $#ldap_host ; $count++ ) {
504 print " > $ldap_host[$count]\n";
505 }
506 print
507 "2. Use Javascript Address Book Search : $WHT$default_use_javascript_addr_book$NRM\n";
508 print "\n";
509 print "R Return to Main Menu\n";
510 } elsif ( $menu == 7 ) {
511 print $WHT. "Message of the Day (MOTD)\n" . $NRM;
512 print "\n$motd\n";
513 print "\n";
514 print "1 Edit the MOTD\n";
515 print "\n";
516 print "R Return to Main Menu\n";
517 } elsif ( $menu == 8 ) {
518 print $WHT. "Plugins\n" . $NRM;
519 print " Installed Plugins\n";
520 $num = 0;
521 for ( $count = 0 ; $count <= $#plugins ; $count++ ) {
522 $num = $count + 1;
523 print " $num. $plugins[$count]\n";
524 }
525 print "\n Available Plugins:\n";
526 opendir( DIR, "../plugins" );
527 @files = readdir(DIR);
528 $pos = 0;
529 @unused_plugins = ();
530 for ( $i = 0 ; $i <= $#files ; $i++ ) {
531 if ( -d "../plugins/" . $files[$i] && $files[$i] !~ /^\./ && $files[$i] ne "CVS" ) {
532 $match = 0;
533 for ( $k = 0 ; $k <= $#plugins ; $k++ ) {
534 if ( $plugins[$k] eq $files[$i] ) {
535 $match = 1;
536 }
537 }
538 if ( $match == 0 ) {
539 $unused_plugins[$pos] = $files[$i];
540 $pos++;
541 }
542 }
543 }
544
545 for ( $i = 0 ; $i <= $#unused_plugins ; $i++ ) {
546 $num = $num + 1;
547 print " $num. $unused_plugins[$i]\n";
548 }
549 closedir DIR;
550
551 print "\n";
552 print "R Return to Main Menu\n";
553 } elsif ( $menu == 9 ) {
554 print $WHT. "Database\n" . $NRM;
555 print "1. DSN for Address Book : $WHT$addrbook_dsn$NRM\n";
556 print "2. Table for Address Book : $WHT$addrbook_table$NRM\n";
557 print "\n";
558 print "3. DSN for Preferences : $WHT$prefs_dsn$NRM\n";
559 print "4. Table for Preferences : $WHT$prefs_table$NRM\n";
560 print "5. Field for username : $WHT$prefs_user_field$NRM\n";
561 print "6. Field for prefs key : $WHT$prefs_key_field$NRM\n";
562 print "7. Field for prefs value : $WHT$prefs_val_field$NRM\n";
563 print "\n";
564 print "8. DSN for Global Address Book : $WHT$addrbook_global_dsn$NRM\n";
565 print "9. Table for Global Address Book : $WHT$addrbook_global_table$NRM\n";
566 print "10. Allow writing into Global Address Book : $WHT$addrbook_global_writeable$NRM\n";
567 print "11. Allow listing of Global Address Book : $WHT$addrbook_global_listing$NRM\n";
568 print "\n";
569 print "R Return to Main Menu\n";
570 } elsif ( $menu == 10 ) {
571 print $WHT. "Language settings\n" . $NRM;
572 print "1. Default Language : $WHT$squirrelmail_default_language$NRM\n";
573 print "2. Default Charset : $WHT$default_charset$NRM\n";
574 print "3. Show alternative language names : $WHT$show_alternative_names$NRM\n";
575 print "4. Available languages : $WHT$available_languages$NRM\n";
576 print "5. Enable aggressive decoding : $WHT$aggressive_decoding$NRM\n";
577 print "6. Enable lossy encoding : $WHT$lossy_encoding$NRM\n";
578 print "\n";
579 print "R Return to Main Menu\n";
580 } elsif ( $menu == 11 ) {
581 print $WHT. "Interface tweaks\n" . $NRM;
582 print "1. Advanced tree : $WHT$advanced_tree$NRM\n";
583 print "2. Oldway : $WHT$oldway$NRM\n";
584 print "3. Use Icons : $WHT$use_icons$NRM\n";
585 print "\n";
586 print $WHT. "PHP tweaks\n" . $NRM;
587 print "4. Use php recode functions : $WHT$use_php_recode$NRM\n";
588 print "5. Use php iconv functions : $WHT$use_php_iconv$NRM\n";
589 print "\n";
590 print "R Return to Main Menu\n";
591 }
592 if ( $config_use_color == 1 ) {
593 print "C Turn color off\n";
594 } else {
595 print "C Turn color on\n";
596 }
597 print "S Save data\n";
598 print "Q Quit\n";
599
600 print "\n";
601 print "Command >> " . $WHT;
602 $command = <STDIN>;
603 $command =~ s/[\n\r]//g;
604 $command =~ tr/A-Z/a-z/;
605 print "$NRM\n";
606
607 # Read the commands they entered.
608 if ( $command eq "r" ) {
609 $menu = 0;
610 } elsif ( $command eq "s" ) {
611 save_data();
612 print "Press enter to continue...";
613 $tmp = <STDIN>;
614 $saved = 1;
615 } elsif ( ( $command eq "q" ) && ( $saved == 0 ) ) {
616 print "You have not saved your data.\n";
617 print "Save? [" . $WHT . "Y" . $NRM . "/n]: ";
618 $save = <STDIN>;
619 if ( ( $save =~ /^y/i ) || ( $save =~ /^\s*$/ ) ) {
620 save_data();
621 }
622 } elsif ( $command eq "c" ) {
623 if ( $config_use_color == 1 ) {
624 $config_use_color = 2;
625 $WHT = "";
626 $NRM = "";
627 } else {
628 $config_use_color = 1;
629 $WHT = "\x1B[37;1m";
630 $NRM = "\x1B[0m";
631 }
632 } elsif ( $command eq "d" && $menu == 0 ) {
633 set_defaults();
634 } else {
635 $saved = 0;
636 if ( $menu == 0 ) {
637 if ( ( $command > 0 ) && ( $command < 12 ) ) {
638 $menu = $command;
639 }
640 } elsif ( $menu == 1 ) {
641 if ( $command == 1 ) { $org_name = command1(); }
642 elsif ( $command == 2 ) { $org_logo = command2(); }
643 elsif ( $command == 3 ) { ($org_logo_width,$org_logo_height) = command2a(); }
644 elsif ( $command == 4 ) { $org_title = command3(); }
645 elsif ( $command == 5 ) { $signout_page = command4(); }
646 elsif ( $command == 6 ) { $frame_top = command6(); }
647 elsif ( $command == 7 ) { $provider_uri = command7(); }
648 elsif ( $command == 8 ) { $provider_name = command8(); }
649
650 } elsif ( $menu == 2 ) {
651 if ( $command eq "a" ) { $show_imap_settings = 1; $show_smtp_settings = 0; }
652 elsif ( $command eq "b" ) { $show_imap_settings = 0; $show_smtp_settings = 1; }
653 elsif ( $command eq "h" ) { $show_imap_settings = 0; $show_smtp_settings = 0; }
654 elsif ( $command <= 3 ) {
655 if ( $command == 1 ) { $domain = command11(); }
656 elsif ( $command == 2 ) { $invert_time = command110(); }
657 elsif ( $command == 3 ) { $useSendmail = command14(); }
658 $show_imap_settings = 0; $show_smtp_settings = 0;
659 } elsif ( $show_imap_settings ) {
660 if ( $command == 4 ) { $imapServerAddress = command12(); }
661 elsif ( $command == 5 ) { $imapPort = command13(); }
662 elsif ( $command == 6 ) { $imap_auth_mech = command112a(); }
663 elsif ( $command == 7 ) { $use_imap_tls = command113("IMAP",$use_imap_tls); }
664 elsif ( $command == 8 ) { $imap_server_type = command19(); }
665 elsif ( $command == 9 ) { $optional_delimiter = command111(); }
666 } elsif ( $show_smtp_settings && lc($useSendmail) eq 'true' ) {
667 if ( $command == 4 ) { $sendmail_path = command15(); }
668 } elsif ( $show_smtp_settings ) {
669 if ( $command == 4 ) { $smtpServerAddress = command16(); }
670 elsif ( $command == 5 ) { $smtpPort = command17(); }
671 elsif ( $command == 6 ) { $pop_before_smtp = command18a(); }
672 elsif ( $command == 7 ) { $smtp_auth_mech = command112b(); }
673 elsif ( $command == 8 ) { $use_smtp_tls = command113("SMTP",$use_smtp_tls); }
674 elsif ( $command == 9 ) { $skip_SM_header = command114(); }
675 }
676 } elsif ( $menu == 3 ) {
677 if ( $command == 1 ) { $default_folder_prefix = command21(); }
678 elsif ( $command == 2 ) { $show_prefix_option = command22(); }
679 elsif ( $command == 3 ) { $trash_folder = command23a(); }
680 elsif ( $command == 4 ) { $sent_folder = command23b(); }
681 elsif ( $command == 5 ) { $draft_folder = command23c(); }
682 elsif ( $command == 6 ) { $default_move_to_trash = command24a(); }
683 elsif ( $command == 7 ) { $default_move_to_sent = command24b(); }
684 elsif ( $command == 8 ) { $default_save_as_draft = command24c(); }
685 elsif ( $command == 9 ) { $list_special_folders_first = command27(); }
686 elsif ( $command == 10 ) { $use_special_folder_color = command28(); }
687 elsif ( $command == 11 ) { $auto_expunge = command29(); }
688 elsif ( $command == 12 ) { $default_sub_of_inbox = command210(); }
689 elsif ( $command == 13 ) { $show_contain_subfolders_option = command211(); }
690 elsif ( $command == 14 ) { $default_unseen_notify = command212(); }
691 elsif ( $command == 15 ) { $default_unseen_type = command213(); }
692 elsif ( $command == 16 ) { $auto_create_special = command214(); }
693 elsif ( $command == 17 ) { $delete_folder = command215(); }
694 elsif ( $command == 18 ) { $noselect_fix_enable = command216(); }
695 } elsif ( $menu == 4 ) {
696 if ( $command == 1 ) { $data_dir = command33a(); }
697 elsif ( $command == 2 ) { $attachment_dir = command33b(); }
698 elsif ( $command == 3 ) { $dir_hash_level = command33c(); }
699 elsif ( $command == 4 ) { $default_left_size = command35(); }
700 elsif ( $command == 5 ) { $force_username_lowercase = command36(); }
701 elsif ( $command == 6 ) { $default_use_priority = command37(); }
702 elsif ( $command == 7 ) { $hide_sm_attributions = command38(); }
703 elsif ( $command == 8 ) { $default_use_mdn = command39(); }
704 elsif ( $command == 9 ) { $edit_identity = command310(); }
705 elsif ( $command == 10 ) { $allow_thread_sort = command312(); }
706 elsif ( $command == 11 ) { $allow_server_sort = command313(); }
707 elsif ( $command == 12 ) { $allow_charset_search = command314(); }
708 elsif ( $command == 13 ) { $allow_advanced_search = command316(); }
709 elsif ( $command == 14 ) { $session_name = command317(); }
710 } elsif ( $menu == 5 ) {
711 if ( $command == 1 ) { command41(); }
712 elsif ( $command == 2 ) { $theme_css = command42(); }
713 } elsif ( $menu == 6 ) {
714 if ( $command == 1 ) { command61(); }
715 elsif ( $command == 2 ) { command62(); }
716 } elsif ( $menu == 7 ) {
717 if ( $command == 1 ) { $motd = command71(); }
718 } elsif ( $menu == 8 ) {
719 if ( $command =~ /^[0-9]+/ ) { @plugins = command81(); }
720 } elsif ( $menu == 9 ) {
721 if ( $command == 1 ) { $addrbook_dsn = command91(); }
722 elsif ( $command == 2 ) { $addrbook_table = command92(); }
723 elsif ( $command == 3 ) { $prefs_dsn = command93(); }
724 elsif ( $command == 4 ) { $prefs_table = command94(); }
725 elsif ( $command == 5 ) { $prefs_user_field = command95(); }
726 elsif ( $command == 6 ) { $prefs_key_field = command96(); }
727 elsif ( $command == 7 ) { $prefs_val_field = command97(); }
728 elsif ( $command == 8 ) { $addrbook_global_dsn = command98(); }
729 elsif ( $command == 9 ) { $addrbook_global_table = command99(); }
730 elsif ( $command == 10 ) { $addrbook_global_writeable = command910(); }
731 elsif ( $command == 11 ) { $addrbook_global_listing = command911(); }
732 } elsif ( $menu == 10 ) {
733 if ( $command == 1 ) { $squirrelmail_default_language = commandA1(); }
734 elsif ( $command == 2 ) { $default_charset = commandA2(); }
735 elsif ( $command == 3 ) { $show_alternative_names = commandA3(); }
736 elsif ( $command == 4 ) { $available_languages = commandA4(); }
737 elsif ( $command == 5 ) { $aggressive_decoding = commandA5(); }
738 elsif ( $command == 6 ) { $lossy_encoding = commandA6(); }
739 } elsif ( $menu == 11 ) {
740 if ( $command == 1 ) { $advanced_tree = commandB1(); }
741 elsif ( $command == 2 ) { $oldway = commandB2(); }
742 elsif ( $command == 3 ) { $use_icons = commandB3(); }
743 elsif ( $command == 4 ) { $use_php_recode = commandB4(); }
744 elsif ( $command == 5 ) { $use_php_iconv = commandB5(); }
745 }
746 }
747 }
748
749 # we exit here
750 print "\nExiting conf.pl.\n".
751 "You might want to test your configuration by browsing to\n".
752 "http://your-squirrelmail-location/src/configtest.php\n".
753 "Happy SquirrelMailing!\n\n";
754
755
756 ####################################################################################
757
758 # org_name
759 sub command1 {
760 print "We have tried to make the name SquirrelMail as transparent as\n";
761 print "possible. If you set up an organization name, most places where\n";
762 print "SquirrelMail would take credit will be credited to your organization.\n";
763 print "\n";
764 print "If your Organization Name includes a '\$', please precede it with a \\. \n";
765 print "Other '\$' will be considered the beginning of a variable that\n";
766 print "must be defined before the \$org_name is printed.\n";
767 print "\$version, for example, is included by default, and will print the\n";
768 print "string representing the current SquirrelMail version.\n";
769 print "\n";
770 print "[$WHT$org_name$NRM]: $WHT";
771 $new_org_name = <STDIN>;
772 if ( $new_org_name eq "\n" ) {
773 $new_org_name = $org_name;
774 } else {
775 $new_org_name =~ s/[\r\n]//g;
776 $new_org_name =~ s/\"/&quot;/g;
777 }
778 return $new_org_name;
779 }
780
781 # org_logo
782 sub command2 {
783 print "Your organization's logo is an image that will be displayed at\n";
784 print "different times throughout SquirrelMail. ";
785 print "\n";
786 print "Please be aware of the following: \n";
787 print " - Relative URLs are relative to the config dir\n";
788 print " to use the default logo, use ../images/sm_logo.png\n";
789 print " - To specify a logo defined outside the SquirrelMail source tree\n";
790 print " use the absolute URL the webserver would use to include the file\n";
791 print " e.g. http://some.host.com/images/mylogo.gif or /images/mylogo.jpg\n";
792 print "\n";
793 print "[$WHT$org_logo$NRM]: $WHT";
794 $new_org_logo = <STDIN>;
795 if ( $new_org_logo eq "\n" ) {
796 $new_org_logo = $org_logo;
797 } else {
798 $new_org_logo =~ s/[\r\n]//g;
799 }
800 return $new_org_logo;
801 }
802
803 # org_logo_width
804 sub command2a {
805 print "Your organization's logo is an image that will be displayed at\n";
806 print "different times throughout SquirrelMail. Width\n";
807 print "and Height of your logo image. Use '0' to disable.\n";
808 print "\n";
809 print "Width: [$WHT$org_logo_width$NRM]: $WHT";
810 $new_org_logo_width = <STDIN>;
811 $new_org_logo_width =~ tr/0-9//cd; # only want digits!
812 if ( $new_org_logo_width eq '' ) {
813 $new_org_logo_width = $org_logo_width;
814 }
815 if ( $new_org_logo_width > 0 ) {
816 print "Height: [$WHT$org_logo_height$NRM]: $WHT";
817 $new_org_logo_height = <STDIN>;
818 $new_org_logo_height =~ tr/0-9//cd; # only want digits!
819 if( $new_org_logo_height eq '' ) {
820 $new_org_logo_height = $org_logo_height;
821 }
822 } else {
823 $new_org_logo_height = 0;
824 }
825 return ($new_org_logo_width, $new_org_logo_height);
826 }
827
828 # org_title
829 sub command3 {
830 print "A title is what is displayed at the top of the browser window in\n";
831 print "the titlebar. Usually this will end up looking something like:\n";
832 print "\"Netscape: $org_title\"\n";
833 print "\n";
834 print "If your Organization Title includes a '\$', please precede it with a \\. \n";
835 print "Other '\$' will be considered the beginning of a variable that\n";
836 print "must be defined before the \$org_title is printed.\n";
837 print "\$version, for example, is included by default, and will print the\n";
838 print "string representing the current SquirrelMail version.\n";
839 print "\n";
840 print "[$WHT$org_title$NRM]: $WHT";
841 $new_org_title = <STDIN>;
842 if ( $new_org_title eq "\n" ) {
843 $new_org_title = $org_title;
844 } else {
845 $new_org_title =~ s/[\r\n]//g;
846 $new_org_title =~ s/\"/\'/g;
847 }
848 return $new_org_title;
849 }
850
851 # signout_page
852 sub command4 {
853 print "When users click the Sign Out button they will be logged out and\n";
854 print "then sent to signout_page. If signout_page is left empty,\n";
855 print "(hit space and then return) they will be taken, as normal,\n";
856 print "to the default and rather sparse SquirrelMail signout page.\n";
857 print "\n";
858 print "[$WHT$signout_page$NRM]: $WHT";
859 $new_signout_page = <STDIN>;
860 if ( $new_signout_page eq "\n" ) {
861 $new_signout_page = $signout_page;
862 } else {
863 $new_signout_page =~ s/[\r\n]//g;
864 $new_signout_page =~ s/^\s+$//g;
865 }
866 return $new_signout_page;
867 }
868
869 # Default top frame
870 sub command6 {
871 print "SquirrelMail defaults to using the whole of the browser window.\n";
872 print "This allows you to keep it within a specified frame. The default\n";
873 print "is '_top'\n";
874 print "\n";
875 print "[$WHT$frame_top$NRM]: $WHT";
876 $new_frame_top = <STDIN>;
877 if ( $new_frame_top eq "\n" ) {
878 $new_frame_top = '_top';
879 } else {
880 $new_frame_top =~ s/[\r\n]//g;
881 $new_frame_top =~ s/^\s+$//g;
882 }
883 return $new_frame_top;
884 }
885
886 # Default link to provider
887 sub command7 {
888 print "Here you can set the link on the right of the page.\n";
889 print "The default is 'http://www.squirrelmail.org/'\n";
890 print "\n";
891 print "[$WHT$provider_uri$NRM]: $WHT";
892 $new_provider_uri = <STDIN>;
893 if ( $new_provider_uri eq "\n" ) {
894 $new_provider_uri = 'http://www.squirrelmail.org/';
895 } else {
896 $new_provider_uri =~ s/[\r\n]//g;
897 $new_provider_uri =~ s/^\s+$//g;
898 }
899 return $new_provider_uri;
900 }
901
902 sub command8 {
903 print "Here you can set the name of the link on the right of the page.\n";
904 print "The default is 'SquirrelMail/'\n";
905 print "\n";
906 print "[$WHT$provider_name$NRM]: $WHT";
907 $new_provider_name = <STDIN>;
908 if ( $new_provider_name eq "\n" ) {
909 $new_provider_name = 'SquirrelMail';
910 } else {
911 $new_provider_name =~ s/[\r\n]//g;
912 $new_provider_name =~ s/^\s+$//g;
913 }
914 return $new_provider_name;
915 }
916
917 ####################################################################################
918
919 # domain
920 sub command11 {
921 print "The domain name is the suffix at the end of all email addresses. If\n";
922 print "for example, your email address is jdoe\@myorg.com, then your domain\n";
923 print "would be myorg.com.\n";
924 print "\n";
925 print "[$WHT$domain$NRM]: $WHT";
926 $new_domain = <STDIN>;
927 if ( $new_domain eq "\n" ) {
928 $new_domain = $domain;
929 } else {
930 $new_domain =~ s/[\r\n]//g;
931 }
932 return $new_domain;
933 }
934
935 # imapServerAddress
936 sub command12 {
937 print "This is the hostname where your IMAP server can be contacted.\n";
938 print "[$WHT$imapServerAddress$NRM]: $WHT";
939 $new_imapServerAddress = <STDIN>;
940 if ( $new_imapServerAddress eq "\n" ) {
941 $new_imapServerAddress = $imapServerAddress;
942 } else {
943 $new_imapServerAddress =~ s/[\r\n]//g;
944 }
945 return $new_imapServerAddress;
946 }
947
948 # imapPort
949 sub command13 {
950 print "This is the port that your IMAP server is on. Usually this is 143.\n";
951 print "[$WHT$imapPort$NRM]: $WHT";
952 $new_imapPort = <STDIN>;
953 if ( $new_imapPort eq "\n" ) {
954 $new_imapPort = $imapPort;
955 } else {
956 $new_imapPort =~ s/[\r\n]//g;
957 }
958 return $new_imapPort;
959 }
960
961 # useSendmail
962 sub command14 {
963 print "You now need to choose the method that you will use for sending\n";
964 print "messages in SquirrelMail. You can either connect to an SMTP server\n";
965 print "or use sendmail directly.\n";
966 if ( lc($useSendmail) eq 'true' ) {
967 $default_value = "1";
968 } else {
969 $default_value = "2";
970 }
971 print "\n";
972 print " 1. Sendmail\n";
973 print " 2. SMTP\n";
974 print "Your choice [1/2] [$WHT$default_value$NRM]: $WHT";
975 $use_sendmail = <STDIN>;
976 if ( ( $use_sendmail =~ /^1\n/i )
977 || ( ( $use_sendmail =~ /^\n/ ) && ( $default_value eq "1" ) ) ) {
978 $useSendmail = 'true';
979 } else {
980 $useSendmail = 'false';
981 }
982 return $useSendmail;
983 }
984
985 # sendmail_path
986 sub command15 {
987 if ( $sendmail_path[0] !~ /./ ) {
988 $sendmail_path = "/usr/sbin/sendmail";
989 }
990 print "Specify where the sendmail executable is located. Usually /usr/sbin/sendmail\n";
991 print "[$WHT$sendmail_path$NRM]: $WHT";
992 $new_sendmail_path = <STDIN>;
993 if ( $new_sendmail_path eq "\n" ) {
994 $new_sendmail_path = $sendmail_path;
995 } else {
996 $new_sendmail_path =~ s/[\r\n]//g;
997 }
998 return $new_sendmail_path;
999 }
1000
1001 # smtpServerAddress
1002 sub command16 {
1003 print "This is the hostname of your SMTP server.\n";
1004 print "[$WHT$smtpServerAddress$NRM]: $WHT";
1005 $new_smtpServerAddress = <STDIN>;
1006 if ( $new_smtpServerAddress eq "\n" ) {
1007 $new_smtpServerAddress = $smtpServerAddress;
1008 } else {
1009 $new_smtpServerAddress =~ s/[\r\n]//g;
1010 }
1011 return $new_smtpServerAddress;
1012 }
1013
1014 # smtpPort
1015 sub command17 {
1016 print "This is the port to connect to for SMTP. Usually 25.\n";
1017 print "[$WHT$smtpPort$NRM]: $WHT";
1018 $new_smtpPort = <STDIN>;
1019 if ( $new_smtpPort eq "\n" ) {
1020 $new_smtpPort = $smtpPort;
1021 } else {
1022 $new_smtpPort =~ s/[\r\n]//g;
1023 }
1024 return $new_smtpPort;
1025 }
1026
1027 # authenticated server
1028 sub command18 {
1029 return;
1030 # This sub disabled by tassium - it has been replaced with smtp_auth_mech
1031 print "Do you wish to use an authenticated SMTP server? Your server must\n";
1032 print "support this in order for SquirrelMail to work with it. We implemented\n";
1033 print "it according to RFC 2554.\n";
1034
1035 $YesNo = 'n';
1036 $YesNo = 'y' if ( lc($use_authenticated_smtp) eq 'true' );
1037
1038 print "Use authenticated SMTP server (y/n) [$WHT$YesNo$NRM]: $WHT";
1039
1040 $new_use_authenticated_smtp = <STDIN>;
1041 $new_use_authenticated_smtp =~ tr/yn//cd;
1042 return 'true' if ( $new_use_authenticated_smtp eq "y" );
1043 return 'false' if ( $new_use_authenticated_smtp eq "n" );
1044 return $use_authenticated_smtp;
1045 }
1046
1047 # pop before SMTP
1048 sub command18a {
1049 print "Do you wish to use POP3 before SMTP? Your server must\n";
1050 print "support this in order for SquirrelMail to work with it.\n";
1051
1052 $YesNo = 'n';
1053 $YesNo = 'y' if ( lc($pop_before_smtp) eq 'true' );
1054
1055 print "Use pop before SMTP (y/n) [$WHT$YesNo$NRM]: $WHT";
1056
1057 $new_pop_before_smtp = <STDIN>;
1058 $new_pop_before_smtp =~ tr/yn//cd;
1059 return 'true' if ( $new_pop_before_smtp eq "y" );
1060 return 'false' if ( $new_pop_before_smtp eq "n" );
1061 return $pop_before_smtp;
1062 }
1063
1064 # imap_server_type
1065 sub command19 {
1066 print "Each IMAP server has its own quirks. As much as we tried to stick\n";
1067 print "to standards, it doesn't help much if the IMAP server doesn't follow\n";
1068 print "the same principles. We have made some work-arounds for some of\n";
1069 print "these servers. If you would like to use them, please select your\n";
1070 print "IMAP server. If you do not wish to use these work-arounds, you can\n";
1071 print "set this to \"other\", and none will be used.\n";
1072 print " cyrus = Cyrus IMAP server\n";
1073 print " uw = University of Washington's IMAP server\n";
1074 print " exchange = Microsoft Exchange IMAP server\n";
1075 print " courier = Courier IMAP server\n";
1076 print " macosx = Mac OS X Mailserver\n";
1077 print " other = Not one of the above servers\n";
1078 print "[$WHT$imap_server_type$NRM]: $WHT";
1079 $new_imap_server_type = <STDIN>;
1080
1081 if ( $new_imap_server_type eq "\n" ) {
1082 $new_imap_server_type = $imap_server_type;
1083 } else {
1084 $new_imap_server_type =~ s/[\r\n]//g;
1085 }
1086 return $new_imap_server_type;
1087 }
1088
1089 # invert_time
1090 sub command110 {
1091 print "Sometimes the date of messages sent is messed up (off by a few hours\n";
1092 print "on some machines). Typically this happens if the system doesn't support\n";
1093 print "tm_gmtoff. It will happen only if your time zone is \"negative\".\n";
1094 print "This most often occurs on Solaris 7 machines in the United States.\n";
1095 print "By default, this is off. It should be kept off unless problems surface\n";
1096 print "about the time that messages are sent.\n";
1097 print " no = Do NOT fix time -- almost always correct\n";
1098 print " yes = Fix the time for this system\n";
1099
1100 $YesNo = 'n';
1101 $YesNo = 'y' if ( lc($invert_time) eq 'true' );
1102
1103 print "Fix the time for this system (y/n) [$WHT$YesNo$NRM]: $WHT";
1104
1105 $new_invert_time = <STDIN>;
1106 $new_invert_time =~ tr/yn//cd;
1107 return 'true' if ( $new_invert_time eq "y" );
1108 return 'false' if ( $new_invert_time eq "n" );
1109 return $invert_time;
1110 }
1111
1112 sub command111 {
1113 print "This is the delimiter that your IMAP server uses to distinguish between\n";
1114 print "folders. For example, Cyrus uses '.' as the delimiter and a complete\n";
1115 print "folder would look like 'INBOX.Friends.Bob', while UW uses '/' and would\n";
1116 print "look like 'INBOX/Friends/Bob'. Normally this should be left at 'detect'\n";
1117 print "but if you are sure you know what delimiter your server uses, you can\n";
1118 print "specify it here.\n";
1119 print "\nTo have it autodetect the delimiter, set it to 'detect'.\n\n";
1120 print "[$WHT$optional_delimiter$NRM]: $WHT";
1121 $new_optional_delimiter = <STDIN>;
1122
1123 if ( $new_optional_delimiter eq "\n" ) {
1124 $new_optional_delimiter = $optional_delimiter;
1125 } else {
1126 $new_optional_delimiter =~ s/[\r\n]//g;
1127 }
1128 return $new_optional_delimiter;
1129 }
1130 # IMAP authentication type
1131 # Possible values: login, plain, cram-md5, digest-md5
1132 # Now offers to detect supported mechs, assuming server & port are set correctly
1133
1134 sub command112a {
1135 if ($use_imap_tls =~ /^true\b/i) {
1136 print "Auto-detection of login methods is unavailable when using TLS.\n";
1137 } else {
1138 print "If you have already set the hostname and port number, I can try to\n";
1139 print "detect the mechanisms your IMAP server supports.\n";
1140 print "I will try to detect CRAM-MD5 and DIGEST-MD5 support. I can't test\n";
1141 print "for \"login\" or \"plain\" without knowing a username and password.\n";
1142 print "Auto-detecting is optional - you can safely say \"n\" here.\n";
1143 print "\nTry to detect supported mechanisms? [y/N]: ";
1144 $inval=<STDIN>;
1145 chomp($inval);
1146 if ($inval =~ /^y\b/i) {
1147 # Yes, let's try to detect.
1148 print "Trying to detect IMAP capabilities...\n";
1149 my $host = $imapServerAddress . ':'. $imapPort;
1150 print "CRAM-MD5:\t";
1151 my $tmp = detect_auth_support('IMAP',$host,'CRAM-MD5');
1152 if (defined($tmp)) {
1153 if ($tmp eq 'YES') {
1154 print "$WHT SUPPORTED$NRM\n";
1155 } else {
1156 print "$WHT NOT SUPPORTED$NRM\n";
1157 }
1158 } else {
1159 print $WHT . " ERROR DETECTING$NRM\n";
1160 }
1161
1162 print "DIGEST-MD5:\t";
1163 $tmp = detect_auth_support('IMAP',$host,'DIGEST-MD5');
1164 if (defined($tmp)) {
1165 if ($tmp eq 'YES') {
1166 print "$WHT SUPPORTED$NRM\n";
1167 } else {
1168 print "$WHT NOT SUPPORTED$NRM\n";
1169 }
1170 } else {
1171 print $WHT . " ERROR DETECTING$NRM\n";
1172 }
1173
1174 }
1175 }
1176 print "\nWhat authentication mechanism do you want to use for IMAP connections?\n\n";
1177 print $WHT . "login" . $NRM . " - Plaintext. If you can do better, you probably should.\n";
1178 print $WHT . "plain" . $NRM . " - SASL PLAIN. If you need this, you already know it.\n";
1179 print $WHT . "cram-md5" . $NRM . " - Slightly better than plaintext methods.\n";
1180 print $WHT . "digest-md5" . $NRM . " - Privacy protection - better than cram-md5.\n";
1181 print "\n*** YOUR IMAP SERVER MUST SUPPORT THE MECHANISM YOU CHOOSE HERE ***\n";
1182 print "If you don't understand or are unsure, you probably want \"login\"\n\n";
1183 print "login, plain, cram-md5, or digest-md5 [$WHT$imap_auth_mech$NRM]: $WHT";
1184 $inval=<STDIN>;
1185 chomp($inval);
1186 if ( ($inval =~ /^cram-md5\b/i) || ($inval =~ /^digest-md5\b/i) || ($inval =~ /^login\b/i) || ($inval =~ /^plain\b/i)) {
1187 return lc($inval);
1188 } else {
1189 # user entered garbage or default value so nothing needs to be set
1190 return $imap_auth_mech;
1191 }
1192 }
1193
1194
1195 # SMTP authentication type
1196 # Possible choices: none, plain, cram-md5, digest-md5
1197 sub command112b {
1198 if ($use_smtp_tls =~ /^true\b/i) {
1199 print "Auto-detection of login methods is unavailable when using TLS.\n";
1200 } else {
1201 print "If you have already set the hostname and port number, I can try to\n";
1202 print "automatically detect some of the mechanisms your SMTP server supports.\n";
1203 print "Auto-detection is *optional* - you can safely say \"n\" here.\n";
1204 print "\nTry to detect auth mechanisms? [y/N]: ";
1205 $inval=<STDIN>;
1206 chomp($inval);
1207 if ($inval =~ /^y\b/i) {
1208 # Yes, let's try to detect.
1209 print "Trying to detect supported methods (SMTP)...\n";
1210
1211 # Special case!
1212 # Check none by trying to relay to junk@microsoft.com
1213 $host = $smtpServerAddress . ':' . $smtpPort;
1214 use IO::Socket;
1215 my $sock = IO::Socket::INET->new($host);
1216 print "Testing none:\t\t$WHT";
1217 if (!defined($sock)) {
1218 print " ERROR TESTING\n";
1219 close $sock;
1220 } else {
1221 print $sock "mail from: tester\@squirrelmail.org\n";
1222 $got = <$sock>; # Discard
1223 print $sock "rcpt to: junk\@microsoft.com\n";
1224 $got = <$sock>; # This is the important line
1225 if ($got =~ /^250\b/) { # SMTP will relay without auth
1226 print "SUPPORTED$NRM\n";
1227 } else {
1228 print "NOT SUPPORTED$NRM\n";
1229 }
1230 print $sock "rset\n";
1231 print $sock "quit\n";
1232 close $sock;
1233 }
1234 # Try login (SquirrelMail default)
1235 print "Testing login:\t\t";
1236 $tmp=detect_auth_support('SMTP',$host,'LOGIN');
1237 if (defined($tmp)) {
1238 if ($tmp eq 'YES') {
1239 print $WHT . "SUPPORTED$NRM\n";
1240 } else {
1241 print $WHT . "NOT SUPPORTED$NRM\n";
1242 }
1243 } else {
1244 print $WHT . "ERROR DETECTING$NRM\n";
1245 }
1246
1247 # Try CRAM-MD5
1248 print "Testing CRAM-MD5:\t";
1249 $tmp=detect_auth_support('SMTP',$host,'CRAM-MD5');
1250 if (defined($tmp)) {
1251 if ($tmp eq 'YES') {
1252 print $WHT . "SUPPORTED$NRM\n";
1253 } else {
1254 print $WHT . "NOT SUPPORTED$NRM\n";
1255 }
1256 } else {
1257 print $WHT . "ERROR DETECTING$NRM\n";
1258 }
1259
1260
1261 print "Testing DIGEST-MD5:\t";
1262 $tmp=detect_auth_support('SMTP',$host,'DIGEST-MD5');
1263 if (defined($tmp)) {
1264 if ($tmp eq 'YES') {
1265 print $WHT . "SUPPORTED$NRM\n";
1266 } else {
1267 print $WHT . "NOT SUPPORTED$NRM\n";
1268 }
1269 } else {
1270 print $WHT . "ERROR DETECTING$NRM\n";
1271 }
1272 }
1273 }
1274 print "\nWhat authentication mechanism do you want to use for SMTP connections?\n";
1275 print $WHT . "none" . $NRM . " - Your SMTP server does not require authorization.\n";
1276 print $WHT . "login" . $NRM . " - Plaintext. If you can do better, you probably should.\n";
1277 print $WHT . "plain" . $NRM . " - SASL PLAIN. You already know it if you need this.\n";
1278 print $WHT . "cram-md5" . $NRM . " - Slightly better than plaintext.\n";
1279 print $WHT . "digest-md5" . $NRM . " - Privacy protection - better than cram-md5.\n";
1280 print $WHT . "\n*** YOUR SMTP SERVER MUST SUPPORT THE MECHANISM YOU CHOOSE HERE ***\n" . $NRM;
1281 print "If you don't understand or are unsure, you probably want \"none\"\n\n";
1282 print "none, login, cram-md5, or digest-md5 [$WHT$smtp_auth_mech$NRM]: $WHT";
1283 $inval=<STDIN>;
1284 chomp($inval);
1285 if ($inval =~ /^none\b/i) {
1286 # SMTP doesn't necessarily require logins
1287 return "none";
1288 }
1289 if ( ($inval =~ /^cram-md5\b/i) || ($inval =~ /^digest-md5\b/i) ||
1290 ($inval =~ /^login\b/i) || ($inval =~/^plain\b/i)) {
1291 return lc($inval);
1292 } else {
1293 # user entered garbage, or default value so nothing needs to be set
1294 return $smtp_auth_mech;
1295 }
1296 }
1297
1298 # TLS
1299 # This sub is reused for IMAP and SMTP
1300 # Args: service name, default value
1301 sub command113 {
1302 my($default_val,$service,$inval);
1303 $service=$_[0];
1304 $default_val=$_[1];
1305 print "TLS (Transport Layer Security) encrypts the traffic between server and client.\n";
1306 print "If you're familiar with SSL, you get the idea.\n";
1307 print "To use this feature, your " . $service . " server must offer TLS\n";
1308 print "capability, plus PHP 4.3.x with OpenSSL support.\n";
1309 print "\nIf your " . $service . " server is localhost, you can safely disable this.\n";
1310 print "If it is remote, you may wish to seriously consider enabling this.\n";
1311 print "Enable TLS (y/n) [$WHT";
1312 if ($default_val eq 'true') {
1313 print "y";
1314 } else {
1315 print "n";
1316 }
1317 print "$NRM]: $WHT";
1318 $inval=<STDIN>;
1319 $inval =~ tr/yn//cd;
1320 return 'true' if ( $inval eq "y" );
1321 return 'false' if ( $inval eq "n" );
1322 return $default_val;
1323 }
1324
1325 sub command114{
1326 print "\nUse this to suppress insertion of SquirrelMail Received: headers\n";
1327 print "in outbound messages.\n\n";
1328
1329 $YesNo = 'n';
1330 $YesNo = 'y' if ( lc($skip_SM_header) eq 'true' );
1331
1332 print "Suppress SM header (y/n) [$WHT$YesNo$NRM]: $WHT";
1333 $new_skip_SM_header = <STDIN>;
1334 chomp($new_skip_SM_header);
1335
1336 return 'true' if ( lc($new_skip_SM_header) eq 'y' );
1337 return 'false' if ( lc($new_skip_SM_header) eq 'n' );
1338 return $skip_SM_header;
1339 }
1340
1341 # MOTD
1342 sub command71 {
1343 print "\nYou can now create the welcome message that is displayed\n";
1344 print "every time a user logs on. You can use HTML or just plain\n";
1345 print
1346 "text. If you do not wish to have one, just make it blank.\n\n(Type @ on a blank line to exit)\n";
1347
1348 $new_motd = "";
1349 do {
1350 print "] ";
1351 $line = <STDIN>;
1352 $line =~ s/[\r\n]//g;
1353 if ( $line ne "@" ) {
1354 $line =~ s/ /\&nbsp;\&nbsp;/g;
1355 $line =~ s/\t/\&nbsp;\&nbsp;\&nbsp;\&nbsp;/g;
1356 $line =~ s/$/ /;
1357 $line =~ s/\"/&quot;/g;
1358
1359 $new_motd = $new_motd . $line;
1360 }
1361 } while ( $line ne "@" );
1362 return $new_motd;
1363 }
1364
1365 ################# PLUGINS ###################
1366
1367 sub command81 {
1368 $command =~ s/[\s\n\r]*//g;
1369 if ( $command > 0 ) {
1370 $command = $command - 1;
1371 if ( $command <= $#plugins ) {
1372 @newplugins = ();
1373 $ct = 0;
1374 while ( $ct <= $#plugins ) {
1375 if ( $ct != $command ) {
1376 @newplugins = ( @newplugins, $plugins[$ct] );
1377 }
1378 $ct++;
1379 }
1380 @plugins = @newplugins;
1381 } elsif ( $command <= $#plugins + $#unused_plugins + 1 ) {
1382 $num = $command - $#plugins - 1;
1383 @newplugins = @plugins;
1384 $ct = 0;
1385 while ( $ct <= $#unused_plugins ) {
1386 if ( $ct == $num ) {
1387 @newplugins = ( @newplugins, $unused_plugins[$ct] );
1388 }
1389 $ct++;
1390 }
1391 @plugins = @newplugins;
1392 }
1393 }
1394 return @plugins;
1395 }
1396
1397 ################# FOLDERS ###################
1398
1399 # default_folder_prefix
1400 sub command21 {
1401 print "Some IMAP servers (UW, for example) store mail and folders in\n";
1402 print "your user space in a separate subdirectory. This is where you\n";
1403 print "specify what that directory is.\n";
1404 print "\n";
1405 print "EXAMPLE: mail/";
1406 print "\n";
1407 print "NOTE: If you use Cyrus, or some server that would not use this\n";
1408 print " option, you must set this to 'none'.\n";
1409 print "\n";
1410 print "[$WHT$default_folder_prefix$NRM]: $WHT";
1411 $new_default_folder_prefix = <STDIN>;
1412
1413 if ( $new_default_folder_prefix eq "\n" ) {
1414 $new_default_folder_prefix = $default_folder_prefix;
1415 } else {
1416 $new_default_folder_prefix =~ s/[\r\n]//g;
1417 }
1418 if ( ( $new_default_folder_prefix =~ /^\s*$/ ) || ( $new_default_folder_prefix =~ m/^none$/i ) ) {
1419 $new_default_folder_prefix = "";
1420 } else {
1421 # add the trailing delimiter only if we know what the server is.
1422 if (($imap_server_type eq 'cyrus' and
1423 $optional_delimiter eq 'detect') or
1424 ($imap_server_type eq 'courier' and
1425 $optional_delimiter eq 'detect')) {
1426 $new_default_folder_prefix =~ s/\.*$/\./;
1427 } elsif ($imap_server_type eq 'uw' and
1428 $optional_delimiter eq 'detect') {
1429 $new_default_folder_prefix =~ s/\/*$/\//;
1430 }
1431 }
1432 return $new_default_folder_prefix;
1433 }
1434
1435 # Show Folder Prefix
1436 sub command22 {
1437 print "It is possible to set up the default folder prefix as a user\n";
1438 print "specific option, where each user can specify what their mail\n";
1439 print "folder is. If you set this to false, they will never see the\n";
1440 print "option, but if it is true, this option will appear in the\n";
1441 print "'options' section.\n";
1442 print "\n";
1443 print "NOTE: You set the default folder prefix in option '1' of this\n";
1444 print " section. That will be the default if the user doesn't\n";
1445 print " specify anything different.\n";
1446 print "\n";
1447
1448 if ( lc($show_prefix_option) eq 'true' ) {
1449 $default_value = "y";
1450 } else {
1451 $default_value = "n";
1452 }
1453 print "\n";
1454 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
1455 $new_show = <STDIN>;
1456 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1457 $show_prefix_option = 'true';
1458 } else {
1459 $show_prefix_option = 'false';
1460 }
1461 return $show_prefix_option;
1462 }
1463
1464 # Trash Folder
1465 sub command23a {
1466 print "You can now specify where the default trash folder is located.\n";
1467 print "On servers where you do not want this, you can set it to anything\n";
1468 print "and set option 6 to false.\n";
1469 print "\n";
1470 print "This is relative to where the rest of your email is kept. You do\n";
1471 print "not need to worry about their mail directory. If this folder\n";
1472 print "would be ~/mail/trash on the filesystem, you only need to specify\n";
1473 print "that this is 'trash', and be sure to put 'mail/' in option 1.\n";
1474 print "\n";
1475
1476 print "[$WHT$trash_folder$NRM]: $WHT";
1477 $new_trash_folder = <STDIN>;
1478 if ( $new_trash_folder eq "\n" ) {
1479 $new_trash_folder = $trash_folder;
1480 } else {
1481 $new_trash_folder =~ s/[\r\n]//g;
1482 }
1483 return $new_trash_folder;
1484 }
1485
1486 # Sent Folder
1487 sub command23b {
1488 print "This is where messages that are sent will be stored. SquirrelMail\n";
1489 print "by default puts a copy of all outgoing messages in this folder.\n";
1490 print "\n";
1491 print "This is relative to where the rest of your email is kept. You do\n";
1492 print "not need to worry about their mail directory. If this folder\n";
1493 print "would be ~/mail/sent on the filesystem, you only need to specify\n";
1494 print "that this is 'sent', and be sure to put 'mail/' in option 1.\n";
1495 print "\n";
1496
1497 print "[$WHT$sent_folder$NRM]: $WHT";
1498 $new_sent_folder = <STDIN>;
1499 if ( $new_sent_folder eq "\n" ) {
1500 $new_sent_folder = $sent_folder;
1501 } else {
1502 $new_sent_folder =~ s/[\r\n]//g;
1503 }
1504 return $new_sent_folder;
1505 }
1506
1507 # Draft Folder
1508 sub command23c {
1509 print "You can now specify where the default draft folder is located.\n";
1510 print "On servers where you do not want this, you can set it to anything\n";
1511 print "and set option 9 to false.\n";
1512 print "\n";
1513 print "This is relative to where the rest of your email is kept. You do\n";
1514 print "not need to worry about their mail directory. If this folder\n";
1515 print "would be ~/mail/drafts on the filesystem, you only need to specify\n";
1516 print "that this is 'drafts', and be sure to put 'mail/' in option 1.\n";
1517 print "\n";
1518
1519 print "[$WHT$draft_folder$NRM]: $WHT";
1520 $new_draft_folder = <STDIN>;
1521 if ( $new_draft_folder eq "\n" ) {
1522 $new_draft_folder = $draft_folder;
1523 } else {
1524 $new_draft_folder =~ s/[\r\n]//g;
1525 }
1526 return $new_draft_folder;
1527 }
1528
1529 # default move to trash
1530 sub command24a {
1531 print "By default, should messages get moved to the trash folder? You\n";
1532 print "can specify the default trash folder in option 3. If this is set\n";
1533 print "to false, messages will get deleted immediately without moving\n";
1534 print "to the trash folder.\n";
1535 print "\n";
1536 print "Trash folder is currently: $trash_folder\n";
1537 print "\n";
1538
1539 if ( lc($default_move_to_trash) eq 'true' ) {
1540 $default_value = "y";
1541 } else {
1542 $default_value = "n";
1543 }
1544 print "By default, move to trash (y/n) [$WHT$default_value$NRM]: $WHT";
1545 $new_show = <STDIN>;
1546 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1547 $default_move_to_trash = 'true';
1548 } else {
1549 $default_move_to_trash = 'false';
1550 }
1551 return $default_move_to_trash;
1552 }
1553
1554 # default move to sent
1555 sub command24b {
1556 print "By default, should messages get moved to the sent folder? You\n";
1557 print "can specify the default sent folder in option 4. If this is set\n";
1558 print "to false, messages will get sent and no copy will be made.\n";
1559 print "\n";
1560 print "Sent folder is currently: $sent_folder\n";
1561 print "\n";
1562
1563 if ( lc($default_move_to_sent) eq 'true' ) {
1564 $default_value = "y";
1565 } else {
1566 $default_value = "n";
1567 }
1568 print "By default, move to sent (y/n) [$WHT$default_value$NRM]: $WHT";
1569 $new_show = <STDIN>;
1570 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1571 $default_move_to_sent = 'true';
1572 } else {
1573 $default_move_to_sent = 'false';
1574 }
1575 return $default_move_to_sent;
1576 }
1577
1578 # default save as draft
1579 sub command24c {
1580 print "By default, should the save to draft option be shown? You can\n";
1581 print "specify the default drafts folder in option 5. If this is set\n";
1582 print "to false, users will not be shown the save to draft option.\n";
1583 print "\n";
1584 print "Drafts folder is currently: $draft_folder\n";
1585 print "\n";
1586
1587 if ( lc($default_move_to_draft) eq 'true' ) {
1588 $default_value = "y";
1589 } else {
1590 $default_value = "n";
1591 }
1592 print "By default, save as draft (y/n) [$WHT$default_value$NRM]: $WHT";
1593 $new_show = <STDIN>;
1594 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1595 $default_save_as_draft = 'true';
1596 } else {
1597 $default_save_as_draft = 'false';
1598 }
1599 return $default_save_as_draft;
1600 }
1601
1602 # List special folders first
1603 sub command27 {
1604 print "SquirrelMail has what we call 'special folders' that are not\n";
1605 print "manipulated and viewed like normal folders. Some examples of\n";
1606 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
1607 print "Simply asks if you want these folders listed first in the folder\n";
1608 print "listing.\n";
1609 print "\n";
1610
1611 if ( lc($list_special_folders_first) eq 'true' ) {
1612 $default_value = "y";
1613 } else {
1614 $default_value = "n";
1615 }
1616 print "\n";
1617 print "List first (y/n) [$WHT$default_value$NRM]: $WHT";
1618 $new_show = <STDIN>;
1619 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1620 $list_special_folders_first = 'true';
1621 } else {
1622 $list_special_folders_first = 'false';
1623 }
1624 return $list_special_folders_first;
1625 }
1626
1627 # Show special folders color
1628 sub command28 {
1629 print "SquirrelMail has what we call 'special folders' that are not\n";
1630 print "manipulated and viewed like normal folders. Some examples of\n";
1631 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
1632 print "wants to know if we should display special folders in a\n";
1633 print "color than the other folders.\n";
1634 print "\n";
1635
1636 if ( lc($use_special_folder_color) eq 'true' ) {
1637 $default_value = "y";
1638 } else {
1639 $default_value = "n";
1640 }
1641 print "\n";
1642 print "Show color (y/n) [$WHT$default_value$NRM]: $WHT";
1643 $new_show = <STDIN>;
1644 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1645 $use_special_folder_color = 'true';
1646 } else {
1647 $use_special_folder_color = 'false';
1648 }
1649 return $use_special_folder_color;
1650 }
1651
1652 # Auto expunge
1653 sub command29 {
1654 print "The way that IMAP handles deleting messages is as follows. You\n";
1655 print "mark the message as deleted, and then to 'really' delete it, you\n";
1656 print "expunge it. This option asks if you want to just have messages\n";
1657 print "marked as deleted, or if you want SquirrelMail to expunge the \n";
1658 print "messages too.\n";
1659 print "\n";
1660
1661 if ( lc($auto_expunge) eq 'true' ) {
1662 $default_value = "y";
1663 } else {
1664 $default_value = "n";
1665 }
1666 print "Auto expunge (y/n) [$WHT$default_value$NRM]: $WHT";
1667 $new_show = <STDIN>;
1668 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1669 $auto_expunge = 'true';
1670 } else {
1671 $auto_expunge = 'false';
1672 }
1673 return $auto_expunge;
1674 }
1675
1676 # Default sub of inbox
1677 sub command210 {
1678 print "Some IMAP servers (Cyrus) have all folders as subfolders of INBOX.\n";
1679 print "This can cause some confusion in folder creation for users when\n";
1680 print "they try to create folders and don't put it as a subfolder of INBOX\n";
1681 print "and get permission errors. This option asks if you want folders\n";
1682 print "to be subfolders of INBOX by default.\n";
1683 print "\n";
1684
1685 if ( lc($default_sub_of_inbox) eq 'true' ) {
1686 $default_value = "y";
1687 } else {
1688 $default_value = "n";
1689 }
1690 print "Default sub of INBOX (y/n) [$WHT$default_value$NRM]: $WHT";
1691 $new_show = <STDIN>;
1692 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1693 $default_sub_of_inbox = 'true';
1694 } else {
1695 $default_sub_of_inbox = 'false';
1696 }
1697 return $default_sub_of_inbox;
1698 }
1699
1700 # Show contain subfolder option
1701 sub command211 {
1702 print "Some IMAP servers (UW) make it so that there are two types of\n";
1703 print "folders. Those that contain messages, and those that contain\n";
1704 print "subfolders. If this is the case for your server, set this to\n";
1705 print "true, and it will ask the user whether the folder they are\n";
1706 print "creating contains subfolders or messages.\n";
1707 print "\n";
1708
1709 if ( lc($show_contain_subfolders_option) eq 'true' ) {
1710 $default_value = "y";
1711 } else {
1712 $default_value = "n";
1713 }
1714 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
1715 $new_show = <STDIN>;
1716 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1717 $show_contain_subfolders_option = 'true';
1718 } else {
1719 $show_contain_subfolders_option = 'false';
1720 }
1721 return $show_contain_subfolders_option;
1722 }
1723
1724 # Default Unseen Notify
1725 sub command212 {
1726 print "This option specifies where the users will receive notification\n";
1727 print "about unseen messages by default. This is of course an option that\n";
1728 print "can be changed on a user level.\n";
1729 print " 1 = No notification\n";
1730 print " 2 = Only on the INBOX\n";
1731 print " 3 = On all folders\n";
1732 print "\n";
1733
1734 print "Which one should be default (1,2,3)? [$WHT$default_unseen_notify$NRM]: $WHT";
1735 $new_show = <STDIN>;
1736 if ( $new_show =~ /^[123]\n/i ) {
1737 $default_unseen_notify = $new_show;
1738 }
1739 $default_unseen_notify =~ s/[\r\n]//g;
1740 return $default_unseen_notify;
1741 }
1742
1743 # Default Unseen Type
1744 sub command213 {
1745 print "Here you can define the default way that unseen messages will be displayed\n";
1746 print "to the user in the folder listing on the left side.\n";
1747 print " 1 = Only unseen messages (4)\n";
1748 print " 2 = Unseen and Total messages (4/27)\n";
1749 print "\n";
1750
1751 print "Which one should be default (1,2)? [$WHT$default_unseen_type$NRM]: $WHT";
1752 $new_show = <STDIN>;
1753 if ( $new_show =~ /^[12]\n/i ) {
1754 $default_unseen_type = $new_show;
1755 }
1756 $default_unseen_type =~ s/[\r\n]//g;
1757 return $default_unseen_type;
1758 }
1759
1760 # Auto create special folders
1761 sub command214 {
1762 print "Would you like the Sent, Trash, and Drafts folders to be created\n";
1763 print "automatically print for you when a user logs in? If the user\n";
1764 print "accidentally deletes their special folders, this option will\n";
1765 print "automatically create it again for them.\n";
1766 print "\n";
1767
1768 if ( lc($auto_create_special) eq 'true' ) {
1769 $default_value = "y";
1770 } else {
1771 $default_value = "n";
1772 }
1773 print "Auto create special folders? (y/n) [$WHT$default_value$NRM]: $WHT";
1774 $new_show = <STDIN>;
1775 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1776 $auto_create_special = 'true';
1777 } else {
1778 $auto_create_special = 'false';
1779 }
1780 return $auto_create_special;
1781 }
1782
1783 # Automatically delete folders
1784 sub command215 {
1785 if ( $imap_server_type eq "uw" ) {
1786 print "UW IMAP servers will not allow folders containing mail to also contain folders.\n";
1787 print "Deleting folders will bypass the trash folder and be immediately deleted\n\n";
1788 print "If this is not the correct value for your server,\n";
1789 print "please use option D on the Main Menu to configure your server correctly.\n\n";
1790 print "Press any key to continue...\n";
1791 $new_delete = <STDIN>;
1792 $delete_folder = 'true';
1793 } else {
1794 if ( $imap_server_type eq "courier" ) {
1795 print "Courier (or Courier-IMAP) IMAP servers may not support ";
1796 print "subfolders of Trash. \n";
1797 print "Specifically, if Courier is set to always move messages to Trash, \n";
1798 print "Trash will be treated by Courier as a special folder that does not \n";
1799 print "allow subfolders. \n\n";
1800 print "Please verify your Courier configuration, and test folder deletion \n";
1801 print "when changing this setting.\n\n";
1802 }
1803
1804 print "Are subfolders of the Trash supported by your IMAP server?\n";
1805 print "If so, should deleted folders be sent to Trash?\n";
1806 print "If not, say no (deleted folders should not be sent to Trash)\n\n";
1807 # reversal of logic.
1808 # question was: Should folders be automatically deleted instead of sent to trash..
1809 # we've changed the question to make it more clear,
1810 # and are here handling that to avoid changing the answers..
1811 if ( lc($delete_folder) eq 'true' ) {
1812 $default_value = "n";
1813 } else {
1814 $default_value = "y";
1815 }
1816 print "Send deleted folders to Trash? (y/n) [$WHT$default_value$NRM]: $WHT";
1817 $new_delete = <STDIN>;
1818 if ( ( $new_delete =~ /^y\n/i ) || ( ( $new_delete =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1819 $delete_folder = 'false';
1820 } else {
1821 $delete_folder = 'true';
1822 }
1823 }
1824 return $delete_folder;
1825 }
1826
1827 #noselect fix
1828 sub command216 {
1829 print "Some IMAP server allow subfolders to exist even if the parent\n";
1830 print "folders do not. This fixes some problems with the folder list\n";
1831 print "when this is the case, causing the /NoSelect folders to be displayed\n";
1832 print "\n";
1833
1834 if ( lc($noselect_fix_enable) eq 'true' ) {
1835 $default_value = "y";
1836 } else {
1837 $default_value = "n";
1838 }
1839 print "enable noselect fix? (y/n) [$WHT$noselect_fix_enable$NRM]: $WHT";
1840 $noselect_fix_enable = <STDIN>;
1841 if ( ( $noselect_fix_enable =~ /^y\n/i ) || ( ( $noselect_fix_enable =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1842 $noselect_fix_enable = 'true';
1843 } else {
1844 $noselect_fix_enable = 'false';
1845 }
1846 return $noselect_fix_enable;
1847 }
1848 ############# GENERAL OPTIONS #####################
1849
1850 # Data directory
1851 sub command33a {
1852 print "Specify the location for your data directory.\n";
1853 print "The path name can be absolute or relative (to the config directory).\n";
1854 print "It doesn't matter. Here are two examples:\n";
1855 print " Absolute: /var/spool/data/\n";
1856 print " Relative: ../data/\n";
1857 print "Relative paths to directories outside of the SquirrelMail distribution\n";
1858 print "will be converted to their absolute path equivalents in config.php.\n\n";
1859 print "Note: There are potential security risks with having a writeable directory\n";
1860 print "under the web server's root directory (ex: /home/httpd/html).\n";
1861 print "For this reason, it is recommended to put the data directory\n";
1862 print "in an alternate location of your choice. \n";
1863 print "\n";
1864
1865 print "[$WHT$data_dir$NRM]: $WHT";
1866 $new_data_dir = <STDIN>;
1867 if ( $new_data_dir eq "\n" ) {
1868 $new_data_dir = $data_dir;
1869 } else {
1870 $new_data_dir =~ s/[\r\n]//g;
1871 }
1872 if ( $new_data_dir =~ /^\s*$/ ) {
1873 $new_data_dir = "";
1874 } else {
1875 $new_data_dir =~ s/\/*$//g;
1876 $new_data_dir =~ s/$/\//g;
1877 }
1878 return $new_data_dir;
1879 }
1880
1881 # Attachment directory
1882 sub command33b {
1883 print "Path to directory used for storing attachments while a mail is\n";
1884 print "being sent. The path name can be absolute or relative (to the config directory).\n";
1885 print "It doesn't matter. Here are two examples:\n";
1886 print " Absolute: /var/spool/attach/\n";
1887 print " Relative: ../attach/\n";
1888 print "Relative paths to directories outside of the SquirrelMail distribution\n";
1889 print "will be converted to their absolute path equivalents in config.php.\n\n";
1890 print "Note: There are a few security considerations regarding this\n";
1891 print "directory:\n";
1892 print " 1. It should have the permission 733 (rwx-wx-wx) to make it\n";
1893 print " impossible for a random person with access to the webserver\n";
1894 print " to list files in this directory. Confidential data might\n";
1895 print " be laying around in there.\n";
1896 print " Depending on your user:group assignments, 730 (rwx-wx---)\n";
1897 print " may be possible, and more secure (e.g. root:apache)\n";
1898 print " 2. Since the webserver is not able to list the files in the\n";
1899 print " content is also impossible for the webserver to delete files\n";
1900 print " lying around there for too long.\n";
1901 print " 3. It should probably be another directory than the data\n";
1902 print " directory specified in option 3.\n";
1903 print "\n";
1904
1905 print "[$WHT$attachment_dir$NRM]: $WHT";
1906 $new_attachment_dir = <STDIN>;
1907 if ( $new_attachment_dir eq "\n" ) {
1908 $new_attachment_dir = $attachment_dir;
1909 } else {
1910 $new_attachment_dir =~ s/[\r\n]//g;
1911 }
1912 if ( $new_attachment_dir =~ /^\s*$/ ) {
1913 $new_attachment_dir = "";
1914 } else {
1915 $new_attachment_dir =~ s/\/*$//g;
1916 $new_attachment_dir =~ s/$/\//g;
1917 }
1918 return $new_attachment_dir;
1919 }
1920
1921 sub command33c {
1922 print "The directory hash level setting allows you to configure the level\n";
1923 print "of hashing that Squirremail employs in your data and attachment\n";
1924 print "directories. This value must be an integer ranging from 0 to 4.\n";
1925 print "When this value is set to 0, Squirrelmail will simply store all\n";
1926 print "files as normal in the data and attachment directories. However,\n";
1927 print "when set to a value from 1 to 4, a simple hashing scheme will be\n";
1928 print "used to organize the files in this directory. In short, the crc32\n";
1929 print "value for a username will be computed. Then, up to the first 4\n";
1930 print "digits of the hash, as set by this configuration value, will be\n";
1931 print "used to directory hash the files for that user in the data and\n";
1932 print "attachment directory. This allows for better performance on\n";
1933 print "servers with larger numbers of users.\n";
1934 print "\n";
1935
1936 print "[$WHT$dir_hash_level$NRM]: $WHT";
1937 $new_dir_hash_level = <STDIN>;
1938 if ( $new_dir_hash_level eq "\n" ) {
1939 $new_dir_hash_level = $dir_hash_level;
1940 } else {
1941 $new_dir_hash_level =~ s/[\r\n]//g;
1942 }
1943 if ( ( int($new_dir_hash_level) < 0 )
1944 || ( int($new_dir_hash_level) > 4 )
1945 || !( int($new_dir_hash_level) eq $new_dir_hash_level ) ) {
1946 print "Invalid Directory Hash Level.\n";
1947 print "Value must be an integer ranging from 0 to 4\n";
1948 print "Hit enter to continue.\n";
1949 $enter_key = <STDIN>;
1950
1951 $new_dir_hash_level = $dir_hash_level;
1952 }
1953
1954 return $new_dir_hash_level;
1955 }
1956
1957 sub command35 {
1958 print "This is the default size (in pixels) of the left folder list.\n";
1959 print "Default is 200, but you can set it to whatever you wish. This\n";
1960 print "is a user preference, so this will only show up as their default.\n";
1961 print "\n";
1962 print "[$WHT$default_left_size$NRM]: $WHT";
1963 $new_default_left_size = <STDIN>;
1964 if ( $new_default_left_size eq "\n" ) {
1965 $new_default_left_size = $default_left_size;
1966 } else {
1967 $new_default_left_size =~ s/[\r\n]//g;
1968 }
1969 return $new_default_left_size;
1970 }
1971
1972 sub command36 {
1973 print "Some IMAP servers only have lowercase letters in the usernames\n";
1974 print "but they still allow people with uppercase to log in. This\n";
1975 print "causes a problem with the user's preference files. This option\n";
1976 print "transparently changes all usernames to lowercase.";
1977 print "\n";
1978
1979 if ( lc($force_username_lowercase) eq 'true' ) {
1980 $default_value = "y";
1981 } else {
1982 $default_value = "n";
1983 }
1984 print "Convert usernames to lowercase (y/n) [$WHT$default_value$NRM]: $WHT";
1985 $new_show = <STDIN>;
1986 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1987 return 'true';
1988 }
1989 return 'false';
1990 }
1991
1992 sub command37 {
1993 print "";
1994 print "\n";
1995
1996 if ( lc($default_use_priority) eq 'true' ) {
1997 $default_value = "y";
1998 } else {
1999 $default_value = "n";
2000 }
2001
2002 print "Allow users to specify priority of outgoing mail (y/n) [$WHT$default_value$NRM]: $WHT";
2003 $new_show = <STDIN>;
2004 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2005 return 'true';
2006 }
2007 return 'false';
2008 }
2009
2010 sub command38 {
2011 print "";
2012 print "\n";
2013
2014 if ( lc($default_hide_attribution) eq 'true' ) {
2015 $default_value = "y";
2016 } else {
2017 $default_value = "n";
2018 }
2019
2020 print "Hide SM attributions (y/n) [$WHT$default_value$NRM]: $WHT";
2021 $new_show = <STDIN>;
2022 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2023 return 'true';
2024 }
2025 return 'false';
2026 }
2027
2028 sub command39 {
2029 print "";
2030 print "\n";
2031
2032 if ( lc($default_use_mdn) eq 'true' ) {
2033 $default_value = "y";
2034 } else {
2035 $default_value = "n";
2036 }
2037
2038 print "Enable support for read/delivery receipt support (y/n) [$WHT$default_value$NRM]: $WHT";
2039 $new_show = <STDIN>;
2040 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2041 return 'true';
2042 }
2043 return 'false';
2044 }
2045
2046 sub command310 {
2047 print "This allows you to prevent the editing of the user's name and ";
2048 print "email address. This is mainly useful when used with the ";
2049 print "retrieveuserdata plugin\n";
2050 print "\n";
2051
2052 if ( lc($edit_identity) eq 'true' ) {
2053 $default_value = "y";
2054 } else {
2055 $default_value = "n";
2056 }
2057 print "Allow editing of user's identity? (y/n) [$WHT$default_value$NRM]: $WHT";
2058 $new_edit = <STDIN>;
2059 if ( ( $new_edit =~ /^y\n/i ) || ( ( $new_edit =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2060 $edit_identity = 'true';
2061 $edit_name = 'true';
2062 } else {
2063 $edit_identity = 'false';
2064 $edit_name = command311();
2065 }
2066 return $edit_identity;
2067 }
2068
2069 sub command311 {
2070 print "As a follow-up, this option allows you to choose if the user ";
2071 print "can edit their full name even when you don't want them to ";
2072 print "change their username\n";
2073 print "\n";
2074
2075 if ( lc($edit_name) eq 'true' ) {
2076 $default_value = "y";
2077 } else {
2078 $default_value = "n";
2079 }
2080 print "Allow editing of the users full name? (y/n) [$WHT$default_value$NRM]: $WHT";
2081 $new_edit = <STDIN>;
2082 if ( ( $new_edit =~ /^y\n/i ) || ( ( $new_edit =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2083 $edit_name = 'true';
2084 } else {
2085 $edit_name = 'false';
2086 }
2087 return $edit_name;
2088 }
2089
2090 sub command312 {
2091 print "This option allows you to choose if users can use thread sorting\n";
2092 print "Your IMAP server must support the THREAD command for this to work\n";
2093 print "PHP versions later than 4.0.3 recommended\n";
2094 print "\n";
2095
2096 if ( lc($allow_thread_sort) eq 'true' ) {
2097 $default_value = "y";
2098 } else {
2099 $default_value = "n";
2100 }
2101 print "Allow server side thread sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
2102 $allow_thread_sort = <STDIN>;
2103 if ( ( $allow_thread_sort =~ /^y\n/i ) || ( ( $allow_thread_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2104 $allow_thread_sort = 'true';
2105 } else {
2106 $allow_thread_sort = 'false';
2107 }
2108 return $allow_thread_sort;
2109 }
2110
2111 sub command313 {
2112 print "This option allows you to choose if SM uses server-side sorting\n";
2113 print "Your IMAP server must support the SORT command for this to work\n";
2114 print "\n";
2115
2116 if ( lc($allow_server_sort) eq 'true' ) {
2117 $default_value = "y";
2118 } else {
2119 $default_value = "n";
2120 }
2121 print "Allow server-side sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
2122 $allow_server_sort = <STDIN>;
2123 if ( ( $allow_server_sort =~ /^y\n/i ) || ( ( $allow_server_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2124 $allow_server_sort = 'true';
2125 } else {
2126 $allow_server_sort = 'false';
2127 }
2128 return $allow_server_sort;
2129 }
2130
2131 sub command314 {
2132 print "This option allows you to choose if SM uses charset search\n";
2133 print "Your IMAP server must support the SEARCH CHARSET command for this to work\n";
2134 print "\n";
2135
2136 if ( lc($allow_charset_search) eq 'true' ) {
2137 $default_value = "y";
2138 } else {
2139 $default_value = "n";
2140 }
2141 print "Allow charset searching? (y/n) [$WHT$default_value$NRM]: $WHT";
2142 $allow_charset_search = <STDIN>;
2143 if ( ( $allow_charset_search =~ /^y\n/i ) || ( ( $allow_charset_search =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2144 $allow_charset_search = 'true';
2145 } else {
2146 $allow_charset_search = 'false';
2147 }
2148 return $allow_charset_search;
2149 }
2150
2151 # command315 (UID support) obsoleted.
2152
2153 # advanced search option
2154 sub command316 {
2155 print "This option allows you to control the use of advanced search form.\n";
2156 print " 0 = enable basic search only\n";
2157 print " 1 = enable advanced search only\n";
2158 print " 2 = enable both\n";
2159 print "\n";
2160
2161 print "Allowed search (0,1,2)? [$WHT$allow_advanced_search$NRM]: $WHT";
2162 $new_allow_advanced_search = <STDIN>;
2163 if ( $new_allow_advanced_search =~ /^[012]\n/i ) {
2164 $allow_advanced_search = $new_allow_advanced_search;
2165 }
2166 $allow_advanced_search =~ s/[\r\n]//g;
2167 return $allow_advanced_search;
2168 }
2169
2170
2171 sub command317 {
2172 print "This option allows you to change the name of the PHP session used\n";
2173 print "by SquirrelMail. Unless you know what you are doing, you probably\n";
2174 print "don't need or want to change this from the default of SQMSESSID.\n";
2175 print "[$WHT$session_name$NRM]: $WHT";
2176 $new_session_name = <STDIN>;
2177 chomp($new_session_name);
2178 if ( $new_session_name eq "" ) {
2179 $new_session_name = $session_name;
2180 }
2181 return $new_session_name;
2182 }
2183
2184
2185
2186 sub command41 {
2187 print "\nDefine the themes that you wish to use. If you have added ";
2188 print "a theme of your own, just follow the instructions (?) about how to add ";
2189 print "them. You can also change the default theme.\n";
2190 print "[theme] command (?=help) > ";
2191 $input = <STDIN>;
2192 $input =~ s/[\r\n]//g;
2193 while ( $input ne "d" ) {
2194 if ( $input =~ /^\s*l\s*/i ) {
2195 $count = 0;
2196 while ( $count <= $#theme_name ) {
2197 if ( $count == $theme_default ) {
2198 print " *";
2199 } else {
2200 print " ";
2201 }
2202 if ( $count < 10 ) {
2203 print " ";
2204 }
2205 $name = $theme_name[$count];
2206 $num_spaces = 35 - length($name);
2207 for ( $i = 0 ; $i < $num_spaces ; $i++ ) {
2208 $name = $name . " ";
2209 }
2210
2211 print " $count. $name";
2212 print "($theme_path[$count])\n";
2213
2214 $count++;
2215 }
2216 } elsif ( $input =~ /^\s*m\s*[0-9]+/i ) {
2217 $old_def = $theme_default;
2218 $theme_default = $input;
2219 $theme_default =~ s/^\s*m\s*//;
2220 if ( ( $theme_default > $#theme_name ) || ( $theme_default < 0 ) ) {
2221 print "Cannot set default theme to $theme_default. That theme does not exist.\n";
2222 $theme_default = $old_def;
2223 }
2224 } elsif ( $input =~ /^\s*\+/ ) {
2225 print "What is the name of this theme: ";
2226 $name = <STDIN>;
2227 $name =~ s/[\r\n]//g;
2228 $theme_name[ $#theme_name + 1 ] = $name;
2229 print "Be sure to put ../themes/ before the filename.\n";
2230 print "What file is this stored in (ex: ../themes/default_theme.php): ";
2231 $name = <STDIN>;
2232 $name =~ s/[\r\n]//g;
2233 $theme_path[ $#theme_path + 1 ] = $name;
2234 } elsif ( $input =~ /^\s*-\s*[0-9]?/ ) {
2235 if ( $input =~ /[0-9]+\s*$/ ) {
2236 $rem_num = $input;
2237 $rem_num =~ s/^\s*-\s*//g;
2238 $rem_num =~ s/\s*$//;
2239 } else {
2240 $rem_num = $#theme_name;
2241 }
2242 if ( $rem_num == $theme_default ) {
2243 print "You cannot remove the default theme!\n";
2244 } else {
2245 $count = 0;
2246 @new_theme_name = ();
2247 @new_theme_path = ();
2248 while ( $count <= $#theme_name ) {
2249 if ( $count != $rem_num ) {
2250 @new_theme_name = ( @new_theme_name, $theme_name[$count] );
2251 @new_theme_path = ( @new_theme_path, $theme_path[$count] );
2252 }
2253 $count++;
2254 }
2255 @theme_name = @new_theme_name;
2256 @theme_path = @new_theme_path;
2257 if ( $theme_default > $rem_num ) {
2258 $theme_default--;
2259 }
2260 }
2261 } elsif ( $input =~ /^\s*t\s*/i ) {
2262 print "\nStarting detection...\n\n";
2263
2264 opendir( DIR, "../themes" );
2265 @files = grep { /\.php$/i } readdir(DIR);
2266 $cnt = 0;
2267 while ( $cnt <= $#files ) {
2268 $filename = "../themes/" . $files[$cnt];
2269 if ( $filename ne "../themes/index.php" ) {
2270 $found = 0;
2271 for ( $x = 0 ; $x <= $#theme_path ; $x++ ) {
2272 if ( $theme_path[$x] eq $filename ) {
2273 $found = 1;
2274 }
2275 }
2276 if ( $found != 1 ) {
2277 print "** Found theme: $filename\n";
2278 print " What is its name? ";
2279 $nm = <STDIN>;
2280 $nm =~ s/[\n\r]//g;
2281 $theme_name[ $#theme_name + 1 ] = $nm;
2282 $theme_path[ $#theme_path + 1 ] = $filename;
2283 }
2284 }
2285 $cnt++;
2286 }
2287 print "\n";
2288 for ( $cnt = 0 ; $cnt <= $#theme_path ; $cnt++ ) {
2289 $filename = $theme_path[$cnt];
2290 if ( !( -e $filename ) ) {
2291 print " Removing $filename (file not found)\n";
2292 $offset = 0;
2293 @new_theme_name = ();
2294 @new_theme_path = ();
2295 for ( $x = 0 ; $x < $#theme_path ; $x++ ) {
2296 if ( $theme_path[$x] eq $filename ) {
2297 $offset = 1;
2298 }
2299 if ( $offset == 1 ) {
2300 $new_theme_name[$x] = $theme_name[ $x + 1 ];
2301 $new_theme_path[$x] = $theme_path[ $x + 1 ];
2302 } else {
2303 $new_theme_name[$x] = $theme_name[$x];
2304 $new_theme_path[$x] = $theme_path[$x];
2305 }
2306 }
2307 @theme_name = @new_theme_name;
2308 @theme_path = @new_theme_path;
2309 }
2310 }
2311 print "\nDetection complete!\n\n";
2312
2313 closedir DIR;
2314 } elsif ( $input =~ /^\s*\?\s*/ ) {
2315 print ".-------------------------.\n";
2316 print "| t (detect themes) |\n";
2317 print "| + (add theme) |\n";
2318 print "| - N (remove theme) |\n";
2319 print "| m N (mark default) |\n";
2320 print "| l (list themes) |\n";
2321 print "| d (done) |\n";
2322 print "`-------------------------'\n";
2323 }
2324 print "[theme] command (?=help) > ";
2325 $input = <STDIN>;
2326 $input =~ s/[\r\n]//g;
2327 }
2328 }
2329
2330 # Theme - CSS file
2331 sub command42 {
2332 print "You may specify a cascading style-sheet (CSS) file to be included\n";
2333 print "on each html page generated by SquirrelMail. The CSS file is useful\n";
2334 print "for specifying a site-wide font. If you're not familiar with CSS\n";
2335 print "files, leave this blank.\n";
2336 print "\n";
2337 print "To clear out an existing value, just type a space for the input.\n";
2338 print "\n";
2339 print "Please be aware of the following: \n";
2340 print " - Relative URLs are relative to the config dir\n";
2341 print " to use the themes directory, use ../themes/css/newdefault.css\n";
2342 print " - To specify a css file defined outside the SquirrelMail source tree\n";
2343 print " use the absolute URL the webserver would use to include the file\n";
2344 print " e.g. http://some.host.com/css/mystyle.css or /css/mystyle.css\n";
2345 print "\n";
2346 print "[$WHT$theme_css$NRM]: $WHT";
2347 $new_theme_css = <STDIN>;
2348
2349 if ( $new_theme_css eq "\n" ) {
2350 $new_theme_css = $theme_css;
2351 } else {
2352 $new_theme_css =~ s/[\r\n]//g;
2353 }
2354 $new_theme_css =~ s/^\s*//;
2355 return $new_theme_css;
2356 }
2357
2358 sub command61 {
2359 print "You can now define different LDAP servers.\n";
2360 print "[ldap] command (?=help) > ";
2361 $input = <STDIN>;
2362 $input =~ s/[\r\n]//g;
2363 while ( $input ne "d" ) {
2364 if ( $input =~ /^\s*l\s*/i ) {
2365 $count = 0;
2366 while ( $count <= $#ldap_host ) {
2367 print "$count. $ldap_host[$count]\n";
2368 print " base: $ldap_base[$count]\n";
2369 if ( $ldap_charset[$count] ) {
2370 print " charset: $ldap_charset[$count]\n";
2371 }
2372 if ( $ldap_port[$count] ) {
2373 print " port: $ldap_port[$count]\n";
2374 }
2375 if ( $ldap_name[$count] ) {
2376 print " name: $ldap_name[$count]\n";
2377 }
2378 if ( $ldap_maxrows[$count] ) {
2379 print " maxrows: $ldap_maxrows[$count]\n";
2380 }
2381 if ( $ldap_binddn[$count] ) {
2382 print " binddn: $ldap_binddn[$count]\n";
2383 if ( $ldap_bindpw[$count] ) {
2384 print " bindpw: $ldap_bindpw[$count]\n";
2385 }
2386 }
2387 if ( $ldap_protocol[$count] ) {
2388 print " protocol: $ldap_protocol[$count]\n";
2389 }
2390
2391 print "\n";
2392 $count++;
2393 }
2394 } elsif ( $input =~ /^\s*\+/ ) {
2395 $sub = $#ldap_host + 1;
2396
2397 print "First, we need to have the hostname or the IP address where\n";
2398 print "this LDAP server resides. Example: ldap.bigfoot.com\n";
2399 print "hostname: ";
2400 $name = <STDIN>;
2401 $name =~ s/[\r\n]//g;
2402 $ldap_host[$sub] = $name;
2403
2404 print "\n";
2405
2406 print "Next, we need the server root (base dn). For this, an empty\n";
2407 print "string is allowed.\n";
2408 print "Example: ou=member_directory,o=netcenter.com\n";
2409 print "base: ";
2410 $name = <STDIN>;
2411 $name =~ s/[\r\n]//g;
2412 $ldap_base[$sub] = $name;
2413
2414 print "\n";
2415
2416 print "This is the TCP/IP port number for the LDAP server. Default\n";
2417 print "port is 389. This is optional. Press ENTER for default.\n";
2418 print "port: ";
2419 $name = <STDIN>;
2420 $name =~ s/[\r\n]//g;
2421 $ldap_port[$sub] = $name;
2422
2423 print "\n";
2424
2425 print "This is the charset for the server. Default is utf-8. This\n";
2426 print "is also optional. Press ENTER for default.\n";
2427 print "charset: ";
2428 $name = <STDIN>;
2429 $name =~ s/[\r\n]//g;
2430 $ldap_charset[$sub] = $name;
2431
2432 print "\n";
2433
2434 print "This is the name for the server, used to tag the results of\n";
2435 print "the search. Default it \"LDAP: hostname\". Press ENTER for default\n";
2436 print "name: ";
2437 $name = <STDIN>;
2438 $name =~ s/[\r\n]//g;
2439 $ldap_name[$sub] = $name;
2440
2441 print "\n";
2442
2443 print "You can specify the maximum number of rows in the search result.\n";
2444 print "Default is unlimited. Press ENTER for default.\n";
2445 print "maxrows: ";
2446 $name = <STDIN>;
2447 $name =~ s/[\r\n]//g;
2448 $ldap_maxrows[$sub] = $name;
2449
2450 print "\n";
2451
2452 print "If your LDAP server does not like anonymous logins, you can specify bind DN.\n";
2453 print "Default is none, anonymous bind. Press ENTER for default.\n";
2454 print "binddn: ";
2455 $name = <STDIN>;
2456 $name =~ s/[\r\n]//g;
2457 $ldap_binddn[$sub] = $name;
2458
2459 print "\n";
2460
2461 if ( $ldap_binddn[$sub] ne '' ) {
2462
2463 print "Now, please specify password for that DN.\n";
2464 print "bindpw: ";
2465 $name = <STDIN>;
2466 $name =~ s/[\r\n]//g;
2467 $ldap_bindpw[$sub] = $name;
2468
2469 print "\n";
2470 }
2471
2472 print "You can specify bind protocol version here.\n";
2473 print "Default protocol version depends on your php ldap settings.\n";
2474 print "Press ENTER for default.\n";
2475 print "protocol: ";
2476 $name = <STDIN>;
2477 $name =~ s/[\r\n]//g;
2478 $ldap_protocol[$sub] = $name;
2479
2480 print "\n";
2481
2482 } elsif ( $input =~ /^\s*-\s*[0-9]?/ ) {
2483 if ( $input =~ /[0-9]+\s*$/ ) {
2484 $rem_num = $input;
2485 $rem_num =~ s/^\s*-\s*//g;
2486 $rem_num =~ s/\s*$//;
2487 } else {
2488 $rem_num = $#ldap_host;
2489 }
2490 $count = 0;
2491 @new_ldap_host = ();
2492 @new_ldap_base = ();
2493 @new_ldap_port = ();
2494 @new_ldap_name = ();
2495 @new_ldap_charset = ();
2496 @new_ldap_maxrows = ();
2497 @new_ldap_bindpw = ();
2498 @new_ldap_binddn = ();
2499 @new_ldap_protocol = ();
2500
2501 while ( $count <= $#ldap_host ) {
2502 if ( $count != $rem_num ) {
2503 @new_ldap_host = ( @new_ldap_host, $ldap_host[$count] );
2504 @new_ldap_base = ( @new_ldap_base, $ldap_base[$count] );
2505 @new_ldap_port = ( @new_ldap_port, $ldap_port[$count] );
2506 @new_ldap_name = ( @new_ldap_name, $ldap_name[$count] );
2507 @new_ldap_charset = ( @new_ldap_charset, $ldap_charset[$count] );
2508 @new_ldap_maxrows = ( @new_ldap_maxrows, $ldap_maxrows[$count] );
2509 @new_ldap_binddn = ( @new_ldap_binddn, $ldap_binddn[$count] );
2510 @new_ldap_bindpw = ( @new_ldap_bindpw, $ldap_bindpw[$count] );
2511 @new_ldap_protocol = ( @new_ldap_protocol, $ldap_protocol[$count] );
2512 }
2513 $count++;
2514 }
2515 @ldap_host = @new_ldap_host;
2516 @ldap_base = @new_ldap_base;
2517 @ldap_port = @new_ldap_port;
2518 @ldap_name = @new_ldap_name;
2519 @ldap_charset = @new_ldap_charset;
2520 @ldap_maxrows = @new_ldap_maxrows;
2521 @ldap_binddn = @new_ldap_binddn;
2522 @ldap_bindpw = @new_ldap_bindpw;
2523 @ldap_protocol = @new_ldap_protocol;
2524
2525 } elsif ( $input =~ /^\s*\?\s*/ ) {
2526 print ".-------------------------.\n";
2527 print "| + (add host) |\n";
2528 print "| - N (remove host) |\n";
2529 print "| l (list hosts) |\n";
2530 print "| d (done) |\n";
2531 print "`-------------------------'\n";
2532 }
2533 print "[ldap] command (?=help) > ";
2534 $input = <STDIN>;
2535 $input =~ s/[\r\n]//g;
2536 }
2537 }
2538
2539 sub command62 {
2540 print "Some of our developers have come up with very good javascript interface\n";
2541 print "for searching through address books, however, our original goals said\n";
2542 print "that we would be 100% HTML. In order to make it possible to use their\n";
2543 print "interface, and yet stick with our goals, we have also written a plain\n";
2544 print "HTML version of the search. Here, you can choose which version to use.\n";
2545 print "\n";
2546 print "This is just the default value. It is also a user option that each\n";
2547 print "user can configure individually\n";
2548 print "\n";
2549
2550 if ( lc($default_use_javascript_addr_book) eq 'true' ) {
2551 $default_value = "y";
2552 } else {
2553 $default_use_javascript_addr_book = 'false';
2554 $default_value = "n";
2555 }
2556 print "Use javascript version by default (y/n) [$WHT$default_value$NRM]: $WHT";
2557 $new_show = <STDIN>;
2558 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2559 $default_use_javascript_addr_book = 'true';
2560 } else {
2561 $default_use_javascript_addr_book = 'false';
2562 }
2563 return $default_use_javascript_addr_book;
2564 }
2565
2566 sub command91 {
2567 print "If you want to store your users address book details in a database then\n";
2568 print "you need to set this DSN to a valid value. The format for this is:\n";
2569 print "mysql://user:pass\@hostname/dbname\n";
2570 print "Where mysql can be one of the databases PHP supports, the most common\n";
2571 print "of these are mysql, msql and pgsql\n";
2572 print "If the DSN is left empty (hit space and then return) the database\n";
2573 print "related code for address books will not be used\n";
2574 print "\n";
2575
2576 if ( $addrbook_dsn eq "" ) {
2577 $default_value = "Disabled";
2578 } else {
2579 $default_value = $addrbook_dsn;
2580 }
2581 print "[$WHT$addrbook_dsn$NRM]: $WHT";
2582 $new_dsn = <STDIN>;
2583 if ( $new_dsn eq "\n" ) {
2584 $new_dsn = "";
2585 } else {
2586 $new_dsn =~ s/[\r\n]//g;
2587 $new_dsn =~ s/^\s+$//g;
2588 }
2589 return $new_dsn;
2590 }
2591
2592 sub command92 {
2593 print "This is the name of the table you want to store the address book\n";
2594 print "data in, it defaults to 'address'\n";
2595 print "\n";
2596 print "[$WHT$addrbook_table$NRM]: $WHT";
2597 $new_table = <STDIN>;
2598 if ( $new_table eq "\n" ) {
2599 $new_table = $addrbook_table;
2600 } else {
2601 $new_table =~ s/[\r\n]//g;
2602 }
2603 return $new_table;
2604 }
2605
2606 sub command93 {
2607 print "If you want to store your users preferences in a database then\n";
2608 print "you need to set this DSN to a valid value. The format for this is:\n";
2609 print "mysql://user:pass\@hostname/dbname\n";
2610 print "Where mysql can be one of the databases PHP supports, the most common\n";
2611 print "of these are mysql, msql and pgsql\n";
2612 print "If the DSN is left empty (hit space and then return) the database\n";
2613 print "related code for address books will not be used\n";
2614 print "\n";
2615
2616 if ( $prefs_dsn eq "" ) {
2617 $default_value = "Disabled";
2618 } else {
2619 $default_value = $prefs_dsn;
2620 }
2621 print "[$WHT$prefs_dsn$NRM]: $WHT";
2622 $new_dsn = <STDIN>;
2623 if ( $new_dsn eq "\n" ) {
2624 $new_dsn = "";
2625 } else {
2626 $new_dsn =~ s/[\r\n]//g;
2627 $new_dsn =~ s/^\s+$//g;
2628 }
2629 return $new_dsn;
2630 }
2631
2632 sub command94 {
2633 print "This is the name of the table you want to store the preferences\n";
2634 print "data in, it defaults to 'userprefs'\n";
2635 print "\n";
2636 print "[$WHT$prefs_table$NRM]: $WHT";
2637 $new_table = <STDIN>;
2638 if ( $new_table eq "\n" ) {
2639 $new_table = $prefs_table;
2640 } else {
2641 $new_table =~ s/[\r\n]//g;
2642 }
2643 return $new_table;
2644 }
2645
2646 sub command95 {
2647 print "This is the name of the field in which you want to store the\n";
2648 print "username of the person the prefs are for. It default to 'user'\n";
2649 print "which clashes with a reserved keyword in PostgreSQL so this\n";
2650 print "will need to be changed for that database at least\n";
2651 print "\n";
2652 print "[$WHT$prefs_user_field$NRM]: $WHT";
2653 $new_field = <STDIN>;
2654 if ( $new_field eq "\n" ) {
2655 $new_field = $prefs_user_field;
2656 } else {
2657 $new_field =~ s/[\r\n]//g;
2658 }
2659 return $new_field;
2660 }
2661
2662 sub command96 {
2663 print "This is the name of the field in which you want to store the\n";
2664 print "preferences keyword. It defaults to 'prefkey'\n";
2665 print "\n";
2666 print "[$WHT$prefs_key_field$NRM]: $WHT";
2667 $new_field = <STDIN>;
2668 if ( $new_field eq "\n" ) {
2669 $new_field = $prefs_key_field;
2670 } else {
2671 $new_field =~ s/[\r\n]//g;
2672 }
2673 return $new_field;
2674 }
2675
2676 sub command97 {
2677 print "This is the name of the field in which you want to store the\n";
2678 print "preferences value. It defaults to 'prefval'\n";
2679 print "\n";
2680 print "[$WHT$prefs_val_field$NRM]: $WHT";
2681 $new_field = <STDIN>;
2682 if ( $new_field eq "\n" ) {
2683 $new_field = $prefs_val_field;
2684 } else {
2685 $new_field =~ s/[\r\n]//g;
2686 }
2687 return $new_field;
2688 }
2689
2690 sub command98 {
2691 print "If you want to store your global address book in a database then\n";
2692 print "you need to set this DSN to a valid value. The format for this is:\n";
2693 print "mysql://user:pass\@hostname/dbname\n";
2694 print "Where mysql can be one of the databases PHP supports, the most common\n";
2695 print "of these are mysql, msql and pgsql\n";
2696 print "If the DSN is left empty (hit space and then return) the database\n";
2697 print "related code for global SQL address book will not be used\n";
2698 print "\n";
2699
2700 if ( $addrbook_global_dsn eq "" ) {
2701 $default_value = "Disabled";
2702 } else {
2703 $default_value = $addrbook_global_dsn;
2704 }
2705 print "[$WHT$addrbook_global_dsn$NRM]: $WHT";
2706 $new_dsn = <STDIN>;
2707 if ( $new_dsn eq "\n" ) {
2708 $new_dsn = "";
2709 } else {
2710 $new_dsn =~ s/[\r\n]//g;
2711 $new_dsn =~ s/^\s+$//g;
2712 }
2713 return $new_dsn;
2714 }
2715
2716 sub command99 {
2717 print "This is the name of the table you want to store the global address book\n";
2718 print "data in, it defaults to 'global_address'\n";
2719 print "\n";
2720 print "[$WHT$addrbook_global_table$NRM]: $WHT";
2721 $new_table = <STDIN>;
2722 if ( $new_table eq "\n" ) {
2723 $new_table = $addrbook_global_table;
2724 } else {
2725 $new_table =~ s/[\r\n]//g;
2726 }
2727 return $new_table;
2728 }
2729
2730 sub command910 {
2731 print "This option controls users\' ability to add or modify records stored \n";
2732 print "in global address book\n";
2733
2734 if ( lc($addrbook_global_writeable) eq 'true' ) {
2735 $default_value = "y";
2736 } else {
2737 $default_value = "n";
2738 }
2739 print "Allow writing into global address book? (y/n) [$WHT$default_value$NRM]: $WHT";
2740 $addrbook_global_writeable = <STDIN>;
2741 if ( ( $addrbook_global_writeable =~ /^y\n/i ) || ( ( $addrbook_global_writeable =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2742 $addrbook_global_writeable = 'true';
2743 } else {
2744 $addrbook_global_writeable = 'false';
2745 }
2746 return $addrbook_global_writeable;
2747 }
2748
2749 sub command911 {
2750 print "Enable this option if you want to see listing of addresses stored \n";
2751 print "in global address book\n";
2752
2753 if ( lc($addrbook_global_listing) eq 'true' ) {
2754 $default_value = "y";
2755 } else {
2756 $default_value = "n";
2757 }
2758 print "Allow listing of global address book? (y/n) [$WHT$default_value$NRM]: $WHT";
2759 $addrbook_global_listing = <STDIN>;
2760 if ( ( $addrbook_global_listing =~ /^y\n/i ) || ( ( $addrbook_global_listing =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2761 $addrbook_global_listing = 'true';
2762 } else {
2763 $addrbook_global_listing = 'false';
2764 }
2765 return $addrbook_global_listing;
2766 }
2767
2768
2769 # Default language
2770 sub commandA1 {
2771 print "SquirrelMail attempts to set the language in many ways. If it\n";
2772 print "can not figure it out in another way, it will default to this\n";
2773 print "language. Please use the code for the desired language.\n";
2774 print "\n";
2775 print "[$WHT$squirrelmail_default_language$NRM]: $WHT";
2776 $new_squirrelmail_default_language = <STDIN>;
2777 if ( $new_squirrelmail_default_language eq "\n" ) {
2778 $new_squirrelmail_default_language = $squirrelmail_default_language;
2779 } else {
2780 $new_squirrelmail_default_language =~ s/[\r\n]//g;
2781 $new_squirrelmail_default_language =~ s/^\s+$//g;
2782 }
2783 return $new_squirrelmail_default_language;
2784 }
2785 # Default Charset
2786 sub commandA2 {
2787 print "This option controls what character set is used when sending\n";
2788 print "mail and when sending HTML to the browser. Option works only\n";
2789 print "with US English (en_US) translation. Other translations use\n";
2790 print "charsets that are set in functions/i18n.php.\n";
2791 print "\n";
2792
2793 print "[$WHT$default_charset$NRM]: $WHT";
2794 $new_default_charset = <STDIN>;
2795 if ( $new_default_charset eq "\n" ) {
2796 $new_default_charset = $default_charset;
2797 } else {
2798 $new_default_charset =~ s/[\r\n]//g;
2799 }
2800 return $new_default_charset;
2801 }
2802 # Alternative language names
2803 sub commandA3 {
2804 print "Enable this option if you want to see localized language names in\n";
2805 print "language selection box. Note, that if don't limit list of available\n";
2806 print "languages, this option can trigger installation of foreign language\n";
2807 print "support modules in some browsers.\n";
2808 print "\n";
2809
2810 if ( lc($show_alternative_names) eq 'true' ) {
2811 $default_value = "y";
2812 } else {
2813 $default_value = "n";
2814 }
2815 print "Show alternative language names? (y/n) [$WHT$default_value$NRM]: $WHT";
2816 $show_alternative_names = <STDIN>;
2817 if ( ( $show_alternative_names =~ /^y\n/i ) || ( ( $show_alternative_names =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2818 $show_alternative_names = 'true';
2819 } else {
2820 $show_alternative_names = 'false';
2821 }
2822 return $show_alternative_names;
2823 }
2824 # Available languages
2825 sub commandA4 {
2826 print "This option allows to limit number of languages available in\n";
2827 print "language selection box. You can enter as code of every language that\n";
2828 print "you want to enable. Language codes should be separated by space. If you\n";
2829 print "enter name unsupported by SquirrelMail, it will be ignored. If you enter\n";
2830 print "special key \'all\' - all languages available in SquirrelMail will be\n";
2831 print "listed. If you enter special key \'none\' - user won't be able to change";
2832 print "language and interface will use language set it \"Default language\" option.\n";
2833 print "\n";
2834 print "You can find valid language names in doc/i18n.txt.\n";
2835 print "\n";
2836 print "[$WHT$available_languages$NRM]: $WHT";
2837 $new_available_languages = <STDIN>;
2838 if ( $new_available_languages eq "\n" ) {
2839 $new_available_languages = $available_languages;
2840 } else {
2841 $new_available_languages =~ s/[\r\n]//g;
2842 $new_available_languages =~ s/^\s+$//g;
2843 }
2844 return $new_available_languages;
2845 }
2846 # Aggressive decoding
2847 sub commandA5 {
2848 print "Enable this option if you want to use CPU and memory intensive decoding\n";
2849 print "functions. This option allows reading multibyte charset, that are used\n";
2850 print "in Eastern Asia. SquirrelMail will try to use recode functions here,\n";
2851 print "even when you have disabled use of recode in Tweaks section.\n";
2852 print "\n";
2853
2854 if ( lc($aggressive_decoding) eq 'true' ) {
2855 $default_value = "y";
2856 } else {
2857 $default_value = "n";