bbd30ac8 |
1 | #!/usr/bin/perl |
2 | # conf.pl |
8beafbbc |
3 | # Luke Ehresman (luke@squirrelmail.org) |
bbd30ac8 |
4 | # |
5 | # A simple configure script to configure squirrelmail |
ccfb2029 |
6 | ############################################################ |
985f7c88 |
7 | $conf_pl_version = "x62"; |
bbd30ac8 |
8 | |
ccfb2029 |
9 | ############################################################ |
bbd30ac8 |
10 | # First, lets read in the data already in there... |
ccfb2029 |
11 | ############################################################ |
bbd30ac8 |
12 | if ( -e "config.php") { |
4011c3ca |
13 | open (FILE, "config.php"); |
14 | while ($line = <FILE>) { |
15 | if ($line =~ /^\s+\$/) { |
16 | $line =~ s/^\s+\$//; |
17 | $var = $line; |
18 | |
19 | $var =~ s/=/EQUALS/; |
20 | if ($var =~ /^([a-z]|[A-Z])/) { |
21 | @o = split(/\s*EQUALS\s*/, $var); |
22 | if ($o[0] eq "config_version") { |
23 | $o[1] =~ s/[\n|\r]//g; |
24 | $o[1] =~ s/\";\s*$//; |
25 | $o[1] =~ s/;$//; |
26 | $o[1] =~ s/^"//; |
27 | |
28 | $config_version = $o[1]; |
29 | close (FILE); |
30 | } |
31 | } |
32 | } |
33 | } |
34 | close (FILE); |
35 | |
36 | if ($config_version ne $conf_pl_version) { |
37 | system "clear"; |
38 | print $WHT."WARNING:\n".$NRM; |
6b638171 |
39 | print " The file \"config/config.php\" was found, but it is for an older version of\n"; |
4011c3ca |
40 | print " SquirrelMail. It is possible to still read the defaults from this file\n"; |
41 | print " but be warned that many preferences change between versions. It is\n"; |
42 | print " recommended that you start with a clean config.php for each upgrade that\n"; |
6b638171 |
43 | print " you do. To do this, just move config/config.php out of the way.\n\n"; |
f0bc4d36 |
44 | print "Continue loading with the old config.php [y/N]? "; |
4011c3ca |
45 | $ctu = <STDIN>; |
f0bc4d36 |
46 | if (($ctu !~ /^y\n/i) || ($ctu =~ /^\n/)) { |
4011c3ca |
47 | exit; |
48 | } |
49 | |
f0bc4d36 |
50 | print "\nDo you want me to stop warning you [y/N]? "; |
4011c3ca |
51 | $ctu = <STDIN>; |
52 | if ($ctu =~ /^y\n/i) { |
53 | $print_config_version = $conf_pl_version; |
54 | } else { |
55 | $print_config_version = $config_version; |
56 | } |
57 | } else { |
58 | $print_config_version = $config_version; |
59 | } |
60 | |
a93b12ba |
61 | $config = 1; |
ccfb2029 |
62 | open (FILE, "config.php"); |
1e0628fb |
63 | } elsif (-e "config_default.php") { |
4011c3ca |
64 | open (FILE, "config_default.php"); |
65 | while ($line = <FILE>) { |
66 | if ($line =~ /^\s+\$/) { |
67 | $line =~ s/^\s+\$//; |
68 | $var = $line; |
69 | |
70 | $var =~ s/=/EQUALS/; |
71 | if ($var =~ /^([a-z]|[A-Z])/) { |
72 | @o = split(/\s*EQUALS\s*/, $var); |
73 | if ($o[0] eq "config_version") { |
74 | $o[1] =~ s/[\n|\r]//g; |
75 | $o[1] =~ s/\";\s*$//; |
76 | $o[1] =~ s/;$//; |
77 | $o[1] =~ s/^"//; |
78 | |
79 | $config_version = $o[1]; |
80 | close (FILE); |
81 | } |
82 | } |
83 | } |
84 | } |
85 | close (FILE); |
86 | |
87 | if ($config_version ne $conf_pl_version) { |
88 | system "clear"; |
89 | print $WHT."WARNING:\n".$NRM; |
90 | print " You are trying to use a \"config_default.php\" from an older version of\n"; |
91 | print " SquirrelMail. This is HIGHLY unrecommended. You should get the\n"; |
92 | print " \"config_default.php\" that matches the version of SquirrelMail that you\n"; |
93 | print " are running. You can get this from the SquirrelMail web page by going\n"; |
94 | print " to: http://www.squirrelmail.org.\n\n"; |
f0bc4d36 |
95 | print "Continue loading with the old config_default.php (not a good idea) [y/N]? "; |
4011c3ca |
96 | $ctu = <STDIN>; |
f0bc4d36 |
97 | if (($ctu !~ /^y\n/i) || ($ctu =~ /^\n/)) { |
4011c3ca |
98 | exit; |
99 | } |
100 | |
f0bc4d36 |
101 | print "\nDo you want me to stop warning you [y/N]? "; |
4011c3ca |
102 | $ctu = <STDIN>; |
103 | if ($ctu =~ /^y\n/i) { |
104 | $print_config_version = $conf_pl_version; |
105 | } else { |
106 | $print_config_version = $config_version; |
107 | } |
108 | } else { |
109 | $print_config_version = $config_version; |
110 | } |
a93b12ba |
111 | $config = 2; |
ccfb2029 |
112 | open (FILE, "config_default.php"); |
1e0628fb |
113 | } else { |
a93b12ba |
114 | print "No configuration file found. Please get config_default.php or\n"; |
115 | print "config.php before running this again. This program needs a\n"; |
116 | print "default config file to get default values.\n"; |
117 | exit; |
bbd30ac8 |
118 | } |
119 | |
120 | # Reads and parses the current configuration file (either |
121 | # config.php or config_default.php). |
122 | |
123 | while ($line = <FILE>) { |
ccfb2029 |
124 | if ($line =~ /^\s+\$/) { |
125 | $line =~ s/^\s+\$//; |
126 | $var = $line; |
127 | |
e9f8ea4e |
128 | $var =~ s/=/EQUALS/; |
ccfb2029 |
129 | if ($var =~ /^([a-z]|[A-Z])/) { |
e9f8ea4e |
130 | @options = split(/\s*EQUALS\s*/, $var); |
ccfb2029 |
131 | $options[1] =~ s/[\n|\r]//g; |
9d0c7bee |
132 | $options[1] =~ s/\";\s*$//; |
e9f8ea4e |
133 | $options[1] =~ s/;$//; |
f0bc4d36 |
134 | $options[1] =~ s/^\"//; |
ccfb2029 |
135 | |
1e0628fb |
136 | if ($options[0] =~ /^theme\[[0-9]+\]\["PATH"\]/) { |
ccfb2029 |
137 | $sub = $options[0]; |
138 | $sub =~ s/\]\["PATH"\]//; |
1fe8fc34 |
139 | $sub =~ s/.*\[//; |
98fe1e9f |
140 | if (-e "../themes") { |
141 | $options[1] =~ s/^\.\.\/config/\.\.\/themes/; |
142 | } |
ccfb2029 |
143 | $theme_path[$sub] = $options[1]; |
144 | } elsif ($options[0] =~ /^theme\[[0-9]+\]\["NAME"\]/) { |
145 | $sub = $options[0]; |
146 | $sub =~ s/\]\["NAME"\]//; |
aa8dcbd5 |
147 | $sub =~ s/.*\[//; |
ccfb2029 |
148 | $theme_name[$sub] = $options[1]; |
9d0c7bee |
149 | } elsif ($options[0] =~ /^plugins\[[0-9]+\]/) { |
150 | $sub = $options[0]; |
151 | $sub =~ s/\]//; |
152 | $sub =~ s/^plugins\[//; |
153 | $plugins[$sub] = $options[1]; |
a93b12ba |
154 | } elsif ($options[0] =~ /^ldap_server\[[0-9]+\]/) { |
1e0628fb |
155 | $sub = $options[0]; |
1fe8fc34 |
156 | $sub =~ s/\]//; |
157 | $sub =~ s/^ldap_server\[//; |
a93b12ba |
158 | $continue = 0; |
159 | while (($tmp = <FILE>) && ($continue != 1)) { |
160 | if ($tmp =~ /\);\s*$/) { |
161 | $continue = 1; |
162 | } |
163 | |
f0bc4d36 |
164 | if ($tmp =~ /^\s*\"host\"/i) { |
165 | $tmp =~ s/^\s*\"host\"\s*=>\s*\"//i; |
166 | $tmp =~ s/\",\s*$//; |
167 | $tmp =~ s/\"\);\s*$//; |
a93b12ba |
168 | $host = $tmp; |
f0bc4d36 |
169 | } elsif ($tmp =~ /^\s*\"base\"/i) { |
170 | $tmp =~ s/^\s*\"base\"\s*=>\s*\"//i; |
171 | $tmp =~ s/\",\s*$//; |
172 | $tmp =~ s/\"\);\s*$//; |
a93b12ba |
173 | $base = $tmp; |
f0bc4d36 |
174 | } elsif ($tmp =~ /^\s*\"charset\"/i) { |
175 | $tmp =~ s/^\s*\"charset\"\s*=>\s*\"//i; |
176 | $tmp =~ s/\",\s*$//; |
177 | $tmp =~ s/\"\);\s*$//; |
a93b12ba |
178 | $charset = $tmp; |
f0bc4d36 |
179 | } elsif ($tmp =~ /^\s*\"port\"/i) { |
180 | $tmp =~ s/^\s*\"port\"\s*=>\s*\"//i; |
181 | $tmp =~ s/\",\s*$//; |
182 | $tmp =~ s/\"\);\s*$//; |
a93b12ba |
183 | $port = $tmp; |
f0bc4d36 |
184 | } elsif ($tmp =~ /^\s*\"maxrows\"/i) { |
185 | $tmp =~ s/^\s*\"maxrows\"\s*=>\s*\"//i; |
186 | $tmp =~ s/\",\s*$//; |
187 | $tmp =~ s/\"\);\s*$//; |
a93b12ba |
188 | $maxrows = $tmp; |
f0bc4d36 |
189 | } elsif ($tmp =~ /^\s*\"name\"/i) { |
190 | $tmp =~ s/^\s*\"name\"\s*=>\s*\"//i; |
191 | $tmp =~ s/\",\s*$//; |
192 | $tmp =~ s/\"\);\s*$//; |
a93b12ba |
193 | $name = $tmp; |
194 | } |
195 | } |
1e0628fb |
196 | $ldap_host[$sub] = $host; |
a93b12ba |
197 | $ldap_base[$sub] = $base; |
198 | $ldap_name[$sub] = $name; |
199 | $ldap_port[$sub] = $port; |
200 | $ldap_maxrows[$sub] = $maxrows; |
201 | $ldap_charset[$sub] = $charset; |
ccfb2029 |
202 | } else { |
203 | ${$options[0]} = $options[1]; |
204 | } |
205 | } |
206 | } |
bbd30ac8 |
207 | } |
1a7a2fcc |
208 | close FILE; |
828b4753 |
209 | if ($useSendmail ne "true") { |
ccfb2029 |
210 | $useSendmail = "false"; |
828b4753 |
211 | } |
212 | if (!$sendmail_path) { |
ccfb2029 |
213 | $sendmail_path = "/usr/sbin/sendmail"; |
828b4753 |
214 | } |
24fc5dd2 |
215 | if (!$default_unseen_notify) { |
216 | $default_unseen_notify = 2; |
217 | } |
218 | if (!$default_unseen_type) { |
219 | $default_unseen_type = 1; |
220 | } |
0ecb47e5 |
221 | if (!$config_use_color) { |
222 | $config_use_color = 1; |
223 | } |
a1f1f9bc |
224 | if (!$invert_time) { |
225 | $invert_time = "false"; |
226 | } |
bbd30ac8 |
227 | |
5b6ae78a |
228 | ##################################################################################### |
0ecb47e5 |
229 | if ($config_use_color == 1) { |
230 | $WHT = "\x1B[37;1m"; |
231 | $NRM = "\x1B[0m"; |
232 | } else { |
233 | $WHT = ""; |
234 | $NRM = ""; |
235 | $config_use_color = 2; |
236 | } |
5b6ae78a |
237 | |
828b4753 |
238 | while (($command ne "q") && ($command ne "Q")) { |
ccfb2029 |
239 | system "clear"; |
612eda0a |
240 | print $WHT."SquirrelMail Configuration : ".$NRM; |
241 | if ($config == 1) { print "Read: config.php"; } |
242 | elsif ($config == 2) { print "Read: config_default.php"; } |
243 | print "\n"; |
244 | print "---------------------------------------------------------\n"; |
1e0628fb |
245 | |
612eda0a |
246 | if ($menu == 0) { |
ccfb2029 |
247 | print $WHT."Main Menu --\n".$NRM; |
248 | print "1. Organization Preferences\n"; |
249 | print "2. Server Settings\n"; |
250 | print "3. Folder Defaults\n"; |
251 | print "4. General Options\n"; |
252 | print "5. Themes\n"; |
253 | print "6. Address Books (LDAP)\n"; |
254 | print "7. Message of the Day (MOTD)\n"; |
9d0c7bee |
255 | print "8. Plugins\n"; |
ccfb2029 |
256 | print "\n"; |
a93b12ba |
257 | print "D. Set pre-defined settings for specific IMAP servers\n"; |
258 | print "\n"; |
ccfb2029 |
259 | } elsif ($menu == 1) { |
260 | print $WHT."Organization Preferences\n".$NRM; |
261 | print "1. Organization Name : $WHT$org_name$NRM\n"; |
262 | print "2. Organization Logo : $WHT$org_logo$NRM\n"; |
263 | print "3. Organization Title : $WHT$org_title$NRM\n"; |
264 | print "\n"; |
265 | print "R Return to Main Menu\n"; |
266 | } elsif ($menu == 2) { |
267 | print $WHT."Server Settings\n".$NRM; |
268 | print "1. Domain : $WHT$domain$NRM\n"; |
269 | print "2. IMAP Server : $WHT$imapServerAddress$NRM\n"; |
270 | print "3. IMAP Port : $WHT$imapPort$NRM\n"; |
996d34de |
271 | print "4. Use Sendmail/SMTP : $WHT"; |
272 | if ($useSendmail eq "true") { |
273 | print "Sendmail"; |
274 | } else { |
275 | print "SMTP"; |
276 | } |
277 | print "$NRM\n"; |
ccfb2029 |
278 | if ($useSendmail eq "true") { |
279 | print "5. Sendmail Path : $WHT$sendmail_path$NRM\n"; |
280 | } else { |
281 | print "6. SMTP Server : $WHT$smtpServerAddress$NRM\n"; |
282 | print "7. SMTP Port : $WHT$smtpPort$NRM\n"; |
283 | } |
a93b12ba |
284 | print "8. Server : $WHT$imap_server_type$NRM\n"; |
d47b2518 |
285 | print "9. Invert Time : $WHT$invert_time$NRM\n"; |
ccfb2029 |
286 | print "\n"; |
287 | print "R Return to Main Menu\n"; |
288 | } elsif ($menu == 3) { |
289 | print $WHT."Folder Defaults\n".$NRM; |
290 | print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n"; |
291 | print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n"; |
292 | print "3. Trash Folder : $WHT$trash_folder$NRM\n"; |
293 | print "4. Sent Folder : $WHT$sent_folder$NRM\n"; |
2f287147 |
294 | print "5. By default, move to trash : $WHT$default_move_to_trash$NRM\n"; |
295 | print "6. By default, move to sent : $WHT$default_move_to_sent$NRM\n"; |
296 | print "7. List Special Folders First : $WHT$list_special_folders_first$NRM\n"; |
297 | print "8. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n"; |
298 | print "9. Auto Expunge : $WHT$auto_expunge$NRM\n"; |
299 | print "10. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n"; |
300 | print "11. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n"; |
24fc5dd2 |
301 | print "12. Default Unseen Notify : $WHT$default_unseen_notify$NRM\n"; |
302 | print "13. Default Unseen Type : $WHT$default_unseen_type$NRM\n"; |
ccfb2029 |
303 | print "\n"; |
304 | print "R Return to Main Menu\n"; |
305 | } elsif ($menu == 4) { |
306 | print $WHT."General Options\n".$NRM; |
985f7c88 |
307 | print "1. Default Charset : $WHT$default_charset$NRM\n"; |
308 | print "2. Data Directory : $WHT$data_dir$NRM\n"; |
309 | print "3. Attachment Directory : $WHT$attachment_dir$NRM\n"; |
310 | print "4. Default Left Size : $WHT$default_left_size$NRM\n"; |
311 | print "5. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n"; |
ccfb2029 |
312 | print "\n"; |
313 | print "R Return to Main Menu\n"; |
314 | } elsif ($menu == 5) { |
315 | print $WHT."Themes\n".$NRM; |
316 | print "1. Change Themes\n"; |
317 | for ($count = 0; $count <= $#theme_name; $count++) { |
70391dd0 |
318 | print " > $theme_name[$count]\n"; |
ccfb2029 |
319 | } |
6f3bfa54 |
320 | print "2. CSS File : $WHT$theme_css$NRM\n"; |
ccfb2029 |
321 | print "\n"; |
322 | print "R Return to Main Menu\n"; |
323 | } elsif ($menu == 6) { |
324 | print $WHT."Address Books (LDAP)\n".$NRM; |
1e0628fb |
325 | print "1. Change Servers\n"; |
326 | for ($count = 0; $count <= $#ldap_host; $count++) { |
327 | print " > $ldap_host[$count]\n"; |
328 | } |
3806fa52 |
329 | print "2. Use Javascript Address Book Search : $WHT$default_use_javascript_addr_book$NRM\n"; |
ccfb2029 |
330 | print "\n"; |
331 | print "R Return to Main Menu\n"; |
332 | } elsif ($menu == 7) { |
333 | print $WHT."Message of the Day (MOTD)\n".$NRM; |
334 | print "\n$motd\n"; |
335 | print "\n"; |
336 | print "1 Edit the MOTD\n"; |
337 | print "\n"; |
338 | print "R Return to Main Menu\n"; |
9d0c7bee |
339 | } elsif ($menu == 8) { |
340 | print $WHT."Plugins\n".$NRM; |
1a7a2fcc |
341 | print " Installed Plugins\n"; |
342 | $num = 0; |
9d0c7bee |
343 | for ($count = 0; $count <= $#plugins; $count++) { |
1a7a2fcc |
344 | $num = $count + 1; |
345 | print " $num. $plugins[$count]\n"; |
9d0c7bee |
346 | } |
1a7a2fcc |
347 | print "\n Available Plugins:\n"; |
348 | opendir(DIR, "../plugins"); |
349 | @files = readdir(DIR); |
350 | $pos=0; |
351 | @unused_plugins = (); |
1a7a2fcc |
352 | for ($i=0; $i <= $#files; $i++) { |
f0bc4d36 |
353 | if ( -d "../plugins/" . $files[$i] && |
2a15d00c |
354 | $files[$i] !~ /^\./ && $files[$i] ne "CVS") { |
1a7a2fcc |
355 | $match = 0; |
356 | for ($k=0; $k<=$#plugins; $k++) { |
357 | if ($plugins[$k] eq $files[$i]) { |
358 | $match = 1; |
359 | } |
360 | } |
361 | if ($match == 0) { |
362 | $unused_plugins[$pos] = $files[$i]; |
363 | $pos++; |
364 | } |
365 | } |
366 | } |
1a7a2fcc |
367 | |
368 | for ($i=0; $i<=$#unused_plugins; $i++) { |
369 | $num = $num + 1; |
370 | print " $num. $unused_plugins[$i]\n"; |
371 | } |
372 | closedir DIR; |
373 | |
9d0c7bee |
374 | print "\n"; |
375 | print "R Return to Main Menu\n"; |
ccfb2029 |
376 | } |
3ed2faff |
377 | if ($config_use_color == 1) { |
378 | print "C. Turn color off\n"; |
379 | } else { |
380 | print "C. Turn color on\n"; |
381 | } |
ccfb2029 |
382 | print "S Save data\n"; |
383 | print "Q Quit\n"; |
384 | |
385 | print "\n"; |
386 | print "Command >> ".$WHT; |
387 | $command = <STDIN>; |
f0bc4d36 |
388 | $command =~ s/[\n|\r]//g; |
389 | $command =~ tr/A-Z/a-z/; |
ccfb2029 |
390 | print "$NRM\n"; |
391 | |
392 | # Read the commands they entered. |
f0bc4d36 |
393 | if ($command eq "r") { |
ccfb2029 |
394 | $menu = 0; |
f0bc4d36 |
395 | } elsif ($command eq "s") { |
ccfb2029 |
396 | save_data (); |
8ad99a99 |
397 | print "Data saved in config.php\n"; |
f0bc4d36 |
398 | print "Press enter to continue..."; |
ccfb2029 |
399 | $tmp = <STDIN>; |
400 | $saved = 1; |
f0bc4d36 |
401 | } elsif (($command eq "q") && ($saved == 0)) { |
ccfb2029 |
402 | print "You have not saved your data.\n"; |
f0bc4d36 |
403 | print "Save? [".$WHT."Y".$NRM."/n]: "; |
ccfb2029 |
404 | $save = <STDIN>; |
405 | if (($save =~ /^y/i) || ($save =~ /^\s*$/)) { |
406 | save_data (); |
407 | } |
f0bc4d36 |
408 | } elsif ($command eq "c") { |
0ecb47e5 |
409 | if ($config_use_color == 1) { |
410 | $config_use_color = 2; |
411 | $WHT = ""; |
412 | $NRM = ""; |
413 | } else { |
414 | $config_use_color = 1; |
415 | $WHT = "\x1B[37;1m"; |
416 | $NRM = "\x1B[0m"; |
417 | } |
f0bc4d36 |
418 | } elsif ($command eq "d" && $menu == 0) { |
a93b12ba |
419 | set_defaults (); |
ccfb2029 |
420 | } else { |
421 | $saved = 0; |
422 | if ($menu == 0) { |
9d0c7bee |
423 | if (($command > 0) && ($command < 9)) { |
ccfb2029 |
424 | $menu = $command; |
425 | } |
426 | } elsif ($menu == 1) { |
427 | if ($command == 1) { $org_name = command1 (); } |
428 | elsif ($command == 2) { $org_logo = command2 (); } |
429 | elsif ($command == 3) { $org_title = command3 (); } |
430 | } elsif ($menu == 2) { |
431 | if ($command == 1) { $domain = command11 (); } |
432 | elsif ($command == 2) { $imapServerAddress = command12 (); } |
433 | elsif ($command == 3) { $imapPort = command13 (); } |
434 | elsif ($command == 4) { $useSendmail = command14 (); } |
435 | elsif ($command == 5) { $sendmail_path = command15 (); } |
436 | elsif ($command == 6) { $smtpServerAddress = command16 (); } |
437 | elsif ($command == 7) { $smtpPort = command17 (); } |
a93b12ba |
438 | elsif ($command == 8) { $imap_server_type = command18 (); } |
d47b2518 |
439 | elsif ($command == 9) { $invert_time = command19 (); } |
ccfb2029 |
440 | } elsif ($menu == 3) { |
441 | if ($command == 1) { $default_folder_prefix = command21 (); } |
442 | elsif ($command == 2) { $show_prefix_option = command22 (); } |
443 | elsif ($command == 3) { $trash_folder = command23 (); } |
444 | elsif ($command == 4) { $sent_folder = command24 (); } |
2f287147 |
445 | elsif ($command == 5) { $default_move_to_trash = command25 (); } |
446 | elsif ($command == 6) { $default_move_to_sent = command26 (); } |
447 | elsif ($command == 7) { $list_special_folders_first = command27 (); } |
448 | elsif ($command == 8) { $use_special_folder_color = command28 (); } |
449 | elsif ($command == 9) { $auto_expunge = command29 (); } |
450 | elsif ($command == 10){ $default_sub_of_inbox = command210(); } |
451 | elsif ($command == 11){ $show_contain_subfolders_option = command211(); } |
24fc5dd2 |
452 | elsif ($command == 12){ $default_unseen_notify = command212(); } |
453 | elsif ($command == 13){ $default_unseen_type = command213(); } |
ccfb2029 |
454 | } elsif ($menu == 4) { |
985f7c88 |
455 | if ($command == 1) { $default_charset = command31 (); } |
456 | elsif ($command == 2) { $data_dir = command33 (); } |
457 | elsif ($command == 3) { $attachment_dir = command34 (); } |
458 | elsif ($command == 4) { $default_left_size = command35 (); } |
459 | elsif ($command == 5) { $force_username_lowercase = command36 (); } |
ccfb2029 |
460 | } elsif ($menu == 5) { |
6f3bfa54 |
461 | if ($command == 1) { command41 (); } |
462 | elsif ($command == 2) { $theme_css = command42 (); } |
ccfb2029 |
463 | } elsif ($menu == 6) { |
3806fa52 |
464 | if ($command == 1) { command61(); } |
465 | elsif ($command == 2) { command62(); } |
ccfb2029 |
466 | } elsif ($menu == 7) { |
a37f3771 |
467 | if ($command == 1) { $motd = command71(); } |
9d0c7bee |
468 | } elsif ($menu == 8) { |
1a7a2fcc |
469 | if ($command =~ /^[0-9]+/) { @plugins = command81(); } |
ccfb2029 |
470 | } |
471 | } |
828b4753 |
472 | } |
473 | |
474 | #################################################################################### |
475 | |
5b6ae78a |
476 | # org_name |
477 | sub command1 { |
478 | print "We have tried to make the name SquirrelMail as transparent as\n"; |
479 | print "possible. If you set up an organization name, most places where\n"; |
480 | print "SquirrelMail would take credit will be credited to your organization.\n"; |
481 | print "\n"; |
828b4753 |
482 | print "[$WHT$org_name$NRM]: $WHT"; |
483 | $new_org_name = <STDIN>; |
484 | if ($new_org_name eq "\n") { |
485 | $new_org_name = $org_name; |
486 | } else { |
487 | $new_org_name =~ s/[\r|\n]//g; |
488 | } |
5b6ae78a |
489 | return $new_org_name; |
490 | } |
491 | |
828b4753 |
492 | |
5b6ae78a |
493 | # org_logo |
494 | sub command2 { |
495 | print "Your organization's logo is an image that will be displayed at\n"; |
496 | print "different times throughout SquirrelMail. This is asking for the\n"; |
497 | print "literal (/usr/local/squirrelmail/images/logo.jpg) or relative\n"; |
498 | print "(../images/logo.jpg) path to your logo.\n"; |
499 | print "\n"; |
828b4753 |
500 | print "[$WHT$org_logo$NRM]: $WHT"; |
5b6ae78a |
501 | $new_org_logo = <STDIN>; |
502 | if ($new_org_logo eq "\n") { |
503 | $new_org_logo = $org_logo; |
bbd30ac8 |
504 | } else { |
5b6ae78a |
505 | $new_org_logo =~ s/[\r|\n]//g; |
bbd30ac8 |
506 | } |
5b6ae78a |
507 | return $new_org_logo; |
508 | } |
509 | |
510 | # org_title |
511 | sub command3 { |
512 | print "A title is what is displayed at the top of the browser window in\n"; |
513 | print "the titlebar. Usually this will end up looking something like:\n"; |
514 | print "\"Netscape: $org_title\"\n"; |
515 | print "\n"; |
828b4753 |
516 | print "[$WHT$org_title$NRM]: $WHT"; |
5b6ae78a |
517 | $new_org_title = <STDIN>; |
518 | if ($new_org_title eq "\n") { |
519 | $new_org_title = $org_title; |
bbd30ac8 |
520 | } else { |
5b6ae78a |
521 | $new_org_title =~ s/[\r|\n]//g; |
bbd30ac8 |
522 | } |
5b6ae78a |
523 | return $new_org_title; |
524 | } |
5b6ae78a |
525 | |
828b4753 |
526 | #################################################################################### |
5b6ae78a |
527 | |
828b4753 |
528 | # domain |
529 | sub command11 { |
ccfb2029 |
530 | print "The domain name is the suffix at the end of all email messages. If\n"; |
531 | print "for example, your email address is jdoe\@myorg.com, then your domain\n"; |
532 | print "would be myorg.com.\n"; |
533 | print "\n"; |
534 | print "[$WHT$domain$NRM]: $WHT"; |
535 | $new_domain = <STDIN>; |
536 | if ($new_domain eq "\n") { |
537 | $new_domain = $domain; |
538 | } else { |
539 | $new_domain =~ s/[\r|\n]//g; |
540 | } |
541 | return $new_domain; |
828b4753 |
542 | } |
5b6ae78a |
543 | |
828b4753 |
544 | # imapServerAddress |
545 | sub command12 { |
ccfb2029 |
546 | print "This is the address where your IMAP server resides.\n"; |
547 | print "[$WHT$imapServerAddress$NRM]: $WHT"; |
548 | $new_imapServerAddress = <STDIN>; |
549 | if ($new_imapServerAddress eq "\n") { |
550 | $new_imapServerAddress = $imapServerAddress; |
551 | } else { |
552 | $new_imapServerAddress =~ s/[\r|\n]//g; |
553 | } |
554 | return $new_imapServerAddress; |
828b4753 |
555 | } |
5b6ae78a |
556 | |
828b4753 |
557 | # imapPort |
558 | sub command13 { |
ccfb2029 |
559 | print "This is the port that your IMAP server is on. Usually this is 143.\n"; |
560 | print "[$WHT$imapPort$NRM]: $WHT"; |
561 | $new_imapPort = <STDIN>; |
562 | if ($new_imapPort eq "\n") { |
563 | $new_imapPort = $imapPort; |
564 | } else { |
565 | $new_imapPort =~ s/[\r|\n]//g; |
566 | } |
567 | return $new_imapPort; |
828b4753 |
568 | } |
569 | |
570 | # useSendmail |
571 | sub command14 { |
ccfb2029 |
572 | print "You now need to choose the method that you will use for sending\n"; |
573 | print "messages in SquirrelMail. You can either connect to an SMTP server\n"; |
574 | print "or use sendmail directly.\n"; |
575 | if ($useSendmail eq "true") { |
996d34de |
576 | $default_value = "1"; |
ccfb2029 |
577 | } else { |
996d34de |
578 | $default_value = "2"; |
ccfb2029 |
579 | } |
580 | print "\n"; |
996d34de |
581 | print " 1. Sendmail\n"; |
582 | print " 2. SMTP\n"; |
583 | print "Your choice [1/2] [$WHT$default_value$NRM]: $WHT"; |
ccfb2029 |
584 | $use_sendmail = <STDIN>; |
996d34de |
585 | if (($use_sendmail =~ /^1\n/i) || (($use_sendmail =~ /^\n/) && ($default_value eq "1"))) { |
ccfb2029 |
586 | $useSendmail = "true"; |
587 | } else { |
588 | $useSendmail = "false"; |
589 | } |
590 | return $useSendmail; |
828b4753 |
591 | } |
5b6ae78a |
592 | |
828b4753 |
593 | # sendmail_path |
594 | sub command15 { |
595 | if ($sendmail_path[0] !~ /./) { |
596 | $sendmail_path = "/usr/sbin/sendmail"; |
597 | } |
ccfb2029 |
598 | print "Specify where the sendmail executable is located. Usually /usr/sbin/sendmail\n"; |
828b4753 |
599 | print "[$WHT$sendmail_path$NRM]: $WHT"; |
600 | $new_sendmail_path = <STDIN>; |
601 | if ($new_sendmail_path eq "\n") { |
602 | $new_sendmail_path = $sendmail_path; |
603 | } else { |
604 | $new_sendmail_path =~ s/[\r|\n]//g; |
605 | } |
ccfb2029 |
606 | return $new_sendmail_path; |
828b4753 |
607 | } |
5b6ae78a |
608 | |
828b4753 |
609 | # smtpServerAddress |
610 | sub command16 { |
ccfb2029 |
611 | print "This is the location of your SMTP server.\n"; |
828b4753 |
612 | print "[$WHT$smtpServerAddress$NRM]: $WHT"; |
613 | $new_smtpServerAddress = <STDIN>; |
614 | if ($new_smtpServerAddress eq "\n") { |
615 | $new_smtpServerAddress = $smtpServerAddress; |
616 | } else { |
617 | $new_smtpServerAddress =~ s/[\r|\n]//g; |
618 | } |
ccfb2029 |
619 | return $new_smtpServerAddress; |
828b4753 |
620 | } |
621 | |
622 | # smtpPort |
623 | sub command17 { |
ccfb2029 |
624 | print "This is the port to connect to for SMTP. Usually 25.\n"; |
828b4753 |
625 | print "[$WHT$smtpPort$NRM]: $WHT"; |
626 | $new_smtpPort = <STDIN>; |
627 | if ($new_smtpPort eq "\n") { |
628 | $new_smtpPort = $smtpPort; |
629 | } else { |
630 | $new_smtpPort =~ s/[\r|\n]//g; |
631 | } |
ccfb2029 |
632 | return $new_smtpPort; |
bbd30ac8 |
633 | } |
a93b12ba |
634 | # imap_server_type |
635 | sub command18 { |
d47b2518 |
636 | print "Each IMAP server has its own quirks. As much as we tried to stick\n"; |
a93b12ba |
637 | print "to standards, it doesn't help much if the IMAP server doesn't follow\n"; |
638 | print "the same principles. We have made some work-arounds for some of\n"; |
639 | print "these servers. If you would like to use them, please select your\n"; |
640 | print "IMAP server. If you do not wish to use these work-arounds, you can\n"; |
641 | print "set this to \"other\", and none will be used.\n"; |
642 | print " cyrus = Cyrus IMAP server\n"; |
643 | print " uw = University of Washington's IMAP server\n"; |
644 | print " exchange = Microsoft Exchange IMAP server\n"; |
645 | print " courier = Courier IMAP server\n"; |
646 | print "[$WHT$imap_server_type$NRM]: $WHT"; |
647 | $new_imap_server_type = <STDIN>; |
648 | if ($new_imap_server_type eq "\n") { |
649 | $new_imap_server_type = $imap_server_type; |
650 | } else { |
651 | $new_imap_server_type =~ s/[\r|\n]//g; |
652 | } |
653 | return $new_imap_server_type; |
654 | } |
3f8fe68e |
655 | |
d47b2518 |
656 | # invert_time |
657 | sub command19 { |
658 | print "Sometimes the date of messages sent is messed up (off by a few hours\n"; |
659 | print "on some machines). Typically this happens if the system doesn't support\n"; |
660 | print "tm_gmtoff. It will happen only if your time zone is \"negative\".\n"; |
661 | print "This most often occurs on Solaris 7 machines in the United States.\n"; |
662 | print "By default, this is off. It should be kept off unless problems surface\n"; |
663 | print "about the time that messages are sent.\n"; |
664 | print " no = Do NOT fix time -- almost always correct\n"; |
665 | print " yes = Fix the time for this system\n"; |
666 | |
667 | $YesNo = 'n'; |
668 | $YesNo = 'y' if ($invert_time eq "true"); |
669 | |
670 | print "Fix the time for this system (y/n) [$WHT$YesNo$NRM]: $WHT"; |
671 | |
672 | $new_invert_time = <STDIN>; |
673 | $new_invert_time =~ tr/yn//cd; |
674 | return "true" if ($new_invert_time eq "y"); |
675 | return "false" if ($new_invert_time eq "n"); |
676 | return $invert_time; |
677 | } |
678 | |
3f8fe68e |
679 | # MOTD |
680 | sub command71 { |
ccfb2029 |
681 | print "\nYou can now create the welcome message that is displayed\n"; |
682 | print "every time a user logs on. You can use HTML or just plain\n"; |
a37f3771 |
683 | print "text. If you do not wish to have one, just make it blank.\n\n(Type @ on a blank line to exit)\n"; |
c4809aca |
684 | |
e9f8ea4e |
685 | $new_motd = ""; |
ccfb2029 |
686 | do { |
687 | print "] "; |
688 | $line = <STDIN>; |
689 | $line =~ s/[\r|\n]//g; |
ccfb2029 |
690 | if ($line ne "@") { |
c4809aca |
691 | $line =~ s/ /\ \ /g; |
692 | $line =~ s/\t/\ \ \ \ /g; |
693 | $line =~ s/$/ /; |
e9f8ea4e |
694 | $line =~ s/\"/\\\"/g; |
c4809aca |
695 | |
ccfb2029 |
696 | $new_motd = $new_motd . $line; |
697 | } |
698 | } while ($line ne "@"); |
699 | return $new_motd; |
3f8fe68e |
700 | } |
911ad01c |
701 | |
9d0c7bee |
702 | ################# PLUGINS ################### |
703 | |
704 | sub command81 { |
1a7a2fcc |
705 | $command =~ s/[\s|\n|\r]*//g; |
706 | if ($command > 0) { |
707 | $command = $command - 1; |
708 | if ($command <= $#plugins) { |
709 | @newplugins = (); |
710 | $ct=0; |
711 | while ($ct <= $#plugins) { |
712 | if ($ct != $command) { |
713 | @newplugins = (@newplugins, $plugins[$ct]); |
9d0c7bee |
714 | } |
1a7a2fcc |
715 | $ct++; |
9d0c7bee |
716 | } |
1a7a2fcc |
717 | @plugins = @newplugins; |
718 | } elsif ($command <= $#plugins + $#unused_plugins + 1) { |
719 | $num = $command - $#plugins - 1; |
720 | @newplugins = @plugins; |
721 | $ct=0; |
722 | while ($ct <= $#unused_plugins) { |
723 | if ($ct == $num) { |
724 | @newplugins = (@newplugins, $unused_plugins[$ct]); |
9d0c7bee |
725 | } |
1a7a2fcc |
726 | $ct++; |
9d0c7bee |
727 | } |
1a7a2fcc |
728 | @plugins = @newplugins; |
9d0c7bee |
729 | } |
1a7a2fcc |
730 | } |
731 | return @plugins; |
9d0c7bee |
732 | } |
733 | |
911ad01c |
734 | ################# FOLDERS ################### |
735 | |
736 | # default_folder_prefix |
737 | sub command21 { |
ccfb2029 |
738 | print "Some IMAP servers (UW, for example) store mail and folders in\n"; |
739 | print "your user space in a separate subdirectory. This is where you\n"; |
740 | print "specify what that directory is.\n"; |
741 | print "\n"; |
742 | print "EXAMPLE: mail/"; |
743 | print "\n"; |
744 | print "NOTE: If you use Cyrus, or some server that would not use this\n"; |
745 | print " option, you must set this to 'none'.\n"; |
746 | print "\n"; |
911ad01c |
747 | print "[$WHT$default_folder_prefix$NRM]: $WHT"; |
748 | $new_default_folder_prefix = <STDIN>; |
749 | if ($new_default_folder_prefix eq "\n") { |
750 | $new_default_folder_prefix = $default_folder_prefix; |
751 | } else { |
752 | $new_default_folder_prefix =~ s/[\r|\n]//g; |
753 | } |
ccfb2029 |
754 | if (($new_default_folder_prefix =~ /^\s*$/) || ($new_default_folder_prefix =~ /none/i)) { |
755 | $new_default_folder_prefix = ""; |
756 | } else { |
757 | $new_default_folder_prefix =~ s/\/*$//g; |
758 | $new_default_folder_prefix =~ s/$/\//g; |
759 | } |
911ad01c |
760 | return $new_default_folder_prefix; |
761 | } |
762 | |
763 | # Show Folder Prefix |
764 | sub command22 { |
ccfb2029 |
765 | print "It is possible to set up the default folder prefix as a user\n"; |
766 | print "specific option, where each user can specify what their mail\n"; |
767 | print "folder is. If you set this to false, they will never see the\n"; |
768 | print "option, but if it is true, this option will appear in the\n"; |
769 | print "'options' section.\n"; |
770 | print "\n"; |
771 | print "NOTE: You set the default folder prefix in option '1' of this\n"; |
772 | print " section. That will be the default if the user doesn't\n"; |
773 | print " specify anything different.\n"; |
774 | print "\n"; |
775 | |
776 | if ($show_prefix_option eq "true") { |
777 | $default_value = "y"; |
778 | } else { |
779 | $default_value = "n"; |
780 | } |
781 | print "\n"; |
782 | print "Show option (y/n) [$WHT$default_value$NRM]: $WHT"; |
783 | $new_show = <STDIN>; |
784 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
785 | $show_prefix_option = "true"; |
786 | } else { |
787 | $show_prefix_option = "false"; |
788 | } |
789 | return $show_prefix_option; |
911ad01c |
790 | } |
791 | |
792 | # Trash Folder |
793 | sub command23 { |
ccfb2029 |
794 | print "You can now specify where the default trash folder is located.\n"; |
795 | print "On servers where you do not want this, you can set it to anything\n"; |
796 | print "and set option 7 to false.\n"; |
797 | print "\n"; |
798 | print "This is relative to where the rest of your email is kept. You do\n"; |
799 | print "not need to worry about their mail directory. If this folder\n"; |
800 | print "would be ~/mail/trash on the filesystem, you only need to specify\n"; |
801 | print "that this is 'trash', and be sure to put 'mail/' in option 1.\n"; |
802 | print "\n"; |
911ad01c |
803 | |
804 | print "[$WHT$trash_folder$NRM]: $WHT"; |
805 | $new_trash_folder = <STDIN>; |
806 | if ($new_trash_folder eq "\n") { |
807 | $new_trash_folder = $trash_folder; |
808 | } else { |
809 | $new_trash_folder =~ s/[\r|\n]//g; |
810 | } |
ccfb2029 |
811 | return $new_trash_folder; |
911ad01c |
812 | } |
813 | |
814 | # Sent Folder |
815 | sub command24 { |
ccfb2029 |
816 | print "This is where messages that are sent will be stored. SquirrelMail\n"; |
817 | print "by default puts a copy of all outgoing messages in this folder.\n"; |
818 | print "\n"; |
819 | print "This is relative to where the rest of your email is kept. You do\n"; |
820 | print "not need to worry about their mail directory. If this folder\n"; |
821 | print "would be ~/mail/sent on the filesystem, you only need to specify\n"; |
822 | print "that this is 'sent', and be sure to put 'mail/' in option 1.\n"; |
823 | print "\n"; |
911ad01c |
824 | |
825 | print "[$WHT$sent_folder$NRM]: $WHT"; |
826 | $new_sent_folder = <STDIN>; |
827 | if ($new_sent_folder eq "\n") { |
828 | $new_sent_folder = $sent_folder; |
829 | } else { |
830 | $new_sent_folder =~ s/[\r|\n]//g; |
831 | } |
ccfb2029 |
832 | return $new_sent_folder; |
911ad01c |
833 | } |
834 | |
2f287147 |
835 | # default move to trash |
911ad01c |
836 | sub command25 { |
2f287147 |
837 | print "By default, should messages get moved to the trash folder? You\n"; |
838 | print "can specify the default trash folder in option 3. If this is set\n"; |
839 | print "to false, messages will get deleted immediately without moving\n"; |
840 | print "to the trash folder.\n"; |
841 | print "\n"; |
842 | print "Trash folder is currently: $trash_folder\n"; |
843 | print "\n"; |
844 | |
845 | if ($default_move_to_trash eq "true") { |
846 | $default_value = "y"; |
847 | } else { |
848 | $default_value = "n"; |
849 | } |
850 | print "By default, move to trash (y/n) [$WHT$default_value$NRM]: $WHT"; |
851 | $new_show = <STDIN>; |
852 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
853 | $default_move_to_trash = "true"; |
854 | } else { |
855 | $default_move_to_trash = "false"; |
856 | } |
857 | return $default_move_to_trash; |
858 | } |
859 | |
860 | # default move to sent |
861 | sub command26 { |
862 | print "By default, should messages get moved to the sent folder? You\n"; |
863 | print "can specify the default sent folder in option 4. If this is set\n"; |
776c7431 |
864 | print "to false, messages will get sent an no copy will be made.\n"; |
2f287147 |
865 | print "\n"; |
866 | print "Trash folder is currently: $sent_folder\n"; |
867 | print "\n"; |
868 | |
869 | if ($default_move_to_sent eq "true") { |
870 | $default_value = "y"; |
871 | } else { |
872 | $default_value = "n"; |
873 | } |
874 | print "By default, move to sent (y/n) [$WHT$default_value$NRM]: $WHT"; |
875 | $new_show = <STDIN>; |
876 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
877 | $default_move_to_sent = "true"; |
878 | } else { |
879 | $default_move_to_sent = "false"; |
880 | } |
881 | return $default_move_to_sent; |
882 | } |
883 | |
884 | # List special folders first |
885 | sub command27 { |
ccfb2029 |
886 | print "SquirrelMail has what we call 'special folders' that are not\n"; |
887 | print "manipulated and viewed like normal folders. Some examples of\n"; |
888 | print "these folders would be INBOX, Trash, Sent, etc. This option\n"; |
889 | print "Simply asks if you want these folders listed first in the folder\n"; |
890 | print "listing.\n"; |
891 | print "\n"; |
892 | |
893 | if ($list_special_folders_first eq "true") { |
894 | $default_value = "y"; |
895 | } else { |
896 | $default_value = "n"; |
897 | } |
898 | print "\n"; |
899 | print "List first (y/n) [$WHT$default_value$NRM]: $WHT"; |
900 | $new_show = <STDIN>; |
901 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
902 | $list_special_folders_first = "true"; |
903 | } else { |
904 | $list_special_folders_first = "false"; |
905 | } |
906 | return $list_special_folders_first; |
911ad01c |
907 | } |
908 | |
909 | # Show special folders color |
2f287147 |
910 | sub command28 { |
ccfb2029 |
911 | print "SquirrelMail has what we call 'special folders' that are not\n"; |
912 | print "manipulated and viewed like normal folders. Some examples of\n"; |
913 | print "these folders would be INBOX, Trash, Sent, etc. This option\n"; |
914 | print "wants to know if we should display special folders in a\n"; |
915 | print "color than the other folders.\n"; |
916 | print "\n"; |
917 | |
918 | if ($use_special_folder_color eq "true") { |
919 | $default_value = "y"; |
920 | } else { |
921 | $default_value = "n"; |
922 | } |
923 | print "\n"; |
924 | print "Show color (y/n) [$WHT$default_value$NRM]: $WHT"; |
925 | $new_show = <STDIN>; |
926 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
927 | $use_special_folder_color = "true"; |
928 | } else { |
929 | $use_special_folder_color = "false"; |
930 | } |
931 | return $use_special_folder_color; |
911ad01c |
932 | } |
933 | |
911ad01c |
934 | # Auto expunge |
2f287147 |
935 | sub command29 { |
ccfb2029 |
936 | print "The way that IMAP handles deleting messages is as follows. You\n"; |
937 | print "mark the message as deleted, and then to 'really' delete it, you\n"; |
938 | print "expunge it. This option asks if you want to just have messages\n"; |
939 | print "marked as deleted, or if you want SquirrelMail to expunge the \n"; |
940 | print "messages too.\n"; |
941 | print "\n"; |
942 | |
943 | if ($auto_expunge eq "true") { |
944 | $default_value = "y"; |
945 | } else { |
946 | $default_value = "n"; |
947 | } |
948 | print "Auto expunge (y/n) [$WHT$default_value$NRM]: $WHT"; |
949 | $new_show = <STDIN>; |
950 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
951 | $auto_expunge = "true"; |
952 | } else { |
953 | $auto_expunge = "false"; |
954 | } |
955 | return $auto_expunge; |
911ad01c |
956 | } |
957 | |
958 | # Default sub of inbox |
2f287147 |
959 | sub command210 { |
ccfb2029 |
960 | print "Some IMAP servers (Cyrus) have all folders as subfolders of INBOX.\n"; |
961 | print "This can cause some confusion in folder creation for users when\n"; |
962 | print "they try to create folders and don't put it as a subfolder of INBOX\n"; |
963 | print "and get permission errors. This option asks if you want folders\n"; |
964 | print "to be subfolders of INBOX by default.\n"; |
965 | print "\n"; |
966 | |
967 | if ($default_sub_of_inbox eq "true") { |
968 | $default_value = "y"; |
969 | } else { |
970 | $default_value = "n"; |
971 | } |
972 | print "Default sub of INBOX (y/n) [$WHT$default_value$NRM]: $WHT"; |
973 | $new_show = <STDIN>; |
974 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
975 | $default_sub_of_inbox = "true"; |
976 | } else { |
977 | $default_sub_of_inbox = "false"; |
978 | } |
979 | return $default_sub_of_inbox; |
911ad01c |
980 | } |
981 | |
982 | # Show contain subfolder option |
2f287147 |
983 | sub command211 { |
ccfb2029 |
984 | print "Some IMAP servers (UW) make it so that there are two types of\n"; |
985 | print "folders. Those that contain messages, and those that contain\n"; |
986 | print "subfolders. If this is the case for your server, set this to\n"; |
987 | print "true, and it will ask the user whether the folder they are\n"; |
988 | print "creating contains subfolders or messages.\n"; |
989 | print "\n"; |
990 | |
991 | if ($show_contain_subfolders_option eq "true") { |
992 | $default_value = "y"; |
993 | } else { |
994 | $default_value = "n"; |
995 | } |
996 | print "Show option (y/n) [$WHT$default_value$NRM]: $WHT"; |
997 | $new_show = <STDIN>; |
998 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
999 | $show_contain_subfolders_option = "true"; |
1000 | } else { |
1001 | $show_contain_subfolders_option = "false"; |
1002 | } |
1003 | return $show_contain_subfolders_option; |
911ad01c |
1004 | } |
1005 | |
24fc5dd2 |
1006 | # Default Unseen Notify |
1007 | sub command212 { |
1008 | print "This option specifies where the users will receive notification\n"; |
1009 | print "about unseen messages by default. This is of course an option that\n"; |
1010 | print "can be changed on a user level.\n"; |
1011 | print " 1 = No notification\n"; |
1012 | print " 2 = Only on the INBOX\n"; |
1013 | print " 3 = On all folders\n"; |
1014 | print "\n"; |
1015 | |
1016 | print "Which one should be default (1,2,3)? [$WHT$default_unseen_notify$NRM]: $WHT"; |
1017 | $new_show = <STDIN>; |
1018 | if ($new_show =~ /^[1|2|3]\n/i) { |
1019 | $default_unseen_notify = $new_show; |
1020 | } |
1021 | $default_unseen_notify =~ s/[\r|\n]//g; |
1022 | return $default_unseen_notify; |
1023 | } |
1024 | |
1025 | # Default Unseen Type |
1026 | sub command213 { |
1027 | print "Here you can define the default way that unseen messages will be displayed\n"; |
1028 | print "to the user in the folder listing on the left side.\n"; |
1029 | print " 1 = Only unseen messages (4)\n"; |
1030 | print " 2 = Unseen and Total messages (4/27)\n"; |
1031 | print "\n"; |
1032 | |
1033 | print "Which one should be default (1,2)? [$WHT$default_unseen_type$NRM]: $WHT"; |
1034 | $new_show = <STDIN>; |
1035 | if ($new_show =~ /^[1|2]\n/i) { |
1036 | $default_unseen_type = $new_show; |
1037 | } |
1038 | $default_unseen_type =~ s/[\r|\n]//g; |
1039 | return $default_unseen_type; |
1040 | } |
1041 | |
1042 | |
ccfb2029 |
1043 | ############# GENERAL OPTIONS ##################### |
1044 | |
1045 | # Default Charset |
1046 | sub command31 { |
1047 | print "This option controls what character set is used when sending\n"; |
1048 | print "mail and when sending HTML to the browser. Do not set this\n"; |
1049 | print "to US-ASCII, use ISO-8859-1 instead. For cyrillic, it is best\n"; |
1050 | print "to use KOI8-R, since this implementation is faster than most\n"; |
1051 | print "of the alternatives\n"; |
1052 | print "\n"; |
1053 | |
1054 | print "[$WHT$default_charset$NRM]: $WHT"; |
1055 | $new_default_charset = <STDIN>; |
1056 | if ($new_default_charset eq "\n") { |
1057 | $new_default_charset = $default_charset; |
1058 | } else { |
1059 | $new_default_charset =~ s/[\r|\n]//g; |
1060 | } |
1061 | return $new_default_charset; |
1062 | } |
1063 | |
ccfb2029 |
1064 | # Data directory |
1065 | sub command33 { |
1066 | print "It is a possible security hole to have a writable directory\n"; |
1067 | print "under the web server's root directory (ex: /home/httpd/html).\n"; |
1068 | print "For this reason, it is possible to put the data directory\n"; |
1069 | print "anywhere you would like. The path name can be absolute or\n"; |
1070 | print "relative (to the config directory). It doesn't matter. Here\n"; |
1071 | print "are two examples:\n"; |
1072 | print " Absolute: /usr/local/squirrelmail/data/\n"; |
1073 | print " Relative: ../data/\n"; |
1074 | print "\n"; |
1075 | |
1076 | print "[$WHT$data_dir$NRM]: $WHT"; |
1077 | $new_data_dir = <STDIN>; |
1078 | if ($new_data_dir eq "\n") { |
1079 | $new_data_dir = $data_dir; |
1080 | } else { |
1081 | $new_data_dir =~ s/[\r|\n]//g; |
1082 | } |
1083 | if ($new_data_dir =~ /^\s*$/) { |
1084 | $new_data_dir = ""; |
1085 | } else { |
1086 | $new_data_dir =~ s/\/*$//g; |
1087 | $new_data_dir =~ s/$/\//g; |
1088 | } |
1089 | return $new_data_dir; |
1090 | } |
1091 | |
1092 | # Attachment directory |
1093 | sub command34 { |
1094 | print "Path to directory used for storing attachments while a mail is\n"; |
1095 | print "being sent. There are a few security considerations regarding this\n"; |
1096 | print "directory:\n"; |
1097 | print " 1. It should have the permission 733 (rwx-wx-wx) to make it\n"; |
1098 | print " impossible for a random person with access to the webserver\n"; |
1099 | print " to list files in this directory. Confidential data might\n"; |
1100 | print " be laying around in there.\n"; |
1101 | print " 2. Since the webserver is not able to list the files in the\n"; |
1102 | print " content is also impossible for the webserver to delete files\n"; |
1103 | print " lying around there for too long.\n"; |
1104 | print " 3. It should probably be another directory than the data\n"; |
1105 | print " directory specified in option 3.\n"; |
1106 | print "\n"; |
1107 | |
1108 | print "[$WHT$attachment_dir$NRM]: $WHT"; |
1109 | $new_attachment_dir = <STDIN>; |
1110 | if ($new_attachment_dir eq "\n") { |
1111 | $new_attachment_dir = $attachment_dir; |
1112 | } else { |
1113 | $new_attachment_dir =~ s/[\r|\n]//g; |
1114 | } |
1115 | if ($new_attachment_dir =~ /^\s*$/) { |
1116 | $new_attachment_dir = ""; |
1117 | } else { |
1118 | $new_attachment_dir =~ s/\/*$//g; |
1119 | $new_attachment_dir =~ s/$/\//g; |
1120 | } |
1121 | return $new_attachment_dir; |
1122 | } |
1123 | |
1124 | |
1125 | sub command35 { |
1126 | print "This is the default size (in pixels) of the left folder list.\n"; |
1127 | print "Default is 200, but you can set it to whatever you wish. This\n"; |
1128 | print "is a user preference, so this will only show up as their default.\n"; |
1129 | print "\n"; |
1130 | print "[$WHT$default_left_size$NRM]: $WHT"; |
1131 | $new_default_left_size = <STDIN>; |
1132 | if ($new_default_left_size eq "\n") { |
1133 | $new_default_left_size = $default_left_size; |
1134 | } else { |
1135 | $new_default_left_size =~ s/[\r|\n]//g; |
1136 | } |
1137 | return $new_default_left_size; |
1138 | } |
1139 | |
1140 | |
985f7c88 |
1141 | sub command36 { |
1142 | print "Some IMAP servers only have lowercase letters in the usernames\n"; |
1143 | print "but they still allow people with uppercase to log in. This\n"; |
1144 | print "causes a problem with the user's preference files. This option\n"; |
1145 | print "transparently changes all usernames to lowercase."; |
1146 | print "\n"; |
1147 | |
1148 | if ($force_username_lowercase eq "true") { |
1149 | $default_value = "y"; |
1150 | } else { |
1151 | $default_value = "n"; |
1152 | } |
1153 | print "Convert usernames to lowercase (y/n) [$WHT$default_value$NRM]: $WHT"; |
1154 | $new_show = <STDIN>; |
1155 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
1156 | return "true"; |
1157 | } |
1158 | return "false"; |
1159 | } |
1160 | |
1161 | |
ccfb2029 |
1162 | sub command41 { |
1163 | print "\nNow we will define the themes that you wish to use. If you have added\n"; |
1164 | print "a theme of your own, just follow the instructions (?) about how to add\n"; |
1165 | print "them. You can also change the default theme.\n"; |
1166 | print "[theme] command (?=help) > "; |
1167 | $input = <STDIN>; |
1168 | $input =~ s/[\r|\n]//g; |
1169 | while ($input ne "d") { |
1170 | if ($input =~ /^\s*l\s*/i) { |
1171 | $count = 0; |
1172 | while ($count <= $#theme_name) { |
1173 | if ($count == $theme_default) { |
1174 | print " *"; |
1175 | } else { |
1176 | print " "; |
1177 | } |
1178 | $name = $theme_name[$count]; |
1179 | $num_spaces = 25 - length($name); |
1180 | for ($i = 0; $i < $num_spaces;$i++) { |
1181 | $name = $name . " "; |
1182 | } |
1183 | |
1184 | print " $count. $name"; |
1185 | print "($theme_path[$count])\n"; |
1186 | |
1187 | $count++; |
1188 | } |
1189 | } elsif ($input =~ /^\s*m\s*[0-9]+/i) { |
1190 | $old_def = $theme_default; |
1191 | $theme_default = $input; |
1192 | $theme_default =~ s/^\s*m\s*//; |
1193 | if (($theme_default > $#theme_name) || ($theme_default < 0)) { |
1194 | print "Cannot set default theme to $theme_default. That theme does not exist.\n"; |
1195 | $theme_default = $old_def; |
1196 | } |
1197 | } elsif ($input =~ /^\s*\+/) { |
1198 | print "What is the name of this theme: "; |
1199 | $name = <STDIN>; |
1200 | $name =~ s/[\r|\n]//g; |
1201 | $theme_name[$#theme_name+1] = $name; |
390372b4 |
1202 | print "Be sure to put ../themes/ before the filename.\n"; |
1203 | print "What file is this stored in (ex: ../themes/default_theme.php): "; |
ccfb2029 |
1204 | $name = <STDIN>; |
1205 | $name =~ s/[\r|\n]//g; |
1206 | $theme_path[$#theme_path+1] = $name; |
1207 | } elsif ($input =~ /^\s*-\s*[0-9]?/) { |
1208 | if ($input =~ /[0-9]+\s*$/) { |
1209 | $rem_num = $input; |
1210 | $rem_num =~ s/^\s*-\s*//g; |
1211 | $rem_num =~ s/\s*$//; |
1212 | } else { |
1213 | $rem_num = $#theme_name; |
1214 | } |
1215 | if ($rem_num == $theme_default) { |
1216 | print "You cannot remove the default theme!\n"; |
1217 | } else { |
1218 | $count = 0; |
1219 | @new_theme_name = (); |
1220 | @new_theme_path = (); |
1221 | while ($count <= $#theme_name) { |
1222 | if ($count != $rem_num) { |
1223 | @new_theme_name = (@new_theme_name, $theme_name[$count]); |
1224 | @new_theme_path = (@new_theme_path, $theme_path[$count]); |
1225 | } |
1226 | $count++; |
1227 | } |
1228 | @theme_name = @new_theme_name; |
1229 | @theme_path = @new_theme_path; |
1230 | if ($theme_default > $rem_num) { |
1231 | $theme_default--; |
1232 | } |
1233 | } |
8442ac08 |
1234 | } elsif ($input =~ /^\s*t\s*/i) { |
1235 | print "\nStarting detection...\n\n"; |
1236 | |
1237 | opendir(DIR, "../themes"); |
1238 | @files = grep { /\.php$/i } readdir(DIR); |
1239 | $cnt = 0; |
1240 | while ($cnt <= $#files) { |
1241 | $filename = "../themes/" . $files[$cnt]; |
1242 | $found = 0; |
1243 | for ($x=0; $x <= $#theme_path; $x++) { |
1244 | if ($theme_path[$x] eq $filename) { |
1245 | $found = 1; |
1246 | } |
1247 | } |
1248 | if ($found != 1) { |
1249 | print "** Found theme: $filename\n"; |
1250 | print " What is its name? "; |
1251 | $nm = <STDIN>; |
1252 | $nm =~ s/[\n|\r]//g; |
1253 | $theme_name[$#theme_name+1] = $nm; |
1254 | $theme_path[$#theme_path+1] = $filename; |
1255 | } |
1256 | $cnt++; |
1257 | } |
1258 | print "\n"; |
1259 | for ($cnt=0; $cnt <= $#theme_path; $cnt++) { |
1260 | $filename = $theme_path[$cnt]; |
1261 | if (! (-e $filename)) { |
1262 | print " Removing $filename (file not found)\n"; |
1263 | $offset = 0; |
1264 | @new_theme_name = (); |
1265 | @new_theme_path = (); |
1266 | for ($x=0; $x < $#theme_path; $x++) { |
1267 | if ($theme_path[$x] eq $filename) { |
1268 | $offset = 1; |
1269 | } |
1270 | if ($offset == 1) { |
1271 | $new_theme_name[$x] = $theme_name[$x+1]; |
1272 | $new_theme_path[$x] = $theme_path[$x+1]; |
1273 | } else { |
1274 | $new_theme_name[$x] = $theme_name[$x]; |
1275 | $new_theme_path[$x] = $theme_path[$x]; |
1276 | } |
1277 | } |
1278 | @theme_name = @new_theme_name; |
1279 | @theme_path = @new_theme_path; |
1280 | } |
1281 | } |
1282 | print "\nDetection complete!\n\n"; |
1283 | |
1284 | closedir DIR; |
ccfb2029 |
1285 | } elsif ($input =~ /^\s*\?\s*/) { |
1286 | print ".-------------------------.\n"; |
8442ac08 |
1287 | print "| t (detect themes) |\n"; |
ccfb2029 |
1288 | print "| + (add theme) |\n"; |
1289 | print "| - N (remove theme) |\n"; |
1290 | print "| m N (mark default) |\n"; |
1291 | print "| l (list themes) |\n"; |
1292 | print "| d (done) |\n"; |
1293 | print "`-------------------------'\n"; |
1294 | } |
1295 | print "[theme] command (?=help) > "; |
1296 | $input = <STDIN>; |
1297 | $input =~ s/[\r|\n]//g; |
1298 | } |
1299 | } |
1300 | |
1301 | |
6f3bfa54 |
1302 | # Theme - CSS file |
1303 | sub command42 { |
1304 | print "You may specify a cascading style-sheet (CSS) file to be included\n"; |
1305 | print "on each html page generated by SquirrelMail. The CSS file is useful\n"; |
1306 | print "for specifying a site-wide font. If you're not familiar with CSS\n"; |
1307 | print "files, leave this blank.\n"; |
1308 | print "\n"; |
1309 | print "To clear out an existing value, just type a space for the input.\n"; |
1310 | print "\n"; |
1311 | print "[$WHT$theme_css$NRM]: $WHT"; |
1312 | $new_theme_css = <STDIN>; |
1313 | if ($new_theme_css eq "\n") { |
1314 | $new_theme_css = $theme_css; |
1315 | } else { |
1316 | $new_theme_css =~ s/[\r|\n]//g; |
1317 | } |
1318 | $new_theme_css =~ s/^\s*//; |
1319 | return $new_theme_css; |
1320 | } |
1321 | |
1322 | |
1e0628fb |
1323 | sub command61 { |
a93b12ba |
1324 | print "You can now define different LDAP servers.\n"; |
1e0628fb |
1325 | print "[ldap] command (?=help) > "; |
1326 | $input = <STDIN>; |
1327 | $input =~ s/[\r|\n]//g; |
1328 | while ($input ne "d") { |
1329 | if ($input =~ /^\s*l\s*/i) { |
1330 | $count = 0; |
1331 | while ($count <= $#ldap_host) { |
a93b12ba |
1332 | print "$count. $ldap_host[$count]\n"; |
1333 | print " base: $ldap_base[$count]\n"; |
1334 | if ($ldap_charset[$count]) { |
1335 | print " charset: $ldap_charset[$count]\n"; |
1336 | } |
1337 | if ($ldap_port[$count]) { |
1338 | print " port: $ldap_port[$count]\n"; |
1339 | } |
1340 | if ($ldap_name[$count]) { |
1341 | print " name: $ldap_name[$count]\n"; |
1342 | } |
1343 | if ($ldap_maxrows[$count]) { |
1344 | print " maxrows: $ldap_maxrows[$count]\n"; |
1345 | } |
1346 | print "\n"; |
1e0628fb |
1347 | $count++; |
1348 | } |
1349 | } elsif ($input =~ /^\s*\+/) { |
a93b12ba |
1350 | $sub = $#ldap_host + 1; |
1e0628fb |
1351 | |
a93b12ba |
1352 | print "First, we need to have the hostname or the IP address where\n"; |
1353 | print "this LDAP server resides. Example: ldap.bigfoot.com\n"; |
1354 | print "hostname: "; |
1e0628fb |
1355 | $name = <STDIN>; |
1356 | $name =~ s/[\r|\n]//g; |
1357 | $ldap_host[$sub] = $name; |
a93b12ba |
1358 | |
1359 | print "\n"; |
1e0628fb |
1360 | |
a93b12ba |
1361 | print "Next, we need the server root (base dn). For this, an empty\n"; |
1362 | print "string is allowed.\n"; |
1363 | print "Example: ou=member_directory,o=netcenter.com\n"; |
1364 | print "base: "; |
1e0628fb |
1365 | $name = <STDIN>; |
1366 | $name =~ s/[\r|\n]//g; |
1367 | $ldap_base[$sub] = $name; |
1368 | |
a93b12ba |
1369 | print "\n"; |
1e0628fb |
1370 | |
a93b12ba |
1371 | print "This is the TCP/IP port number for the LDAP server. Default\n"; |
1372 | print "port is 389. This is optional. Press ENTER for default.\n"; |
1373 | print "port: "; |
1e0628fb |
1374 | $name = <STDIN>; |
1375 | $name =~ s/[\r|\n]//g; |
1376 | $ldap_port[$sub] = $name; |
1377 | |
a93b12ba |
1378 | print "\n"; |
1e0628fb |
1379 | |
a93b12ba |
1380 | print "This is the charset for the server. Default is utf-8. This\n"; |
1381 | print "is also optional. Press ENTER for default.\n"; |
1382 | print "charset: "; |
1e0628fb |
1383 | $name = <STDIN>; |
1384 | $name =~ s/[\r|\n]//g; |
1385 | $ldap_charset[$sub] = $name; |
1386 | |
a93b12ba |
1387 | print "\n"; |
1e0628fb |
1388 | |
a93b12ba |
1389 | print "This is the name for the server, used to tag the results of\n"; |
1390 | print "the search. Default it \"LDAP: hostname\". Press ENTER for default\n"; |
1391 | print "name: "; |
1e0628fb |
1392 | $name = <STDIN>; |
1393 | $name =~ s/[\r|\n]//g; |
1394 | $ldap_name[$sub] = $name; |
1395 | |
a93b12ba |
1396 | print "\n"; |
1e0628fb |
1397 | |
a93b12ba |
1398 | print "You can specify the maximum number of rows in the search result.\n"; |
1399 | print "Default is unlimited. Press ENTER for default.\n"; |
1400 | print "maxrows: "; |
1e0628fb |
1401 | $name = <STDIN>; |
1402 | $name =~ s/[\r|\n]//g; |
1403 | $ldap_maxrows[$sub] = $name; |
1404 | |
a93b12ba |
1405 | print "\n"; |
1e0628fb |
1406 | |
1407 | } elsif ($input =~ /^\s*-\s*[0-9]?/) { |
1408 | if ($input =~ /[0-9]+\s*$/) { |
1409 | $rem_num = $input; |
1410 | $rem_num =~ s/^\s*-\s*//g; |
1411 | $rem_num =~ s/\s*$//; |
1412 | } else { |
1413 | $rem_num = $#ldap_host; |
1414 | } |
1415 | $count = 0; |
1416 | @new_ldap_host = (); |
1417 | @new_ldap_base = (); |
1418 | @new_ldap_port = (); |
1419 | @new_ldap_name = (); |
1420 | @new_ldap_charset = (); |
1421 | @new_ldap_maxrows = (); |
1422 | while ($count <= $#ldap_host) { |
1423 | if ($count != $rem_num) { |
1424 | @new_ldap_host = (@new_ldap_host, $ldap_host[$count]); |
1425 | @new_ldap_base = (@new_ldap_base, $ldap_base[$count]); |
1426 | @new_ldap_port = (@new_ldap_port, $ldap_port[$count]); |
1427 | @new_ldap_name = (@new_ldap_name, $ldap_name[$count]); |
1428 | @new_ldap_charset = (@new_ldap_charset, $ldap_charset[$count]); |
1429 | @new_ldap_maxrows = (@new_ldap_maxrows, $ldap_maxrows[$count]); |
1430 | } |
1431 | $count++; |
1432 | } |
1433 | @ldap_host = @new_ldap_host; |
1434 | @ldap_base = @new_ldap_base; |
1435 | @ldap_port = @new_ldap_port; |
1436 | @ldap_name = @new_ldap_name; |
1437 | @ldap_charset = @new_ldap_charset; |
1438 | @ldap_maxrows = @new_ldap_maxrows; |
1439 | } elsif ($input =~ /^\s*\?\s*/) { |
1440 | print ".-------------------------.\n"; |
1441 | print "| + (add host) |\n"; |
1442 | print "| - N (remove host) |\n"; |
1443 | print "| l (list hosts) |\n"; |
1444 | print "| d (done) |\n"; |
1445 | print "`-------------------------'\n"; |
1446 | } |
1447 | print "[ldap] command (?=help) > "; |
1448 | $input = <STDIN>; |
1449 | $input =~ s/[\r|\n]//g; |
1450 | } |
1451 | } |
1452 | |
3806fa52 |
1453 | sub command62 { |
591000ec |
1454 | print "Some of our developers have come up with very good javascript interface\n"; |
1455 | print "for searching through address books, however, our original goals said\n"; |
1456 | print "that we would be 100% HTML. In order to make it possible to use their\n"; |
1457 | print "interface, and yet stick with our goals, we have also written a plain\n"; |
1458 | print "HTML version of the search. Here, you can choose which version to use.\n"; |
3806fa52 |
1459 | print "\n"; |
1460 | print "This is just the default value. It is also a user option that each\n"; |
1461 | print "user can configure individually\n"; |
1462 | print "\n"; |
1463 | |
1464 | if ($default_use_javascript_addr_book eq "true") { |
1465 | $default_value = "y"; |
1466 | } else { |
1467 | $default_use_javascript_addr_book = "false"; |
1468 | $default_value = "n"; |
1469 | } |
c4809aca |
1470 | print "Use javascript version by default (y/n) [$WHT$default_value$NRM]: $WHT"; |
3806fa52 |
1471 | $new_show = <STDIN>; |
1472 | if (($new_show =~ /^y\n/i) || (($new_show =~ /^\n/) && ($default_value eq "y"))) { |
1473 | $default_use_javascript_addr_book = "true"; |
1474 | } else { |
1475 | $default_use_javascript_addr_book = "false"; |
1476 | } |
1477 | return $default_use_javascript_addr_book; |
1478 | } |
1e0628fb |
1479 | |
ccfb2029 |
1480 | |
1481 | sub save_data { |
1482 | open (FILE, ">config.php"); |
1483 | |
349ca9f7 |
1484 | print FILE "<?php\n\t/** SquirrelMail configuration\n"; |
ccfb2029 |
1485 | print FILE "\t ** Created using the configure script, conf.pl\n\t **/\n\n"; |
1486 | |
6b638171 |
1487 | if ($print_config_version) { |
1488 | print FILE "\t\$config_version = \"$print_config_version\";\n"; |
6b638171 |
1489 | } |
0ecb47e5 |
1490 | print FILE "\t\$config_use_color = $config_use_color;\n"; |
1491 | print FILE "\n"; |
4011c3ca |
1492 | |
ccfb2029 |
1493 | print FILE "\t\$org_name = \"$org_name\";\n"; |
1494 | print FILE "\t\$org_logo = \"$org_logo\";\n"; |
1495 | print FILE "\t\$org_title = \"$org_title\";\n"; |
1496 | |
1497 | print FILE "\n"; |
1498 | |
c39a6b45 |
1499 | print FILE "\t\$domain = \"$domain\";\n"; |
1500 | print FILE "\t\$imapServerAddress = \"$imapServerAddress\";\n"; |
1501 | print FILE "\t\$imapPort = $imapPort;\n"; |
1502 | print FILE "\t\$useSendmail = $useSendmail;\n"; |
1503 | print FILE "\t\$smtpServerAddress = \"$smtpServerAddress\";\n"; |
1504 | print FILE "\t\$smtpPort = $smtpPort;\n"; |
d47b2518 |
1505 | print FILE "\t\$sendmail_path = \"$sendmail_path\";\n"; |
a93b12ba |
1506 | print FILE "\t\$imap_server_type = \"$imap_server_type\";\n"; |
d47b2518 |
1507 | print FILE "\t\$invert_time = $invert_time;\n"; |
ccfb2029 |
1508 | |
1509 | print FILE "\n"; |
1510 | |
1511 | print FILE "\t\$default_folder_prefix = \"$default_folder_prefix\";\n"; |
8ad99a99 |
1512 | print FILE "\t\$trash_folder = \"$trash_folder\";\n"; |
ccfb2029 |
1513 | print FILE "\t\$sent_folder = \"$sent_folder\";\n"; |
2f287147 |
1514 | print FILE "\t\$default_move_to_trash = $default_move_to_trash;\n"; |
1515 | print FILE "\t\$default_move_to_sent = $default_move_to_sent;\n"; |
ccfb2029 |
1516 | print FILE "\t\$show_prefix_option = $show_prefix_option;\n"; |
1517 | print FILE "\t\$list_special_folders_first = $list_special_folders_first;\n"; |
1518 | print FILE "\t\$use_special_folder_color = $use_special_folder_color;\n"; |
ccfb2029 |
1519 | print FILE "\t\$auto_expunge = $auto_expunge;\n"; |
1520 | print FILE "\t\$default_sub_of_inbox = $default_sub_of_inbox;\n"; |
c39a6b45 |
1521 | print FILE "\t\$show_contain_subfolders_option = $show_contain_subfolders_option;\n"; |
24fc5dd2 |
1522 | print FILE "\t\$default_unseen_notify = $default_unseen_notify;\n"; |
1523 | print FILE "\t\$default_unseen_type = $default_unseen_type;\n"; |
ccfb2029 |
1524 | print FILE "\n"; |
1525 | |
985f7c88 |
1526 | print FILE "\t\$default_charset = \"$default_charset\";\n"; |
1527 | print FILE "\t\$data_dir = \"$data_dir\";\n"; |
1528 | print FILE "\t\$attachment_dir = \"$attachment_dir\";\n"; |
1529 | print FILE "\t\$default_left_size = $default_left_size;\n"; |
1530 | print FILE "\t\$force_username_lowercase = $force_username_lowercase;\n"; |
ccfb2029 |
1531 | |
1532 | print FILE "\n"; |
1533 | |
1a7a2fcc |
1534 | for ($ct=0; $ct <= $#plugins; $ct++) { |
1535 | print FILE "\t\$plugins[$ct] = \"$plugins[$ct]\";\n"; |
9d0c7bee |
1536 | } |
1537 | |
1538 | print FILE "\n"; |
1539 | |
6f3bfa54 |
1540 | print FILE "\t\$theme_css = \"$theme_css\";\n"; |
ccfb2029 |
1541 | for ($count=0; $count <= $#theme_name; $count++) { |
8ad99a99 |
1542 | print FILE "\t\$theme[$count][\"PATH\"] = \"$theme_path[$count]\";\n"; |
1543 | print FILE "\t\$theme[$count][\"NAME\"] = \"$theme_name[$count]\";\n"; |
1544 | } |
1545 | |
ccfb2029 |
1546 | print FILE "\n"; |
1547 | |
3806fa52 |
1548 | if ($default_use_javascript_addr_book ne "true") { |
1549 | $default_use_javascript_addr_book = "false"; |
1550 | } |
1551 | print FILE "\t\$default_use_javascript_addr_book = $default_use_javascript_addr_book;\n"; |
1e0628fb |
1552 | for ($count=0; $count <= $#ldap_host; $count++) { |
a93b12ba |
1553 | print FILE "\t\$ldap_server[$count] = Array(\n"; |
1554 | print FILE "\t\t\t\"host\" => \"$ldap_host[$count]\",\n"; |
1555 | print FILE "\t\t\t\"base\" => \"$ldap_base[$count]\""; |
1556 | if ($ldap_name[$count]) { |
1557 | print FILE ",\n\t\t\t\"name\" => \"$ldap_name[$count]\""; |
1558 | } |
1559 | if ($ldap_port[$count]) { |
1560 | print FILE ",\n\t\t\t\"port\" => \"$ldap_port[$count]\""; |
1561 | } |
1562 | if ($ldap_charset[$count]) { |
1563 | print FILE ",\n\t\t\t\"charset\" => \"$ldap_charset[$count]\""; |
1564 | } |
1565 | if ($ldap_maxrows[$count]) { |
1566 | print FILE ",\n\t\t\t\"maxrows\" => \"$ldap_maxrows[$count]\""; |
1567 | } |
1568 | print FILE ");\n\n"; |
1e0628fb |
1569 | } |
1570 | |
8ad99a99 |
1571 | print FILE "\t\$motd = \"$motd\";\n"; |
ccfb2029 |
1572 | |
1573 | print FILE "?>\n"; |
1574 | close FILE; |
911ad01c |
1575 | } |
a93b12ba |
1576 | |
1577 | sub set_defaults { |
1578 | system "clear"; |
612eda0a |
1579 | print $WHT."SquirrelMail Configuration : ".$NRM; |
1580 | if ($config == 1) { print "Read: config.php"; } |
1581 | elsif ($config == 2) { print "Read: config_default.php"; } |
1582 | print "\n"; |
1583 | print "---------------------------------------------------------\n"; |
1584 | |
a93b12ba |
1585 | print "While we have been building SquirrelMail, we have discovered some\n"; |
1586 | print "preferences that work better with some servers that don't work so\n"; |
1587 | print "well with others. If you select your IMAP server, this option will\n"; |
1588 | print "set some pre-defined settings for that server.\n"; |
1589 | print "\n"; |
1590 | print "Please note that you will still need to go through and make sure\n"; |
1591 | print "everything is correct. This does not change everything. There are\n"; |
e9f8ea4e |
1592 | print "only a few settings that this will change.\n"; |
a93b12ba |
1593 | print "\n"; |
1594 | |
1595 | $continue = 0; |
1596 | while ($continue != 1) { |
1597 | print "Please select your IMAP server:\n"; |
1598 | print " cyrus = Cyrus IMAP server\n"; |
1599 | print " uw = University of Washington's IMAP server\n"; |
1600 | print " exchange = Microsoft Exchange IMAP server\n"; |
1601 | print " courier = Courier IMAP server\n"; |
1602 | print " quit = Do not change anything\n"; |
1603 | print "Command >> "; |
1604 | $server = <STDIN>; |
1605 | $server =~ s/[\r|\n]//g; |
1606 | |
c4809aca |
1607 | print "\n"; |
1608 | if ($server eq "cyrus") { |
1609 | $default_folder_prefix = "INBOX"; |
a93b12ba |
1610 | $trash_folder = "INBOX.Trash"; |
1611 | $sent_folder = "INBOX.Sent"; |
1612 | $show_prefix_option = false; |
1613 | $default_sub_of_inbox = true; |
1614 | $show_contain_subfolders_option = false; |
1615 | $imap_server_type = "cyrus"; |
1616 | |
c4809aca |
1617 | print " default_folder_prefix = INBOX\n"; |
1618 | print " trash_folder = INBOX.Trash\n"; |
1619 | print " sent_folder = INBOX.Sent\n"; |
e9f8ea4e |
1620 | print " show_prefix_option = false\n"; |
c4809aca |
1621 | print " default_sub_of_inbox = true\n"; |
1622 | print "show_contain_subfolders_option = false\n"; |
1623 | print " imap_server_type = cyrus\n"; |
1624 | |
a93b12ba |
1625 | $continue = 1; |
1626 | } elsif ($server eq "uw") { |
1627 | $default_folder_prefix = "mail/"; |
1628 | $trash_folder = "Trash"; |
1629 | $sent_folder = "Sent"; |
1630 | $show_prefix_option = true; |
1631 | $default_sub_of_inbox = false; |
1632 | $show_contain_subfolders_option = true; |
1633 | $imap_server_type = "uw"; |
c4809aca |
1634 | |
1635 | print " default_folder_prefix = mail/\n"; |
1636 | print " trash_folder = Trash\n"; |
1637 | print " sent_folder = Sent\n"; |
1638 | print " show_prefix_option = true\n"; |
1639 | print " default_sub_of_inbox = false\n"; |
1640 | print "show_contain_subfolders_option = true\n"; |
1641 | print " imap_server_type = uw\n"; |
a93b12ba |
1642 | |
1643 | $continue = 1; |
1644 | } elsif ($server eq "exchange") { |
1645 | $default_folder_prefix = "INBOX/"; |
1646 | $default_sub_of_inbox = true; |
1647 | $trash_folder = "INBOX/Deleted Items"; |
1648 | $sent_folder = "INBOX/Sent Items"; |
1649 | $show_prefix_option = false; |
1650 | $show_contain_subfolders_option = false; |
a93b12ba |
1651 | $imap_server_type = "exchange"; |
1652 | |
612eda0a |
1653 | print " default_folder_prefix = INBOX/\n"; |
1654 | print " default_sub_of_inbox = true\n"; |
1655 | print " trash_folder = \"INBOX/Deleted Items\"\n"; |
1656 | print " sent_folder = \"INBOX/Sent Items\"\n"; |
1657 | print " show_prefix_option = false\n"; |
1658 | print " show_contain_subfolders_option = false\n"; |
1659 | print " imap_server_type = exchange\n"; |
1660 | |
a93b12ba |
1661 | $continue = 1; |
1662 | } elsif ($server eq "courier") { |
1663 | $imap_server_type = "courier"; |
612eda0a |
1664 | |
1665 | print " imap_server_type = courier\n"; |
a93b12ba |
1666 | |
1667 | $continue = 1; |
1668 | } elsif ($server eq "quit") { |
1669 | $continue = 1; |
1670 | } else { |
1671 | print "Unrecognized server: $server\n"; |
1672 | print "\n"; |
1673 | } |
1674 | } |
c4809aca |
1675 | print "\nPress any key to continue..."; |
1676 | $tmp = <STDIN>; |
a93b12ba |
1677 | } |