9c3b27b17f72fdb094713e6bc5d121514961d5fc
3 # Luke Ehresman (luke@squirrelmail.org)
5 # A simple configure script to configure squirrelmail
8 ############################################################
9 $conf_pl_version = "x63";
11 ############################################################
12 # Some people try to run this as a CGI. That's wrong!
13 ############################################################
14 if(defined($ENV{'PATH_INFO'}) || defined($ENV{'QUERY_STRING'}) ||
15 defined($ENV{'REQUEST_METHOD'})) {
16 print "Content-Type: text/html\n\n";
17 print "You must run this script from the command line.";
21 ############################################################
22 # First, lets read in the data already in there...
23 ############################################################
24 if ( -e
"config.php") {
25 open (FILE
, "config.php");
26 while ($line = <FILE
>) {
27 if ($line =~ /^\s+\$/) {
32 if ($var =~ /^([a-z]|[A-Z])/) {
33 @o = split(/\s*EQUALS\s*/, $var);
34 if ($o[0] eq "config_version") {
35 $o[1] =~ s/[\n|\r]//g;
40 $config_version = $o[1];
48 if ($config_version ne $conf_pl_version) {
50 print $WHT."WARNING:\n".$NRM;
51 print " The file \"config/config.php\" was found, but it is for an older version of\n";
52 print " SquirrelMail. It is possible to still read the defaults from this file\n";
53 print " but be warned that many preferences change between versions. It is\n";
54 print " recommended that you start with a clean config.php for each upgrade that\n";
55 print " you do. To do this, just move config/config.php out of the way.\n\n";
56 print "Continue loading with the old config.php [y/N]? ";
58 if (($ctu !~ /^y\n/i) || ($ctu =~ /^\n/)) {
62 print "\nDo you want me to stop warning you [y/N]? ";
64 if ($ctu =~ /^y\n/i) {
65 $print_config_version = $conf_pl_version;
67 $print_config_version = $config_version;
70 $print_config_version = $config_version;
74 open (FILE
, "config.php");
75 } elsif (-e
"config_default.php") {
76 open (FILE
, "config_default.php");
77 while ($line = <FILE
>) {
78 if ($line =~ /^\s+\$/) {
83 if ($var =~ /^([a-z]|[A-Z])/) {
84 @o = split(/\s*EQUALS\s*/, $var);
85 if ($o[0] eq "config_version") {
86 $o[1] =~ s/[\n|\r]//g;
91 $config_version = $o[1];
99 if ($config_version ne $conf_pl_version) {
101 print $WHT."WARNING:\n".$NRM;
102 print " You are trying to use a \"config_default.php\" from an older version of\n";
103 print " SquirrelMail. This is HIGHLY unrecommended. You should get the\n";
104 print " \"config_default.php\" that matches the version of SquirrelMail that you\n";
105 print " are running. You can get this from the SquirrelMail web page by going\n";
106 print " to: http://www.squirrelmail.org.\n\n";
107 print "Continue loading with the old config_default.php (not a good idea) [y/N]? ";
109 if (($ctu !~ /^y\n/i) || ($ctu =~ /^\n/)) {
113 print "\nDo you want me to stop warning you [y/N]? ";
115 if ($ctu =~ /^y\n/i) {
116 $print_config_version = $conf_pl_version;
118 $print_config_version = $config_version;
121 $print_config_version = $config_version;
124 open (FILE
, "config_default.php");
126 print "No configuration file found. Please get config_default.php or\n";
127 print "config.php before running this again. This program needs a\n";
128 print "default config file to get default values.\n";
132 # Reads and parses the current configuration file (either
133 # config.php or config_default.php).
135 while ($line = <FILE
>) {
136 if ($line =~ /^\s+\$/) {
141 if ($var =~ /^([a-z]|[A-Z])/) {
142 @options = split(/\s*EQUALS\s*/, $var);
143 $options[1] =~ s/[\n|\r]//g;
144 $options[1] =~ s/\";\s*$//;
145 $options[1] =~ s/;$//;
146 $options[1] =~ s/^\"//;
148 if ($options[0] =~ /^theme\[[0-9]+\]\["PATH"\]/) {
150 $sub =~ s/\]\["PATH"\]//;
152 if (-e
"../themes") {
153 $options[1] =~ s/^\.\.\/config/\
.\
.\
/themes/;
155 $theme_path[$sub] = $options[1];
156 } elsif ($options[0] =~ /^theme\[[0-9]+\]\["NAME"\]/) {
158 $sub =~ s/\]\["NAME"\]//;
160 $theme_name[$sub] = $options[1];
161 } elsif ($options[0] =~ /^plugins\[[0-9]+\]/) {
164 $sub =~ s/^plugins\[//;
165 $plugins[$sub] = $options[1];
166 } elsif ($options[0] =~ /^ldap_server\[[0-9]+\]/) {
169 $sub =~ s/^ldap_server\[//;
171 while (($tmp = <FILE
>) && ($continue != 1)) {
172 if ($tmp =~ /\);\s*$/) {
176 if ($tmp =~ /^\s*\"host\"/i) {
177 $tmp =~ s/^\s*\"host\"\s*=>\s*\"//i;
179 $tmp =~ s/\"\);\s*$//;
181 } elsif ($tmp =~ /^\s*\"base\"/i) {
182 $tmp =~ s/^\s*\"base\"\s*=>\s*\"//i;
184 $tmp =~ s/\"\);\s*$//;
186 } elsif ($tmp =~ /^\s*\"charset\"/i) {
187 $tmp =~ s/^\s*\"charset\"\s*=>\s*\"//i;
189 $tmp =~ s/\"\);\s*$//;
191 } elsif ($tmp =~ /^\s*\"port\"/i) {
192 $tmp =~ s/^\s*\"port\"\s*=>\s*\"//i;
194 $tmp =~ s/\"\);\s*$//;
196 } elsif ($tmp =~ /^\s*\"maxrows\"/i) {
197 $tmp =~ s/^\s*\"maxrows\"\s*=>\s*\"//i;
199 $tmp =~ s/\"\);\s*$//;
201 } elsif ($tmp =~ /^\s*\"name\"/i) {
202 $tmp =~ s/^\s*\"name\"\s*=>\s*\"//i;
204 $tmp =~ s/\"\);\s*$//;
208 $ldap_host[$sub] = $host;
209 $ldap_base[$sub] = $base;
210 $ldap_name[$sub] = $name;
211 $ldap_port[$sub] = $port;
212 $ldap_maxrows[$sub] = $maxrows;
213 $ldap_charset[$sub] = $charset;
215 ${$options[0]} = $options[1];
221 if ($useSendmail ne "true") {
222 $useSendmail = "false";
224 if (!$sendmail_path) {
225 $sendmail_path = "/usr/sbin/sendmail";
227 if (!$default_unseen_notify) {
228 $default_unseen_notify = 2;
230 if (!$default_unseen_type) {
231 $default_unseen_type = 1;
233 if (!$config_use_color) {
234 $config_use_color = 1;
237 $invert_time = "false";
239 if (!$force_username_lowercase) {
240 $force_username_lowercase = "false";
242 if (!$optional_delimiter) {
243 $optional_delimiter = "detect";
245 if (!$use_authenticated_smtp) {
246 $use_authenticated_smtp = "false";
248 if (!$auto_create_special) {
249 $auto_create_special = "false";
251 if(!$default_use_priority) {
252 $default_use_priority = "true";
255 #####################################################################################
256 if ($config_use_color == 1) {
262 $config_use_color = 2;
265 while (($command ne "q") && ($command ne "Q")) {
267 print $WHT."SquirrelMail Configuration : ".$NRM;
268 if ($config == 1) { print "Read: config.php"; }
269 elsif ($config == 2) { print "Read: config_default.php"; }
271 print "---------------------------------------------------------\n";
274 print $WHT."Main Menu --\n".$NRM;
275 print "1. Organization Preferences\n";
276 print "2. Server Settings\n";
277 print "3. Folder Defaults\n";
278 print "4. General Options\n";
280 print "6. Address Books (LDAP)\n";
281 print "7. Message of the Day (MOTD)\n";
282 print "8. Plugins\n";
284 print "D. Set pre-defined settings for specific IMAP servers\n";
286 } elsif ($menu == 1) {
287 print $WHT."Organization Preferences\n".$NRM;
288 print "1. Organization Name : $WHT$org_name$NRM\n";
289 print "2. Organization Logo : $WHT$org_logo$NRM\n";
290 print "3. Organization Title : $WHT$org_title$NRM\n";
291 print "4. Signout Page : $WHT$signout_page$NRM\n";
292 print "5. Default Language : $WHT$squirrelmail_default_language$NRM\n";
294 print "R Return to Main Menu\n";
295 } elsif ($menu == 2) {
296 print $WHT."Server Settings\n".$NRM;
297 print "1. Domain : $WHT$domain$NRM\n";
298 print "2. IMAP Server : $WHT$imapServerAddress$NRM\n";
299 print "3. IMAP Port : $WHT$imapPort$NRM\n";
300 print "4. Use Sendmail/SMTP : $WHT";
301 if ($useSendmail eq "true") {
307 if ($useSendmail eq "true") {
308 print "5. Sendmail Path : $WHT$sendmail_path$NRM\n";
310 print "6. SMTP Server : $WHT$smtpServerAddress$NRM\n";
311 print "7. SMTP Port : $WHT$smtpPort$NRM\n";
312 print "8. Authenticated SMTP : $WHT$use_authenticated_smtp$NRM\n";
314 print "9. Server : $WHT$imap_server_type$NRM\n";
315 print "10. Invert Time : $WHT$invert_time$NRM\n";
316 print "11. Delimiter : $WHT$optional_delimiter$NRM\n";
318 print "R Return to Main Menu\n";
319 } elsif ($menu == 3) {
320 print $WHT."Folder Defaults\n".$NRM;
321 print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n";
322 print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n";
323 print "3. Trash Folder : $WHT$trash_folder$NRM\n";
324 print "4. Sent Folder : $WHT$sent_folder$NRM\n";
325 print "5. Drafts Folder : $WHT$draft_folder$NRM\n";
326 print "6. By default, move to trash : $WHT$default_move_to_trash$NRM\n";
327 print "7. By default, move to sent : $WHT$default_move_to_sent$NRM\n";
328 print "8. By default, save as draft : $WHT$default_save_as_draft$NRM\n";
329 print "9. List Special Folders First : $WHT$list_special_folders_first$NRM\n";
330 print "10. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n";
331 print "11. Auto Expunge : $WHT$auto_expunge$NRM\n";
332 print "12. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n";
333 print "13. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n";
334 print "14. Default Unseen Notify : $WHT$default_unseen_notify$NRM\n";
335 print "15. Default Unseen Type : $WHT$default_unseen_type$NRM\n";
336 print "16. Auto Create Special Folders : $WHT$auto_create_special$NRM\n";
338 print "R Return to Main Menu\n";
339 } elsif ($menu == 4) {
340 print $WHT."General Options\n".$NRM;
341 print "1. Default Charset : $WHT$default_charset$NRM\n";
342 print "2. Data Directory : $WHT$data_dir$NRM\n";
343 print "3. Attachment Directory : $WHT$attachment_dir$NRM\n";
344 print "4. Default Left Size : $WHT$default_left_size$NRM\n";
345 print "5. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n";
346 print "6. Allow use of priority : $WHT$default_use_priority$NRM\n";
348 print "R Return to Main Menu\n";
349 } elsif ($menu == 5) {
350 print $WHT."Themes\n".$NRM;
351 print "1. Change Themes\n";
352 for ($count = 0; $count <= $#theme_name; $count++) {
353 print " > $theme_name[$count]\n";
355 print "2. CSS File : $WHT$theme_css$NRM\n";
357 print "R Return to Main Menu\n";
358 } elsif ($menu == 6) {
359 print $WHT."Address Books (LDAP)\n".$NRM;
360 print "1. Change Servers\n";
361 for ($count = 0; $count <= $#ldap_host; $count++) {
362 print " > $ldap_host[$count]\n";
364 print "2. Use Javascript Address Book Search : $WHT$default_use_javascript_addr_book$NRM\n";
366 print "R Return to Main Menu\n";
367 } elsif ($menu == 7) {
368 print $WHT."Message of the Day (MOTD)\n".$NRM;
371 print "1 Edit the MOTD\n";
373 print "R Return to Main Menu\n";
374 } elsif ($menu == 8) {
375 print $WHT."Plugins\n".$NRM;
376 print " Installed Plugins\n";
378 for ($count = 0; $count <= $#plugins; $count++) {
380 print " $num. $plugins[$count]\n";
382 print "\n Available Plugins:\n";
383 opendir(DIR
, "../plugins");
384 @files = readdir(DIR
);
386 @unused_plugins = ();
387 for ($i=0; $i <= $#files; $i++) {
388 if ( -d
"../plugins/" . $files[$i] &&
389 $files[$i] !~ /^\./ && $files[$i] ne "CVS") {
391 for ($k=0; $k<=$#plugins; $k++) {
392 if ($plugins[$k] eq $files[$i]) {
397 $unused_plugins[$pos] = $files[$i];
403 for ($i=0; $i<=$#unused_plugins; $i++) {
405 print " $num. $unused_plugins[$i]\n";
410 print "R Return to Main Menu\n";
412 if ($config_use_color == 1) {
413 print "C. Turn color off\n";
415 print "C. Turn color on\n";
417 print "S Save data\n";
421 print "Command >> ".$WHT;
423 $command =~ s/[\n|\r]//g;
424 $command =~ tr/A-Z/a-z/;
427 # Read the commands they entered.
428 if ($command eq "r") {
430 } elsif ($command eq "s") {
432 print "Data saved in config.php\n";
433 print "Press enter to continue...";
436 } elsif (($command eq "q") && ($saved == 0)) {
437 print "You have not saved your data.\n";
438 print "Save? [".$WHT."Y".$NRM."/n]: ";
440 if (($save =~ /^y/i) || ($save =~ /^\s*$/)) {
443 } elsif ($command eq "c") {
444 if ($config_use_color == 1) {
445 $config_use_color = 2;
449 $config_use_color = 1;
453 } elsif ($command eq "d" && $menu == 0) {
458 if (($command > 0) && ($command < 9)) {
461 } elsif ($menu == 1) {
462 if ($command == 1) { $org_name = command1
(); }
463 elsif ($command == 2) { $org_logo = command2
(); }
464 elsif ($command == 3) { $org_title = command3
(); }
465 elsif ($command == 4) { $signout_page = command4
(); }
466 elsif ($command == 5) { $squirrelmail_default_language = command5
(); }
467 } elsif ($menu == 2) {
468 if ($command == 1) { $domain = command11
(); }
469 elsif ($command == 2) { $imapServerAddress = command12
(); }
470 elsif ($command == 3) { $imapPort = command13
(); }
471 elsif ($command == 4) { $useSendmail = command14
(); }
472 elsif ($command == 5) { $sendmail_path = command15
(); }
473 elsif ($command == 6) { $smtpServerAddress = command16
(); }
474 elsif ($command == 7) { $smtpPort = command17
(); }
475 elsif ($command == 8) { $use_authenticated_smtp = command18
(); }
476 elsif ($command == 9) { $imap_server_type = command19
(); }
477 elsif ($command == 10) { $invert_time = command110
(); }
478 elsif ($command == 11) { $optional_delimiter = command111
(); }
479 } elsif ($menu == 3) {
480 if ($command == 1) { $default_folder_prefix = command21
(); }
481 elsif ($command == 2) { $show_prefix_option = command22
(); }
482 elsif ($command == 3) { $trash_folder = command23a
(); }
483 elsif ($command == 4) { $sent_folder = command23b
(); }
484 elsif ($command == 5) { $draft_folder = command23c
(); }
485 elsif ($command == 6) { $default_move_to_trash = command24a
(); }
486 elsif ($command == 7) { $default_move_to_sent = command24b
(); }
487 elsif ($command == 8) { $default_save_as_draft = command24c
(); }
488 elsif ($command == 9) { $list_special_folders_first = command27
(); }
489 elsif ($command == 10) { $use_special_folder_color = command28
(); }
490 elsif ($command == 11) { $auto_expunge = command29
(); }
491 elsif ($command == 12) { $default_sub_of_inbox = command210
(); }
492 elsif ($command == 13) { $show_contain_subfolders_option = command211
(); }
493 elsif ($command == 14) { $default_unseen_notify = command212
(); }
494 elsif ($command == 15) { $default_unseen_type = command213
(); }
495 elsif ($command == 16) { $auto_create_special = command214
(); }
496 } elsif ($menu == 4) {
497 if ($command == 1) { $default_charset = command31
(); }
498 elsif ($command == 2) { $data_dir = command33
(); }
499 elsif ($command == 3) { $attachment_dir = command34
(); }
500 elsif ($command == 4) { $default_left_size = command35
(); }
501 elsif ($command == 5) { $force_username_lowercase = command36
(); }
502 elsif ($command == 6) { $default_use_priority = command37
(); }
503 } elsif ($menu == 5) {
504 if ($command == 1) { command41
(); }
505 elsif ($command == 2) { $theme_css = command42
(); }
506 } elsif ($menu == 6) {
507 if ($command == 1) { command61
(); }
508 elsif ($command == 2) { command62
(); }
509 } elsif ($menu == 7) {
510 if ($command == 1) { $motd = command71
(); }
511 } elsif ($menu == 8) {
512 if ($command =~ /^[0-9]+/) { @plugins = command81
(); }
517 ####################################################################################
521 print "We have tried to make the name SquirrelMail as transparent as\n";
522 print "possible. If you set up an organization name, most places where\n";
523 print "SquirrelMail would take credit will be credited to your organization.\n";
525 print "[$WHT$org_name$NRM]: $WHT";
526 $new_org_name = <STDIN
>;
527 if ($new_org_name eq "\n") {
528 $new_org_name = $org_name;
530 $new_org_name =~ s/[\r|\n]//g;
532 return $new_org_name;
538 print "Your organization's logo is an image that will be displayed at\n";
539 print "different times throughout SquirrelMail. This is asking for the\n";
540 print "literal (/usr/local/squirrelmail/images/logo.jpg) or relative\n";
541 print "(../images/logo.jpg) path to your logo.\n";
543 print "[$WHT$org_logo$NRM]: $WHT";
544 $new_org_logo = <STDIN
>;
545 if ($new_org_logo eq "\n") {
546 $new_org_logo = $org_logo;
548 $new_org_logo =~ s/[\r|\n]//g;
550 return $new_org_logo;
555 print "A title is what is displayed at the top of the browser window in\n";
556 print "the titlebar. Usually this will end up looking something like:\n";
557 print "\"Netscape: $org_title\"\n";
559 print "[$WHT$org_title$NRM]: $WHT";
560 $new_org_title = <STDIN
>;
561 if ($new_org_title eq "\n") {
562 $new_org_title = $org_title;
564 $new_org_title =~ s/[\r|\n]//g;
566 return $new_org_title;
571 print "When users click the Sign Out button they will be logged out and\n";
572 print "then sent to signout_page. If signout_page is left empty,\n";
573 print "(hit space and then return) they will be taken, as normal,\n";
574 print "to the default and rather sparse SquirrelMail signout page.\n";
576 print "[$WHT$signout_page$NRM]: $WHT";
577 $new_signout_page = <STDIN
>;
578 if ($new_signout_page eq "\n") {
579 $new_signout_page = $signout_page;
581 $new_signout_page =~ s/[\r|\n]//g;
582 $new_signout_page =~ s/^\s+$//g;
584 return $new_signout_page;
589 print "SquirrelMail attempts to set the language in many ways. If it\n";
590 print "can not figure it out in another way, it will default to this\n";
591 print "language. Please use the two-letter code for the desired language.\n";
593 print "[$WHT$squirrelmail_default_language$NRM]: $WHT";
594 $new_signout_page = <STDIN
>;
595 if ($new_signout_page eq "\n") {
596 $new_signout_page = $squirrelmail_default_language;
598 $new_signout_page =~ s/[\r|\n]//g;
599 $new_signout_page =~ s/^\s+$//g;
601 return $new_signout_page;
604 ####################################################################################
608 print "The domain name is the suffix at the end of all email messages. If\n";
609 print "for example, your email address is jdoe\@myorg.com, then your domain\n";
610 print "would be myorg.com.\n";
612 print "[$WHT$domain$NRM]: $WHT";
613 $new_domain = <STDIN
>;
614 if ($new_domain eq "\n") {
615 $new_domain = $domain;
617 $new_domain =~ s/[\r|\n]//g;
624 print "This is the address where your IMAP server resides.\n";
625 print "[$WHT$imapServerAddress$NRM]: $WHT";
626 $new_imapServerAddress = <STDIN
>;
627 if ($new_imapServerAddress eq "\n") {
628 $new_imapServerAddress = $imapServerAddress;
630 $new_imapServerAddress =~ s/[\r|\n]//g;
632 return $new_imapServerAddress;
637 print "This is the port that your IMAP server is on. Usually this is 143.\n";
638 print "[$WHT$imapPort$NRM]: $WHT";
639 $new_imapPort = <STDIN
>;
640 if ($new_imapPort eq "\n") {
641 $new_imapPort = $imapPort;
643 $new_imapPort =~ s/[\r|\n]//g;
645 return $new_imapPort;
650 print "You now need to choose the method that you will use for sending\n";
651 print "messages in SquirrelMail. You can either connect to an SMTP server\n";
652 print "or use sendmail directly.\n";
653 if ($useSendmail eq "true") {
654 $default_value = "1";
656 $default_value = "2";
659 print " 1. Sendmail\n";
661 print "Your choice [1/2] [$WHT$default_value$NRM]: $WHT";
662 $use_sendmail = <STDIN
>;
663 if (($use_sendmail =~ /^1\n/i) || (($use_sendmail =~ /^\n/) && ($default_value eq "1"))) {
664 $useSendmail = "true";
666 $useSendmail = "false";
673 if ($sendmail_path[0] !~ /./) {
674 $sendmail_path = "/usr/sbin/sendmail";
676 print "Specify where the sendmail executable is located. Usually /usr/sbin/sendmail\n";
677 print "[$WHT$sendmail_path$NRM]: $WHT";
678 $new_sendmail_path = <STDIN
>;
679 if ($new_sendmail_path eq "\n") {
680 $new_sendmail_path = $sendmail_path;
682 $new_sendmail_path =~ s/[\r|\n]//g;
684 return $new_sendmail_path;
689 print "This is the location of your SMTP server.\n";
690 print "[$WHT$smtpServerAddress$NRM]: $WHT";
691 $new_smtpServerAddress = <STDIN
>;
692 if ($new_smtpServerAddress eq "\n") {
693 $new_smtpServerAddress = $smtpServerAddress;
695 $new_smtpServerAddress =~ s/[\r|\n]//g;
697 return $new_smtpServerAddress;
702 print "This is the port to connect to for SMTP. Usually 25.\n";
703 print "[$WHT$smtpPort$NRM]: $WHT";
704 $new_smtpPort = <STDIN
>;
705 if ($new_smtpPort eq "\n") {
706 $new_smtpPort = $smtpPort;
708 $new_smtpPort =~ s/[\r|\n]//g;
710 return $new_smtpPort;
713 # authenticated server
715 print "Do you wish to use an authenticated SMTP server? Your server must\n";
716 print "support this in order for SquirrelMail to work with it. We implemented\n";
717 print "it according to RFC 2554.\n";
720 $YesNo = 'y' if ($use_authenticated_smtp eq "true");
722 print "Use authenticated SMTP server (y/n) [$WHT$YesNo$NRM]: $WHT";
724 $new_use_authenticated_smtp = <STDIN
>;
725 $new_use_authenticated_smtp =~ tr/yn//cd;
726 return "true" if ($new_use_authenticated_smtp eq "y");
727 return "false" if ($new_use_authenticated_smtp eq "n");
728 return $use_authenticated_smtp;
733 print "Each IMAP server has its own quirks. As much as we tried to stick\n";
734 print "to standards, it doesn't help much if the IMAP server doesn't follow\n";
735 print "the same principles. We have made some work-arounds for some of\n";
736 print "these servers. If you would like to use them, please select your\n";
737 print "IMAP server. If you do not wish to use these work-arounds, you can\n";
738 print "set this to \"other\", and none will be used.\n";
739 print " cyrus = Cyrus IMAP server\n";
740 print " uw = University of Washington's IMAP server\n";
741 print " exchange = Microsoft Exchange IMAP server\n";
742 print " courier = Courier IMAP server\n";
743 print " other = Not one of the above servers\n";
744 print "[$WHT$imap_server_type$NRM]: $WHT";
745 $new_imap_server_type = <STDIN
>;
746 if ($new_imap_server_type eq "\n") {
747 $new_imap_server_type = $imap_server_type;
749 $new_imap_server_type =~ s/[\r|\n]//g;
751 return $new_imap_server_type;
756 print "Sometimes the date of messages sent is messed up (off by a few hours\n";
757 print "on some machines). Typically this happens if the system doesn't support\n";
758 print "tm_gmtoff. It will happen only if your time zone is \"negative\".\n";
759 print "This most often occurs on Solaris 7 machines in the United States.\n";
760 print "By default, this is off. It should be kept off unless problems surface\n";
761 print "about the time that messages are sent.\n";
762 print " no = Do NOT fix time -- almost always correct\n";
763 print " yes = Fix the time for this system\n";
766 $YesNo = 'y' if ($invert_time eq "true");
768 print "Fix the time for this system (y/n) [$WHT$YesNo$NRM]: $WHT";
770 $new_invert_time = <STDIN
>;
771 $new_invert_time =~ tr/yn//cd;
772 return "true" if ($new_invert_time eq "y");
773 return "false" if ($new_invert_time eq "n");
778 print "This is the delimiter that your IMAP server uses to distinguish between\n";
779 print "folders. For example, Cyrus uses '.' as the delimiter and a complete\n";
780 print "folder would look like 'INBOX.Friends.Bob', while UW uses '/' and would\n";
781 print "look like 'INBOX/Friends/Bob'. Normally this should be left at 'detect'\n";
782 print "but if you are sure you konw what delimiter your server uses, you can\n";
783 print "specify it here.\n";
784 print "\nTo have it autodetect the delimiter, set it to 'detect'.\n\n";
785 print "[$WHT$optional_delimiter$NRM]: $WHT";
786 $new_optional_delimiter = <STDIN
>;
787 if ($new_optional_delimiter eq "\n") {
788 $new_optional_delimiter = $optional_delimiter;
790 $new_optional_delimiter =~ s/[\r|\n]//g;
792 return $new_optional_delimiter;
797 print "\nYou can now create the welcome message that is displayed\n";
798 print "every time a user logs on. You can use HTML or just plain\n";
799 print "text. If you do not wish to have one, just make it blank.\n\n(Type @ on a blank line to exit)\n";
805 $line =~ s/[\r|\n]//g;
807 $line =~ s/ /\ \ /g;
808 $line =~ s/\t/\ \ \ \ /g;
810 $line =~ s/\"/\\\"/g;
812 $new_motd = $new_motd . $line;
814 } while ($line ne "@");
818 ################# PLUGINS ###################
821 $command =~ s/[\s|\n|\r]*//g;
823 $command = $command - 1;
824 if ($command <= $#plugins) {
827 while ($ct <= $#plugins) {
828 if ($ct != $command) {
829 @newplugins = (@newplugins, $plugins[$ct]);
833 @plugins = @newplugins;
834 } elsif ($command <= $#plugins + $#unused_plugins + 1) {
835 $num = $command - $#plugins - 1;
836 @newplugins = @plugins;
838 while ($ct <= $#unused_plugins) {
840 @newplugins = (@newplugins, $unused_plugins[$ct]);
844 @plugins = @newplugins;
850 ################# FOLDERS ###################
852 # default_folder_prefix
854 print "Some IMAP servers (UW, for example) store mail and folders in\n";
855 print "your user space in a separate subdirectory. This is where you\n";
856 print "specify what that directory is.\n";
858 print "EXAMPLE: mail/";
860 print "NOTE: If you use Cyrus, or some server that would not use this\n";
861 print " option, you must set this to 'none'.\n";
863 print "[$WHT$default_folder_prefix$NRM]: $WHT";
864 $new_default_folder_prefix = <STDIN
>;
865 if ($new_default_folder_prefix eq "\n") {
866 $new_default_folder_prefix = $default_folder_prefix;
868 $new_default_folder_prefix =~ s/[\r|\n]//g;
870 if (($new_default_folder_prefix =~ /^\s*$/) || ($new_default_folder_prefix =~ /none/i)) {
871 $new_default_folder_prefix = "";
873 $new_default_folder_prefix =~ s/\/*$//g
;
874 $new_default_folder_prefix =~ s/$/\//g
;
876 return $new_default_folder_prefix;
881 print "It is possible to set up the default folder prefix as a user\n";
882 print "specific option, where each user can specify what their mail\n";
883 print "folder is. If you set this to false, they will never see the\n";
884 print "option, but if it is true, this option will appear in the\n";
885 print "'options' section.\n";
887 print "NOTE: You set the default folder prefix in option '1' of this\n";
888 print " section. That will be the default if the user doesn't\n";
889 print " specify anything different.\n";
892 if ($show_prefix_option eq "true") {
893 $default_value = "y";
895 $default_value = "n";
898 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
900 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
901 $show_prefix_option = "true";
903 $show_prefix_option = "false";
905 return $show_prefix_option;
910 print "You can now specify where the default trash folder is located.\n";
911 print "On servers where you do not want this, you can set it to anything\n";
912 print "and set option 6 to false.\n";
914 print "This is relative to where the rest of your email is kept. You do\n";
915 print "not need to worry about their mail directory. If this folder\n";
916 print "would be ~/mail/trash on the filesystem, you only need to specify\n";
917 print "that this is 'trash', and be sure to put 'mail/' in option 1.\n";
920 print "[$WHT$trash_folder$NRM]: $WHT";
921 $new_trash_folder = <STDIN
>;
922 if ($new_trash_folder eq "\n") {
923 $new_trash_folder = $trash_folder;
925 $new_trash_folder =~ s/[\r|\n]//g;
927 return $new_trash_folder;
932 print "This is where messages that are sent will be stored. SquirrelMail\n";
933 print "by default puts a copy of all outgoing messages in this folder.\n";
935 print "This is relative to where the rest of your email is kept. You do\n";
936 print "not need to worry about their mail directory. If this folder\n";
937 print "would be ~/mail/sent on the filesystem, you only need to specify\n";
938 print "that this is 'sent', and be sure to put 'mail/' in option 1.\n";
941 print "[$WHT$sent_folder$NRM]: $WHT";
942 $new_sent_folder = <STDIN
>;
943 if ($new_sent_folder eq "\n") {
944 $new_sent_folder = $sent_folder;
946 $new_sent_folder =~ s/[\r|\n]//g;
948 return $new_sent_folder;
953 print "You can now specify where the default draft folder is located.\n";
954 print "On servers where you do not want this, you can set it to anything\n";
955 print "and set option 9 to false.\n";
957 print "This is relative to where the rest of your email is kept. You do\n";
958 print "not need to worry about their mail directory. If this folder\n";
959 print "would be ~/mail/drafts on the filesystem, you only need to specify\n";
960 print "that this is 'drafts', and be sure to put 'mail/' in option 1.\n";
963 print "[$WHT$draft_folder$NRM]: $WHT";
964 $new_draft_folder = <STDIN
>;
965 if ($new_draft_folder eq "\n") {
966 $new_draft_folder = $draft_folder;
968 $new_draft_folder =~ s/[\r|\n]//g;
970 return $new_draft_folder;
973 # default move to trash
975 print "By default, should messages get moved to the trash folder? You\n";
976 print "can specify the default trash folder in option 3. If this is set\n";
977 print "to false, messages will get deleted immediately without moving\n";
978 print "to the trash folder.\n";
980 print "Trash folder is currently: $trash_folder\n";
983 if ($default_move_to_trash eq "true") {
984 $default_value = "y";
986 $default_value = "n";
988 print "By default, move to trash (y/n) [$WHT$default_value$NRM]: $WHT";
990 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
991 $default_move_to_trash = "true";
993 $default_move_to_trash = "false";
995 return $default_move_to_trash;
998 # default move to sent
1000 print "By default, should messages get moved to the sent folder? You\n";
1001 print "can specify the default sent folder in option 4. If this is set\n";
1002 print "to false, messages will get sent an no copy will be made.\n";
1004 print "Trash folder is currently: $sent_folder\n";
1007 if ($default_move_to_sent eq "true") {
1008 $default_value = "y";
1010 $default_value = "n";
1012 print "By default, move to sent (y/n) [$WHT$default_value$NRM]: $WHT";
1013 $new_show = <STDIN
>;
1014 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1015 $default_move_to_sent = "true";
1017 $default_move_to_sent = "false";
1019 return $default_move_to_sent;
1022 # default save as draft
1024 print "By default, should the save to draft option be shown? You can\n";
1025 print "specify the default drafts folder in option 5. If this is set\n";
1026 print "to false, users will not be shown the save to draft option.\n";
1028 print "Drafts folder is currently: $draft_folder\n";
1031 if ($default_move_to_draft eq "true") {
1032 $default_value = "y";
1034 $default_value = "n";
1036 print "By default, save as draft (y/n) [$WHT$default_value$NRM]: $WHT";
1037 $new_show = <STDIN
>;
1038 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1039 $default_save_as_draft = "true";
1041 $default_save_as_draft = "false";
1043 return $default_save_as_draft;
1046 # List special folders first
1048 print "SquirrelMail has what we call 'special folders' that are not\n";
1049 print "manipulated and viewed like normal folders. Some examples of\n";
1050 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
1051 print "Simply asks if you want these folders listed first in the folder\n";
1055 if ($list_special_folders_first eq "true") {
1056 $default_value = "y";
1058 $default_value = "n";
1061 print "List first (y/n) [$WHT$default_value$NRM]: $WHT";
1062 $new_show = <STDIN
>;
1063 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1064 $list_special_folders_first = "true";
1066 $list_special_folders_first = "false";
1068 return $list_special_folders_first;
1071 # Show special folders color
1073 print "SquirrelMail has what we call 'special folders' that are not\n";
1074 print "manipulated and viewed like normal folders. Some examples of\n";
1075 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
1076 print "wants to know if we should display special folders in a\n";
1077 print "color than the other folders.\n";
1080 if ($use_special_folder_color eq "true") {
1081 $default_value = "y";
1083 $default_value = "n";
1086 print "Show color (y/n) [$WHT$default_value$NRM]: $WHT";
1087 $new_show = <STDIN
>;
1088 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1089 $use_special_folder_color = "true";
1091 $use_special_folder_color = "false";
1093 return $use_special_folder_color;
1098 print "The way that IMAP handles deleting messages is as follows. You\n";
1099 print "mark the message as deleted, and then to 'really' delete it, you\n";
1100 print "expunge it. This option asks if you want to just have messages\n";
1101 print "marked as deleted, or if you want SquirrelMail to expunge the \n";
1102 print "messages too.\n";
1105 if ($auto_expunge eq "true") {
1106 $default_value = "y";
1108 $default_value = "n";
1110 print "Auto expunge (y/n) [$WHT$default_value$NRM]: $WHT";
1111 $new_show = <STDIN
>;
1112 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1113 $auto_expunge = "true";
1115 $auto_expunge = "false";
1117 return $auto_expunge;
1120 # Default sub of inbox
1122 print "Some IMAP servers (Cyrus) have all folders as subfolders of INBOX.\n";
1123 print "This can cause some confusion in folder creation for users when\n";
1124 print "they try to create folders and don't put it as a subfolder of INBOX\n";
1125 print "and get permission errors. This option asks if you want folders\n";
1126 print "to be subfolders of INBOX by default.\n";
1129 if ($default_sub_of_inbox eq "true") {
1130 $default_value = "y";
1132 $default_value = "n";
1134 print "Default sub of INBOX (y/n) [$WHT$default_value$NRM]: $WHT";
1135 $new_show = <STDIN
>;
1136 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1137 $default_sub_of_inbox = "true";
1139 $default_sub_of_inbox = "false";
1141 return $default_sub_of_inbox;
1144 # Show contain subfolder option
1146 print "Some IMAP servers (UW) make it so that there are two types of\n";
1147 print "folders. Those that contain messages, and those that contain\n";
1148 print "subfolders. If this is the case for your server, set this to\n";
1149 print "true, and it will ask the user whether the folder they are\n";
1150 print "creating contains subfolders or messages.\n";
1153 if ($show_contain_subfolders_option eq "true") {
1154 $default_value = "y";
1156 $default_value = "n";
1158 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
1159 $new_show = <STDIN
>;
1160 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1161 $show_contain_subfolders_option = "true";
1163 $show_contain_subfolders_option = "false";
1165 return $show_contain_subfolders_option;
1168 # Default Unseen Notify
1170 print "This option specifies where the users will receive notification\n";
1171 print "about unseen messages by default. This is of course an option that\n";
1172 print "can be changed on a user level.\n";
1173 print " 1 = No notification\n";
1174 print " 2 = Only on the INBOX\n";
1175 print " 3 = On all folders\n";
1178 print "Which one should be default (1,2,3)? [$WHT$default_unseen_notify$NRM]: $WHT";
1179 $new_show = <STDIN
>;
1180 if ($new_show =~ /^[1|2|3]\n/i) {
1181 $default_unseen_notify = $new_show;
1183 $default_unseen_notify =~ s/[\r|\n]//g;
1184 return $default_unseen_notify;
1187 # Default Unseen Type
1189 print "Here you can define the default way that unseen messages will be displayed\n";
1190 print "to the user in the folder listing on the left side.\n";
1191 print " 1 = Only unseen messages (4)\n";
1192 print " 2 = Unseen and Total messages (4/27)\n";
1195 print "Which one should be default (1,2)? [$WHT$default_unseen_type$NRM]: $WHT";
1196 $new_show = <STDIN
>;
1197 if ($new_show =~ /^[1|2]\n/i) {
1198 $default_unseen_type = $new_show;
1200 $default_unseen_type =~ s/[\r|\n]//g;
1201 return $default_unseen_type;
1204 # Auto create special folders
1206 print "Would you like the Sent, Trash, and Drafts folders to be created\n";
1207 print "automatically print for you when a user logs in? If the user\n";
1208 print "accidentally deletes their special folders, this option will\n";
1209 print "automatically create it again for them.\n";
1212 if ($auto_create_special eq "true") {
1213 $default_value = "y";
1215 $default_value = "n";
1217 print "Auto create special folders? (y/n) [$WHT$default_value$NRM]: $WHT";
1218 $new_show = <STDIN
>;
1219 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1220 $auto_create_special = "true";
1222 $auto_create_special = "false";
1224 return $auto_create_special;
1228 ############# GENERAL OPTIONS #####################
1232 print "This option controls what character set is used when sending\n";
1233 print "mail and when sending HTML to the browser. Do not set this\n";
1234 print "to US-ASCII, use ISO-8859-1 instead. For cyrillic, it is best\n";
1235 print "to use KOI8-R, since this implementation is faster than most\n";
1236 print "of the alternatives\n";
1239 print "[$WHT$default_charset$NRM]: $WHT";
1240 $new_default_charset = <STDIN
>;
1241 if ($new_default_charset eq "\n") {
1242 $new_default_charset = $default_charset;
1244 $new_default_charset =~ s/[\r|\n]//g;
1246 return $new_default_charset;
1251 print "It is a possible security hole to have a writable directory\n";
1252 print "under the web server's root directory (ex: /home/httpd/html).\n";
1253 print "For this reason, it is possible to put the data directory\n";
1254 print "anywhere you would like. The path name can be absolute or\n";
1255 print "relative (to the config directory). It doesn't matter. Here\n";
1256 print "are two examples:\n";
1257 print " Absolute: /usr/local/squirrelmail/data/\n";
1258 print " Relative: ../data/\n";
1261 print "[$WHT$data_dir$NRM]: $WHT";
1262 $new_data_dir = <STDIN
>;
1263 if ($new_data_dir eq "\n") {
1264 $new_data_dir = $data_dir;
1266 $new_data_dir =~ s/[\r|\n]//g;
1268 if ($new_data_dir =~ /^\s*$/) {
1271 $new_data_dir =~ s/\/*$//g
;
1272 $new_data_dir =~ s/$/\//g
;
1274 return $new_data_dir;
1277 # Attachment directory
1279 print "Path to directory used for storing attachments while a mail is\n";
1280 print "being sent. There are a few security considerations regarding this\n";
1281 print "directory:\n";
1282 print " 1. It should have the permission 733 (rwx-wx-wx) to make it\n";
1283 print " impossible for a random person with access to the webserver\n";
1284 print " to list files in this directory. Confidential data might\n";
1285 print " be laying around in there.\n";
1286 print " 2. Since the webserver is not able to list the files in the\n";
1287 print " content is also impossible for the webserver to delete files\n";
1288 print " lying around there for too long.\n";
1289 print " 3. It should probably be another directory than the data\n";
1290 print " directory specified in option 3.\n";
1293 print "[$WHT$attachment_dir$NRM]: $WHT";
1294 $new_attachment_dir = <STDIN
>;
1295 if ($new_attachment_dir eq "\n") {
1296 $new_attachment_dir = $attachment_dir;
1298 $new_attachment_dir =~ s/[\r|\n]//g;
1300 if ($new_attachment_dir =~ /^\s*$/) {
1301 $new_attachment_dir = "";
1303 $new_attachment_dir =~ s/\/*$//g
;
1304 $new_attachment_dir =~ s/$/\//g
;
1306 return $new_attachment_dir;
1311 print "This is the default size (in pixels) of the left folder list.\n";
1312 print "Default is 200, but you can set it to whatever you wish. This\n";
1313 print "is a user preference, so this will only show up as their default.\n";
1315 print "[$WHT$default_left_size$NRM]: $WHT";
1316 $new_default_left_size = <STDIN
>;
1317 if ($new_default_left_size eq "\n") {
1318 $new_default_left_size = $default_left_size;
1320 $new_default_left_size =~ s/[\r|\n]//g;
1322 return $new_default_left_size;
1327 print "Some IMAP servers only have lowercase letters in the usernames\n";
1328 print "but they still allow people with uppercase to log in. This\n";
1329 print "causes a problem with the user's preference files. This option\n";
1330 print "transparently changes all usernames to lowercase.";
1333 if ($force_username_lowercase eq "true") {
1334 $default_value = "y";
1336 $default_value = "n";
1338 print "Convert usernames to lowercase (y/n) [$WHT$default_value$NRM]: $WHT";
1339 $new_show = <STDIN
>;
1340 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1350 if ($default_use_priority eq "true") {
1351 $default_value = "y";
1353 $default_value = "n";
1356 print "Allow users to specify priority of outgoing mail (y/n) [$WHT$default_value$NRM]: $WHT";
1357 $new_show = <STDIN
>;
1358 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
1366 print "\nNow we will define the themes that you wish to use. If you have added\n";
1367 print "a theme of your own, just follow the instructions (?) about how to add\n";
1368 print "them. You can also change the default theme.\n";
1369 print "[theme] command (?=help) > ";
1371 $input =~ s/[\r|\n]//g;
1372 while ($input ne "d") {
1373 if ($input =~ /^\s*l\s*/i) {
1375 while ($count <= $#theme_name) {
1376 if ($count == $theme_default) {
1381 $name = $theme_name[$count];
1382 $num_spaces = 25 - length($name);
1383 for ($i = 0; $i < $num_spaces;$i++) {
1384 $name = $name . " ";
1387 print " $count. $name";
1388 print "($theme_path[$count])\n";
1392 } elsif ($input =~ /^\s*m\s*[0-9]+/i) {
1393 $old_def = $theme_default;
1394 $theme_default = $input;
1395 $theme_default =~ s/^\s*m\s*//;
1396 if (($theme_default > $#theme_name) || ($theme_default < 0)) {
1397 print "Cannot set default theme to $theme_default. That theme does not exist.\n";
1398 $theme_default = $old_def;
1400 } elsif ($input =~ /^\s*\+/) {
1401 print "What is the name of this theme: ";
1403 $name =~ s/[\r|\n]//g;
1404 $theme_name[$#theme_name+1] = $name;
1405 print "Be sure to put ../themes/ before the filename.\n";
1406 print "What file is this stored in (ex: ../themes/default_theme.php): ";
1408 $name =~ s/[\r|\n]//g;
1409 $theme_path[$#theme_path+1] = $name;
1410 } elsif ($input =~ /^\s*-\s*[0-9]?/) {
1411 if ($input =~ /[0-9]+\s*$/) {
1413 $rem_num =~ s/^\s*-\s*//g;
1414 $rem_num =~ s/\s*$//;
1416 $rem_num = $#theme_name;
1418 if ($rem_num == $theme_default) {
1419 print "You cannot remove the default theme!\n";
1422 @new_theme_name = ();
1423 @new_theme_path = ();
1424 while ($count <= $#theme_name) {
1425 if ($count != $rem_num) {
1426 @new_theme_name = (@new_theme_name, $theme_name[$count]);
1427 @new_theme_path = (@new_theme_path, $theme_path[$count]);
1431 @theme_name = @new_theme_name;
1432 @theme_path = @new_theme_path;
1433 if ($theme_default > $rem_num) {
1437 } elsif ($input =~ /^\s*t\s*/i) {
1438 print "\nStarting detection...\n\n";
1440 opendir(DIR
, "../themes");
1441 @files = grep { /\.php$/i } readdir(DIR
);
1443 while ($cnt <= $#files) {
1444 $filename = "../themes/" . $files[$cnt];
1445 if ($filename ne "../themes/index.php") {
1447 for ($x=0; $x <= $#theme_path; $x++) {
1448 if ($theme_path[$x] eq $filename) {
1453 print "** Found theme: $filename\n";
1454 print " What is its name? ";
1456 $nm =~ s/[\n|\r]//g;
1457 $theme_name[$#theme_name+1] = $nm;
1458 $theme_path[$#theme_path+1] = $filename;
1464 for ($cnt=0; $cnt <= $#theme_path; $cnt++) {
1465 $filename = $theme_path[$cnt];
1466 if (! (-e
$filename)) {
1467 print " Removing $filename (file not found)\n";
1469 @new_theme_name = ();
1470 @new_theme_path = ();
1471 for ($x=0; $x < $#theme_path; $x++) {
1472 if ($theme_path[$x] eq $filename) {
1476 $new_theme_name[$x] = $theme_name[$x+1];
1477 $new_theme_path[$x] = $theme_path[$x+1];
1479 $new_theme_name[$x] = $theme_name[$x];
1480 $new_theme_path[$x] = $theme_path[$x];
1483 @theme_name = @new_theme_name;
1484 @theme_path = @new_theme_path;
1487 print "\nDetection complete!\n\n";
1490 } elsif ($input =~ /^\s*\?\s*/) {
1491 print ".-------------------------.\n";
1492 print "| t (detect themes) |\n";
1493 print "| + (add theme) |\n";
1494 print "| - N (remove theme) |\n";
1495 print "| m N (mark default) |\n";
1496 print "| l (list themes) |\n";
1497 print "| d (done) |\n";
1498 print "`-------------------------'\n";
1500 print "[theme] command (?=help) > ";
1502 $input =~ s/[\r|\n]//g;
1509 print "You may specify a cascading style-sheet (CSS) file to be included\n";
1510 print "on each html page generated by SquirrelMail. The CSS file is useful\n";
1511 print "for specifying a site-wide font. If you're not familiar with CSS\n";
1512 print "files, leave this blank.\n";
1514 print "To clear out an existing value, just type a space for the input.\n";
1516 print "[$WHT$theme_css$NRM]: $WHT";
1517 $new_theme_css = <STDIN
>;
1518 if ($new_theme_css eq "\n") {
1519 $new_theme_css = $theme_css;
1521 $new_theme_css =~ s/[\r|\n]//g;
1523 $new_theme_css =~ s/^\s*//;
1524 return $new_theme_css;
1529 print "You can now define different LDAP servers.\n";
1530 print "[ldap] command (?=help) > ";
1532 $input =~ s/[\r|\n]//g;
1533 while ($input ne "d") {
1534 if ($input =~ /^\s*l\s*/i) {
1536 while ($count <= $#ldap_host) {
1537 print "$count. $ldap_host[$count]\n";
1538 print " base: $ldap_base[$count]\n";
1539 if ($ldap_charset[$count]) {
1540 print " charset: $ldap_charset[$count]\n";
1542 if ($ldap_port[$count]) {
1543 print " port: $ldap_port[$count]\n";
1545 if ($ldap_name[$count]) {
1546 print " name: $ldap_name[$count]\n";
1548 if ($ldap_maxrows[$count]) {
1549 print " maxrows: $ldap_maxrows[$count]\n";
1554 } elsif ($input =~ /^\s*\+/) {
1555 $sub = $#ldap_host + 1;
1557 print "First, we need to have the hostname or the IP address where\n";
1558 print "this LDAP server resides. Example: ldap.bigfoot.com\n";
1561 $name =~ s/[\r|\n]//g;
1562 $ldap_host[$sub] = $name;
1566 print "Next, we need the server root (base dn). For this, an empty\n";
1567 print "string is allowed.\n";
1568 print "Example: ou=member_directory,o=netcenter.com\n";
1571 $name =~ s/[\r|\n]//g;
1572 $ldap_base[$sub] = $name;
1576 print "This is the TCP/IP port number for the LDAP server. Default\n";
1577 print "port is 389. This is optional. Press ENTER for default.\n";
1580 $name =~ s/[\r|\n]//g;
1581 $ldap_port[$sub] = $name;
1585 print "This is the charset for the server. Default is utf-8. This\n";
1586 print "is also optional. Press ENTER for default.\n";
1589 $name =~ s/[\r|\n]//g;
1590 $ldap_charset[$sub] = $name;
1594 print "This is the name for the server, used to tag the results of\n";
1595 print "the search. Default it \"LDAP: hostname\". Press ENTER for default\n";
1598 $name =~ s/[\r|\n]//g;
1599 $ldap_name[$sub] = $name;
1603 print "You can specify the maximum number of rows in the search result.\n";
1604 print "Default is unlimited. Press ENTER for default.\n";
1607 $name =~ s/[\r|\n]//g;
1608 $ldap_maxrows[$sub] = $name;
1612 } elsif ($input =~ /^\s*-\s*[0-9]?/) {
1613 if ($input =~ /[0-9]+\s*$/) {
1615 $rem_num =~ s/^\s*-\s*//g;
1616 $rem_num =~ s/\s*$//;
1618 $rem_num = $#ldap_host;
1621 @new_ldap_host = ();
1622 @new_ldap_base = ();
1623 @new_ldap_port = ();
1624 @new_ldap_name = ();
1625 @new_ldap_charset = ();
1626 @new_ldap_maxrows = ();
1627 while ($count <= $#ldap_host) {
1628 if ($count != $rem_num) {
1629 @new_ldap_host = (@new_ldap_host, $ldap_host[$count]);
1630 @new_ldap_base = (@new_ldap_base, $ldap_base[$count]);
1631 @new_ldap_port = (@new_ldap_port, $ldap_port[$count]);
1632 @new_ldap_name = (@new_ldap_name, $ldap_name[$count]);
1633 @new_ldap_charset = (@new_ldap_charset, $ldap_charset[$count]);
1634 @new_ldap_maxrows = (@new_ldap_maxrows, $ldap_maxrows[$count]);
1638 @ldap_host = @new_ldap_host;
1639 @ldap_base = @new_ldap_base;
1640 @ldap_port = @new_ldap_port;
1641 @ldap_name = @new_ldap_name;
1642 @ldap_charset = @new_ldap_charset;
1643 @ldap_maxrows = @new_ldap_maxrows;
1644 } elsif ($input =~ /^\s*\?\s*/) {
1645 print ".-------------------------.\n";
1646 print "| + (add host) |\n";
1647 print "| - N (remove host) |\n";
1648 print "| l (list hosts) |\n";
1649 print "| d (done) |\n";
1650 print "`-------------------------'\n";
1652 print "[ldap] command (?=help) > ";
1654 $input =~ s/[\r|\n]//g;
1659 print "Some of our developers have come up with very good javascript interface\n";
1660 print "for searching through address books, however, our original goals said\n";
1661 print "that we would be 100% HTML. In order to make it possible to use their\n";
1662 print "interface, and yet stick with our goals, we have also written a plain\n";
1663 print "HTML version of the search. Here, you can choose which version to use.\n";
1665 print "This is just the default value. It is also a user option that each\n";
1666 print "user can configure individually\n";
1669 if ($default_use_javascript_addr_book eq "true") {
1670 $default_value = "y";
1672 $default_use_javascript_addr_book = "false";
1673 $default_value = "n";
1675 print "Use javascript version by default (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 $default_use_javascript_addr_book = "true";
1680 $default_use_javascript_addr_book = "false";
1682 return $default_use_javascript_addr_book;
1687 open (FILE
, ">config.php");
1689 print FILE
"<?php\n\t/** SquirrelMail configuration\n";
1690 print FILE
"\t ** Created using the configure script, conf.pl\n\t **/\n\n";
1692 print FILE
"if (defined('config_php'))\n return;\n";
1693 print FILE
"define('config_php', true);\n\n";
1695 print FILE
"\tglobal \$print_config_version, \$config_version, \$config_use_color;\n";
1697 if ($print_config_version) {
1698 print FILE
"\t\$config_version = \"$print_config_version\";\n";
1700 print FILE
"\t\$config_use_color = $config_use_color;\n";
1703 print FILE
"\tglobal \$org_name, \$org_logo, \$org_title, \$signout_page;\n";
1704 print FILE
"\t\$org_name = \"$org_name\";\n";
1705 print FILE
"\t\$org_logo = \"$org_logo\";\n";
1706 print FILE
"\t\$org_title = \"$org_title\";\n";
1707 print FILE
"\t\$signout_page = \"$signout_page\";\n";
1711 print FILE
"\tglobal \$domain, \$imapServerAddress, \$imapPort;\n";
1712 print FILE
"\tglobal \$useSendmail, \$smtpServerAddress, \$smtpPort;\n";
1713 print FILE
"\tglobal \$sendmail_path, \$use_authenticated_smtp, \$imap_server_type;\n";
1714 print FILE
"\tglobal \$invert_time, \$optional_delimiter;\n";
1715 print FILE
"\t\$domain = \"$domain\";\n";
1716 print FILE
"\t\$imapServerAddress = \"$imapServerAddress\";\n";
1717 print FILE
"\t\$imapPort = $imapPort;\n";
1718 print FILE
"\t\$useSendmail = $useSendmail;\n";
1719 print FILE
"\t\$smtpServerAddress = \"$smtpServerAddress\";\n";
1720 print FILE
"\t\$smtpPort = $smtpPort;\n";
1721 print FILE
"\t\$sendmail_path = \"$sendmail_path\";\n";
1722 print FILE
"\t\$use_authenticated_smtp = $use_authenticated_smtp;\n";
1723 print FILE
"\t\$imap_server_type = \"$imap_server_type\";\n";
1724 print FILE
"\t\$invert_time = $invert_time;\n";
1725 print FILE
"\t\$optional_delimiter = \"$optional_delimiter\";\n";
1729 print FILE
"\tglobal \$default_folder_prefix;\n";
1730 print FILE
"\tglobal \$trash_folder, \$default_move_to_trash;\n";
1731 print FILE
"\tglobal \$sent_folder, \$default_move_to_sent;\n";
1732 print FILE
"\tglobal \$draft_folder, \$default_save_to_draft;\n";
1733 print FILE
"\tglobal \$show_prefix_option, \$list_special_folders_first;\n";
1734 print FILE
"\tglobal \$use_special_folder_color, \$auto_expunge, \$default_sub_of_inbox;\n";
1735 print FILE
"\tglobal \$show_contain_subfolders_option, \$default_unseen_notify;\n";
1736 print FILE
"\tglobal \$default_unseen_type, \$auto_create_special;\n";
1737 print FILE
"\t\$default_folder_prefix = \"$default_folder_prefix\";\n";
1738 print FILE
"\t\$trash_folder = \"$trash_folder\";\n";
1739 print FILE
"\t\$sent_folder = \"$sent_folder\";\n";
1740 print FILE
"\t\$draft_folder = \"$draft_folder\";\n";
1741 print FILE
"\t\$default_move_to_trash = $default_move_to_trash;\n";
1742 print FILE
"\t\$default_move_to_sent = $default_move_to_sent;\n";
1743 print FILE
"\t\$default_save_as_draft = $default_save_as_draft;\n";
1744 print FILE
"\t\$show_prefix_option = $show_prefix_option;\n";
1745 print FILE
"\t\$list_special_folders_first = $list_special_folders_first;\n";
1746 print FILE
"\t\$use_special_folder_color = $use_special_folder_color;\n";
1747 print FILE
"\t\$auto_expunge = $auto_expunge;\n";
1748 print FILE
"\t\$default_sub_of_inbox = $default_sub_of_inbox;\n";
1749 print FILE
"\t\$show_contain_subfolders_option = $show_contain_subfolders_option;\n";
1750 print FILE
"\t\$default_unseen_notify = $default_unseen_notify;\n";
1751 print FILE
"\t\$default_unseen_type = $default_unseen_type;\n";
1752 print FILE
"\t\$auto_create_special = $auto_create_special;\n";
1755 print FILE
"\tglobal \$default_charset, \$data_dir, \$attachment_dir;\n";
1756 print FILE
"\tglobal \$default_left_size, \$force_username_lowercase;\n";
1757 print FILE
"\tglobal \$default_use_priority;\n";
1758 print FILE
"\t\$default_charset = \"$default_charset\";\n";
1759 print FILE
"\t\$data_dir = \"$data_dir\";\n";
1760 print FILE
"\t\$attachment_dir = \"$attachment_dir\";\n";
1761 print FILE
"\t\$default_left_size = $default_left_size;\n";
1762 print FILE
"\t\$force_username_lowercase = $force_username_lowercase;\n";
1763 print FILE
"\t\$default_use_priority = $default_use_priority;\n";
1767 print FILE
"\tglobal \$plugins;\n";
1768 for ($ct=0; $ct <= $#plugins; $ct++) {
1769 print FILE
"\t\$plugins[$ct] = \"$plugins[$ct]\";\n";
1774 print FILE
"\tglobal \$theme_css, \$theme;\n";
1775 print FILE
"\t\$theme_css = \"$theme_css\";\n";
1776 for ($count=0; $count <= $#theme_name; $count++) {
1777 print FILE
"\t\$theme[$count][\"PATH\"] = \"$theme_path[$count]\";\n";
1778 print FILE
"\t\$theme[$count][\"NAME\"] = \"$theme_name[$count]\";\n";
1783 if ($default_use_javascript_addr_book ne "true") {
1784 $default_use_javascript_addr_book = "false";
1786 print FILE
"\tglobal \$default_use_javascript_addr_book, \$ldap_server;\n";
1787 print FILE
"\t\$default_use_javascript_addr_book = $default_use_javascript_addr_book;\n";
1788 for ($count=0; $count <= $#ldap_host; $count++) {
1789 print FILE
"\t\$ldap_server[$count] = Array(\n";
1790 print FILE
"\t\t\t\"host\" => \"$ldap_host[$count]\",\n";
1791 print FILE
"\t\t\t\"base\" => \"$ldap_base[$count]\"";
1792 if ($ldap_name[$count]) {
1793 print FILE
",\n\t\t\t\"name\" => \"$ldap_name[$count]\"";
1795 if ($ldap_port[$count]) {
1796 print FILE
",\n\t\t\t\"port\" => \"$ldap_port[$count]\"";
1798 if ($ldap_charset[$count]) {
1799 print FILE
",\n\t\t\t\"charset\" => \"$ldap_charset[$count]\"";
1801 if ($ldap_maxrows[$count]) {
1802 print FILE
",\n\t\t\t\"maxrows\" => \"$ldap_maxrows[$count]\"";
1804 print FILE
");\n\n";
1807 print FILE
"\tglobal \$motd;\n";
1808 print FILE
"\t\$motd = \"$motd\";\n";
1810 print FILE
"\tglobal \$squirrelmail_default_language;\n";
1811 print FILE
"\t\$squirrelmail_default_language = \"$squirrelmail_default_language\";\n";
1818 print $WHT."SquirrelMail Configuration : ".$NRM;
1819 if ($config == 1) { print "Read: config.php"; }
1820 elsif ($config == 2) { print "Read: config_default.php"; }
1822 print "---------------------------------------------------------\n";
1824 print "While we have been building SquirrelMail, we have discovered some\n";
1825 print "preferences that work better with some servers that don't work so\n";
1826 print "well with others. If you select your IMAP server, this option will\n";
1827 print "set some pre-defined settings for that server.\n";
1829 print "Please note that you will still need to go through and make sure\n";
1830 print "everything is correct. This does not change everything. There are\n";
1831 print "only a few settings that this will change.\n";
1835 while ($continue != 1) {
1836 print "Please select your IMAP server:\n";
1837 print " cyrus = Cyrus IMAP server\n";
1838 print " uw = University of Washington's IMAP server\n";
1839 print " exchange = Microsoft Exchange IMAP server\n";
1840 print " courier = Courier IMAP server\n";
1841 print " quit = Do not change anything\n";
1842 print "Command >> ";
1844 $server =~ s/[\r|\n]//g;
1847 if ($server eq "cyrus") {
1848 $default_folder_prefix = "";
1849 $trash_folder = "INBOX.Trash";
1850 $sent_folder = "INBOX.Sent";
1851 $draft_folder = "INBOX.Drafts";
1852 $show_prefix_option = false
;
1853 $default_sub_of_inbox = true
;
1854 $show_contain_subfolders_option = false
;
1855 $imap_server_type = "cyrus";
1857 print " default_folder_prefix = none\n";
1858 print " trash_folder = INBOX.Trash\n";
1859 print " sent_folder = INBOX.Sent\n";
1860 print " draft_folder = INBOX.Drafts\n";
1861 print " show_prefix_option = false\n";
1862 print " default_sub_of_inbox = true\n";
1863 print "show_contain_subfolders_option = false\n";
1864 print " imap_server_type = cyrus\n";
1867 } elsif ($server eq "uw") {
1868 $default_folder_prefix = "mail/";
1869 $trash_folder = "Trash";
1870 $sent_folder = "Sent";
1871 $draft_folder = "Drafts";
1872 $show_prefix_option = true
;
1873 $default_sub_of_inbox = false
;
1874 $show_contain_subfolders_option = true
;
1875 $imap_server_type = "uw";
1877 print " default_folder_prefix = mail/\n";
1878 print " trash_folder = Trash\n";
1879 print " sent_folder = Sent\n";
1880 print " draft_folder = Drafts\n";
1881 print " show_prefix_option = true\n";
1882 print " default_sub_of_inbox = false\n";
1883 print "show_contain_subfolders_option = true\n";
1884 print " imap_server_type = uw\n";
1887 } elsif ($server eq "exchange") {
1888 $default_folder_prefix = "";
1889 $default_sub_of_inbox = true
;
1890 $trash_folder = "INBOX/Deleted Items";
1891 $sent_folder = "INBOX/Sent Items";
1892 $drafts_folder = "INBOX/Drafts";
1893 $show_prefix_option = false
;
1894 $show_contain_subfolders_option = false
;
1895 $imap_server_type = "exchange";
1897 print " default_folder_prefix = <none>\n";
1898 print " default_sub_of_inbox = true\n";
1899 print " trash_folder = \"INBOX/Deleted Items\"\n";
1900 print " sent_folder = \"INBOX/Sent Items\"\n";
1901 print " draft_folder = \"INBOX/Drafts\"\n";
1902 print " show_prefix_option = false\n";
1903 print " show_contain_subfolders_option = false\n";
1904 print " imap_server_type = exchange\n";
1907 } elsif ($server eq "courier") {
1908 $imap_server_type = "courier";
1910 print " imap_server_type = courier\n";
1913 } elsif ($server eq "quit") {
1916 print "Unrecognized server: $server\n";
1920 print "\nPress any key to continue...";