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