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