3 # Written March 26, 2000
4 # Luke Ehresman (lehresma@css.tayloru.edu)
6 # A simple configure script to configure squirrelmail
7 ############################################################
12 print "\n\n--------------------------------------------------------\n";
13 print "SquirrelMail version 0.4 -- Configure script\n";
14 print "by SquirrelMail Development Team\n";
15 print "http://squirrelmail.sourceforge.net\n";
16 print "--------------------------------------------------------\n";
19 ############################################################
20 # First, lets read in the data already in there...
21 ############################################################
22 if ( -e
"config.php") {
23 print "The file \"config.php\" exists. Using it for defaults.\n\n";
24 open (FILE
, "config.php");
26 print "No config file found. Reading from config_defaults.php.\n\n";
27 open (FILE
, "config_default.php");
30 # Reads and parses the current configuration file (either
31 # config.php or config_default.php).
33 while ($line = <FILE
>) {
34 if ($line =~ /^\s+\$/) {
38 if ($var =~ /^([a-z]|[A-Z])/) {
39 @options = split(/\s=\s/, $var);
40 $options[1] =~ s/[\n|\r]//g;
41 $options[1] =~ s/^"//g;
42 $options[1] =~ s/;.*$//g;
43 $options[1] =~ s/"$//g;
45 if ($options[0] =~ /^special_folders/) {
46 if ($options[0] =~ /\[.*\]$/) {
49 $sub = substr ($sub, @sub-1, 1);
51 $special_folders[$sub] = $options[1];
53 } elsif ($options[0] =~ /^theme\[[0-9]+\]\["PATH"\]/) {
55 $sub =~ s/\]\["PATH"\]//;
56 $sub = substr ($sub, @sub-1, 1);
57 $theme_path[$sub] = $options[1];
58 } elsif ($options[0] =~ /^theme\[[0-9]+\]\["NAME"\]/) {
60 $sub =~ s/\]\["NAME"\]//;
61 $sub = substr ($sub, @sub-1, 1);
62 $theme_name[$sub] = $options[1];
64 ${$options[0]} = $options[1];
70 open (FILE
, ">cf.php");
71 print FILE
"<?\n\t/** SquirrelMail configure script\n";
72 print FILE
" ** Created using the configure script, config.pl.\n\t **/\n\n";
75 #####################################################################################
79 print "We have tried to make the name SquirrelMail as transparent as\n";
80 print "possible. If you set up an organization name, most places where\n";
81 print "SquirrelMail would take credit will be credited to your organization.\n";
83 print "What is the name of your organization [$org_name]: ";
84 $new_org_name = <STDIN
>;
85 if ($new_org_name eq "\n") {
86 $new_org_name = $org_name;
88 $new_org_name =~ s/[\r|\n]//g;
95 print "Your organization's logo is an image that will be displayed at\n";
96 print "different times throughout SquirrelMail. This is asking for the\n";
97 print "literal (/usr/local/squirrelmail/images/logo.jpg) or relative\n";
98 print "(../images/logo.jpg) path to your logo.\n";
100 print "Where is the logo for your organization [$org_logo]: ";
101 $new_org_logo = <STDIN
>;
102 if ($new_org_logo eq "\n") {
103 $new_org_logo = $org_logo;
105 $new_org_logo =~ s/[\r|\n]//g;
107 return $new_org_logo;
112 print "A title is what is displayed at the top of the browser window in\n";
113 print "the titlebar. Usually this will end up looking something like:\n";
114 print "\"Netscape: $org_title\"\n";
116 print "The title of the web page [$org_title]: ";
117 $new_org_title = <STDIN
>;
118 if ($new_org_title eq "\n") {
119 $new_org_title = $org_title;
121 $new_org_title =~ s/[\r|\n]//g;
123 return $new_org_title;
128 print "The domain is what is on the right side of the \@ in the email\n";
129 print "address. If your address is somebody\@somewhere.com, then your\n";
130 print "domain would be \"somewhere.com\".\n";
132 print "Your domain [$WHT$domain$NRM]: ".$WHT;
133 $new_domain = <STDIN
>;
134 if ($new_domain eq "\n") {
135 $new_domain = $domain;
137 $new_domain =~ s/[\r|\n]//g;
142 #####################################################################################
144 while (($command ne "q") && ($command ne "Q")) {
146 print $WHT."General Information --\n".$NRM;
147 print "1 Name of organization : $WHT$org_name$NRM\n";
148 print "2 Where is your logo : $WHT$org_logo$NRM\n";
149 print "3 Title of web page : $WHT$org_title$NRM\n";
151 print $WHT."Server Information --\n".$NRM;
152 print "10 Domain : $WHT$domain$NRM\n";
153 print "11 IMAP server : \n";
154 print "12 IMAP port : \n";
155 print "13 Use Sendmail? : \n";
156 if (@vars[4] eq "true") {
157 print "14 Sendmail path : \n";
159 print "15 SMTP server : \n";
160 print "16 SMTP port : \n";
163 print $WHT."General Options --\n".$NRM;
164 print "20 Welcome message\n";
165 print "21 Auto expunge : @vars[10]\n";
166 print "22 Fodlers sub of INBOX : @vars[11]\n";
168 print "x Exit without saving\n";
169 print "q Save and exit\n";
174 $command =~ s/[\n|\r]//g;
178 if ($command eq "1" ) { $org_name = command1
(); }
179 elsif ($command eq "2" ) { $org_logo = command2
(); }
180 elsif ($command eq "3" ) { $org_title = command3
(); }
182 elsif ($command eq "10") { $domain = command10
(); }
183 elsif ($command eq "11") { $imapServerAddress = command11
(); }
184 elsif ($command eq "12") { $imapPort = command12
(); }
185 elsif ($command eq "13") { $use_sendmail = command3
(); }
186 elsif ($command eq "14") { $org_title = command3
(); }
187 elsif ($command eq "15") { $org_title = command3
(); }