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