moving functions to separate file, adding configuration files
[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://www.example.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\@example.com, then your domain\n";
923 print "would be example.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 "HELO $domain\r\n";
1222 $got = <$sock>; # Discard
1223 print $sock "MAIL FROM:<tester\@squirrelmail.org>\r\n";
1224 $got = <$sock>; # Discard
1225 print $sock "RCPT TO:<junk\@microsoft.com\r\n";
1226 $got = <$sock>; # This is the important line
1227 if ($got =~ /^250\b/) { # SMTP will relay without auth
1228 print "SUPPORTED$NRM\n";
1229 } else {
1230 print "NOT SUPPORTED$NRM\n";
1231 }
1232 print $sock "RSET\r\n";
1233 print $sock "QUIT\r\n";
1234 close $sock;
1235 }
1236 # Try login (SquirrelMail default)
1237 print "Testing login:\t\t";
1238 $tmp=detect_auth_support('SMTP',$host,'LOGIN');
1239 if (defined($tmp)) {
1240 if ($tmp eq 'YES') {
1241 print $WHT . "SUPPORTED$NRM\n";
1242 } else {
1243 print $WHT . "NOT SUPPORTED$NRM\n";
1244 }
1245 } else {
1246 print $WHT . "ERROR DETECTING$NRM\n";
1247 }
1248
1249 # Try CRAM-MD5
1250 print "Testing CRAM-MD5:\t";
1251 $tmp=detect_auth_support('SMTP',$host,'CRAM-MD5');
1252 if (defined($tmp)) {
1253 if ($tmp eq 'YES') {
1254 print $WHT . "SUPPORTED$NRM\n";
1255 } else {
1256 print $WHT . "NOT SUPPORTED$NRM\n";
1257 }
1258 } else {
1259 print $WHT . "ERROR DETECTING$NRM\n";
1260 }
1261
1262
1263 print "Testing DIGEST-MD5:\t";
1264 $tmp=detect_auth_support('SMTP',$host,'DIGEST-MD5');
1265 if (defined($tmp)) {
1266 if ($tmp eq 'YES') {
1267 print $WHT . "SUPPORTED$NRM\n";
1268 } else {
1269 print $WHT . "NOT SUPPORTED$NRM\n";
1270 }
1271 } else {
1272 print $WHT . "ERROR DETECTING$NRM\n";
1273 }
1274 }
1275 }
1276 print "\nWhat authentication mechanism do you want to use for SMTP connections?\n";
1277 print $WHT . "none" . $NRM . " - Your SMTP server does not require authorization.\n";
1278 print $WHT . "login" . $NRM . " - Plaintext. If you can do better, you probably should.\n";
1279 print $WHT . "plain" . $NRM . " - SASL PLAIN. You already know it if you need this.\n";
1280 print $WHT . "cram-md5" . $NRM . " - Slightly better than plaintext.\n";
1281 print $WHT . "digest-md5" . $NRM . " - Privacy protection - better than cram-md5.\n";
1282 print $WHT . "\n*** YOUR SMTP SERVER MUST SUPPORT THE MECHANISM YOU CHOOSE HERE ***\n" . $NRM;
1283 print "If you don't understand or are unsure, you probably want \"none\"\n\n";
1284 print "none, login, cram-md5, or digest-md5 [$WHT$smtp_auth_mech$NRM]: $WHT";
1285 $inval=<STDIN>;
1286 chomp($inval);
1287 if ($inval =~ /^none\b/i) {
1288 # SMTP doesn't necessarily require logins
1289 return "none";
1290 }
1291 if ( ($inval =~ /^cram-md5\b/i) || ($inval =~ /^digest-md5\b/i) ||
1292 ($inval =~ /^login\b/i) || ($inval =~/^plain\b/i)) {
1293 return lc($inval);
1294 } else {
1295 # user entered garbage, or default value so nothing needs to be set
1296 return $smtp_auth_mech;
1297 }
1298 }
1299
1300 # TLS
1301 # This sub is reused for IMAP and SMTP
1302 # Args: service name, default value
1303 sub command113 {
1304 my($default_val,$service,$inval);
1305 $service=$_[0];
1306 $default_val=$_[1];
1307 print "TLS (Transport Layer Security) encrypts the traffic between server and client.\n";
1308 print "If you're familiar with SSL, you get the idea.\n";
1309 print "To use this feature, your " . $service . " server must offer TLS\n";
1310 print "capability, plus PHP 4.3.x with OpenSSL support.\n";
1311 print "\nIf your " . $service . " server is localhost, you can safely disable this.\n";
1312 print "If it is remote, you may wish to seriously consider enabling this.\n";
1313 print "Enable TLS (y/n) [$WHT";
1314 if ($default_val eq 'true') {
1315 print "y";
1316 } else {
1317 print "n";
1318 }
1319 print "$NRM]: $WHT";
1320 $inval=<STDIN>;
1321 $inval =~ tr/yn//cd;
1322 return 'true' if ( $inval eq "y" );
1323 return 'false' if ( $inval eq "n" );
1324 return $default_val;
1325 }
1326
1327 sub command114{
1328 print "\nUse this to suppress insertion of SquirrelMail Received: headers\n";
1329 print "in outbound messages.\n\n";
1330
1331 $YesNo = 'n';
1332 $YesNo = 'y' if ( lc($skip_SM_header) eq 'true' );
1333
1334 print "Suppress SM header (y/n) [$WHT$YesNo$NRM]: $WHT";
1335 $new_skip_SM_header = <STDIN>;
1336 chomp($new_skip_SM_header);
1337
1338 return 'true' if ( lc($new_skip_SM_header) eq 'y' );
1339 return 'false' if ( lc($new_skip_SM_header) eq 'n' );
1340 return $skip_SM_header;
1341 }
1342
1343 # MOTD
1344 sub command71 {
1345 print "\nYou can now create the welcome message that is displayed\n";
1346 print "every time a user logs on. You can use HTML or just plain\n";
1347 print
1348 "text. If you do not wish to have one, just make it blank.\n\n(Type @ on a blank line to exit)\n";
1349
1350 $new_motd = "";
1351 do {
1352 print "] ";
1353 $line = <STDIN>;
1354 $line =~ s/[\r\n]//g;
1355 if ( $line ne "@" ) {
1356 $line =~ s/ /\&nbsp;\&nbsp;/g;
1357 $line =~ s/\t/\&nbsp;\&nbsp;\&nbsp;\&nbsp;/g;
1358 $line =~ s/$/ /;
1359 $line =~ s/\"/&quot;/g;
1360
1361 $new_motd = $new_motd . $line;
1362 }
1363 } while ( $line ne "@" );
1364 return $new_motd;
1365 }
1366
1367 ################# PLUGINS ###################
1368
1369 sub command81 {
1370 $command =~ s/[\s\n\r]*//g;
1371 if ( $command > 0 ) {
1372 $command = $command - 1;
1373 if ( $command <= $#plugins ) {
1374 @newplugins = ();
1375 $ct = 0;
1376 while ( $ct <= $#plugins ) {
1377 if ( $ct != $command ) {
1378 @newplugins = ( @newplugins, $plugins[$ct] );
1379 }
1380 $ct++;
1381 }
1382 @plugins = @newplugins;
1383 } elsif ( $command <= $#plugins + $#unused_plugins + 1 ) {
1384 $num = $command - $#plugins - 1;
1385 @newplugins = @plugins;
1386 $ct = 0;
1387 while ( $ct <= $#unused_plugins ) {
1388 if ( $ct == $num ) {
1389 @newplugins = ( @newplugins, $unused_plugins[$ct] );
1390 }
1391 $ct++;
1392 }
1393 @plugins = @newplugins;
1394 }
1395 }
1396 return @plugins;
1397 }
1398
1399 ################# FOLDERS ###################
1400
1401 # default_folder_prefix
1402 sub command21 {
1403 print "Some IMAP servers (UW, for example) store mail and folders in\n";
1404 print "your user space in a separate subdirectory. This is where you\n";
1405 print "specify what that directory is.\n";
1406 print "\n";
1407 print "EXAMPLE: mail/";
1408 print "\n";
1409 print "NOTE: If you use Cyrus, or some server that would not use this\n";
1410 print " option, you must set this to 'none'.\n";
1411 print "\n";
1412 print "[$WHT$default_folder_prefix$NRM]: $WHT";
1413 $new_default_folder_prefix = <STDIN>;
1414
1415 if ( $new_default_folder_prefix eq "\n" ) {
1416 $new_default_folder_prefix = $default_folder_prefix;
1417 } else {
1418 $new_default_folder_prefix =~ s/[\r\n]//g;
1419 }
1420 if ( ( $new_default_folder_prefix =~ /^\s*$/ ) || ( $new_default_folder_prefix =~ m/^none$/i ) ) {
1421 $new_default_folder_prefix = "";
1422 } else {
1423 # add the trailing delimiter only if we know what the server is.
1424 if (($imap_server_type eq 'cyrus' and
1425 $optional_delimiter eq 'detect') or
1426 ($imap_server_type eq 'courier' and
1427 $optional_delimiter eq 'detect')) {
1428 $new_default_folder_prefix =~ s/\.*$/\./;
1429 } elsif ($imap_server_type eq 'uw' and
1430 $optional_delimiter eq 'detect') {
1431 $new_default_folder_prefix =~ s/\/*$/\//;
1432 }
1433 }
1434 return $new_default_folder_prefix;
1435 }
1436
1437 # Show Folder Prefix
1438 sub command22 {
1439 print "It is possible to set up the default folder prefix as a user\n";
1440 print "specific option, where each user can specify what their mail\n";
1441 print "folder is. If you set this to false, they will never see the\n";
1442 print "option, but if it is true, this option will appear in the\n";
1443 print "'options' section.\n";
1444 print "\n";
1445 print "NOTE: You set the default folder prefix in option '1' of this\n";
1446 print " section. That will be the default if the user doesn't\n";
1447 print " specify anything different.\n";
1448 print "\n";
1449
1450 if ( lc($show_prefix_option) eq 'true' ) {
1451 $default_value = "y";
1452 } else {
1453 $default_value = "n";
1454 }
1455 print "\n";
1456 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
1457 $new_show = <STDIN>;
1458 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1459 $show_prefix_option = 'true';
1460 } else {
1461 $show_prefix_option = 'false';
1462 }
1463 return $show_prefix_option;
1464 }
1465
1466 # Trash Folder
1467 sub command23a {
1468 print "You can now specify where the default trash folder is located.\n";
1469 print "On servers where you do not want this, you can set it to anything\n";
1470 print "and set option 6 to false.\n";
1471 print "\n";
1472 print "This is relative to where the rest of your email is kept. You do\n";
1473 print "not need to worry about their mail directory. If this folder\n";
1474 print "would be ~/mail/trash on the filesystem, you only need to specify\n";
1475 print "that this is 'trash', and be sure to put 'mail/' in option 1.\n";
1476 print "\n";
1477
1478 print "[$WHT$trash_folder$NRM]: $WHT";
1479 $new_trash_folder = <STDIN>;
1480 if ( $new_trash_folder eq "\n" ) {
1481 $new_trash_folder = $trash_folder;
1482 } else {
1483 $new_trash_folder =~ s/[\r\n]//g;
1484 }
1485 return $new_trash_folder;
1486 }
1487
1488 # Sent Folder
1489 sub command23b {
1490 print "This is where messages that are sent will be stored. SquirrelMail\n";
1491 print "by default puts a copy of all outgoing messages in this folder.\n";
1492 print "\n";
1493 print "This is relative to where the rest of your email is kept. You do\n";
1494 print "not need to worry about their mail directory. If this folder\n";
1495 print "would be ~/mail/sent on the filesystem, you only need to specify\n";
1496 print "that this is 'sent', and be sure to put 'mail/' in option 1.\n";
1497 print "\n";
1498
1499 print "[$WHT$sent_folder$NRM]: $WHT";
1500 $new_sent_folder = <STDIN>;
1501 if ( $new_sent_folder eq "\n" ) {
1502 $new_sent_folder = $sent_folder;
1503 } else {
1504 $new_sent_folder =~ s/[\r\n]//g;
1505 }
1506 return $new_sent_folder;
1507 }
1508
1509 # Draft Folder
1510 sub command23c {
1511 print "You can now specify where the default draft folder is located.\n";
1512 print "On servers where you do not want this, you can set it to anything\n";
1513 print "and set option 9 to false.\n";
1514 print "\n";
1515 print "This is relative to where the rest of your email is kept. You do\n";
1516 print "not need to worry about their mail directory. If this folder\n";
1517 print "would be ~/mail/drafts on the filesystem, you only need to specify\n";
1518 print "that this is 'drafts', and be sure to put 'mail/' in option 1.\n";
1519 print "\n";
1520
1521 print "[$WHT$draft_folder$NRM]: $WHT";
1522 $new_draft_folder = <STDIN>;
1523 if ( $new_draft_folder eq "\n" ) {
1524 $new_draft_folder = $draft_folder;
1525 } else {
1526 $new_draft_folder =~ s/[\r\n]//g;
1527 }
1528 return $new_draft_folder;
1529 }
1530
1531 # default move to trash
1532 sub command24a {
1533 print "By default, should messages get moved to the trash folder? You\n";
1534 print "can specify the default trash folder in option 3. If this is set\n";
1535 print "to false, messages will get deleted immediately without moving\n";
1536 print "to the trash folder.\n";
1537 print "\n";
1538 print "Trash folder is currently: $trash_folder\n";
1539 print "\n";
1540
1541 if ( lc($default_move_to_trash) eq 'true' ) {
1542 $default_value = "y";
1543 } else {
1544 $default_value = "n";
1545 }
1546 print "By default, move to trash (y/n) [$WHT$default_value$NRM]: $WHT";
1547 $new_show = <STDIN>;
1548 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1549 $default_move_to_trash = 'true';
1550 } else {
1551 $default_move_to_trash = 'false';
1552 }
1553 return $default_move_to_trash;
1554 }
1555
1556 # default move to sent
1557 sub command24b {
1558 print "By default, should messages get moved to the sent folder? You\n";
1559 print "can specify the default sent folder in option 4. If this is set\n";
1560 print "to false, messages will get sent and no copy will be made.\n";
1561 print "\n";
1562 print "Sent folder is currently: $sent_folder\n";
1563 print "\n";
1564
1565 if ( lc($default_move_to_sent) eq 'true' ) {
1566 $default_value = "y";
1567 } else {
1568 $default_value = "n";
1569 }
1570 print "By default, move to sent (y/n) [$WHT$default_value$NRM]: $WHT";
1571 $new_show = <STDIN>;
1572 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1573 $default_move_to_sent = 'true';
1574 } else {
1575 $default_move_to_sent = 'false';
1576 }
1577 return $default_move_to_sent;
1578 }
1579
1580 # default save as draft
1581 sub command24c {
1582 print "By default, should the save to draft option be shown? You can\n";
1583 print "specify the default drafts folder in option 5. If this is set\n";
1584 print "to false, users will not be shown the save to draft option.\n";
1585 print "\n";
1586 print "Drafts folder is currently: $draft_folder\n";
1587 print "\n";
1588
1589 if ( lc($default_move_to_draft) eq 'true' ) {
1590 $default_value = "y";
1591 } else {
1592 $default_value = "n";
1593 }
1594 print "By default, save as draft (y/n) [$WHT$default_value$NRM]: $WHT";
1595 $new_show = <STDIN>;
1596 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1597 $default_save_as_draft = 'true';
1598 } else {
1599 $default_save_as_draft = 'false';
1600 }
1601 return $default_save_as_draft;
1602 }
1603
1604 # List special folders first
1605 sub command27 {
1606 print "SquirrelMail has what we call 'special folders' that are not\n";
1607 print "manipulated and viewed like normal folders. Some examples of\n";
1608 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
1609 print "Simply asks if you want these folders listed first in the folder\n";
1610 print "listing.\n";
1611 print "\n";
1612
1613 if ( lc($list_special_folders_first) eq 'true' ) {
1614 $default_value = "y";
1615 } else {
1616 $default_value = "n";
1617 }
1618 print "\n";
1619 print "List first (y/n) [$WHT$default_value$NRM]: $WHT";
1620 $new_show = <STDIN>;
1621 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1622 $list_special_folders_first = 'true';
1623 } else {
1624 $list_special_folders_first = 'false';
1625 }
1626 return $list_special_folders_first;
1627 }
1628
1629 # Show special folders color
1630 sub command28 {
1631 print "SquirrelMail has what we call 'special folders' that are not\n";
1632 print "manipulated and viewed like normal folders. Some examples of\n";
1633 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
1634 print "wants to know if we should display special folders in a\n";
1635 print "color than the other folders.\n";
1636 print "\n";
1637
1638 if ( lc($use_special_folder_color) eq 'true' ) {
1639 $default_value = "y";
1640 } else {
1641 $default_value = "n";
1642 }
1643 print "\n";
1644 print "Show color (y/n) [$WHT$default_value$NRM]: $WHT";
1645 $new_show = <STDIN>;
1646 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1647 $use_special_folder_color = 'true';
1648 } else {
1649 $use_special_folder_color = 'false';
1650 }
1651 return $use_special_folder_color;
1652 }
1653
1654 # Auto expunge
1655 sub command29 {
1656 print "The way that IMAP handles deleting messages is as follows. You\n";
1657 print "mark the message as deleted, and then to 'really' delete it, you\n";
1658 print "expunge it. This option asks if you want to just have messages\n";
1659 print "marked as deleted, or if you want SquirrelMail to expunge the \n";
1660 print "messages too.\n";
1661 print "\n";
1662
1663 if ( lc($auto_expunge) eq 'true' ) {
1664 $default_value = "y";
1665 } else {
1666 $default_value = "n";
1667 }
1668 print "Auto expunge (y/n) [$WHT$default_value$NRM]: $WHT";
1669 $new_show = <STDIN>;
1670 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1671 $auto_expunge = 'true';
1672 } else {
1673 $auto_expunge = 'false';
1674 }
1675 return $auto_expunge;
1676 }
1677
1678 # Default sub of inbox
1679 sub command210 {
1680 print "Some IMAP servers (Cyrus) have all folders as subfolders of INBOX.\n";
1681 print "This can cause some confusion in folder creation for users when\n";
1682 print "they try to create folders and don't put it as a subfolder of INBOX\n";
1683 print "and get permission errors. This option asks if you want folders\n";
1684 print "to be subfolders of INBOX by default.\n";
1685 print "\n";
1686
1687 if ( lc($default_sub_of_inbox) eq 'true' ) {
1688 $default_value = "y";
1689 } else {
1690 $default_value = "n";
1691 }
1692 print "Default sub of INBOX (y/n) [$WHT$default_value$NRM]: $WHT";
1693 $new_show = <STDIN>;
1694 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1695 $default_sub_of_inbox = 'true';
1696 } else {
1697 $default_sub_of_inbox = 'false';
1698 }
1699 return $default_sub_of_inbox;
1700 }
1701
1702 # Show contain subfolder option
1703 sub command211 {
1704 print "Some IMAP servers (UW) make it so that there are two types of\n";
1705 print "folders. Those that contain messages, and those that contain\n";
1706 print "subfolders. If this is the case for your server, set this to\n";
1707 print "true, and it will ask the user whether the folder they are\n";
1708 print "creating contains subfolders or messages.\n";
1709 print "\n";
1710
1711 if ( lc($show_contain_subfolders_option) eq 'true' ) {
1712 $default_value = "y";
1713 } else {
1714 $default_value = "n";
1715 }
1716 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
1717 $new_show = <STDIN>;
1718 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1719 $show_contain_subfolders_option = 'true';
1720 } else {
1721 $show_contain_subfolders_option = 'false';
1722 }
1723 return $show_contain_subfolders_option;
1724 }
1725
1726 # Default Unseen Notify
1727 sub command212 {
1728 print "This option specifies where the users will receive notification\n";
1729 print "about unseen messages by default. This is of course an option that\n";
1730 print "can be changed on a user level.\n";
1731 print " 1 = No notification\n";
1732 print " 2 = Only on the INBOX\n";
1733 print " 3 = On all folders\n";
1734 print "\n";
1735
1736 print "Which one should be default (1,2,3)? [$WHT$default_unseen_notify$NRM]: $WHT";
1737 $new_show = <STDIN>;
1738 if ( $new_show =~ /^[123]\n/i ) {
1739 $default_unseen_notify = $new_show;
1740 }
1741 $default_unseen_notify =~ s/[\r\n]//g;
1742 return $default_unseen_notify;
1743 }
1744
1745 # Default Unseen Type
1746 sub command213 {
1747 print "Here you can define the default way that unseen messages will be displayed\n";
1748 print "to the user in the folder listing on the left side.\n";
1749 print " 1 = Only unseen messages (4)\n";
1750 print " 2 = Unseen and Total messages (4/27)\n";
1751 print "\n";
1752
1753 print "Which one should be default (1,2)? [$WHT$default_unseen_type$NRM]: $WHT";
1754 $new_show = <STDIN>;
1755 if ( $new_show =~ /^[12]\n/i ) {
1756 $default_unseen_type = $new_show;
1757 }
1758 $default_unseen_type =~ s/[\r\n]//g;
1759 return $default_unseen_type;
1760 }
1761
1762 # Auto create special folders
1763 sub command214 {
1764 print "Would you like the Sent, Trash, and Drafts folders to be created\n";
1765 print "automatically print for you when a user logs in? If the user\n";
1766 print "accidentally deletes their special folders, this option will\n";
1767 print "automatically create it again for them.\n";
1768 print "\n";
1769
1770 if ( lc($auto_create_special) eq 'true' ) {
1771 $default_value = "y";
1772 } else {
1773 $default_value = "n";
1774 }
1775 print "Auto create special folders? (y/n) [$WHT$default_value$NRM]: $WHT";
1776 $new_show = <STDIN>;
1777 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1778 $auto_create_special = 'true';
1779 } else {
1780 $auto_create_special = 'false';
1781 }
1782 return $auto_create_special;
1783 }
1784
1785 # Automatically delete folders
1786 sub command215 {
1787 if ( $imap_server_type eq "uw" ) {
1788 print "UW IMAP servers will not allow folders containing mail to also contain folders.\n";
1789 print "Deleting folders will bypass the trash folder and be immediately deleted\n\n";
1790 print "If this is not the correct value for your server,\n";
1791 print "please use option D on the Main Menu to configure your server correctly.\n\n";
1792 print "Press any key to continue...\n";
1793 $new_delete = <STDIN>;
1794 $delete_folder = 'true';
1795 } else {
1796 if ( $imap_server_type eq "courier" ) {
1797 print "Courier (or Courier-IMAP) IMAP servers may not support ";
1798 print "subfolders of Trash. \n";
1799 print "Specifically, if Courier is set to always move messages to Trash, \n";
1800 print "Trash will be treated by Courier as a special folder that does not \n";
1801 print "allow subfolders. \n\n";
1802 print "Please verify your Courier configuration, and test folder deletion \n";
1803 print "when changing this setting.\n\n";
1804 }
1805
1806 print "Are subfolders of the Trash supported by your IMAP server?\n";
1807 print "If so, should deleted folders be sent to Trash?\n";
1808 print "If not, say no (deleted folders should not be sent to Trash)\n\n";
1809 # reversal of logic.
1810 # question was: Should folders be automatically deleted instead of sent to trash..
1811 # we've changed the question to make it more clear,
1812 # and are here handling that to avoid changing the answers..
1813 if ( lc($delete_folder) eq 'true' ) {
1814 $default_value = "n";
1815 } else {
1816 $default_value = "y";
1817 }
1818 print "Send deleted folders to Trash? (y/n) [$WHT$default_value$NRM]: $WHT";
1819 $new_delete = <STDIN>;
1820 if ( ( $new_delete =~ /^y\n/i ) || ( ( $new_delete =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1821 $delete_folder = 'false';
1822 } else {
1823 $delete_folder = 'true';
1824 }
1825 }
1826 return $delete_folder;
1827 }
1828
1829 #noselect fix
1830 sub command216 {
1831 print "Some IMAP server allow subfolders to exist even if the parent\n";
1832 print "folders do not. This fixes some problems with the folder list\n";
1833 print "when this is the case, causing the /NoSelect folders to be displayed\n";
1834 print "\n";
1835
1836 if ( lc($noselect_fix_enable) eq 'true' ) {
1837 $default_value = "y";
1838 } else {
1839 $default_value = "n";
1840 }
1841 print "enable noselect fix? (y/n) [$WHT$noselect_fix_enable$NRM]: $WHT";
1842 $noselect_fix_enable = <STDIN>;
1843 if ( ( $noselect_fix_enable =~ /^y\n/i ) || ( ( $noselect_fix_enable =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1844 $noselect_fix_enable = 'true';
1845 } else {
1846 $noselect_fix_enable = 'false';
1847 }
1848 return $noselect_fix_enable;
1849 }
1850 ############# GENERAL OPTIONS #####################
1851
1852 # Data directory
1853 sub command33a {
1854 print "Specify the location for your data directory.\n";
1855 print "The path name can be absolute or relative (to the config directory).\n";
1856 print "It doesn't matter. Here are two examples:\n";
1857 print " Absolute: /var/spool/data/\n";
1858 print " Relative: ../data/\n";
1859 print "Relative paths to directories outside of the SquirrelMail distribution\n";
1860 print "will be converted to their absolute path equivalents in config.php.\n\n";
1861 print "Note: There are potential security risks with having a writeable directory\n";
1862 print "under the web server's root directory (ex: /home/httpd/html).\n";
1863 print "For this reason, it is recommended to put the data directory\n";
1864 print "in an alternate location of your choice. \n";
1865 print "\n";
1866
1867 print "[$WHT$data_dir$NRM]: $WHT";
1868 $new_data_dir = <STDIN>;
1869 if ( $new_data_dir eq "\n" ) {
1870 $new_data_dir = $data_dir;
1871 } else {
1872 $new_data_dir =~ s/[\r\n]//g;
1873 }
1874 if ( $new_data_dir =~ /^\s*$/ ) {
1875 $new_data_dir = "";
1876 } else {
1877 $new_data_dir =~ s/\/*$//g;
1878 $new_data_dir =~ s/$/\//g;
1879 }
1880 return $new_data_dir;
1881 }
1882
1883 # Attachment directory
1884 sub command33b {
1885 print "Path to directory used for storing attachments while a mail is\n";
1886 print "being sent. The path name can be absolute or relative (to the config directory).\n";
1887 print "It doesn't matter. Here are two examples:\n";
1888 print " Absolute: /var/spool/attach/\n";
1889 print " Relative: ../attach/\n";
1890 print "Relative paths to directories outside of the SquirrelMail distribution\n";
1891 print "will be converted to their absolute path equivalents in config.php.\n\n";
1892 print "Note: There are a few security considerations regarding this\n";
1893 print "directory:\n";
1894 print " 1. It should have the permission 733 (rwx-wx-wx) to make it\n";
1895 print " impossible for a random person with access to the webserver\n";
1896 print " to list files in this directory. Confidential data might\n";
1897 print " be laying around in there.\n";
1898 print " Depending on your user:group assignments, 730 (rwx-wx---)\n";
1899 print " may be possible, and more secure (e.g. root:apache)\n";
1900 print " 2. Since the webserver is not able to list the files in the\n";
1901 print " content is also impossible for the webserver to delete files\n";
1902 print " lying around there for too long.\n";
1903 print " 3. It should probably be another directory than the data\n";
1904 print " directory specified in option 3.\n";
1905 print "\n";
1906
1907 print "[$WHT$attachment_dir$NRM]: $WHT";
1908 $new_attachment_dir = <STDIN>;
1909 if ( $new_attachment_dir eq "\n" ) {
1910 $new_attachment_dir = $attachment_dir;
1911 } else {
1912 $new_attachment_dir =~ s/[\r\n]//g;
1913 }
1914 if ( $new_attachment_dir =~ /^\s*$/ ) {
1915 $new_attachment_dir = "";
1916 } else {
1917 $new_attachment_dir =~ s/\/*$//g;
1918 $new_attachment_dir =~ s/$/\//g;
1919 }
1920 return $new_attachment_dir;
1921 }
1922
1923 sub command33c {
1924 print "The directory hash level setting allows you to configure the level\n";
1925 print "of hashing that Squirremail employs in your data and attachment\n";
1926 print "directories. This value must be an integer ranging from 0 to 4.\n";
1927 print "When this value is set to 0, Squirrelmail will simply store all\n";
1928 print "files as normal in the data and attachment directories. However,\n";
1929 print "when set to a value from 1 to 4, a simple hashing scheme will be\n";
1930 print "used to organize the files in this directory. In short, the crc32\n";
1931 print "value for a username will be computed. Then, up to the first 4\n";
1932 print "digits of the hash, as set by this configuration value, will be\n";
1933 print "used to directory hash the files for that user in the data and\n";
1934 print "attachment directory. This allows for better performance on\n";
1935 print "servers with larger numbers of users.\n";
1936 print "\n";
1937
1938 print "[$WHT$dir_hash_level$NRM]: $WHT";
1939 $new_dir_hash_level = <STDIN>;
1940 if ( $new_dir_hash_level eq "\n" ) {
1941 $new_dir_hash_level = $dir_hash_level;
1942 } else {
1943 $new_dir_hash_level =~ s/[\r\n]//g;
1944 }
1945 if ( ( int($new_dir_hash_level) < 0 )
1946 || ( int($new_dir_hash_level) > 4 )
1947 || !( int($new_dir_hash_level) eq $new_dir_hash_level ) ) {
1948 print "Invalid Directory Hash Level.\n";
1949 print "Value must be an integer ranging from 0 to 4\n";
1950 print "Hit enter to continue.\n";
1951 $enter_key = <STDIN>;
1952
1953 $new_dir_hash_level = $dir_hash_level;
1954 }
1955
1956 return $new_dir_hash_level;
1957 }
1958
1959 sub command35 {
1960 print "This is the default size (in pixels) of the left folder list.\n";
1961 print "Default is 200, but you can set it to whatever you wish. This\n";
1962 print "is a user preference, so this will only show up as their default.\n";
1963 print "\n";
1964 print "[$WHT$default_left_size$NRM]: $WHT";
1965 $new_default_left_size = <STDIN>;
1966 if ( $new_default_left_size eq "\n" ) {
1967 $new_default_left_size = $default_left_size;
1968 } else {
1969 $new_default_left_size =~ s/[\r\n]//g;
1970 }
1971 return $new_default_left_size;
1972 }
1973
1974 sub command36 {
1975 print "Some IMAP servers only have lowercase letters in the usernames\n";
1976 print "but they still allow people with uppercase to log in. This\n";
1977 print "causes a problem with the user's preference files. This option\n";
1978 print "transparently changes all usernames to lowercase.";
1979 print "\n";
1980
1981 if ( lc($force_username_lowercase) eq 'true' ) {
1982 $default_value = "y";
1983 } else {
1984 $default_value = "n";
1985 }
1986 print "Convert usernames to lowercase (y/n) [$WHT$default_value$NRM]: $WHT";
1987 $new_show = <STDIN>;
1988 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
1989 return 'true';
1990 }
1991 return 'false';
1992 }
1993
1994 sub command37 {
1995 print "";
1996 print "\n";
1997
1998 if ( lc($default_use_priority) eq 'true' ) {
1999 $default_value = "y";
2000 } else {
2001 $default_value = "n";
2002 }
2003
2004 print "Allow users to specify priority of outgoing mail (y/n) [$WHT$default_value$NRM]: $WHT";
2005 $new_show = <STDIN>;
2006 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2007 return 'true';
2008 }
2009 return 'false';
2010 }
2011
2012 sub command38 {
2013 print "";
2014 print "\n";
2015
2016 if ( lc($default_hide_attribution) eq 'true' ) {
2017 $default_value = "y";
2018 } else {
2019 $default_value = "n";
2020 }
2021
2022 print "Hide SM attributions (y/n) [$WHT$default_value$NRM]: $WHT";
2023 $new_show = <STDIN>;
2024 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2025 return 'true';
2026 }
2027 return 'false';
2028 }
2029
2030 sub command39 {
2031 print "";
2032 print "\n";
2033
2034 if ( lc($default_use_mdn) eq 'true' ) {
2035 $default_value = "y";
2036 } else {
2037 $default_value = "n";
2038 }
2039
2040 print "Enable support for read/delivery receipt support (y/n) [$WHT$default_value$NRM]: $WHT";
2041 $new_show = <STDIN>;
2042 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2043 return 'true';
2044 }
2045 return 'false';
2046 }
2047
2048 sub command310 {
2049 print "This allows you to prevent the editing of the user's name and ";
2050 print "email address. This is mainly useful when used with the ";
2051 print "retrieveuserdata plugin\n";
2052 print "\n";
2053
2054 if ( lc($edit_identity) eq 'true' ) {
2055 $default_value = "y";
2056 } else {
2057 $default_value = "n";
2058 }
2059 print "Allow editing of user's identity? (y/n) [$WHT$default_value$NRM]: $WHT";
2060 $new_edit = <STDIN>;
2061 if ( ( $new_edit =~ /^y\n/i ) || ( ( $new_edit =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2062 $edit_identity = 'true';
2063 $edit_name = 'true';
2064 } else {
2065 $edit_identity = 'false';
2066 $edit_name = command311();
2067 }
2068 return $edit_identity;
2069 }
2070
2071 sub command311 {
2072 print "As a follow-up, this option allows you to choose if the user ";
2073 print "can edit their full name even when you don't want them to ";
2074 print "change their username\n";
2075 print "\n";
2076
2077 if ( lc($edit_name) eq 'true' ) {
2078 $default_value = "y";
2079 } else {
2080 $default_value = "n";
2081 }
2082 print "Allow editing of the users full name? (y/n) [$WHT$default_value$NRM]: $WHT";
2083 $new_edit = <STDIN>;
2084 if ( ( $new_edit =~ /^y\n/i ) || ( ( $new_edit =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2085 $edit_name = 'true';
2086 } else {
2087 $edit_name = 'false';
2088 }
2089 return $edit_name;
2090 }
2091
2092 sub command312 {
2093 print "This option allows you to choose if users can use thread sorting\n";
2094 print "Your IMAP server must support the THREAD command for this to work\n";
2095 print "PHP versions later than 4.0.3 recommended\n";
2096 print "\n";
2097
2098 if ( lc($allow_thread_sort) eq 'true' ) {
2099 $default_value = "y";
2100 } else {
2101 $default_value = "n";
2102 }
2103 print "Allow server side thread sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
2104 $allow_thread_sort = <STDIN>;
2105 if ( ( $allow_thread_sort =~ /^y\n/i ) || ( ( $allow_thread_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2106 $allow_thread_sort = 'true';
2107 } else {
2108 $allow_thread_sort = 'false';
2109 }
2110 return $allow_thread_sort;
2111 }
2112
2113 sub command313 {
2114 print "This option allows you to choose if SM uses server-side sorting\n";
2115 print "Your IMAP server must support the SORT command for this to work\n";
2116 print "\n";
2117
2118 if ( lc($allow_server_sort) eq 'true' ) {
2119 $default_value = "y";
2120 } else {
2121 $default_value = "n";
2122 }
2123 print "Allow server-side sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
2124 $allow_server_sort = <STDIN>;
2125 if ( ( $allow_server_sort =~ /^y\n/i ) || ( ( $allow_server_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2126 $allow_server_sort = 'true';
2127 } else {
2128 $allow_server_sort = 'false';
2129 }
2130 return $allow_server_sort;
2131 }
2132
2133 sub command314 {
2134 print "This option allows you to choose if SM uses charset search\n";
2135 print "Your IMAP server must support the SEARCH CHARSET command for this to work\n";
2136 print "\n";
2137
2138 if ( lc($allow_charset_search) eq 'true' ) {
2139 $default_value = "y";
2140 } else {
2141 $default_value = "n";
2142 }
2143 print "Allow charset searching? (y/n) [$WHT$default_value$NRM]: $WHT";
2144 $allow_charset_search = <STDIN>;
2145 if ( ( $allow_charset_search =~ /^y\n/i ) || ( ( $allow_charset_search =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2146 $allow_charset_search = 'true';
2147 } else {
2148 $allow_charset_search = 'false';
2149 }
2150 return $allow_charset_search;
2151 }
2152
2153 # command315 (UID support) obsoleted.
2154
2155 # advanced search option
2156 sub command316 {
2157 print "This option allows you to control the use of advanced search form.\n";
2158 print " 0 = enable basic search only\n";
2159 print " 1 = enable advanced search only\n";
2160 print " 2 = enable both\n";
2161 print "\n";
2162
2163 print "Allowed search (0,1,2)? [$WHT$allow_advanced_search$NRM]: $WHT";
2164 $new_allow_advanced_search = <STDIN>;
2165 if ( $new_allow_advanced_search =~ /^[012]\n/i ) {
2166 $allow_advanced_search = $new_allow_advanced_search;
2167 }
2168 $allow_advanced_search =~ s/[\r\n]//g;
2169 return $allow_advanced_search;
2170 }
2171
2172
2173 sub command317 {
2174 print "This option allows you to change the name of the PHP session used\n";
2175 print "by SquirrelMail. Unless you know what you are doing, you probably\n";
2176 print "don't need or want to change this from the default of SQMSESSID.\n";
2177 print "[$WHT$session_name$NRM]: $WHT";
2178 $new_session_name = <STDIN>;
2179 chomp($new_session_name);
2180 if ( $new_session_name eq "" ) {
2181 $new_session_name = $session_name;
2182 }
2183 return $new_session_name;
2184 }
2185
2186
2187
2188 sub command41 {
2189 print "\nDefine the themes that you wish to use. If you have added ";
2190 print "a theme of your own, just follow the instructions (?) about how to add ";
2191 print "them. You can also change the default theme.\n";
2192 print "[theme] command (?=help) > ";
2193 $input = <STDIN>;
2194 $input =~ s/[\r\n]//g;
2195 while ( $input ne "d" ) {
2196 if ( $input =~ /^\s*l\s*/i ) {
2197 $count = 0;
2198 while ( $count <= $#theme_name ) {
2199 if ( $count == $theme_default ) {
2200 print " *";
2201 } else {
2202 print " ";
2203 }
2204 if ( $count < 10 ) {
2205 print " ";
2206 }
2207 $name = $theme_name[$count];
2208 $num_spaces = 35 - length($name);
2209 for ( $i = 0 ; $i < $num_spaces ; $i++ ) {
2210 $name = $name . " ";
2211 }
2212
2213 print " $count. $name";
2214 print "($theme_path[$count])\n";
2215
2216 $count++;
2217 }
2218 } elsif ( $input =~ /^\s*m\s*[0-9]+/i ) {
2219 $old_def = $theme_default;
2220 $theme_default = $input;
2221 $theme_default =~ s/^\s*m\s*//;
2222 if ( ( $theme_default > $#theme_name ) || ( $theme_default < 0 ) ) {
2223 print "Cannot set default theme to $theme_default. That theme does not exist.\n";
2224 $theme_default = $old_def;
2225 }
2226 } elsif ( $input =~ /^\s*\+/ ) {
2227 print "What is the name of this theme: ";
2228 $name = <STDIN>;
2229 $name =~ s/[\r\n]//g;
2230 $theme_name[ $#theme_name + 1 ] = $name;
2231 print "Be sure to put ../themes/ before the filename.\n";
2232 print "What file is this stored in (ex: ../themes/default_theme.php): ";
2233 $name = <STDIN>;
2234 $name =~ s/[\r\n]//g;
2235 $theme_path[ $#theme_path + 1 ] = $name;
2236 } elsif ( $input =~ /^\s*-\s*[0-9]?/ ) {
2237 if ( $input =~ /[0-9]+\s*$/ ) {
2238 $rem_num = $input;
2239 $rem_num =~ s/^\s*-\s*//g;
2240 $rem_num =~ s/\s*$//;
2241 } else {
2242 $rem_num = $#theme_name;
2243 }
2244 if ( $rem_num == $theme_default ) {
2245 print "You cannot remove the default theme!\n";
2246 } else {
2247 $count = 0;
2248 @new_theme_name = ();
2249 @new_theme_path = ();
2250 while ( $count <= $#theme_name ) {
2251 if ( $count != $rem_num ) {
2252 @new_theme_name = ( @new_theme_name, $theme_name[$count] );
2253 @new_theme_path = ( @new_theme_path, $theme_path[$count] );
2254 }
2255 $count++;
2256 }
2257 @theme_name = @new_theme_name;
2258 @theme_path = @new_theme_path;
2259 if ( $theme_default > $rem_num ) {
2260 $theme_default--;
2261 }
2262 }
2263 } elsif ( $input =~ /^\s*t\s*/i ) {
2264 print "\nStarting detection...\n\n";
2265
2266 opendir( DIR, "../themes" );
2267 @files = grep { /\.php$/i } readdir(DIR);
2268 $cnt = 0;
2269 while ( $cnt <= $#files ) {
2270 $filename = "../themes/" . $files[$cnt];
2271 if ( $filename ne "../themes/index.php" ) {
2272 $found = 0;
2273 for ( $x = 0 ; $x <= $#theme_path ; $x++ ) {
2274 if ( $theme_path[$x] eq $filename ) {
2275 $found = 1;
2276 }
2277 }
2278 if ( $found != 1 ) {
2279 print "** Found theme: $filename\n";
2280 print " What is its name? ";
2281 $nm = <STDIN>;
2282 $nm =~ s/[\n\r]//g;
2283 $theme_name[ $#theme_name + 1 ] = $nm;
2284 $theme_path[ $#theme_path + 1 ] = $filename;
2285 }
2286 }
2287 $cnt++;
2288 }
2289 print "\n";
2290 for ( $cnt = 0 ; $cnt <= $#theme_path ; $cnt++ ) {
2291 $filename = $theme_path[$cnt];
2292 if ( !( -e $filename ) ) {
2293 print " Removing $filename (file not found)\n";
2294 $offset = 0;
2295 @new_theme_name = ();
2296 @new_theme_path = ();
2297 for ( $x = 0 ; $x < $#theme_path ; $x++ ) {
2298 if ( $theme_path[$x] eq $filename ) {
2299 $offset = 1;
2300 }
2301 if ( $offset == 1 ) {
2302 $new_theme_name[$x] = $theme_name[ $x + 1 ];
2303 $new_theme_path[$x] = $theme_path[ $x + 1 ];
2304 } else {
2305 $new_theme_name[$x] = $theme_name[$x];
2306 $new_theme_path[$x] = $theme_path[$x];
2307 }
2308 }
2309 @theme_name = @new_theme_name;
2310 @theme_path = @new_theme_path;
2311 }
2312 }
2313 print "\nDetection complete!\n\n";
2314
2315 closedir DIR;
2316 } elsif ( $input =~ /^\s*\?\s*/ ) {
2317 print ".-------------------------.\n";
2318 print "| t (detect themes) |\n";
2319 print "| + (add theme) |\n";
2320 print "| - N (remove theme) |\n";
2321 print "| m N (mark default) |\n";
2322 print "| l (list themes) |\n";
2323 print "| d (done) |\n";
2324 print "`-------------------------'\n";
2325 }
2326 print "[theme] command (?=help) > ";
2327 $input = <STDIN>;
2328 $input =~ s/[\r\n]//g;
2329 }
2330 }
2331
2332 # Theme - CSS file
2333 sub command42 {
2334 print "You may specify a cascading style-sheet (CSS) file to be included\n";
2335 print "on each html page generated by SquirrelMail. The CSS file is useful\n";
2336 print "for specifying a site-wide font. If you're not familiar with CSS\n";
2337 print "files, leave this blank.\n";
2338 print "\n";
2339 print "To clear out an existing value, just type a space for the input.\n";
2340 print "\n";
2341 print "Please be aware of the following: \n";
2342 print " - Relative URLs are relative to the config dir\n";
2343 print " to use the themes directory, use ../themes/css/newdefault.css\n";
2344 print " - To specify a css file defined outside the SquirrelMail source tree\n";
2345 print " use the absolute URL the webserver would use to include the file\n";
2346 print " e.g. http://some.host.com/css/mystyle.css or /css/mystyle.css\n";
2347 print "\n";
2348 print "[$WHT$theme_css$NRM]: $WHT";
2349 $new_theme_css = <STDIN>;
2350
2351 if ( $new_theme_css eq "\n" ) {
2352 $new_theme_css = $theme_css;
2353 } else {
2354 $new_theme_css =~ s/[\r\n]//g;
2355 }
2356 $new_theme_css =~ s/^\s*//;
2357 return $new_theme_css;
2358 }
2359
2360 sub command61 {
2361 print "You can now define different LDAP servers.\n";
2362 print "[ldap] command (?=help) > ";
2363 $input = <STDIN>;
2364 $input =~ s/[\r\n]//g;
2365 while ( $input ne "d" ) {
2366 if ( $input =~ /^\s*l\s*/i ) {
2367 $count = 0;
2368 while ( $count <= $#ldap_host ) {
2369 print "$count. $ldap_host[$count]\n";
2370 print " base: $ldap_base[$count]\n";
2371 if ( $ldap_charset[$count] ) {
2372 print " charset: $ldap_charset[$count]\n";
2373 }
2374 if ( $ldap_port[$count] ) {
2375 print " port: $ldap_port[$count]\n";
2376 }
2377 if ( $ldap_name[$count] ) {
2378 print " name: $ldap_name[$count]\n";
2379 }
2380 if ( $ldap_maxrows[$count] ) {
2381 print " maxrows: $ldap_maxrows[$count]\n";
2382 }
2383 if ( $ldap_binddn[$count] ) {
2384 print " binddn: $ldap_binddn[$count]\n";
2385 if ( $ldap_bindpw[$count] ) {
2386 print " bindpw: $ldap_bindpw[$count]\n";
2387 }
2388 }
2389 if ( $ldap_protocol[$count] ) {
2390 print " protocol: $ldap_protocol[$count]\n";
2391 }
2392
2393 print "\n";
2394 $count++;
2395 }
2396 } elsif ( $input =~ /^\s*\+/ ) {
2397 $sub = $#ldap_host + 1;
2398
2399 print "First, we need to have the hostname or the IP address where\n";
2400 print "this LDAP server resides. Example: ldap.bigfoot.com\n";
2401 print "hostname: ";
2402 $name = <STDIN>;
2403 $name =~ s/[\r\n]//g;
2404 $ldap_host[$sub] = $name;
2405
2406 print "\n";
2407
2408 print "Next, we need the server root (base dn). For this, an empty\n";
2409 print "string is allowed.\n";
2410 print "Example: ou=member_directory,o=netcenter.com\n";
2411 print "base: ";
2412 $name = <STDIN>;
2413 $name =~ s/[\r\n]//g;
2414 $ldap_base[$sub] = $name;
2415
2416 print "\n";
2417
2418 print "This is the TCP/IP port number for the LDAP server. Default\n";
2419 print "port is 389. This is optional. Press ENTER for default.\n";
2420 print "port: ";
2421 $name = <STDIN>;
2422 $name =~ s/[\r\n]//g;
2423 $ldap_port[$sub] = $name;
2424
2425 print "\n";
2426
2427 print "This is the charset for the server. Default is utf-8. This\n";
2428 print "is also optional. Press ENTER for default.\n";
2429 print "charset: ";
2430 $name = <STDIN>;
2431 $name =~ s/[\r\n]//g;
2432 $ldap_charset[$sub] = $name;
2433
2434 print "\n";
2435
2436 print "This is the name for the server, used to tag the results of\n";
2437 print "the search. Default it \"LDAP: hostname\". Press ENTER for default\n";
2438 print "name: ";
2439 $name = <STDIN>;
2440 $name =~ s/[\r\n]//g;
2441 $ldap_name[$sub] = $name;
2442
2443 print "\n";
2444
2445 print "You can specify the maximum number of rows in the search result.\n";
2446 print "Default is unlimited. Press ENTER for default.\n";
2447 print "maxrows: ";
2448 $name = <STDIN>;
2449 $name =~ s/[\r\n]//g;
2450 $ldap_maxrows[$sub] = $name;
2451
2452 print "\n";
2453
2454 print "If your LDAP server does not like anonymous logins, you can specify bind DN.\n";
2455 print "Default is none, anonymous bind. Press ENTER for default.\n";
2456 print "binddn: ";
2457 $name = <STDIN>;
2458 $name =~ s/[\r\n]//g;
2459 $ldap_binddn[$sub] = $name;
2460
2461 print "\n";
2462
2463 if ( $ldap_binddn[$sub] ne '' ) {
2464
2465 print "Now, please specify password for that DN.\n";
2466 print "bindpw: ";
2467 $name = <STDIN>;
2468 $name =~ s/[\r\n]//g;
2469 $ldap_bindpw[$sub] = $name;
2470
2471 print "\n";
2472 }
2473
2474 print "You can specify bind protocol version here.\n";
2475 print "Default protocol version depends on your php ldap settings.\n";
2476 print "Press ENTER for default.\n";
2477 print "protocol: ";
2478 $name = <STDIN>;
2479 $name =~ s/[\r\n]//g;
2480 $ldap_protocol[$sub] = $name;
2481
2482 print "\n";
2483
2484 } elsif ( $input =~ /^\s*-\s*[0-9]?/ ) {
2485 if ( $input =~ /[0-9]+\s*$/ ) {
2486 $rem_num = $input;
2487 $rem_num =~ s/^\s*-\s*//g;
2488 $rem_num =~ s/\s*$//;
2489 } else {
2490 $rem_num = $#ldap_host;
2491 }
2492 $count = 0;
2493 @new_ldap_host = ();
2494 @new_ldap_base = ();
2495 @new_ldap_port = ();
2496 @new_ldap_name = ();
2497 @new_ldap_charset = ();
2498 @new_ldap_maxrows = ();
2499 @new_ldap_bindpw = ();
2500 @new_ldap_binddn = ();
2501 @new_ldap_protocol = ();
2502
2503 while ( $count <= $#ldap_host ) {
2504 if ( $count != $rem_num ) {
2505 @new_ldap_host = ( @new_ldap_host, $ldap_host[$count] );
2506 @new_ldap_base = ( @new_ldap_base, $ldap_base[$count] );
2507 @new_ldap_port = ( @new_ldap_port, $ldap_port[$count] );
2508 @new_ldap_name = ( @new_ldap_name, $ldap_name[$count] );
2509 @new_ldap_charset = ( @new_ldap_charset, $ldap_charset[$count] );
2510 @new_ldap_maxrows = ( @new_ldap_maxrows, $ldap_maxrows[$count] );
2511 @new_ldap_binddn = ( @new_ldap_binddn, $ldap_binddn[$count] );
2512 @new_ldap_bindpw = ( @new_ldap_bindpw, $ldap_bindpw[$count] );
2513 @new_ldap_protocol = ( @new_ldap_protocol, $ldap_protocol[$count] );
2514 }
2515 $count++;
2516 }
2517 @ldap_host = @new_ldap_host;
2518 @ldap_base = @new_ldap_base;
2519 @ldap_port = @new_ldap_port;
2520 @ldap_name = @new_ldap_name;
2521 @ldap_charset = @new_ldap_charset;
2522 @ldap_maxrows = @new_ldap_maxrows;
2523 @ldap_binddn = @new_ldap_binddn;
2524 @ldap_bindpw = @new_ldap_bindpw;
2525 @ldap_protocol = @new_ldap_protocol;
2526
2527 } elsif ( $input =~ /^\s*\?\s*/ ) {
2528 print ".-------------------------.\n";
2529 print "| + (add host) |\n";
2530 print "| - N (remove host) |\n";
2531 print "| l (list hosts) |\n";
2532 print "| d (done) |\n";
2533 print "`-------------------------'\n";
2534 }
2535 print "[ldap] command (?=help) > ";
2536 $input = <STDIN>;
2537 $input =~ s/[\r\n]//g;
2538 }
2539 }
2540
2541 sub command62 {
2542 print "Some of our developers have come up with very good javascript interface\n";
2543 print "for searching through address books, however, our original goals said\n";
2544 print "that we would be 100% HTML. In order to make it possible to use their\n";
2545 print "interface, and yet stick with our goals, we have also written a plain\n";
2546 print "HTML version of the search. Here, you can choose which version to use.\n";
2547 print "\n";
2548 print "This is just the default value. It is also a user option that each\n";
2549 print "user can configure individually\n";
2550 print "\n";
2551
2552 if ( lc($default_use_javascript_addr_book) eq 'true' ) {
2553 $default_value = "y";
2554 } else {
2555 $default_use_javascript_addr_book = 'false';
2556 $default_value = "n";
2557 }
2558 print "Use javascript version by default (y/n) [$WHT$default_value$NRM]: $WHT";
2559 $new_show = <STDIN>;
2560 if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2561 $default_use_javascript_addr_book = 'true';
2562 } else {
2563 $default_use_javascript_addr_book = 'false';
2564 }
2565 return $default_use_javascript_addr_book;
2566 }
2567
2568 sub command91 {
2569 print "If you want to store your users address book details in a database then\n";
2570 print "you need to set this DSN to a valid value. The format for this is:\n";
2571 print "mysql://user:pass\@hostname/dbname\n";
2572 print "Where mysql can be one of the databases PHP supports, the most common\n";
2573 print "of these are mysql, msql and pgsql\n";
2574 print "If the DSN is left empty (hit space and then return) the database\n";
2575 print "related code for address books will not be used\n";
2576 print "\n";
2577
2578 if ( $addrbook_dsn eq "" ) {
2579 $default_value = "Disabled";
2580 } else {
2581 $default_value = $addrbook_dsn;
2582 }
2583 print "[$WHT$addrbook_dsn$NRM]: $WHT";
2584 $new_dsn = <STDIN>;
2585 if ( $new_dsn eq "\n" ) {
2586 $new_dsn = "";
2587 } else {
2588 $new_dsn =~ s/[\r\n]//g;
2589 $new_dsn =~ s/^\s+$//g;
2590 }
2591 return $new_dsn;
2592 }
2593
2594 sub command92 {
2595 print "This is the name of the table you want to store the address book\n";
2596 print "data in, it defaults to 'address'\n";
2597 print "\n";
2598 print "[$WHT$addrbook_table$NRM]: $WHT";
2599 $new_table = <STDIN>;
2600 if ( $new_table eq "\n" ) {
2601 $new_table = $addrbook_table;
2602 } else {
2603 $new_table =~ s/[\r\n]//g;
2604 }
2605 return $new_table;
2606 }
2607
2608 sub command93 {
2609 print "If you want to store your users preferences in a database then\n";
2610 print "you need to set this DSN to a valid value. The format for this is:\n";
2611 print "mysql://user:pass\@hostname/dbname\n";
2612 print "Where mysql can be one of the databases PHP supports, the most common\n";
2613 print "of these are mysql, msql and pgsql\n";
2614 print "If the DSN is left empty (hit space and then return) the database\n";
2615 print "related code for address books will not be used\n";
2616 print "\n";
2617
2618 if ( $prefs_dsn eq "" ) {
2619 $default_value = "Disabled";
2620 } else {
2621 $default_value = $prefs_dsn;
2622 }
2623 print "[$WHT$prefs_dsn$NRM]: $WHT";
2624 $new_dsn = <STDIN>;
2625 if ( $new_dsn eq "\n" ) {
2626 $new_dsn = "";
2627 } else {
2628 $new_dsn =~ s/[\r\n]//g;
2629 $new_dsn =~ s/^\s+$//g;
2630 }
2631 return $new_dsn;
2632 }
2633
2634 sub command94 {
2635 print "This is the name of the table you want to store the preferences\n";
2636 print "data in, it defaults to 'userprefs'\n";
2637 print "\n";
2638 print "[$WHT$prefs_table$NRM]: $WHT";
2639 $new_table = <STDIN>;
2640 if ( $new_table eq "\n" ) {
2641 $new_table = $prefs_table;
2642 } else {
2643 $new_table =~ s/[\r\n]//g;
2644 }
2645 return $new_table;
2646 }
2647
2648 sub command95 {
2649 print "This is the name of the field in which you want to store the\n";
2650 print "username of the person the prefs are for. It default to 'user'\n";
2651 print "which clashes with a reserved keyword in PostgreSQL so this\n";
2652 print "will need to be changed for that database at least\n";
2653 print "\n";
2654 print "[$WHT$prefs_user_field$NRM]: $WHT";
2655 $new_field = <STDIN>;
2656 if ( $new_field eq "\n" ) {
2657 $new_field = $prefs_user_field;
2658 } else {
2659 $new_field =~ s/[\r\n]//g;
2660 }
2661 return $new_field;
2662 }
2663
2664 sub command96 {
2665 print "This is the name of the field in which you want to store the\n";
2666 print "preferences keyword. It defaults to 'prefkey'\n";
2667 print "\n";
2668 print "[$WHT$prefs_key_field$NRM]: $WHT";
2669 $new_field = <STDIN>;
2670 if ( $new_field eq "\n" ) {
2671 $new_field = $prefs_key_field;
2672 } else {
2673 $new_field =~ s/[\r\n]//g;
2674 }
2675 return $new_field;
2676 }
2677
2678 sub command97 {
2679 print "This is the name of the field in which you want to store the\n";
2680 print "preferences value. It defaults to 'prefval'\n";
2681 print "\n";
2682 print "[$WHT$prefs_val_field$NRM]: $WHT";
2683 $new_field = <STDIN>;
2684 if ( $new_field eq "\n" ) {
2685 $new_field = $prefs_val_field;
2686 } else {
2687 $new_field =~ s/[\r\n]//g;
2688 }
2689 return $new_field;
2690 }
2691
2692 sub command98 {
2693 print "If you want to store your global address book in a database then\n";
2694 print "you need to set this DSN to a valid value. The format for this is:\n";
2695 print "mysql://user:pass\@hostname/dbname\n";
2696 print "Where mysql can be one of the databases PHP supports, the most common\n";
2697 print "of these are mysql, msql and pgsql\n";
2698 print "If the DSN is left empty (hit space and then return) the database\n";
2699 print "related code for global SQL address book will not be used\n";
2700 print "\n";
2701
2702 if ( $addrbook_global_dsn eq "" ) {
2703 $default_value = "Disabled";
2704 } else {
2705 $default_value = $addrbook_global_dsn;
2706 }
2707 print "[$WHT$addrbook_global_dsn$NRM]: $WHT";
2708 $new_dsn = <STDIN>;
2709 if ( $new_dsn eq "\n" ) {
2710 $new_dsn = "";
2711 } else {
2712 $new_dsn =~ s/[\r\n]//g;
2713 $new_dsn =~ s/^\s+$//g;
2714 }
2715 return $new_dsn;
2716 }
2717
2718 sub command99 {
2719 print "This is the name of the table you want to store the global address book\n";
2720 print "data in, it defaults to 'global_address'\n";
2721 print "\n";
2722 print "[$WHT$addrbook_global_table$NRM]: $WHT";
2723 $new_table = <STDIN>;
2724 if ( $new_table eq "\n" ) {
2725 $new_table = $addrbook_global_table;
2726 } else {
2727 $new_table =~ s/[\r\n]//g;
2728 }
2729 return $new_table;
2730 }
2731
2732 sub command910 {
2733 print "This option controls users\' ability to add or modify records stored \n";
2734 print "in global address book\n";
2735
2736 if ( lc($addrbook_global_writeable) eq 'true' ) {
2737 $default_value = "y";
2738 } else {
2739 $default_value = "n";
2740 }
2741 print "Allow writing into global address book? (y/n) [$WHT$default_value$NRM]: $WHT";
2742 $addrbook_global_writeable = <STDIN>;
2743 if ( ( $addrbook_global_writeable =~ /^y\n/i ) || ( ( $addrbook_global_writeable =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2744 $addrbook_global_writeable = 'true';
2745 } else {
2746 $addrbook_global_writeable = 'false';
2747 }
2748 return $addrbook_global_writeable;
2749 }
2750
2751 sub command911 {
2752 print "Enable this option if you want to see listing of addresses stored \n";
2753 print "in global address book\n";
2754
2755 if ( lc($addrbook_global_listing) eq 'true' ) {
2756 $default_value = "y";
2757 } else {
2758 $default_value = "n";
2759 }
2760 print "Allow listing of global address book? (y/n) [$WHT$default_value$NRM]: $WHT";
2761 $addrbook_global_listing = <STDIN>;
2762 if ( ( $addrbook_global_listing =~ /^y\n/i ) || ( ( $addrbook_global_listing =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2763 $addrbook_global_listing = 'true';
2764 } else {
2765 $addrbook_global_listing = 'false';
2766 }
2767 return $addrbook_global_listing;
2768 }
2769
2770
2771 # Default language
2772 sub commandA1 {
2773 print "SquirrelMail attempts to set the language in many ways. If it\n";
2774 print "can not figure it out in another way, it will default to this\n";
2775 print "language. Please use the code for the desired language.\n";
2776 print "\n";
2777 print "[$WHT$squirrelmail_default_language$NRM]: $WHT";
2778 $new_squirrelmail_default_language = <STDIN>;
2779 if ( $new_squirrelmail_default_language eq "\n" ) {
2780 $new_squirrelmail_default_language = $squirrelmail_default_language;
2781 } else {
2782 $new_squirrelmail_default_language =~ s/[\r\n]//g;
2783 $new_squirrelmail_default_language =~ s/^\s+$//g;
2784 }
2785 return $new_squirrelmail_default_language;
2786 }
2787 # Default Charset
2788 sub commandA2 {
2789 print "This option controls what character set is used when sending\n";
2790 print "mail and when sending HTML to the browser. Option works only\n";
2791 print "with US English (en_US) translation. Other translations use\n";
2792 print "charsets that are set in functions/i18n.php.\n";
2793 print "\n";
2794
2795 print "[$WHT$default_charset$NRM]: $WHT";
2796 $new_default_charset = <STDIN>;
2797 if ( $new_default_charset eq "\n" ) {
2798 $new_default_charset = $default_charset;
2799 } else {
2800 $new_default_charset =~ s/[\r\n]//g;
2801 }
2802 return $new_default_charset;
2803 }
2804 # Alternative language names
2805 sub commandA3 {
2806 print "Enable this option if you want to see localized language names in\n";
2807 print "language selection box. Note, that if don't limit list of available\n";
2808 print "languages, this option can trigger installation of foreign language\n";
2809 print "support modules in some browsers.\n";
2810 print "\n";
2811
2812 if ( lc($show_alternative_names) eq 'true' ) {
2813 $default_value = "y";
2814 } else {
2815 $default_value = "n";
2816 }
2817 print "Show alternative language names? (y/n) [$WHT$default_value$NRM]: $WHT";
2818 $show_alternative_names = <STDIN>;
2819 if ( ( $show_alternative_names =~ /^y\n/i ) || ( ( $show_alternative_names =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
2820 $show_alternative_names = 'true';
2821 } else {
2822 $show_alternative_names = 'false';
2823 }
2824 return $show_alternative_names;
2825 }
2826 # Available languages
2827 sub commandA4 {
2828 print "This option allows to limit number of languages available in\n";
2829 print "language selection box. You can enter as code of every language that\n";
2830 print "you want to enable. Language codes should be separated by space. If you\n";
2831 print "enter name unsupported by SquirrelMail, it will be ignored. If you enter\n";
2832 print "special key \'all\' - all languages available in SquirrelMail will be\n";
2833 print "listed. If you enter special key \'none\' - user won't be able to change";
2834 print "language and interface will use language set it \"Default language\" option.\n";
2835 print "\n";
2836 print "You can find valid language names in doc/i18n.txt.\n";
2837 print "\n";
2838 print "[$WHT$available_languages$NRM]: $WHT";
2839 $new_available_languages = <STDIN>;
2840 if ( $new_available_languages eq "\n" ) {
2841 $new_available_languages = $available_languages;
2842 } else {
2843 $new_available_languages =~ s/[\r\n]//g;
2844 $new_available_languages =~ s/^\s+$//g;
2845 }
2846 return $new_available_languages;
2847 }
2848 # Aggressive decoding
2849 sub commandA5 {
2850 print "Enable this option if you want to use CPU and memory intensive decoding\n";
2851 print "functions. This option allows reading multibyte charset, that are used\n";
2852 print "in Eastern Asia. SquirrelMail will try to use recode functions here,\n";
2853 print "even when you have disabled use of recode in Tweaks section.\n";
2854 print "\n";
2855
2856 if ( lc($aggressive_decoding) eq 'true' ) {