3 # Written March 26, 2000
4 # Luke Ehresman (lehresma@css.tayloru.edu)
6 # A simple configure script to configure squirrelmail
7 ############################################################
11 ############################################################
12 # First, lets read in the data already in there...
13 ############################################################
14 if ( -e
"config.php") {
15 print "The file \"config.php\" exists. Using it for defaults.\n\n";
16 open (FILE
, "config.php");
18 print "No config file found. Reading from config_defaults.php.\n\n";
19 open (FILE
, "config_default.php");
22 # Reads and parses the current configuration file (either
23 # config.php or config_default.php).
25 while ($line = <FILE
>) {
26 if ($line =~ /^\s+\$/) {
30 if ($var =~ /^([a-z]|[A-Z])/) {
31 @options = split(/\s*=\s*/, $var);
32 $options[1] =~ s/[\n|\r]//g;
33 $options[1] =~ s/^"//g;
34 $options[1] =~ s/;.*$//g;
35 $options[1] =~ s/"$//g;
37 if ($options[0] =~ /^special_folders/) {
38 if ($options[0] =~ /\[.*\]$/) {
41 $sub = substr ($sub, @sub-1, 1);
43 $special_folders[$sub] = $options[1];
45 } elsif ($options[0] =~ /^theme\[[0-9]+\]\["PATH"\]/) {
47 $sub =~ s/\]\["PATH"\]//;
48 $sub = substr ($sub, @sub-1, 1);
49 $theme_path[$sub] = $options[1];
50 } elsif ($options[0] =~ /^theme\[[0-9]+\]\["NAME"\]/) {
52 $sub =~ s/\]\["NAME"\]//;
53 $sub = substr ($sub, @sub-1, 1);
54 $theme_name[$sub] = $options[1];
56 ${$options[0]} = $options[1];
61 if ($useSendmail ne "true") {
62 $useSendmail = "false";
64 if (!$sendmail_path) {
65 $sendmail_path = "/usr/sbin/sendmail";
69 #####################################################################################
71 while (($command ne "q") && ($command ne "Q")) {
74 print $WHT."SquirrelMail Configuration Utility\n".$NRM;
75 print $WHT."Main Menu --\n".$NRM;
76 print "1. Organization Preferences\n";
77 print "2. Server Settings\n";
78 print "3. Folder Defaults\n";
79 print "4. General Options\n";
81 print "6. Address Books (LDAP)\n";
82 print "7. Message of the Day (MOTD)\n";
84 } elsif ($menu == 1) {
85 print $WHT."Organization Preferences\n".$NRM;
86 print "1. Organization Name : $WHT$org_name$NRM\n";
87 print "2. Organization Logo : $WHT$org_logo$NRM\n";
88 print "3. Organization Title : $WHT$org_title$NRM\n";
90 print "R Return to Main Menu\n";
91 } elsif ($menu == 2) {
92 print $WHT."Server Settings\n".$NRM;
93 print "1. Domain : $WHT$domain$NRM\n";
94 print "2. IMAP Server : $WHT$imapServerAddress$NRM\n";
95 print "3. IMAP Port : $WHT$imapPort$NRM\n";
96 print "4. Use Sendmail : $WHT$useSendmail$NRM\n";
97 if ($useSendmail eq "true") {
98 print "5. Sendmail Path : $WHT$sendmail_path$NRM\n";
100 print "6. SMTP Server : $WHT$smtpServerAddress$NRM\n";
101 print "7. SMTP Port : $WHT$smtpPort$NRM\n";
104 print "R Return to Main Menu\n";
105 } elsif ($menu == 3) {
106 print $WHT."Folder Defaults\n".$NRM;
107 print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n";
108 print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n";
109 print "3. Trash Folder : $WHT$trash_folder$NRM\n";
110 print "4. Sent Folder : $WHT$sent_folder$NRM\n";
111 print "5. List Special Folders First : $WHT$list_special_folders_first$NRM\n";
112 print "6. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n";
113 print "7. By default, move to trash : $WHT$default_move_to_trash$NRM\n";
114 print "8. Auto Expunge : $WHT$auto_expunge$NRM\n";
115 print "9. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n";
116 print "10. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n";
117 print "11. Special Folders > $WHT$special_folders[0]$NRM\n";
118 for ($count = 1; $count <= $#special_folders; $count++) {
119 print " > $WHT$special_folders[$count]$NRM\n";
122 print "R Return to Main Menu\n";
123 } elsif ($menu == 4) {
124 print $WHT."General Options\n".$NRM;
125 print "1. Default Charset : $WHT$default_charset$NRM\n";
126 print "2. Auto Forward : $WHT$auto_forward$NRM\n";
127 print "3. Data Directory : $WHT$data_dir$NRM\n";
128 print "4. Attachment Directory : $WHT$attachment_dir$NRM\n";
129 print "5. Default Left Size : $WHT$default_left_size$NRM\n";
131 print "R Return to Main Menu\n";
132 } elsif ($menu == 5) {
133 print $WHT."Themes\n".$NRM;
134 print "1. Change Themes\n";
135 for ($count = 0; $count <= $#theme_name; $count++) {
136 print " | $theme_name[$count]\n";
139 print "R Return to Main Menu\n";
140 } elsif ($menu == 6) {
141 print $WHT."Address Books (LDAP)\n".$NRM;
143 print "R Return to Main Menu\n";
144 } elsif ($menu == 7) {
145 print $WHT."Message of the Day (MOTD)\n".$NRM;
148 print "1 Edit the MOTD\n";
150 print "R Return to Main Menu\n";
152 print "S Save data\n";
156 print "Command >> ".$WHT;
158 $command =~ s/[\n|\r]//g;
161 # Read the commands they entered.
162 if (($command eq "R") || ($command eq "r")) {
164 } elsif (($command eq "s") || ($command eq "S")) {
166 print "Data saved in config.php\n";
167 print "Press any key to continue...";
170 } elsif ((($command eq "q") || ($command eq "Q")) && ($saved == 0)) {
171 print "You have not saved your data.\n";
172 print "Save? (y/n) [".$WHT."y".$NRM."]: ";
174 if (($save =~ /^y/i) || ($save =~ /^\s*$/)) {
180 if (($command > 0) && ($command < 8)) {
183 } elsif ($menu == 1) {
184 if ($command == 1) { $org_name = command1
(); }
185 elsif ($command == 2) { $org_logo = command2
(); }
186 elsif ($command == 3) { $org_title = command3
(); }
187 } elsif ($menu == 2) {
188 if ($command == 1) { $domain = command11
(); }
189 elsif ($command == 2) { $imapServerAddress = command12
(); }
190 elsif ($command == 3) { $imapPort = command13
(); }
191 elsif ($command == 4) { $useSendmail = command14
(); }
192 elsif ($command == 5) { $sendmail_path = command15
(); }
193 elsif ($command == 6) { $smtpServerAddress = command16
(); }
194 elsif ($command == 7) { $smtpPort = command17
(); }
195 } elsif ($menu == 3) {
196 if ($command == 1) { $default_folder_prefix = command21
(); }
197 elsif ($command == 2) { $show_prefix_option = command22
(); }
198 elsif ($command == 3) { $trash_folder = command23
(); }
199 elsif ($command == 4) { $sent_folder = command24
(); }
200 elsif ($command == 5) { $list_special_folders_first = command25
(); }
201 elsif ($command == 6) { $use_special_folder_color = command26
(); }
202 elsif ($command == 7) { $default_move_to_trash = command27
(); }
203 elsif ($command == 8) { $auto_expunge = command28
(); }
204 elsif ($command == 9) { $default_sub_of_inbox = command29
(); }
205 elsif ($command == 10){ $show_contain_subfolders_option = command210
(); }
206 elsif ($command == 11){ $special_folders = command211
(); }
207 } elsif ($menu == 4) {
208 if ($command == 1) { $default_charset = command31
(); }
209 elsif ($command == 2) { $auto_forward = command32
(); }
210 elsif ($command == 3) { $data_dir = command33
(); }
211 elsif ($command == 4) { $attachment_dir = command34
(); }
212 elsif ($command == 5) { $default_left_size = command35
(); }
213 } elsif ($menu == 5) {
217 } elsif ($menu == 6) {
218 } elsif ($menu == 7) {
219 if ($command == 1) { $motd = command71
(); $motd =~ s/"/\\"/g;}
224 ####################################################################################
228 print "We have tried to make the name SquirrelMail as transparent as\n";
229 print "possible. If you set up an organization name, most places where\n";
230 print "SquirrelMail would take credit will be credited to your organization.\n";
232 print "[$WHT$org_name$NRM]: $WHT";
233 $new_org_name = <STDIN
>;
234 if ($new_org_name eq "\n") {
235 $new_org_name = $org_name;
237 $new_org_name =~ s/[\r|\n]//g;
239 return $new_org_name;
245 print "Your organization's logo is an image that will be displayed at\n";
246 print "different times throughout SquirrelMail. This is asking for the\n";
247 print "literal (/usr/local/squirrelmail/images/logo.jpg) or relative\n";
248 print "(../images/logo.jpg) path to your logo.\n";
250 print "[$WHT$org_logo$NRM]: $WHT";
251 $new_org_logo = <STDIN
>;
252 if ($new_org_logo eq "\n") {
253 $new_org_logo = $org_logo;
255 $new_org_logo =~ s/[\r|\n]//g;
257 return $new_org_logo;
262 print "A title is what is displayed at the top of the browser window in\n";
263 print "the titlebar. Usually this will end up looking something like:\n";
264 print "\"Netscape: $org_title\"\n";
266 print "[$WHT$org_title$NRM]: $WHT";
267 $new_org_title = <STDIN
>;
268 if ($new_org_title eq "\n") {
269 $new_org_title = $org_title;
271 $new_org_title =~ s/[\r|\n]//g;
273 return $new_org_title;
276 ####################################################################################
280 print "The domain name is the suffix at the end of all email messages. If\n";
281 print "for example, your email address is jdoe\@myorg.com, then your domain\n";
282 print "would be myorg.com.\n";
284 print "[$WHT$domain$NRM]: $WHT";
285 $new_domain = <STDIN
>;
286 if ($new_domain eq "\n") {
287 $new_domain = $domain;
289 $new_domain =~ s/[\r|\n]//g;
296 print "This is the address where your IMAP server resides.\n";
297 print "[$WHT$imapServerAddress$NRM]: $WHT";
298 $new_imapServerAddress = <STDIN
>;
299 if ($new_imapServerAddress eq "\n") {
300 $new_imapServerAddress = $imapServerAddress;
302 $new_imapServerAddress =~ s/[\r|\n]//g;
304 return $new_imapServerAddress;
309 print "This is the port that your IMAP server is on. Usually this is 143.\n";
310 print "[$WHT$imapPort$NRM]: $WHT";
311 $new_imapPort = <STDIN
>;
312 if ($new_imapPort eq "\n") {
313 $new_imapPort = $imapPort;
315 $new_imapPort =~ s/[\r|\n]//g;
317 return $new_imapPort;
322 print "You now need to choose the method that you will use for sending\n";
323 print "messages in SquirrelMail. You can either connect to an SMTP server\n";
324 print "or use sendmail directly.\n";
325 if ($useSendmail eq "true") {
326 $default_value = "y";
328 $default_value = "n";
331 print "Use Sendmail (y/n) [$WHT$default_value$NRM]: $WHT";
332 $use_sendmail = <STDIN
>;
333 if (($use_sendmail =~ /^y\n/i) || (($use_sendmail =~ /^\n/) && ($default_value eq "y"))) {
334 $useSendmail = "true";
336 $useSendmail = "false";
343 if ($sendmail_path[0] !~ /./) {
344 $sendmail_path = "/usr/sbin/sendmail";
346 print "Specify where the sendmail executable is located. Usually /usr/sbin/sendmail\n";
347 print "[$WHT$sendmail_path$NRM]: $WHT";
348 $new_sendmail_path = <STDIN
>;
349 if ($new_sendmail_path eq "\n") {
350 $new_sendmail_path = $sendmail_path;
352 $new_sendmail_path =~ s/[\r|\n]//g;
354 return $new_sendmail_path;
359 print "This is the location of your SMTP server.\n";
360 print "[$WHT$smtpServerAddress$NRM]: $WHT";
361 $new_smtpServerAddress = <STDIN
>;
362 if ($new_smtpServerAddress eq "\n") {
363 $new_smtpServerAddress = $smtpServerAddress;
365 $new_smtpServerAddress =~ s/[\r|\n]//g;
367 return $new_smtpServerAddress;
372 print "This is the port to connect to for SMTP. Usually 25.\n";
373 print "[$WHT$smtpPort$NRM]: $WHT";
374 $new_smtpPort = <STDIN
>;
375 if ($new_smtpPort eq "\n") {
376 $new_smtpPort = $smtpPort;
378 $new_smtpPort =~ s/[\r|\n]//g;
380 return $new_smtpPort;
385 print "\nYou can now create the welcome message that is displayed\n";
386 print "every time a user logs on. You can use HTML or just plain\n";
387 print "text.\n\n(Type @ on a blank line to exit)\n";
391 $line =~ s/[\r|\n]//g;
392 $line =~ s/ /\ \ /g;
394 $new_motd = $new_motd . $line;
396 } while ($line ne "@");
400 ################# FOLDERS ###################
402 # default_folder_prefix
404 print "Some IMAP servers (UW, for example) store mail and folders in\n";
405 print "your user space in a separate subdirectory. This is where you\n";
406 print "specify what that directory is.\n";
408 print "EXAMPLE: mail/";
410 print "NOTE: If you use Cyrus, or some server that would not use this\n";
411 print " option, you must set this to 'none'.\n";
413 print "[$WHT$default_folder_prefix$NRM]: $WHT";
414 $new_default_folder_prefix = <STDIN
>;
415 if ($new_default_folder_prefix eq "\n") {
416 $new_default_folder_prefix = $default_folder_prefix;
418 $new_default_folder_prefix =~ s/[\r|\n]//g;
420 if (($new_default_folder_prefix =~ /^\s*$/) || ($new_default_folder_prefix =~ /none/i)) {
421 $new_default_folder_prefix = "";
423 $new_default_folder_prefix =~ s/\/*$//g
;
424 $new_default_folder_prefix =~ s/$/\//g
;
426 return $new_default_folder_prefix;
431 print "It is possible to set up the default folder prefix as a user\n";
432 print "specific option, where each user can specify what their mail\n";
433 print "folder is. If you set this to false, they will never see the\n";
434 print "option, but if it is true, this option will appear in the\n";
435 print "'options' section.\n";
437 print "NOTE: You set the default folder prefix in option '1' of this\n";
438 print " section. That will be the default if the user doesn't\n";
439 print " specify anything different.\n";
442 if ($show_prefix_option eq "true") {
443 $default_value = "y";
445 $default_value = "n";
448 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
450 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
451 $show_prefix_option = "true";
453 $show_prefix_option = "false";
455 return $show_prefix_option;
460 print "You can now specify where the default trash folder is located.\n";
461 print "On servers where you do not want this, you can set it to anything\n";
462 print "and set option 7 to false.\n";
464 print "This is relative to where the rest of your email is kept. You do\n";
465 print "not need to worry about their mail directory. If this folder\n";
466 print "would be ~/mail/trash on the filesystem, you only need to specify\n";
467 print "that this is 'trash', and be sure to put 'mail/' in option 1.\n";
470 print "[$WHT$trash_folder$NRM]: $WHT";
471 $new_trash_folder = <STDIN
>;
472 if ($new_trash_folder eq "\n") {
473 $new_trash_folder = $trash_folder;
475 $new_trash_folder =~ s/[\r|\n]//g;
477 return $new_trash_folder;
482 print "This is where messages that are sent will be stored. SquirrelMail\n";
483 print "by default puts a copy of all outgoing messages in this folder.\n";
485 print "This is relative to where the rest of your email is kept. You do\n";
486 print "not need to worry about their mail directory. If this folder\n";
487 print "would be ~/mail/sent on the filesystem, you only need to specify\n";
488 print "that this is 'sent', and be sure to put 'mail/' in option 1.\n";
491 print "[$WHT$sent_folder$NRM]: $WHT";
492 $new_sent_folder = <STDIN
>;
493 if ($new_sent_folder eq "\n") {
494 $new_sent_folder = $sent_folder;
496 $new_sent_folder =~ s/[\r|\n]//g;
498 return $new_sent_folder;
501 # List special folders first
503 print "SquirrelMail has what we call 'special folders' that are not\n";
504 print "manipulated and viewed like normal folders. Some examples of\n";
505 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
506 print "Simply asks if you want these folders listed first in the folder\n";
510 if ($list_special_folders_first eq "true") {
511 $default_value = "y";
513 $default_value = "n";
516 print "List first (y/n) [$WHT$default_value$NRM]: $WHT";
518 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
519 $list_special_folders_first = "true";
521 $list_special_folders_first = "false";
523 return $list_special_folders_first;
526 # Show special folders color
528 print "SquirrelMail has what we call 'special folders' that are not\n";
529 print "manipulated and viewed like normal folders. Some examples of\n";
530 print "these folders would be INBOX, Trash, Sent, etc. This option\n";
531 print "wants to know if we should display special folders in a\n";
532 print "color than the other folders.\n";
535 if ($use_special_folder_color eq "true") {
536 $default_value = "y";
538 $default_value = "n";
541 print "Show color (y/n) [$WHT$default_value$NRM]: $WHT";
543 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
544 $use_special_folder_color = "true";
546 $use_special_folder_color = "false";
548 return $use_special_folder_color;
551 # default move to trash
553 print "By default, should messages get moved to the trash folder? You\n";
554 print "can specify the default trash folder in option 3. If this is set\n";
555 print "to false, messages will get deleted immediately without moving\n";
556 print "to the trash folder.\n";
558 print "Trash folder is currently: $trash_folder\n";
561 if ($default_move_to_trash eq "true") {
562 $default_value = "y";
564 $default_value = "n";
566 print "By default, move to trash (y/n) [$WHT$default_value$NRM]: $WHT";
568 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
569 $default_move_to_trash = "true";
571 $default_move_to_trash = "false";
573 return $default_move_to_trash;
578 print "The way that IMAP handles deleting messages is as follows. You\n";
579 print "mark the message as deleted, and then to 'really' delete it, you\n";
580 print "expunge it. This option asks if you want to just have messages\n";
581 print "marked as deleted, or if you want SquirrelMail to expunge the \n";
582 print "messages too.\n";
585 if ($auto_expunge eq "true") {
586 $default_value = "y";
588 $default_value = "n";
590 print "Auto expunge (y/n) [$WHT$default_value$NRM]: $WHT";
592 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
593 $auto_expunge = "true";
595 $auto_expunge = "false";
597 return $auto_expunge;
600 # Default sub of inbox
602 print "Some IMAP servers (Cyrus) have all folders as subfolders of INBOX.\n";
603 print "This can cause some confusion in folder creation for users when\n";
604 print "they try to create folders and don't put it as a subfolder of INBOX\n";
605 print "and get permission errors. This option asks if you want folders\n";
606 print "to be subfolders of INBOX by default.\n";
609 if ($default_sub_of_inbox eq "true") {
610 $default_value = "y";
612 $default_value = "n";
614 print "Default sub of INBOX (y/n) [$WHT$default_value$NRM]: $WHT";
616 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
617 $default_sub_of_inbox = "true";
619 $default_sub_of_inbox = "false";
621 return $default_sub_of_inbox;
624 # Show contain subfolder option
626 print "Some IMAP servers (UW) make it so that there are two types of\n";
627 print "folders. Those that contain messages, and those that contain\n";
628 print "subfolders. If this is the case for your server, set this to\n";
629 print "true, and it will ask the user whether the folder they are\n";
630 print "creating contains subfolders or messages.\n";
633 if ($show_contain_subfolders_option eq "true") {
634 $default_value = "y";
636 $default_value = "n";
638 print "Show option (y/n) [$WHT$default_value$NRM]: $WHT";
640 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
641 $show_contain_subfolders_option = "true";
643 $show_contain_subfolders_option = "false";
645 return $show_contain_subfolders_option;
650 print "\nSpecial folders are folders that can't be manipulated like normal\n";
651 print "user-created folders. A couple of examples of these would be the\n";
652 print "trash folder, the sent folder, etc.\n";
653 print "Special Folders:\n";
656 while ($count < @special_folders) {
657 print " $count) $WHT" . $special_folders[$count] . "$NRM\n";
660 print "\n[folders] command (?=help) > ";
662 $input =~ s/[\r|\n]//g;
663 while ($input !~ /^d$/i) {
665 if ($input =~ /^\s*\+\s*.*/) {
666 $input =~ s/^\s*\+\s*//;
667 $special_folders[$#special_folders+1] = $input;
670 elsif ($input =~ /^\s*-\s*[0-9]?/i) {
671 if ($input =~ /[0-9]+\s*$/) {
673 $rem_num =~ s/^\s*-\s*//g;
674 $rem_num =~ s/\s*$//;
676 $rem_num = $#special_folders;
680 print "You cannot remove INBOX. It is a very special folder.\n";
683 @new_special_folders = ();
685 while ($count <= $#special_folders) {
686 if ($count != $rem_num) {
687 @new_special_folders = (@new_special_folders, $special_folders[$count]);
689 if ($count == $rem_num) {
690 print "Removed: $special_folders[$rem_num]\n";
696 print "Error: Can't delete an entry that's not there!\n";
698 @special_folders = @new_special_folders;
702 elsif ($input =~ /^\s*l\s*/i) {
705 while ($count < @special_folders) {
706 print " $count) $WHT" . $special_folders[$count] . "$NRM\n";
709 } elsif ($input =~ /^\s*\?\s*/) {
710 print ".-------------------------.\n";
711 print "| + Folder (add folder) |\n";
712 print "| - N (remove folder) |\n";
713 print "| l (list folders) |\n";
714 print "| d (done) |\n";
715 print "`-------------------------'\n";
719 print "Unrecognized command.\n";
722 print "\n[folders] command (?=help) > ";
724 $input =~ s/[\r|\n]//g;
726 return @special_folders;
729 ############# GENERAL OPTIONS #####################
733 print "This option controls what character set is used when sending\n";
734 print "mail and when sending HTML to the browser. Do not set this\n";
735 print "to US-ASCII, use ISO-8859-1 instead. For cyrillic, it is best\n";
736 print "to use KOI8-R, since this implementation is faster than most\n";
737 print "of the alternatives\n";
740 print "[$WHT$default_charset$NRM]: $WHT";
741 $new_default_charset = <STDIN
>;
742 if ($new_default_charset eq "\n") {
743 $new_default_charset = $default_charset;
745 $new_default_charset =~ s/[\r|\n]//g;
747 return $new_default_charset;
752 print "There are some places that we will automatically forward the user\n";
753 print "rather than display pointless messages like 'Message sent!' or\n";
754 print "stuff like that. Use this or not?\n";
756 print "NOTE: This is not working currently as we are trying to find a\n";
757 print " better way to handle this. This option really doesn't do\n";
761 if ($auto_forward eq "true") {
762 $default_value = "y";
764 $default_value = "n";
766 print "Auto forward (y/n) [$WHT$default_value$NRM]: $WHT";
768 if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) {
769 $auto_forward = "true";
771 $auto_forward = "false";
773 return $auto_forward;
778 print "It is a possible security hole to have a writable directory\n";
779 print "under the web server's root directory (ex: /home/httpd/html).\n";
780 print "For this reason, it is possible to put the data directory\n";
781 print "anywhere you would like. The path name can be absolute or\n";
782 print "relative (to the config directory). It doesn't matter. Here\n";
783 print "are two examples:\n";
784 print " Absolute: /usr/local/squirrelmail/data/\n";
785 print " Relative: ../data/\n";
788 print "[$WHT$data_dir$NRM]: $WHT";
789 $new_data_dir = <STDIN
>;
790 if ($new_data_dir eq "\n") {
791 $new_data_dir = $data_dir;
793 $new_data_dir =~ s/[\r|\n]//g;
795 if ($new_data_dir =~ /^\s*$/) {
798 $new_data_dir =~ s/\/*$//g
;
799 $new_data_dir =~ s/$/\//g
;
801 return $new_data_dir;
804 # Attachment directory
806 print "Path to directory used for storing attachments while a mail is\n";
807 print "being sent. There are a few security considerations regarding this\n";
808 print "directory:\n";
809 print " 1. It should have the permission 733 (rwx-wx-wx) to make it\n";
810 print " impossible for a random person with access to the webserver\n";
811 print " to list files in this directory. Confidential data might\n";
812 print " be laying around in there.\n";
813 print " 2. Since the webserver is not able to list the files in the\n";
814 print " content is also impossible for the webserver to delete files\n";
815 print " lying around there for too long.\n";
816 print " 3. It should probably be another directory than the data\n";
817 print " directory specified in option 3.\n";
820 print "[$WHT$attachment_dir$NRM]: $WHT";
821 $new_attachment_dir = <STDIN
>;
822 if ($new_attachment_dir eq "\n") {
823 $new_attachment_dir = $attachment_dir;
825 $new_attachment_dir =~ s/[\r|\n]//g;
827 if ($new_attachment_dir =~ /^\s*$/) {
828 $new_attachment_dir = "";
830 $new_attachment_dir =~ s/\/*$//g
;
831 $new_attachment_dir =~ s/$/\//g
;
833 return $new_attachment_dir;
838 print "This is the default size (in pixels) of the left folder list.\n";
839 print "Default is 200, but you can set it to whatever you wish. This\n";
840 print "is a user preference, so this will only show up as their default.\n";
842 print "[$WHT$default_left_size$NRM]: $WHT";
843 $new_default_left_size = <STDIN
>;
844 if ($new_default_left_size eq "\n") {
845 $new_default_left_size = $default_left_size;
847 $new_default_left_size =~ s/[\r|\n]//g;
849 return $new_default_left_size;
854 print "\nNow we will define the themes that you wish to use. If you have added\n";
855 print "a theme of your own, just follow the instructions (?) about how to add\n";
856 print "them. You can also change the default theme.\n";
857 print "[theme] command (?=help) > ";
859 $input =~ s/[\r|\n]//g;
860 while ($input ne "d") {
861 if ($input =~ /^\s*l\s*/i) {
863 while ($count <= $#theme_name) {
864 if ($count == $theme_default) {
869 $name = $theme_name[$count];
870 $num_spaces = 25 - length($name);
871 for ($i = 0; $i < $num_spaces;$i++) {
875 print " $count. $name";
876 print "($theme_path[$count])\n";
880 } elsif ($input =~ /^\s*m\s*[0-9]+/i) {
881 $old_def = $theme_default;
882 $theme_default = $input;
883 $theme_default =~ s/^\s*m\s*//;
884 if (($theme_default > $#theme_name) || ($theme_default < 0)) {
885 print "Cannot set default theme to $theme_default. That theme does not exist.\n";
886 $theme_default = $old_def;
888 } elsif ($input =~ /^\s*\+/) {
889 print "What is the name of this theme: ";
891 $name =~ s/[\r|\n]//g;
892 $theme_name[$#theme_name+1] = $name;
893 print "Be sure to put ../config/ before the filename.\n";
894 print "What file is this stored in (ex: ../config/default_theme.php): ";
896 $name =~ s/[\r|\n]//g;
897 $theme_path[$#theme_path+1] = $name;
898 } elsif ($input =~ /^\s*-\s*[0-9]?/) {
899 if ($input =~ /[0-9]+\s*$/) {
901 $rem_num =~ s/^\s*-\s*//g;
902 $rem_num =~ s/\s*$//;
904 $rem_num = $#theme_name;
906 if ($rem_num == $theme_default) {
907 print "You cannot remove the default theme!\n";
910 @new_theme_name = ();
911 @new_theme_path = ();
912 while ($count <= $#theme_name) {
913 if ($count != $rem_num) {
914 @new_theme_name = (@new_theme_name, $theme_name[$count]);
915 @new_theme_path = (@new_theme_path, $theme_path[$count]);
919 @theme_name = @new_theme_name;
920 @theme_path = @new_theme_path;
921 if ($theme_default > $rem_num) {
925 } elsif ($input =~ /^\s*\?\s*/) {
926 print ".-------------------------.\n";
927 print "| + (add theme) |\n";
928 print "| - N (remove theme) |\n";
929 print "| m N (mark default) |\n";
930 print "| l (list themes) |\n";
931 print "| d (done) |\n";
932 print "`-------------------------'\n";
934 print "[theme] command (?=help) > ";
936 $input =~ s/[\r|\n]//g;
943 open (FILE
, ">config.php");
945 print FILE
"<?\n\t/** SquirrelMail configuration\n";
946 print FILE
"\t ** Created using the configure script, conf.pl\n\t **/\n\n";
948 print FILE
"\t\$org_name = \"$org_name\";\n";
949 print FILE
"\t\$org_logo = \"$org_logo\";\n";
950 print FILE
"\t\$org_title = \"$org_title\";\n";
954 print FILE
"\t\$domain = $domain;\n";
955 print FILE
"\t\$imapServerAddress = $imapServerAddress;\n";
956 print FILE
"\t\$imapPort = $imapPort;\n";
957 print FILE
"\t\$useSendmail = $useSendmail;\n";
958 print FILE
"\t\$smtpServerAddress = $smtpServerAddress;\n";
959 print FILE
"\t\$smtpPort = $smtpPort;\n";
960 print FILE
"\t\$sendmailPath = $sendmailPath;\n";
964 print FILE
"\t\$default_folder_prefix = \"$default_folder_prefix\";\n";
965 print FILE
"\t\$trash_folder = \"$trash_folder\";\n";
966 print FILE
"\t\$sent_folder = \"$sent_folder\";\n";
967 print FILE
"\t\$show_prefix_option = $show_prefix_option;\n";
968 print FILE
"\t\$list_special_folders_first = $list_special_folders_first;\n";
969 print FILE
"\t\$use_special_folder_color = $use_special_folder_color;\n";
970 print FILE
"\t\$default_move_to_trash = $default_move_to_trash;\n";
971 print FILE
"\t\$auto_expunge = $auto_expunge;\n";
972 print FILE
"\t\$default_sub_of_inbox = $default_sub_of_inbox;\n";
973 print FILE
"\t\$show_contain_subfolders_option = $show_contain_subfolders_option;\n";
974 for ($count=0; $count <= $#special_folders; $count++) {
975 print FILE
"\t\$special_folders[$count] = \"$special_folders[$count]\";\n";
979 print FILE
"\t\$default_charset = \"$default_charset\";\n";
980 print FILE
"\t\$auto_forward = $auto_forward;\n";
981 print FILE
"\t\$data_dir = \"$data_dir\";\n";
982 print FILE
"\t\$attachment_dir = \"$attachment_dir\";\n";
983 print FILE
"\t\$default_left_size = $default_left_size;\n";
987 for ($count=0; $count <= $#theme_name; $count++) {
988 print FILE
"\t\$theme[$count][\"PATH\"] = \"$theme_path[$count]\";\n";
989 print FILE
"\t\$theme[$count][\"NAME\"] = \"$theme_name[$count]\";\n";
994 print FILE
"\t\$motd = \"$motd\";\n";