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