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