23afd0bd |
1 | #!/usr/bin/env perl |
bbd30ac8 |
2 | # conf.pl |
bbd30ac8 |
3 | # |
ba6338ee |
4 | # Copyright (c) 1999-2005 The SquirrelMail Project Team |
6614128e |
5 | # Licensed under the GNU GPL. For full terms see COPYING. |
6 | # |
7 | # A simple configure script to configure SquirrelMail |
245a6892 |
8 | # |
9 | # $Id$ |
598294a7 |
10 | ############################################################ |
6614128e |
11 | $conf_pl_version = "1.4.0"; |
bbd30ac8 |
12 | |
38b69acb |
13 | ############################################################ |
14 | # Check what directory we're supposed to be running in, and |
15 | # change there if necessary. File::Basename has been in |
16 | # Perl since at least 5.003_7, and nobody sane runs anything |
17 | # before that, but just in case. |
18 | ############################################################ |
8bd9e0dd |
19 | my $dir; |
eaace00e |
20 | if ( eval q{require "File/Basename.pm"} ) { |
8bd9e0dd |
21 | $dir = File::Basename::dirname($0); |
38b69acb |
22 | chdir($dir); |
23 | } |
24 | |
598294a7 |
25 | ############################################################ |
d595e32e |
26 | # Some people try to run this as a CGI. That's wrong! |
598294a7 |
27 | ############################################################ |
eaace00e |
28 | if ( defined( $ENV{'PATH_INFO'} ) |
29 | || defined( $ENV{'QUERY_STRING'} ) |
30 | || defined( $ENV{'REQUEST_METHOD'} ) ) { |
31 | print "Content-Type: text/html\n\n"; |
32 | print "You must run this script from the command line."; |
33 | exit; |
34 | } |
d595e32e |
35 | |
8bd9e0dd |
36 | ############################################################ |
37 | # If we got here, use Cwd to get the full directory path |
38 | # (the Basename stuff above will sometimes return '.' as |
598294a7 |
39 | # the base directory, which is not helpful here). |
8bd9e0dd |
40 | ############################################################ |
41 | use Cwd; |
42 | $dir = cwd(); |
43 | |
598294a7 |
44 | |
45 | ############################################################ |
bbd30ac8 |
46 | # First, lets read in the data already in there... |
598294a7 |
47 | ############################################################ |
eaace00e |
48 | if ( -e "config.php" ) { |
49 | open( FILE, "config.php" ); |
50 | while ( $line = <FILE> ) { |
51 | $line =~ s/^\s+//; |
52 | $line =~ s/^\$//; |
53 | $var = $line; |
54 | |
55 | $var =~ s/=/EQUALS/; |
85645192 |
56 | if ( $var =~ /^([a-z])/i ) { |
eaace00e |
57 | @o = split ( /\s*EQUALS\s*/, $var ); |
58 | if ( $o[0] eq "config_version" ) { |
85645192 |
59 | $o[1] =~ s/[\n\r]//g; |
60 | $o[1] =~ s/[\'\"];\s*$//; |
eaace00e |
61 | $o[1] =~ s/;$//; |
85645192 |
62 | $o[1] =~ s/^[\'\"]//; |
eaace00e |
63 | |
64 | $config_version = $o[1]; |
65 | close(FILE); |
66 | } |
67 | } |
68 | } |
69 | close(FILE); |
70 | |
71 | if ( $config_version ne $conf_pl_version ) { |
f8c17cdd |
72 | clear_screen(); |
eaace00e |
73 | print $WHT. "WARNING:\n" . $NRM; |
74 | print " The file \"config/config.php\" was found, but it is for\n"; |
75 | print " an older version of SquirrelMail. It is possible to still\n"; |
76 | print " read the defaults from this file but be warned that many\n"; |
77 | print " preferences change between versions. It is recommended that\n"; |
78 | print " you start with a clean config.php for each upgrade that you\n"; |
79 | print " do. To do this, just move config/config.php out of the way.\n"; |
80 | print "\n"; |
81 | print "Continue loading with the old config.php [y/N]? "; |
82 | $ctu = <STDIN>; |
83 | |
84 | if ( ( $ctu !~ /^y\n/i ) || ( $ctu =~ /^\n/ ) ) { |
85 | exit; |
86 | } |
87 | |
88 | print "\nDo you want me to stop warning you [y/N]? "; |
89 | $ctu = <STDIN>; |
90 | if ( $ctu =~ /^y\n/i ) { |
91 | $print_config_version = $conf_pl_version; |
92 | } else { |
93 | $print_config_version = $config_version; |
94 | } |
95 | } else { |
96 | $print_config_version = $config_version; |
97 | } |
98 | |
99 | $config = 1; |
100 | open( FILE, "config.php" ); |
101 | } elsif ( -e "config_default.php" ) { |
102 | open( FILE, "config_default.php" ); |
103 | while ( $line = <FILE> ) { |
104 | $line =~ s/^\s+//; |
105 | $line =~ s/^\$//; |
106 | $var = $line; |
107 | |
108 | $var =~ s/=/EQUALS/; |
85645192 |
109 | if ( $var =~ /^([a-z])/i ) { |
eaace00e |
110 | @o = split ( /\s*EQUALS\s*/, $var ); |
111 | if ( $o[0] eq "config_version" ) { |
85645192 |
112 | $o[1] =~ s/[\n\r]//g; |
113 | $o[1] =~ s/[\'\"];\s*$//; |
eaace00e |
114 | $o[1] =~ s/;$//; |
85645192 |
115 | $o[1] =~ s/^[\'\"]//; |
eaace00e |
116 | |
117 | $config_version = $o[1]; |
118 | close(FILE); |
119 | } |
120 | } |
121 | } |
122 | close(FILE); |
123 | |
124 | if ( $config_version ne $conf_pl_version ) { |
f8c17cdd |
125 | clear_screen(); |
eaace00e |
126 | print $WHT. "WARNING:\n" . $NRM; |
127 | print " You are trying to use a 'config_default.php' from an older\n"; |
128 | print " version of SquirrelMail. This is HIGHLY unrecommended. You\n"; |
129 | print " should get the 'config_default.php' that matches the version\n"; |
130 | print " of SquirrelMail that you are running. You can get this from\n"; |
131 | print " the SquirrelMail web page by going to the following URL:\n"; |
132 | print " http://www.squirrelmail.org.\n"; |
133 | print "\n"; |
134 | print "Continue loading with old config_default.php (a bad idea) [y/N]? "; |
135 | $ctu = <STDIN>; |
136 | |
137 | if ( ( $ctu !~ /^y\n/i ) || ( $ctu =~ /^\n/ ) ) { |
138 | exit; |
139 | } |
140 | |
141 | print "\nDo you want me to stop warning you [y/N]? "; |
142 | $ctu = <STDIN>; |
143 | if ( $ctu =~ /^y\n/i ) { |
144 | $print_config_version = $conf_pl_version; |
145 | } else { |
146 | $print_config_version = $config_version; |
147 | } |
148 | } else { |
149 | $print_config_version = $config_version; |
150 | } |
151 | $config = 2; |
152 | open( FILE, "config_default.php" ); |
1e0628fb |
153 | } else { |
eaace00e |
154 | print "No configuration file found. Please get config_default.php\n"; |
155 | print "or config.php before running this again. This program needs\n"; |
156 | print "a default config file to get default values.\n"; |
157 | exit; |
bbd30ac8 |
158 | } |
159 | |
a3439b27 |
160 | # Read and parse the current configuration file |
161 | # (either config.php or config_default.php). |
eaace00e |
162 | while ( $line = <FILE> ) { |
598294a7 |
163 | $line =~ s/^\s+//; |
eaace00e |
164 | $line =~ s/^\$//; |
165 | $var = $line; |
166 | |
167 | $var =~ s/=/EQUALS/; |
85645192 |
168 | if ( $var =~ /^([a-z])/i ) { |
eaace00e |
169 | @options = split ( /\s*EQUALS\s*/, $var ); |
85645192 |
170 | $options[1] =~ s/[\n\r]//g; |
171 | $options[1] =~ s/[\'\"];\s*$//; |
eaace00e |
172 | $options[1] =~ s/;$//; |
85645192 |
173 | $options[1] =~ s/^[\'\"]//; |
ed65d11b |
174 | # de-escape escaped strings |
175 | $options[1] =~ s/\\'/'/g; |
176 | $options[1] =~ s/\\\\/\\/g; |
eaace00e |
177 | |
85645192 |
178 | if ( $options[0] =~ /^theme\[[0-9]+\]\[['"]PATH['"]\]/ ) { |
eaace00e |
179 | $sub = $options[0]; |
85645192 |
180 | $sub =~ s/\]\[['"]PATH['"]\]//; |
eaace00e |
181 | $sub =~ s/.*\[//; |
182 | if ( -e "../themes" ) { |
183 | $options[1] =~ s/^\.\.\/config/\.\.\/themes/; |
a3439b27 |
184 | } |
8bd9e0dd |
185 | $theme_path[$sub] = &change_to_rel_path($options[1]); |
85645192 |
186 | } elsif ( $options[0] =~ /^theme\[[0-9]+\]\[['"]NAME['"]\]/ ) { |
eaace00e |
187 | $sub = $options[0]; |
85645192 |
188 | $sub =~ s/\]\[['"]NAME['"]\]//; |
eaace00e |
189 | $sub =~ s/.*\[//; |
190 | $theme_name[$sub] = $options[1]; |
a1b036d6 |
191 | } elsif ( $options[0] =~ /^plugins\[[0-9]*\]/ ) { |
eaace00e |
192 | $sub = $options[0]; |
193 | $sub =~ s/\]//; |
194 | $sub =~ s/^plugins\[//; |
a1b036d6 |
195 | if ($sub eq '') { |
196 | push @plugins, $options[1]; |
197 | } else { |
198 | $plugins[$sub] = $options[1]; |
199 | } |
eaace00e |
200 | } elsif ( $options[0] =~ /^ldap_server\[[0-9]+\]/ ) { |
201 | $sub = $options[0]; |
202 | $sub =~ s/\]//; |
203 | $sub =~ s/^ldap_server\[//; |
204 | $continue = 0; |
205 | while ( ( $tmp = <FILE> ) && ( $continue != 1 ) ) { |
206 | if ( $tmp =~ /\);\s*$/ ) { |
207 | $continue = 1; |
208 | } |
209 | |
85645192 |
210 | if ( $tmp =~ /^\s*[\'\"]host[\'\"]/i ) { |
211 | $tmp =~ s/^\s*[\'\"]host[\'\"]\s*=>\s*[\'\"]//i; |
212 | $tmp =~ s/[\'\"],?\s*$//; |
213 | $tmp =~ s/[\'\"]\);\s*$//; |
eaace00e |
214 | $host = $tmp; |
85645192 |
215 | } elsif ( $tmp =~ /^\s*[\'\"]base[\'\"]/i ) { |
216 | $tmp =~ s/^\s*[\'\"]base[\'\"]\s*=>\s*[\'\"]//i; |
217 | $tmp =~ s/[\'\"],?\s*$//; |
218 | $tmp =~ s/[\'\"]\);\s*$//; |
eaace00e |
219 | $base = $tmp; |
85645192 |
220 | } elsif ( $tmp =~ /^\s*[\'\"]charset[\'\"]/i ) { |
221 | $tmp =~ s/^\s*[\'\"]charset[\'\"]\s*=>\s*[\'\"]//i; |
222 | $tmp =~ s/[\'\"],?\s*$//; |
223 | $tmp =~ s/[\'\"]\);\s*$//; |
eaace00e |
224 | $charset = $tmp; |
85645192 |
225 | } elsif ( $tmp =~ /^\s*[\'\"]port[\'\"]/i ) { |
226 | $tmp =~ s/^\s*[\'\"]port[\'\"]\s*=>\s*[\'\"]?//i; |
227 | $tmp =~ s/[\'\"]?,?\s*$//; |
228 | $tmp =~ s/[\'\"]?\);\s*$//; |
eaace00e |
229 | $port = $tmp; |
85645192 |
230 | } elsif ( $tmp =~ /^\s*[\'\"]maxrows[\'\"]/i ) { |
231 | $tmp =~ s/^\s*[\'\"]maxrows[\'\"]\s*=>\s*[\'\"]?//i; |
232 | $tmp =~ s/[\'\"]?,?\s*$//; |
233 | $tmp =~ s/[\'\"]?\);\s*$//; |
eaace00e |
234 | $maxrows = $tmp; |
85645192 |
235 | } elsif ( $tmp =~ /^\s*[\'\"]name[\'\"]/i ) { |
236 | $tmp =~ s/^\s*[\'\"]name[\'\"]\s*=>\s*[\'\"]//i; |
237 | $tmp =~ s/[\'\"],?\s*$//; |
238 | $tmp =~ s/[\'\"]\);\s*$//; |
eaace00e |
239 | $name = $tmp; |
85645192 |
240 | } elsif ( $tmp =~ /^\s*[\'\"]binddn[\'\"]/i ) { |
241 | $tmp =~ s/^\s*[\'\"]binddn[\'\"]\s*=>\s*[\'\"]//i; |
242 | $tmp =~ s/[\'\"],?\s*$//; |
243 | $tmp =~ s/[\'\"]\);\s*$//; |
30e9932c |
244 | $binddn = $tmp; |
85645192 |
245 | } elsif ( $tmp =~ /^\s*[\'\"]bindpw[\'\"]/i ) { |
246 | $tmp =~ s/^\s*[\'\"]bindpw[\'\"]\s*=>\s*[\'\"]//i; |
247 | $tmp =~ s/[\'\"],?\s*$//; |
248 | $tmp =~ s/[\'\"]\);\s*$//; |
30e9932c |
249 | $bindpw = $tmp; |
85645192 |
250 | } elsif ( $tmp =~ /^\s*[\'\"]protocol[\'\"]/i ) { |
251 | $tmp =~ s/^\s*[\'\"]protocol[\'\"]\s*=>\s*[\'\"]?//i; |
252 | $tmp =~ s/[\'\"]?,?\s*$//; |
253 | $tmp =~ s/[\'\"]?\);\s*$//; |
30e9932c |
254 | $protocol = $tmp; |
eaace00e |
255 | } |
a3439b27 |
256 | } |
eaace00e |
257 | $ldap_host[$sub] = $host; |
258 | $ldap_base[$sub] = $base; |
259 | $ldap_name[$sub] = $name; |
260 | $ldap_port[$sub] = $port; |
261 | $ldap_maxrows[$sub] = $maxrows; |
262 | $ldap_charset[$sub] = $charset; |
30e9932c |
263 | $ldap_binddn[$sub] = $binddn; |
264 | $ldap_bindpw[$sub] = $bindpw; |
265 | $ldap_protocol[$sub] = $protocol; |
8bd9e0dd |
266 | } elsif ( $options[0] =~ /^(data_dir|attachment_dir|theme_css|org_logo|signout_page)$/ ) { |
267 | ${ $options[0] } = &change_to_rel_path($options[1]); |
eaace00e |
268 | } else { |
269 | ${ $options[0] } = $options[1]; |
270 | } |
271 | } |
bbd30ac8 |
272 | } |
1a7a2fcc |
273 | close FILE; |
0ae4c1f2 |
274 | |
35aaf666 |
275 | $useSendmail = 'false' if ( lc($useSendmail) ne 'true' ); |
276 | $sendmail_path = "/usr/sbin/sendmail" if ( !$sendmail_path ); |
277 | $pop_before_smtp = 'false' if ( !$pop_before_smtp ); |
278 | $default_unseen_notify = 2 if ( !$default_unseen_notify ); |
279 | $default_unseen_type = 1 if ( !$default_unseen_type ); |
280 | $config_use_color = 0 if ( !$config_use_color ); |
281 | $invert_time = 'false' if ( !$invert_time ); |
282 | $force_username_lowercase = 'false' if ( !$force_username_lowercase ); |
283 | $optional_delimiter = "detect" if ( !$optional_delimiter ); |
284 | $auto_create_special = 'false' if ( !$auto_create_special ); |
285 | $default_use_priority = 'true' if ( !$default_use_priority ); |
286 | $hide_sm_attributions = 'false' if ( !$hide_sm_attributions ); |
287 | $default_use_mdn = 'true' if ( !$default_use_mdn ); |
288 | $delete_folder = 'false' if ( !$delete_folder ); |
289 | $noselect_fix_enable = 'false' if ( !$noselect_fix_enable ); |
290 | $frame_top = "_top" if ( !$frame_top ); |
291 | $provider_uri = '' if ( !$provider_uri ); |
292 | $provider_name = '' if ( !$provider_name ); |
293 | $edit_identity = 'true' if ( !$edit_identity ); |
294 | $edit_name = 'true' if ( !$edit_name ); |
295 | $allow_thread_sort = 'false' if ( !$allow_thread_sort ); |
aacc7bec |
296 | $allow_server_sort = 'false' if ( !$allow_server_sort ); |
35aaf666 |
297 | $no_list_for_subscribe = 'false' if ( !$no_list_for_subscribe ); |
298 | $allow_charset_search = 'true' if ( !$allow_charset_search ); |
66bfb27b |
299 | $allow_advanced_search = 0 if ( !$allow_advanced_search) ; |
35aaf666 |
300 | $prefs_user_field = 'user' if ( !$prefs_user_field ); |
301 | $prefs_key_field = 'prefkey' if ( !$prefs_key_field ); |
302 | $prefs_val_field = 'prefval' if ( !$prefs_val_field ); |
35aaf666 |
303 | $use_smtp_tls= 'false' if ( !$use_smtp_tls); |
304 | $smtp_auth_mech = 'none' if ( !$smtp_auth_mech ); |
305 | $use_imap_tls = 'false' if ( !$use_imap_tls ); |
306 | $imap_auth_mech = 'login' if ( !$imap_auth_mech ); |
307 | $session_name = 'SQMSESSID' if ( !$session_name ); |
71d3f882 |
308 | $skip_SM_header = 'false' if ( !$skip_SM_header ); |
309 | $default_use_javascript_addr_book = 'false' if (! $default_use_javascript_addr_book); |
310 | # since 1.5.0 |
35aaf666 |
311 | $show_alternative_names = 'false' if ( !$show_alternative_names ); |
312 | $available_languages = 'all' if ( !$available_languages ); |
f03f6ee7 |
313 | $aggressive_decoding = 'false' if ( !$aggressive_decoding ); |
35aaf666 |
314 | $advanced_tree = 'false' if ( !$advanced_tree ); |
315 | $oldway = 'false' if ( !$oldway ); |
35aaf666 |
316 | $use_php_recode = 'false' if ( !$use_php_recode ); |
317 | $use_php_iconv = 'false' if ( !$use_php_iconv ); |
71d3f882 |
318 | # since 1.5.1 |
319 | $use_icons = 'false' if ( !$use_icons ); |
320 | $lossy_encoding = 'false' if ( !$lossy_encoding ); |
321 | $allow_remote_configtest = 'false' if ( !$allow_remote_configtest ); |
322 | $addrbook_global_table = 'global_abook' if ( !$addrbook_global_table ); |
323 | $addrbook_global_writeable = 'false' if ( !$addrbook_global_writeable ); |
324 | $addrbook_global_listing = 'false' if ( !$addrbook_global_listing ); |
325 | $abook_global_file = '' if ( !$abook_global_file); |
326 | $abook_global_file_writeable = 'false' if ( !$abook_global_file_writeable); |
327 | $abook_global_file_listing = 'true' if ( !$abook_global_file_listing ); |
39d3ec89 |
328 | |
eaace00e |
329 | if ( $ARGV[0] eq '--install-plugin' ) { |
330 | print "Activating plugin " . $ARGV[1] . "\n"; |
ebd13f55 |
331 | push @plugins, $ARGV[1]; |
332 | save_data(); |
333 | exit(0); |
eaace00e |
334 | } elsif ( $ARGV[0] eq '--remove-plugin' ) { |
335 | print "Removing plugin " . $ARGV[1] . "\n"; |
ebd13f55 |
336 | foreach $plugin (@plugins) { |
eaace00e |
337 | if ( $plugin ne $ARGV[1] ) { |
338 | push @newplugins, $plugin; |
ebd13f55 |
339 | } |
340 | } |
341 | @plugins = @newplugins; |
342 | save_data(); |
343 | exit(0); |
344 | } |
345 | |
5b6ae78a |
346 | ##################################################################################### |
eaace00e |
347 | if ( $config_use_color == 1 ) { |
348 | $WHT = "\x1B[37;1m"; |
349 | $NRM = "\x1B[0m"; |
0ecb47e5 |
350 | } else { |
eaace00e |
351 | $WHT = ""; |
352 | $NRM = ""; |
353 | $config_use_color = 2; |
354 | } |
355 | |
8b5c49cd |
356 | while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) { |
f8c17cdd |
357 | clear_screen(); |
eaace00e |
358 | print $WHT. "SquirrelMail Configuration : " . $NRM; |
359 | if ( $config == 1 ) { print "Read: config.php"; } |
360 | elsif ( $config == 2 ) { print "Read: config_default.php"; } |
361 | print " ($print_config_version)\n"; |
362 | print "---------------------------------------------------------\n"; |
363 | |
364 | if ( $menu == 0 ) { |
365 | print $WHT. "Main Menu --\n" . $NRM; |
366 | print "1. Organization Preferences\n"; |
367 | print "2. Server Settings\n"; |
368 | print "3. Folder Defaults\n"; |
369 | print "4. General Options\n"; |
370 | print "5. Themes\n"; |
4272758c |
371 | print "6. Address Books\n"; |
eaace00e |
372 | print "7. Message of the Day (MOTD)\n"; |
373 | print "8. Plugins\n"; |
374 | print "9. Database\n"; |
598294a7 |
375 | print "10. Language settings\n"; |
376 | print "11. Tweaks\n"; |
eaace00e |
377 | print "\n"; |
378 | print "D. Set pre-defined settings for specific IMAP servers\n"; |
379 | print "\n"; |
380 | } elsif ( $menu == 1 ) { |
381 | print $WHT. "Organization Preferences\n" . $NRM; |
b6e0c3b6 |
382 | print "1. Organization Name : $WHT$org_name$NRM\n"; |
383 | print "2. Organization Logo : $WHT$org_logo$NRM\n"; |
384 | print "3. Org. Logo Width/Height : $WHT($org_logo_width/$org_logo_height)$NRM\n"; |
385 | print "4. Organization Title : $WHT$org_title$NRM\n"; |
386 | print "5. Signout Page : $WHT$signout_page$NRM\n"; |
39d3ec89 |
387 | print "6. Top Frame : $WHT$frame_top$NRM\n"; |
388 | print "7. Provider link : $WHT$provider_uri$NRM\n"; |
389 | print "8. Provider name : $WHT$provider_name$NRM\n"; |
0ae4c1f2 |
390 | |
eaace00e |
391 | print "\n"; |
dcc1cc82 |
392 | print "R Return to Main Menu\n"; |
eaace00e |
393 | } elsif ( $menu == 2 ) { |
47a29326 |
394 | print $WHT. "Server Settings\n\n" . $NRM; |
395 | print $WHT . "General" . $NRM . "\n"; |
396 | print "-------\n"; |
397 | print "1. Domain : $WHT$domain$NRM\n"; |
398 | print "2. Invert Time : $WHT$invert_time$NRM\n"; |
399 | print "3. Sendmail or SMTP : $WHT"; |
35aaf666 |
400 | if ( lc($useSendmail) eq 'true' ) { |
eaace00e |
401 | print "Sendmail"; |
402 | } else { |
403 | print "SMTP"; |
404 | } |
405 | print "$NRM\n"; |
47a29326 |
406 | print "\n"; |
598294a7 |
407 | |
47a29326 |
408 | if ( $show_imap_settings ) { |
409 | print $WHT . "IMAP Settings". $NRM . "\n--------------\n"; |
410 | print "4. IMAP Server : $WHT$imapServerAddress$NRM\n"; |
411 | print "5. IMAP Port : $WHT$imapPort$NRM\n"; |
412 | print "6. Authentication type : $WHT$imap_auth_mech$NRM\n"; |
413 | print "7. Secure IMAP (TLS) : $WHT$use_imap_tls$NRM\n"; |
414 | print "8. Server software : $WHT$imap_server_type$NRM\n"; |
415 | print "9. Delimiter : $WHT$optional_delimiter$NRM\n"; |
416 | print "\n"; |
417 | } elsif ( $show_smtp_settings ) { |
35aaf666 |
418 | if ( lc($useSendmail) eq 'true' ) { |
47a29326 |
419 | print $WHT . "Sendmail" . $NRM . "\n--------\n"; |
420 | print "4. Sendmail Path : $WHT$sendmail_path$NRM\n"; |
cba7675e |
421 | print "5. Suppress SM header : $WHT$skip_SM_header$NRM\n"; |
47a29326 |
422 | print "\n"; |
423 | } else { |
424 | print $WHT . "SMTP Settings" . $NRM . "\n-------------\n"; |
425 | print "4. SMTP Server : $WHT$smtpServerAddress$NRM\n"; |
426 | print "5. SMTP Port : $WHT$smtpPort$NRM\n"; |
427 | print "6. POP before SMTP : $WHT$pop_before_smtp$NRM\n"; |
428 | print "7. SMTP Authentication : $WHT$smtp_auth_mech$NRM\n"; |
429 | print "8. Secure SMTP (TLS) : $WHT$use_smtp_tls$NRM\n"; |
35aaf666 |
430 | print "9. Suppress SM header : $WHT$skip_SM_header$NRM\n"; |
47a29326 |
431 | print "\n"; |
432 | } |
eaace00e |
433 | } |
47a29326 |
434 | |
435 | if ($show_imap_settings == 0) { |
436 | print "A. Update IMAP Settings : "; |
437 | print "$WHT$imapServerAddress$NRM:"; |
438 | print "$WHT$imapPort$NRM "; |
439 | print "($WHT$imap_server_type$NRM)\n"; |
598294a7 |
440 | } |
47a29326 |
441 | if ($show_smtp_settings == 0) { |
35aaf666 |
442 | if ( lc($useSendmail) eq 'true' ) { |
47a29326 |
443 | print "B. Change Sendmail Config : $WHT$sendmail_path$NRM\n"; |
444 | } else { |
445 | print "B. Update SMTP Settings : "; |
446 | print "$WHT$smtpServerAddress$NRM:"; |
447 | print "$WHT$smtpPort$NRM\n"; |
448 | } |
449 | } |
450 | if ( $show_smtp_settings || $show_imap_settings ) |
451 | { |
598294a7 |
452 | print "H. Hide " . |
453 | ($show_imap_settings ? "IMAP Server" : |
35aaf666 |
454 | (lc($useSendmail) eq 'true') ? "Sendmail" : "SMTP") . " Settings\n"; |
47a29326 |
455 | } |
598294a7 |
456 | |
eaace00e |
457 | print "\n"; |
dcc1cc82 |
458 | print "R Return to Main Menu\n"; |
eaace00e |
459 | } elsif ( $menu == 3 ) { |
460 | print $WHT. "Folder Defaults\n" . $NRM; |
461 | print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n"; |
462 | print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n"; |
463 | print "3. Trash Folder : $WHT$trash_folder$NRM\n"; |
464 | print "4. Sent Folder : $WHT$sent_folder$NRM\n"; |
465 | print "5. Drafts Folder : $WHT$draft_folder$NRM\n"; |
466 | print "6. By default, move to trash : $WHT$default_move_to_trash$NRM\n"; |
467 | print "7. By default, move to sent : $WHT$default_move_to_sent$NRM\n"; |
468 | print "8. By default, save as draft : $WHT$default_save_as_draft$NRM\n"; |
469 | print "9. List Special Folders First : $WHT$list_special_folders_first$NRM\n"; |
470 | print "10. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n"; |
471 | print "11. Auto Expunge : $WHT$auto_expunge$NRM\n"; |
472 | print "12. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n"; |
473 | print "13. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n"; |
474 | print "14. Default Unseen Notify : $WHT$default_unseen_notify$NRM\n"; |
475 | print "15. Default Unseen Type : $WHT$default_unseen_type$NRM\n"; |
476 | print "16. Auto Create Special Folders : $WHT$auto_create_special$NRM\n"; |
2eec12b5 |
477 | print "17. Folder Delete Bypasses Trash : $WHT$delete_folder$NRM\n"; |
ca85aabe |
478 | print "18. Enable /NoSelect folder fix : $WHT$noselect_fix_enable$NRM\n"; |
eaace00e |
479 | print "\n"; |
dcc1cc82 |
480 | print "R Return to Main Menu\n"; |
eaace00e |
481 | } elsif ( $menu == 4 ) { |
482 | print $WHT. "General Options\n" . $NRM; |
39d3ec89 |
483 | print "1. Data Directory : $WHT$data_dir$NRM\n"; |
484 | print "2. Attachment Directory : $WHT$attachment_dir$NRM\n"; |
485 | print "3. Directory Hash Level : $WHT$dir_hash_level$NRM\n"; |
486 | print "4. Default Left Size : $WHT$default_left_size$NRM\n"; |
487 | print "5. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n"; |
488 | print "6. Allow use of priority : $WHT$default_use_priority$NRM\n"; |
489 | print "7. Hide SM attributions : $WHT$hide_sm_attributions$NRM\n"; |
490 | print "8. Allow use of receipts : $WHT$default_use_mdn$NRM\n"; |
35aaf666 |
491 | print "9. Allow editing of identity : $WHT$edit_identity$NRM/$WHT$edit_name$NRM\n"; |
39d3ec89 |
492 | print "10. Allow server thread sort : $WHT$allow_thread_sort$NRM\n"; |
aacc7bec |
493 | print "11. Allow server-side sorting : $WHT$allow_server_sort$NRM\n"; |
39d3ec89 |
494 | print "12. Allow server charset search : $WHT$allow_charset_search$NRM\n"; |
de74555e |
495 | print "13. Allow advanced search : $WHT$allow_advanced_search$NRM\n"; |
66bfb27b |
496 | print "14. PHP session name : $WHT$session_name$NRM\n"; |
eaace00e |
497 | print "\n"; |
dcc1cc82 |
498 | print "R Return to Main Menu\n"; |
eaace00e |
499 | } elsif ( $menu == 5 ) { |
500 | print $WHT. "Themes\n" . $NRM; |
501 | print "1. Change Themes\n"; |
2eec12b5 |
502 | for ( $count = 0 ; $count <= $#theme_name/2 ; $count++ ) { |
503 | $temp_name = $theme_name[$count*2]; |
598294a7 |
504 | printf " %s%*s %s\n", $temp_name, |
2eec12b5 |
505 | 40 - length($temp_name), " ", |
506 | $theme_name[($count*2)+1]; |
eaace00e |
507 | } |
508 | print "2. CSS File : $WHT$theme_css$NRM\n"; |
509 | print "\n"; |
dcc1cc82 |
510 | print "R Return to Main Menu\n"; |
eaace00e |
511 | } elsif ( $menu == 6 ) { |
4272758c |
512 | print $WHT. "Address Books\n" . $NRM; |
513 | print "1. Change LDAP Servers\n"; |
eaace00e |
514 | for ( $count = 0 ; $count <= $#ldap_host ; $count++ ) { |
515 | print " > $ldap_host[$count]\n"; |
516 | } |
71d3f882 |
517 | print "2. Use Javascript address book search : $WHT$default_use_javascript_addr_book$NRM\n"; |
518 | print "3. Use global file address book : $WHT$abook_global_file$NRM\n"; |
4272758c |
519 | print "4. Allow writing into global file address book : $WHT$abook_global_file_writeable$NRM\n"; |
71d3f882 |
520 | print "5. Allow listing of global file address book : $WHT$abook_global_file_listing$NRM\n"; |
eaace00e |
521 | print "\n"; |
dcc1cc82 |
522 | print "R Return to Main Menu\n"; |
eaace00e |
523 | } elsif ( $menu == 7 ) { |
524 | print $WHT. "Message of the Day (MOTD)\n" . $NRM; |
525 | print "\n$motd\n"; |
526 | print "\n"; |
527 | print "1 Edit the MOTD\n"; |
528 | print "\n"; |
dcc1cc82 |
529 | print "R Return to Main Menu\n"; |
eaace00e |
530 | } elsif ( $menu == 8 ) { |
531 | print $WHT. "Plugins\n" . $NRM; |
532 | print " Installed Plugins\n"; |
533 | $num = 0; |
534 | for ( $count = 0 ; $count <= $#plugins ; $count++ ) { |
535 | $num = $count + 1; |
536 | print " $num. $plugins[$count]\n"; |
537 | } |
538 | print "\n Available Plugins:\n"; |
539 | opendir( DIR, "../plugins" ); |
540 | @files = readdir(DIR); |
541 | $pos = 0; |
542 | @unused_plugins = (); |
543 | for ( $i = 0 ; $i <= $#files ; $i++ ) { |
544 | if ( -d "../plugins/" . $files[$i] && $files[$i] !~ /^\./ && $files[$i] ne "CVS" ) { |
545 | $match = 0; |
546 | for ( $k = 0 ; $k <= $#plugins ; $k++ ) { |
547 | if ( $plugins[$k] eq $files[$i] ) { |
548 | $match = 1; |
549 | } |
550 | } |
551 | if ( $match == 0 ) { |
552 | $unused_plugins[$pos] = $files[$i]; |
553 | $pos++; |
554 | } |
1a7a2fcc |
555 | } |
eaace00e |
556 | } |
557 | |
558 | for ( $i = 0 ; $i <= $#unused_plugins ; $i++ ) { |
559 | $num = $num + 1; |
560 | print " $num. $unused_plugins[$i]\n"; |
561 | } |
562 | closedir DIR; |
563 | |
eaace00e |
564 | print "\n"; |
dcc1cc82 |
565 | print "R Return to Main Menu\n"; |
eaace00e |
566 | } elsif ( $menu == 9 ) { |
567 | print $WHT. "Database\n" . $NRM; |
568 | print "1. DSN for Address Book : $WHT$addrbook_dsn$NRM\n"; |
569 | print "2. Table for Address Book : $WHT$addrbook_table$NRM\n"; |
99a6c222 |
570 | print "\n"; |
eaace00e |
571 | print "3. DSN for Preferences : $WHT$prefs_dsn$NRM\n"; |
572 | print "4. Table for Preferences : $WHT$prefs_table$NRM\n"; |
99a6c222 |
573 | print "5. Field for username : $WHT$prefs_user_field$NRM\n"; |
574 | print "6. Field for prefs key : $WHT$prefs_key_field$NRM\n"; |
575 | print "7. Field for prefs value : $WHT$prefs_val_field$NRM\n"; |
eaace00e |
576 | print "\n"; |
30e9932c |
577 | print "8. DSN for Global Address Book : $WHT$addrbook_global_dsn$NRM\n"; |
578 | print "9. Table for Global Address Book : $WHT$addrbook_global_table$NRM\n"; |
579 | print "10. Allow writing into Global Address Book : $WHT$addrbook_global_writeable$NRM\n"; |
580 | print "11. Allow listing of Global Address Book : $WHT$addrbook_global_listing$NRM\n"; |
581 | print "\n"; |
dcc1cc82 |
582 | print "R Return to Main Menu\n"; |
39d3ec89 |
583 | } elsif ( $menu == 10 ) { |
35aaf666 |
584 | print $WHT. "Language settings\n" . $NRM; |
585 | print "1. Default Language : $WHT$squirrelmail_default_language$NRM\n"; |
586 | print "2. Default Charset : $WHT$default_charset$NRM\n"; |
587 | print "3. Show alternative language names : $WHT$show_alternative_names$NRM\n"; |
588 | print "4. Available languages : $WHT$available_languages$NRM\n"; |
f03f6ee7 |
589 | print "5. Enable aggressive decoding : $WHT$aggressive_decoding$NRM\n"; |
6d3689f5 |
590 | print "6. Enable lossy encoding : $WHT$lossy_encoding$NRM\n"; |
35aaf666 |
591 | print "\n"; |
dcc1cc82 |
592 | print "R Return to Main Menu\n"; |
39d3ec89 |
593 | } elsif ( $menu == 11 ) { |
35aaf666 |
594 | print $WHT. "Interface tweaks\n" . $NRM; |
595 | print "1. Advanced tree : $WHT$advanced_tree$NRM\n"; |
596 | print "2. Oldway : $WHT$oldway$NRM\n"; |
597 | print "3. Use Icons : $WHT$use_icons$NRM\n"; |
598 | print "\n"; |
599 | print $WHT. "PHP tweaks\n" . $NRM; |
600 | print "4. Use php recode functions : $WHT$use_php_recode$NRM\n"; |
601 | print "5. Use php iconv functions : $WHT$use_php_iconv$NRM\n"; |
71d3f882 |
602 | print "\n"; |
603 | print $WHT. "Configuration tweaks\n" . $NRM; |
604 | print "6. Allow remote configtest : $WHT$allow_remote_configtest$NRM\n"; |
35aaf666 |
605 | print "\n"; |
dcc1cc82 |
606 | print "R Return to Main Menu\n"; |
eaace00e |
607 | } |
608 | if ( $config_use_color == 1 ) { |
1ef64acb |
609 | print "C Turn color off\n"; |
eaace00e |
610 | } else { |
1ef64acb |
611 | print "C Turn color on\n"; |
eaace00e |
612 | } |
dcc1cc82 |
613 | print "S Save data\n"; |
614 | print "Q Quit\n"; |
eaace00e |
615 | |
616 | print "\n"; |
617 | print "Command >> " . $WHT; |
618 | $command = <STDIN>; |
85645192 |
619 | $command =~ s/[\n\r]//g; |
eaace00e |
620 | $command =~ tr/A-Z/a-z/; |
621 | print "$NRM\n"; |
622 | |
623 | # Read the commands they entered. |
624 | if ( $command eq "r" ) { |
625 | $menu = 0; |
626 | } elsif ( $command eq "s" ) { |
627 | save_data(); |
628 | print "Press enter to continue..."; |
629 | $tmp = <STDIN>; |
630 | $saved = 1; |
631 | } elsif ( ( $command eq "q" ) && ( $saved == 0 ) ) { |
632 | print "You have not saved your data.\n"; |
633 | print "Save? [" . $WHT . "Y" . $NRM . "/n]: "; |
634 | $save = <STDIN>; |
635 | if ( ( $save =~ /^y/i ) || ( $save =~ /^\s*$/ ) ) { |
636 | save_data(); |
637 | } |
638 | } elsif ( $command eq "c" ) { |
639 | if ( $config_use_color == 1 ) { |
640 | $config_use_color = 2; |
641 | $WHT = ""; |
642 | $NRM = ""; |
643 | } else { |
644 | $config_use_color = 1; |
645 | $WHT = "\x1B[37;1m"; |
646 | $NRM = "\x1B[0m"; |
647 | } |
648 | } elsif ( $command eq "d" && $menu == 0 ) { |
649 | set_defaults(); |
650 | } else { |
651 | $saved = 0; |
652 | if ( $menu == 0 ) { |
39d3ec89 |
653 | if ( ( $command > 0 ) && ( $command < 12 ) ) { |
eaace00e |
654 | $menu = $command; |
1a7a2fcc |
655 | } |
eaace00e |
656 | } elsif ( $menu == 1 ) { |
657 | if ( $command == 1 ) { $org_name = command1(); } |
658 | elsif ( $command == 2 ) { $org_logo = command2(); } |
b6e0c3b6 |
659 | elsif ( $command == 3 ) { ($org_logo_width,$org_logo_height) = command2a(); } |
660 | elsif ( $command == 4 ) { $org_title = command3(); } |
661 | elsif ( $command == 5 ) { $signout_page = command4(); } |
39d3ec89 |
662 | elsif ( $command == 6 ) { $frame_top = command6(); } |
663 | elsif ( $command == 7 ) { $provider_uri = command7(); } |
664 | elsif ( $command == 8 ) { $provider_name = command8(); } |
0ae4c1f2 |
665 | |
eaace00e |
666 | } elsif ( $menu == 2 ) { |
47a29326 |
667 | if ( $command eq "a" ) { $show_imap_settings = 1; $show_smtp_settings = 0; } |
668 | elsif ( $command eq "b" ) { $show_imap_settings = 0; $show_smtp_settings = 1; } |
669 | elsif ( $command eq "h" ) { $show_imap_settings = 0; $show_smtp_settings = 0; } |
670 | elsif ( $command <= 3 ) { |
671 | if ( $command == 1 ) { $domain = command11(); } |
672 | elsif ( $command == 2 ) { $invert_time = command110(); } |
673 | elsif ( $command == 3 ) { $useSendmail = command14(); } |
674 | $show_imap_settings = 0; $show_smtp_settings = 0; |
675 | } elsif ( $show_imap_settings ) { |
676 | if ( $command == 4 ) { $imapServerAddress = command12(); } |
677 | elsif ( $command == 5 ) { $imapPort = command13(); } |
b47821fb |
678 | elsif ( $command == 6 ) { $imap_auth_mech = command112a(); } |
47a29326 |
679 | elsif ( $command == 7 ) { $use_imap_tls = command113("IMAP",$use_imap_tls); } |
680 | elsif ( $command == 8 ) { $imap_server_type = command19(); } |
681 | elsif ( $command == 9 ) { $optional_delimiter = command111(); } |
35aaf666 |
682 | } elsif ( $show_smtp_settings && lc($useSendmail) eq 'true' ) { |
47a29326 |
683 | if ( $command == 4 ) { $sendmail_path = command15(); } |
684 | } elsif ( $show_smtp_settings ) { |
685 | if ( $command == 4 ) { $smtpServerAddress = command16(); } |
686 | elsif ( $command == 5 ) { $smtpPort = command17(); } |
687 | elsif ( $command == 6 ) { $pop_before_smtp = command18a(); } |
b47821fb |
688 | elsif ( $command == 7 ) { $smtp_auth_mech = command112b(); } |
47a29326 |
689 | elsif ( $command == 8 ) { $use_smtp_tls = command113("SMTP",$use_smtp_tls); } |
35aaf666 |
690 | elsif ( $command == 9 ) { $skip_SM_header = command114(); } |
47a29326 |
691 | } |
eaace00e |
692 | } elsif ( $menu == 3 ) { |
693 | if ( $command == 1 ) { $default_folder_prefix = command21(); } |
694 | elsif ( $command == 2 ) { $show_prefix_option = command22(); } |
695 | elsif ( $command == 3 ) { $trash_folder = command23a(); } |
696 | elsif ( $command == 4 ) { $sent_folder = command23b(); } |
697 | elsif ( $command == 5 ) { $draft_folder = command23c(); } |
698 | elsif ( $command == 6 ) { $default_move_to_trash = command24a(); } |
699 | elsif ( $command == 7 ) { $default_move_to_sent = command24b(); } |
700 | elsif ( $command == 8 ) { $default_save_as_draft = command24c(); } |
701 | elsif ( $command == 9 ) { $list_special_folders_first = command27(); } |
702 | elsif ( $command == 10 ) { $use_special_folder_color = command28(); } |
703 | elsif ( $command == 11 ) { $auto_expunge = command29(); } |
704 | elsif ( $command == 12 ) { $default_sub_of_inbox = command210(); } |
705 | elsif ( $command == 13 ) { $show_contain_subfolders_option = command211(); } |
706 | elsif ( $command == 14 ) { $default_unseen_notify = command212(); } |
707 | elsif ( $command == 15 ) { $default_unseen_type = command213(); } |
708 | elsif ( $command == 16 ) { $auto_create_special = command214(); } |
709 | elsif ( $command == 17 ) { $delete_folder = command215(); } |
ca85aabe |
710 | elsif ( $command == 18 ) { $noselect_fix_enable = command216(); } |
eaace00e |
711 | } elsif ( $menu == 4 ) { |
39d3ec89 |
712 | if ( $command == 1 ) { $data_dir = command33a(); } |
713 | elsif ( $command == 2 ) { $attachment_dir = command33b(); } |
714 | elsif ( $command == 3 ) { $dir_hash_level = command33c(); } |
715 | elsif ( $command == 4 ) { $default_left_size = command35(); } |
716 | elsif ( $command == 5 ) { $force_username_lowercase = command36(); } |
717 | elsif ( $command == 6 ) { $default_use_priority = command37(); } |
718 | elsif ( $command == 7 ) { $hide_sm_attributions = command38(); } |
719 | elsif ( $command == 8 ) { $default_use_mdn = command39(); } |
720 | elsif ( $command == 9 ) { $edit_identity = command310(); } |
721 | elsif ( $command == 10 ) { $allow_thread_sort = command312(); } |
722 | elsif ( $command == 11 ) { $allow_server_sort = command313(); } |
723 | elsif ( $command == 12 ) { $allow_charset_search = command314(); } |
de74555e |
724 | elsif ( $command == 13 ) { $allow_advanced_search = command316(); } |
725 | elsif ( $command == 14 ) { $session_name = command317(); } |
eaace00e |
726 | } elsif ( $menu == 5 ) { |
727 | if ( $command == 1 ) { command41(); } |
728 | elsif ( $command == 2 ) { $theme_css = command42(); } |
729 | } elsif ( $menu == 6 ) { |
730 | if ( $command == 1 ) { command61(); } |
731 | elsif ( $command == 2 ) { command62(); } |
4272758c |
732 | elsif ( $command == 3 ) { $abook_global_file=command63(); } |
733 | elsif ( $command == 4 ) { command64(); } |
71d3f882 |
734 | elsif ( $command == 5 ) { command65(); } |
eaace00e |
735 | } elsif ( $menu == 7 ) { |
736 | if ( $command == 1 ) { $motd = command71(); } |
737 | } elsif ( $menu == 8 ) { |
738 | if ( $command =~ /^[0-9]+/ ) { @plugins = command81(); } |
eaace00e |
739 | } elsif ( $menu == 9 ) { |
99a6c222 |
740 | if ( $command == 1 ) { $addrbook_dsn = command91(); } |
741 | elsif ( $command == 2 ) { $addrbook_table = command92(); } |
742 | elsif ( $command == 3 ) { $prefs_dsn = command93(); } |
743 | elsif ( $command == 4 ) { $prefs_table = command94(); } |
744 | elsif ( $command == 5 ) { $prefs_user_field = command95(); } |
745 | elsif ( $command == 6 ) { $prefs_key_field = command96(); } |
746 | elsif ( $command == 7 ) { $prefs_val_field = command97(); } |
30e9932c |
747 | elsif ( $command == 8 ) { $addrbook_global_dsn = command98(); } |
748 | elsif ( $command == 9 ) { $addrbook_global_table = command99(); } |
749 | elsif ( $command == 10 ) { $addrbook_global_writeable = command910(); } |
750 | elsif ( $command == 11 ) { $addrbook_global_listing = command911(); } |
39d3ec89 |
751 | } elsif ( $menu == 10 ) { |
752 | if ( $command == 1 ) { $squirrelmail_default_language = commandA1(); } |
35aaf666 |
753 | elsif ( $command == 2 ) { $default_charset = commandA2(); } |
dcc1cc82 |
754 | elsif ( $command == 3 ) { $show_alternative_names = commandA3(); } |
35aaf666 |
755 | elsif ( $command == 4 ) { $available_languages = commandA4(); } |
f03f6ee7 |
756 | elsif ( $command == 5 ) { $aggressive_decoding = commandA5(); } |
6d3689f5 |
757 | elsif ( $command == 6 ) { $lossy_encoding = commandA6(); } |
39d3ec89 |
758 | } elsif ( $menu == 11 ) { |
759 | if ( $command == 1 ) { $advanced_tree = commandB1(); } |
71d3f882 |
760 | elsif ( $command == 2 ) { $oldway = commandB2(); } |
6395c46d |
761 | elsif ( $command == 3 ) { $use_icons = commandB3(); } |
762 | elsif ( $command == 4 ) { $use_php_recode = commandB4(); } |
763 | elsif ( $command == 5 ) { $use_php_iconv = commandB5(); } |
71d3f882 |
764 | elsif ( $command == 6 ) { $allow_remote_configtest = commandB6(); } |
eaace00e |
765 | } |
766 | } |
828b4753 |
767 | } |
768 | |
cbd6543c |
769 | # we exit here |
770 | print "\nExiting conf.pl.\n". |
35aaf666 |
771 | "You might want to test your configuration by browsing to\n". |
772 | "http://your-squirrelmail-location/src/configtest.php\n". |
773 | "Happy SquirrelMailing!\n\n"; |
cbd6543c |
774 | |
775 | |
828b4753 |
776 | #################################################################################### |
777 | |
5b6ae78a |
778 | # org_name |
779 | sub command1 { |
eaace00e |
780 | print "We have tried to make the name SquirrelMail as transparent as\n"; |
781 | print "possible. If you set up an organization name, most places where\n"; |
782 | print "SquirrelMail would take credit will be credited to your organization.\n"; |
783 | print "\n"; |
360ef370 |
784 | print "If your Organization Name includes a '\$', please precede it with a \\. \n"; |
785 | print "Other '\$' will be considered the beginning of a variable that\n"; |
786 | print "must be defined before the \$org_name is printed.\n"; |
360ef370 |
787 | print "\n"; |
eaace00e |
788 | print "[$WHT$org_name$NRM]: $WHT"; |
789 | $new_org_name = <STDIN>; |
790 | if ( $new_org_name eq "\n" ) { |
791 | $new_org_name = $org_name; |
792 | } else { |
85645192 |
793 | $new_org_name =~ s/[\r\n]//g; |
35aaf666 |
794 | $new_org_name =~ s/\"/"/g; |
eaace00e |
795 | } |
796 | return $new_org_name; |
5b6ae78a |
797 | } |
798 | |
799 | # org_logo |
800 | sub command2 { |
eaace00e |
801 | print "Your organization's logo is an image that will be displayed at\n"; |
25be56ab |
802 | print "different times throughout SquirrelMail. "; |
803 | print "\n"; |
804 | print "Please be aware of the following: \n"; |
805 | print " - Relative URLs are relative to the config dir\n"; |
806 | print " to use the default logo, use ../images/sm_logo.png\n"; |
807 | print " - To specify a logo defined outside the SquirrelMail source tree\n"; |
808 | print " use the absolute URL the webserver would use to include the file\n"; |
5d28b77e |
809 | print " e.g. http://www.example.com/images/mylogo.gif or /images/mylogo.jpg\n"; |
eaace00e |
810 | print "\n"; |
811 | print "[$WHT$org_logo$NRM]: $WHT"; |
812 | $new_org_logo = <STDIN>; |
813 | if ( $new_org_logo eq "\n" ) { |
814 | $new_org_logo = $org_logo; |
815 | } else { |
85645192 |
816 | $new_org_logo =~ s/[\r\n]//g; |
eaace00e |
817 | } |
818 | return $new_org_logo; |
5b6ae78a |
819 | } |
820 | |
b6e0c3b6 |
821 | # org_logo_width |
822 | sub command2a { |
823 | print "Your organization's logo is an image that will be displayed at\n"; |
824 | print "different times throughout SquirrelMail. Width\n"; |
825 | print "and Height of your logo image. Use '0' to disable.\n"; |
826 | print "\n"; |
827 | print "Width: [$WHT$org_logo_width$NRM]: $WHT"; |
828 | $new_org_logo_width = <STDIN>; |
829 | $new_org_logo_width =~ tr/0-9//cd; # only want digits! |
830 | if ( $new_org_logo_width eq '' ) { |
831 | $new_org_logo_width = $org_logo_width; |
832 | } |
0e21688d |
833 | if ( $new_org_logo_width > 0 ) { |
834 | print "Height: [$WHT$org_logo_height$NRM]: $WHT"; |
835 | $new_org_logo_height = <STDIN>; |
836 | $new_org_logo_height =~ tr/0-9//cd; # only want digits! |
e03345e1 |
837 | if( $new_org_logo_height eq '' ) { |
35aaf666 |
838 | $new_org_logo_height = $org_logo_height; |
839 | } |
00c4b08d |
840 | } else { |
0e21688d |
841 | $new_org_logo_height = 0; |
b6e0c3b6 |
842 | } |
843 | return ($new_org_logo_width, $new_org_logo_height); |
844 | } |
845 | |
5b6ae78a |
846 | # org_title |
847 | sub command3 { |
eaace00e |
848 | print "A title is what is displayed at the top of the browser window in\n"; |
849 | print "the titlebar. Usually this will end up looking something like:\n"; |
850 | print "\"Netscape: $org_title\"\n"; |
851 | print "\n"; |
360ef370 |
852 | print "If your Organization Title includes a '\$', please precede it with a \\. \n"; |
853 | print "Other '\$' will be considered the beginning of a variable that\n"; |
854 | print "must be defined before the \$org_title is printed.\n"; |
8b5c49cd |
855 | print "\$version, for example can be used, and will print the\n"; |
360ef370 |
856 | print "string representing the current SquirrelMail version.\n"; |
857 | print "\n"; |
eaace00e |
858 | print "[$WHT$org_title$NRM]: $WHT"; |
859 | $new_org_title = <STDIN>; |
860 | if ( $new_org_title eq "\n" ) { |
861 | $new_org_title = $org_title; |
862 | } else { |
85645192 |
863 | $new_org_title =~ s/[\r\n]//g; |
35aaf666 |
864 | $new_org_title =~ s/\"/\'/g; |
eaace00e |
865 | } |
866 | return $new_org_title; |
5b6ae78a |
867 | } |
5b6ae78a |
868 | |
f923b93d |
869 | # signout_page |
870 | sub command4 { |
eaace00e |
871 | print "When users click the Sign Out button they will be logged out and\n"; |
872 | print "then sent to signout_page. If signout_page is left empty,\n"; |
873 | print "(hit space and then return) they will be taken, as normal,\n"; |
874 | print "to the default and rather sparse SquirrelMail signout page.\n"; |
875 | print "\n"; |
876 | print "[$WHT$signout_page$NRM]: $WHT"; |
877 | $new_signout_page = <STDIN>; |
878 | if ( $new_signout_page eq "\n" ) { |
879 | $new_signout_page = $signout_page; |
880 | } else { |
85645192 |
881 | $new_signout_page =~ s/[\r\n]//g; |
eaace00e |
882 | $new_signout_page =~ s/^\s+$//g; |
883 | } |
884 | return $new_signout_page; |
6ef7145f |
885 | } |
886 | |
80e86e94 |
887 | # Default top frame |
888 | sub command6 { |
889 | print "SquirrelMail defaults to using the whole of the browser window.\n"; |
890 | print "This allows you to keep it within a specified frame. The default\n"; |
891 | print "is '_top'\n"; |
892 | print "\n"; |
893 | print "[$WHT$frame_top$NRM]: $WHT"; |
894 | $new_frame_top = <STDIN>; |
eaace00e |
895 | if ( $new_frame_top eq "\n" ) { |
80e86e94 |
896 | $new_frame_top = '_top'; |
897 | } else { |
85645192 |
898 | $new_frame_top =~ s/[\r\n]//g; |
80e86e94 |
899 | $new_frame_top =~ s/^\s+$//g; |
900 | } |
901 | return $new_frame_top; |
902 | } |
903 | |
0ae4c1f2 |
904 | # Default link to provider |
905 | sub command7 { |
906 | print "Here you can set the link on the right of the page.\n"; |
8b5c49cd |
907 | print "If empty, it will link to the SquirrelMail About page.\n"; |
0ae4c1f2 |
908 | print "\n"; |
909 | print "[$WHT$provider_uri$NRM]: $WHT"; |
910 | $new_provider_uri = <STDIN>; |
911 | if ( $new_provider_uri eq "\n" ) { |
8b5c49cd |
912 | $new_provider_uri = ''; |
0ae4c1f2 |
913 | } else { |
85645192 |
914 | $new_provider_uri =~ s/[\r\n]//g; |
0ae4c1f2 |
915 | $new_provider_uri =~ s/^\s+$//g; |
916 | } |
7b6563c0 |
917 | return $new_provider_uri; |
0ae4c1f2 |
918 | } |
919 | |
920 | sub command8 { |
921 | print "Here you can set the name of the link on the right of the page.\n"; |
922 | print "The default is 'SquirrelMail/'\n"; |
923 | print "\n"; |
924 | print "[$WHT$provider_name$NRM]: $WHT"; |
925 | $new_provider_name = <STDIN>; |
926 | if ( $new_provider_name eq "\n" ) { |
927 | $new_provider_name = 'SquirrelMail'; |
928 | } else { |
85645192 |
929 | $new_provider_name =~ s/[\r\n]//g; |
0ae4c1f2 |
930 | $new_provider_name =~ s/^\s+$//g; |
931 | } |
7b6563c0 |
932 | return $new_provider_name; |
0ae4c1f2 |
933 | } |
934 | |
828b4753 |
935 | #################################################################################### |
5b6ae78a |
936 | |
828b4753 |
937 | # domain |
938 | sub command11 { |
e1e4f932 |
939 | print "The domain name is the suffix at the end of all email addresses. If\n"; |
5d28b77e |
940 | print "for example, your email address is jdoe\@example.com, then your domain\n"; |
941 | print "would be example.com.\n"; |
eaace00e |
942 | print "\n"; |
943 | print "[$WHT$domain$NRM]: $WHT"; |
944 | $new_domain = <STDIN>; |
945 | if ( $new_domain eq "\n" ) { |
946 | $new_domain = $domain; |
947 | } else { |
85645192 |
948 | $new_domain =~ s/[\r\n]//g; |
eaace00e |
949 | } |
950 | return $new_domain; |
828b4753 |
951 | } |
5b6ae78a |
952 | |
828b4753 |
953 | # imapServerAddress |
954 | sub command12 { |
47a29326 |
955 | print "This is the hostname where your IMAP server can be contacted.\n"; |
eaace00e |
956 | print "[$WHT$imapServerAddress$NRM]: $WHT"; |
957 | $new_imapServerAddress = <STDIN>; |
958 | if ( $new_imapServerAddress eq "\n" ) { |
959 | $new_imapServerAddress = $imapServerAddress; |
960 | } else { |
85645192 |
961 | $new_imapServerAddress =~ s/[\r\n]//g; |
eaace00e |
962 | } |
963 | return $new_imapServerAddress; |
828b4753 |
964 | } |
5b6ae78a |
965 | |
828b4753 |
966 | # imapPort |
967 | sub command13 { |
eaace00e |
968 | print "This is the port that your IMAP server is on. Usually this is 143.\n"; |
969 | print "[$WHT$imapPort$NRM]: $WHT"; |
970 | $new_imapPort = <STDIN>; |
971 | if ( $new_imapPort eq "\n" ) { |
972 | $new_imapPort = $imapPort; |
973 | } else { |
85645192 |
974 | $new_imapPort =~ s/[\r\n]//g; |
eaace00e |
975 | } |
976 | return $new_imapPort; |
828b4753 |
977 | } |
978 | |
979 | # useSendmail |
980 | sub command14 { |
eaace00e |
981 | print "You now need to choose the method that you will use for sending\n"; |
982 | print "messages in SquirrelMail. You can either connect to an SMTP server\n"; |
983 | print "or use sendmail directly.\n"; |
35aaf666 |
984 | if ( lc($useSendmail) eq 'true' ) { |
eaace00e |
985 | $default_value = "1"; |
986 | } else { |
987 | $default_value = "2"; |
988 | } |
989 | print "\n"; |
990 | print " 1. Sendmail\n"; |
991 | print " 2. SMTP\n"; |
992 | print "Your choice [1/2] [$WHT$default_value$NRM]: $WHT"; |
993 | $use_sendmail = <STDIN>; |
994 | if ( ( $use_sendmail =~ /^1\n/i ) |
995 | || ( ( $use_sendmail =~ /^\n/ ) && ( $default_value eq "1" ) ) ) { |
35aaf666 |
996 | $useSendmail = 'true'; |
eaace00e |
997 | } else { |
35aaf666 |
998 | $useSendmail = 'false'; |
eaace00e |
999 | } |
1000 | return $useSendmail; |
828b4753 |
1001 | } |
5b6ae78a |
1002 | |
828b4753 |
1003 | # sendmail_path |
1004 | sub command15 { |
eaace00e |
1005 | if ( $sendmail_path[0] !~ /./ ) { |
1006 | $sendmail_path = "/usr/sbin/sendmail"; |
1007 | } |
1008 | print "Specify where the sendmail executable is located. Usually /usr/sbin/sendmail\n"; |
1009 | print "[$WHT$sendmail_path$NRM]: $WHT"; |
1010 | $new_sendmail_path = <STDIN>; |
1011 | if ( $new_sendmail_path eq "\n" ) { |
1012 | $new_sendmail_path = $sendmail_path; |
1013 | } else { |
85645192 |
1014 | $new_sendmail_path =~ s/[\r\n]//g; |
eaace00e |
1015 | } |
1016 | return $new_sendmail_path; |
828b4753 |
1017 | } |
5b6ae78a |
1018 | |
828b4753 |
1019 | # smtpServerAddress |
1020 | sub command16 { |
47a29326 |
1021 | print "This is the hostname of your SMTP server.\n"; |
eaace00e |
1022 | print "[$WHT$smtpServerAddress$NRM]: $WHT"; |
1023 | $new_smtpServerAddress = <STDIN>; |
1024 | if ( $new_smtpServerAddress eq "\n" ) { |
1025 | $new_smtpServerAddress = $smtpServerAddress; |
1026 | } else { |
85645192 |
1027 | $new_smtpServerAddress =~ s/[\r\n]//g; |
eaace00e |
1028 | } |
1029 | return $new_smtpServerAddress; |
828b4753 |
1030 | } |
1031 | |
1032 | # smtpPort |
1033 | sub command17 { |
eaace00e |
1034 | print "This is the port to connect to for SMTP. Usually 25.\n"; |
1035 | print "[$WHT$smtpPort$NRM]: $WHT"; |
1036 | $new_smtpPort = <STDIN>; |
1037 | if ( $new_smtpPort eq "\n" ) { |
1038 | $new_smtpPort = $smtpPort; |
1039 | } else { |
85645192 |
1040 | $new_smtpPort =~ s/[\r\n]//g; |
eaace00e |
1041 | } |
1042 | return $new_smtpPort; |
bbd30ac8 |
1043 | } |
d2f4c914 |
1044 | |
598294a7 |
1045 | # authenticated server |
a93b12ba |
1046 | sub command18 { |
47a29326 |
1047 | return; |
35aaf666 |
1048 | # This sub disabled by tassium - it has been replaced with smtp_auth_mech |
eaace00e |
1049 | print "Do you wish to use an authenticated SMTP server? Your server must\n"; |
1050 | print "support this in order for SquirrelMail to work with it. We implemented\n"; |
1051 | print "it according to RFC 2554.\n"; |
1052 | |
1053 | $YesNo = 'n'; |
35aaf666 |
1054 | $YesNo = 'y' if ( lc($use_authenticated_smtp) eq 'true' ); |
eaace00e |
1055 | |
1056 | print "Use authenticated SMTP server (y/n) [$WHT$YesNo$NRM]: $WHT"; |
1057 | |
1058 | $new_use_authenticated_smtp = <STDIN>; |
1059 | $new_use_authenticated_smtp =~ tr/yn//cd; |
35aaf666 |
1060 | return 'true' if ( $new_use_authenticated_smtp eq "y" ); |
1061 | return 'false' if ( $new_use_authenticated_smtp eq "n" ); |
eaace00e |
1062 | return $use_authenticated_smtp; |
1063 | } |
d2f4c914 |
1064 | |
2044f95a |
1065 | # pop before SMTP |
1066 | sub command18a { |
1067 | print "Do you wish to use POP3 before SMTP? Your server must\n"; |
1068 | print "support this in order for SquirrelMail to work with it.\n"; |
1069 | |
1070 | $YesNo = 'n'; |
35aaf666 |
1071 | $YesNo = 'y' if ( lc($pop_before_smtp) eq 'true' ); |
2044f95a |
1072 | |
1073 | print "Use pop before SMTP (y/n) [$WHT$YesNo$NRM]: $WHT"; |
1074 | |
1075 | $new_pop_before_smtp = <STDIN>; |
1076 | $new_pop_before_smtp =~ tr/yn//cd; |
35aaf666 |
1077 | return 'true' if ( $new_pop_before_smtp eq "y" ); |
1078 | return 'false' if ( $new_pop_before_smtp eq "n" ); |
2044f95a |
1079 | return $pop_before_smtp; |
1080 | } |
1081 | |
598294a7 |
1082 | # imap_server_type |
d2f4c914 |
1083 | sub command19 { |
eaace00e |
1084 | print "Each IMAP server has its own quirks. As much as we tried to stick\n"; |
1085 | print "to standards, it doesn't help much if the IMAP server doesn't follow\n"; |
1086 | print "the same principles. We have made some work-arounds for some of\n"; |
1087 | print "these servers. If you would like to use them, please select your\n"; |
1088 | print "IMAP server. If you do not wish to use these work-arounds, you can\n"; |
1089 | print "set this to \"other\", and none will be used.\n"; |
b39825f0 |
1090 | print " cyrus = Cyrus IMAP server\n"; |
1091 | print " uw = University of Washington's IMAP server\n"; |
1092 | print " exchange = Microsoft Exchange IMAP server\n"; |
1093 | print " courier = Courier IMAP server\n"; |
1094 | print " macosx = Mac OS X Mailserver\n"; |
1095 | print " hmailserver = hMailServer\n"; |
1096 | print " other = Not one of the above servers\n"; |
eaace00e |
1097 | print "[$WHT$imap_server_type$NRM]: $WHT"; |
1098 | $new_imap_server_type = <STDIN>; |
1099 | |
1100 | if ( $new_imap_server_type eq "\n" ) { |
1101 | $new_imap_server_type = $imap_server_type; |
1102 | } else { |
85645192 |
1103 | $new_imap_server_type =~ s/[\r\n]//g; |
eaace00e |
1104 | } |
1105 | return $new_imap_server_type; |
a93b12ba |
1106 | } |
3f8fe68e |
1107 | |
d47b2518 |
1108 | # invert_time |
d2f4c914 |
1109 | sub command110 { |
eaace00e |
1110 | print "Sometimes the date of messages sent is messed up (off by a few hours\n"; |
1111 | print "on some machines). Typically this happens if the system doesn't support\n"; |
1112 | print "tm_gmtoff. It will happen only if your time zone is \"negative\".\n"; |
1113 | print "This most often occurs on Solaris 7 machines in the United States.\n"; |
1114 | print "By default, this is off. It should be kept off unless problems surface\n"; |
1115 | print "about the time that messages are sent.\n"; |
1116 | print " no = Do NOT fix time -- almost always correct\n"; |
1117 | print " yes = Fix the time for this system\n"; |
1118 | |
1119 | $YesNo = 'n'; |
35aaf666 |
1120 | $YesNo = 'y' if ( lc($invert_time) eq 'true' ); |
eaace00e |
1121 | |
1122 | print "Fix the time for this system (y/n) [$WHT$YesNo$NRM]: $WHT"; |
1123 | |
1124 | $new_invert_time = <STDIN>; |
1125 | $new_invert_time =~ tr/yn//cd; |
35aaf666 |
1126 | return 'true' if ( $new_invert_time eq "y" ); |
1127 | return 'false' if ( $new_invert_time eq "n" ); |
eaace00e |
1128 | return $invert_time; |
1129 | } |
d47b2518 |
1130 | |
d2f4c914 |
1131 | sub command111 { |
eaace00e |
1132 | print "This is the delimiter that your IMAP server uses to distinguish between\n"; |
1133 | print "folders. For example, Cyrus uses '.' as the delimiter and a complete\n"; |
1134 | print "folder would look like 'INBOX.Friends.Bob', while UW uses '/' and would\n"; |
1135 | print "look like 'INBOX/Friends/Bob'. Normally this should be left at 'detect'\n"; |
1136 | print "but if you are sure you know what delimiter your server uses, you can\n"; |
1137 | print "specify it here.\n"; |
1138 | print "\nTo have it autodetect the delimiter, set it to 'detect'.\n\n"; |
1139 | print "[$WHT$optional_delimiter$NRM]: $WHT"; |
1140 | $new_optional_delimiter = <STDIN>; |
1141 | |
1142 | if ( $new_optional_delimiter eq "\n" ) { |
1143 | $new_optional_delimiter = $optional_delimiter; |
1144 | } else { |
85645192 |
1145 | $new_optional_delimiter =~ s/[\r\n]//g; |
eaace00e |
1146 | } |
1147 | return $new_optional_delimiter; |
40ba4d36 |
1148 | } |
b47821fb |
1149 | # IMAP authentication type |
33feaaec |
1150 | # Possible values: login, plain, cram-md5, digest-md5 |
b47821fb |
1151 | # Now offers to detect supported mechs, assuming server & port are set correctly |
1152 | |
1153 | sub command112a { |
80e3fcf8 |
1154 | if ($use_imap_tls =~ /^true\b/i) { |
1155 | print "Auto-detection of login methods is unavailable when using TLS.\n"; |
1156 | } else { |
35aaf666 |
1157 | print "If you have already set the hostname and port number, I can try to\n"; |
1158 | print "detect the mechanisms your IMAP server supports.\n"; |
1159 | print "I will try to detect CRAM-MD5 and DIGEST-MD5 support. I can't test\n"; |
1160 | print "for \"login\" or \"plain\" without knowing a username and password.\n"; |
1161 | print "Auto-detecting is optional - you can safely say \"n\" here.\n"; |
1162 | print "\nTry to detect supported mechanisms? [y/N]: "; |
1163 | $inval=<STDIN>; |
1164 | chomp($inval); |
1165 | if ($inval =~ /^y\b/i) { |
1166 | # Yes, let's try to detect. |
1167 | print "Trying to detect IMAP capabilities...\n"; |
1168 | my $host = $imapServerAddress . ':'. $imapPort; |
1169 | print "CRAM-MD5:\t"; |
1170 | my $tmp = detect_auth_support('IMAP',$host,'CRAM-MD5'); |
1171 | if (defined($tmp)) { |
1172 | if ($tmp eq 'YES') { |
1173 | print "$WHT SUPPORTED$NRM\n"; |
1174 | } else { |
1175 | print "$WHT NOT SUPPORTED$NRM\n"; |
1176 | } |
80e3fcf8 |
1177 | } else { |
35aaf666 |
1178 | print $WHT . " ERROR DETECTING$NRM\n"; |
1179 | } |
1180 | |
1181 | print "DIGEST-MD5:\t"; |
1182 | $tmp = detect_auth_support('IMAP',$host,'DIGEST-MD5'); |
1183 | if (defined($tmp)) { |
1184 | if ($tmp eq 'YES') { |
1185 | print "$WHT SUPPORTED$NRM\n"; |
1186 | } else { |
1187 | print "$WHT NOT SUPPORTED$NRM\n"; |
1188 | } |
1189 | } else { |
1190 | print $WHT . " ERROR DETECTING$NRM\n"; |
1191 | } |
598294a7 |
1192 | |
35aaf666 |
1193 | } |
598294a7 |
1194 | } |
35aaf666 |
1195 | print "\nWhat authentication mechanism do you want to use for IMAP connections?\n\n"; |
1196 | print $WHT . "login" . $NRM . " - Plaintext. If you can do better, you probably should.\n"; |
33feaaec |
1197 | print $WHT . "plain" . $NRM . " - SASL PLAIN. If you need this, you already know it.\n"; |
35aaf666 |
1198 | print $WHT . "cram-md5" . $NRM . " - Slightly better than plaintext methods.\n"; |
1199 | print $WHT . "digest-md5" . $NRM . " - Privacy protection - better than cram-md5.\n"; |
1200 | print "\n*** YOUR IMAP SERVER MUST SUPPORT THE MECHANISM YOU CHOOSE HERE ***\n"; |
1201 | print "If you don't understand or are unsure, you probably want \"login\"\n\n"; |
1202 | print "login, plain, cram-md5, or digest-md5 [$WHT$imap_auth_mech$NRM]: $WHT"; |
b47821fb |
1203 | $inval=<STDIN>; |
1204 | chomp($inval); |
33feaaec |
1205 | if ( ($inval =~ /^cram-md5\b/i) || ($inval =~ /^digest-md5\b/i) || ($inval =~ /^login\b/i) || ($inval =~ /^plain\b/i)) { |
b47821fb |
1206 | return lc($inval); |
1207 | } else { |
1208 | # user entered garbage or default value so nothing needs to be set |
1209 | return $imap_auth_mech; |
1210 | } |
1211 | } |
40ba4d36 |
1212 | |
598294a7 |
1213 | |
b47821fb |
1214 | # SMTP authentication type |
1215 | # Possible choices: none, plain, cram-md5, digest-md5 |
1216 | sub command112b { |
80e3fcf8 |
1217 | if ($use_smtp_tls =~ /^true\b/i) { |
1218 | print "Auto-detection of login methods is unavailable when using TLS.\n"; |
1219 | } else { |
1220 | print "If you have already set the hostname and port number, I can try to\n"; |
1221 | print "automatically detect some of the mechanisms your SMTP server supports.\n"; |
35aaf666 |
1222 | print "Auto-detection is *optional* - you can safely say \"n\" here.\n"; |
80e3fcf8 |
1223 | print "\nTry to detect auth mechanisms? [y/N]: "; |
1224 | $inval=<STDIN>; |
1225 | chomp($inval); |
1226 | if ($inval =~ /^y\b/i) { |
35aaf666 |
1227 | # Yes, let's try to detect. |
1228 | print "Trying to detect supported methods (SMTP)...\n"; |
598294a7 |
1229 | |
35aaf666 |
1230 | # Special case! |
1231 | # Check none by trying to relay to junk@microsoft.com |
1232 | $host = $smtpServerAddress . ':' . $smtpPort; |
1233 | use IO::Socket; |
1234 | my $sock = IO::Socket::INET->new($host); |
1235 | print "Testing none:\t\t$WHT"; |
1236 | if (!defined($sock)) { |
1237 | print " ERROR TESTING\n"; |
1238 | close $sock; |
1239 | } else { |
5d28b77e |
1240 | print $sock "HELO $domain\r\n"; |
35aaf666 |
1241 | $got = <$sock>; # Discard |
5d28b77e |
1242 | print $sock "MAIL FROM:<tester\@squirrelmail.org>\r\n"; |
1243 | $got = <$sock>; # Discard |
1244 | print $sock "RCPT TO:<junk\@microsoft.com\r\n"; |
35aaf666 |
1245 | $got = <$sock>; # This is the important line |
1246 | if ($got =~ /^250\b/) { # SMTP will relay without auth |
1247 | print "SUPPORTED$NRM\n"; |
1248 | } else { |
1249 | print "NOT SUPPORTED$NRM\n"; |
1250 | } |
5d28b77e |
1251 | print $sock "RSET\r\n"; |
1252 | print $sock "QUIT\r\n"; |
35aaf666 |
1253 | close $sock; |
1254 | } |
1255 | # Try login (SquirrelMail default) |
1256 | print "Testing login:\t\t"; |
1257 | $tmp=detect_auth_support('SMTP',$host,'LOGIN'); |
1258 | if (defined($tmp)) { |
1259 | if ($tmp eq 'YES') { |
1260 | print $WHT . "SUPPORTED$NRM\n"; |
1261 | } else { |
1262 | print $WHT . "NOT SUPPORTED$NRM\n"; |
1263 | } |
1264 | } else { |
1265 | print $WHT . "ERROR DETECTING$NRM\n"; |
1266 | } |
598294a7 |
1267 | |
35aaf666 |
1268 | # Try CRAM-MD5 |
80e3fcf8 |
1269 | print "Testing CRAM-MD5:\t"; |
1270 | $tmp=detect_auth_support('SMTP',$host,'CRAM-MD5'); |
1271 | if (defined($tmp)) { |
1272 | if ($tmp eq 'YES') { |
1273 | print $WHT . "SUPPORTED$NRM\n"; |
1274 | } else { |
1275 | print $WHT . "NOT SUPPORTED$NRM\n"; |
1276 | } |
1277 | } else { |
1278 | print $WHT . "ERROR DETECTING$NRM\n"; |
b47821fb |
1279 | } |
598294a7 |
1280 | |
80e3fcf8 |
1281 | |
1282 | print "Testing DIGEST-MD5:\t"; |
1283 | $tmp=detect_auth_support('SMTP',$host,'DIGEST-MD5'); |
1284 | if (defined($tmp)) { |
1285 | if ($tmp eq 'YES') { |
1286 | print $WHT . "SUPPORTED$NRM\n"; |
1287 | } else { |
1288 | print $WHT . "NOT SUPPORTED$NRM\n"; |
1289 | } |
1290 | } else { |
1291 | print $WHT . "ERROR DETECTING$NRM\n"; |
b47821fb |
1292 | } |
598294a7 |
1293 | } |
80e3fcf8 |
1294 | } |
1295 | print "\nWhat authentication mechanism do you want to use for SMTP connections?\n"; |
b47821fb |
1296 | print $WHT . "none" . $NRM . " - Your SMTP server does not require authorization.\n"; |
fe0b18b3 |
1297 | print $WHT . "login" . $NRM . " - Plaintext. If you can do better, you probably should.\n"; |
33feaaec |
1298 | print $WHT . "plain" . $NRM . " - SASL PLAIN. You already know it if you need this.\n"; |
639c7164 |
1299 | print $WHT . "cram-md5" . $NRM . " - Slightly better than plaintext.\n"; |
1300 | print $WHT . "digest-md5" . $NRM . " - Privacy protection - better than cram-md5.\n"; |
fe0b18b3 |
1301 | print $WHT . "\n*** YOUR SMTP SERVER MUST SUPPORT THE MECHANISM YOU CHOOSE HERE ***\n" . $NRM; |
b47821fb |
1302 | print "If you don't understand or are unsure, you probably want \"none\"\n\n"; |
fe0b18b3 |
1303 | print "none, login, cram-md5, or digest-md5 [$WHT$smtp_auth_mech$NRM]: $WHT"; |
47a29326 |
1304 | $inval=<STDIN>; |
1305 | chomp($inval); |
b47821fb |
1306 | if ($inval =~ /^none\b/i) { |
47a29326 |
1307 | # SMTP doesn't necessarily require logins |
1308 | return "none"; |
1309 | } |
598294a7 |
1310 | if ( ($inval =~ /^cram-md5\b/i) || ($inval =~ /^digest-md5\b/i) || |
33feaaec |
1311 | ($inval =~ /^login\b/i) || ($inval =~/^plain\b/i)) { |
47a29326 |
1312 | return lc($inval); |
1313 | } else { |
b47821fb |
1314 | # user entered garbage, or default value so nothing needs to be set |
35aaf666 |
1315 | return $smtp_auth_mech; |
47a29326 |
1316 | } |
1317 | } |
1318 | |
1319 | # TLS |
1320 | # This sub is reused for IMAP and SMTP |
1321 | # Args: service name, default value |
1322 | sub command113 { |
35aaf666 |
1323 | my($default_val,$service,$inval); |
1324 | $service=$_[0]; |
1325 | $default_val=$_[1]; |
1326 | print "TLS (Transport Layer Security) encrypts the traffic between server and client.\n"; |
1327 | print "If you're familiar with SSL, you get the idea.\n"; |
1328 | print "To use this feature, your " . $service . " server must offer TLS\n"; |
1329 | print "capability, plus PHP 4.3.x with OpenSSL support.\n"; |
1330 | print "\nIf your " . $service . " server is localhost, you can safely disable this.\n"; |
1331 | print "If it is remote, you may wish to seriously consider enabling this.\n"; |
47a29326 |
1332 | print "Enable TLS (y/n) [$WHT"; |
35aaf666 |
1333 | if ($default_val eq 'true') { |
47a29326 |
1334 | print "y"; |
1335 | } else { |
1336 | print "n"; |
1337 | } |
598294a7 |
1338 | print "$NRM]: $WHT"; |
47a29326 |
1339 | $inval=<STDIN>; |
1340 | $inval =~ tr/yn//cd; |
35aaf666 |
1341 | return 'true' if ( $inval eq "y" ); |
1342 | return 'false' if ( $inval eq "n" ); |
47a29326 |
1343 | return $default_val; |
35aaf666 |
1344 | } |
47a29326 |
1345 | |
35aaf666 |
1346 | sub command114{ |
1347 | print "\nUse this to suppress insertion of SquirrelMail Received: headers\n"; |
1348 | print "in outbound messages.\n\n"; |
47a29326 |
1349 | |
35aaf666 |
1350 | $YesNo = 'n'; |
1351 | $YesNo = 'y' if ( lc($skip_SM_header) eq 'true' ); |
47a29326 |
1352 | |
35aaf666 |
1353 | print "Suppress SM header (y/n) [$WHT$YesNo$NRM]: $WHT"; |
1354 | $new_skip_SM_header = <STDIN>; |
1355 | chomp($new_skip_SM_header); |
1356 | |
1357 | return 'true' if ( lc($new_skip_SM_header) eq 'y' ); |
1358 | return 'false' if ( lc($new_skip_SM_header) eq 'n' ); |
598294a7 |
1359 | return $skip_SM_header; |
35aaf666 |
1360 | } |
47a29326 |
1361 | |
3f8fe68e |
1362 | # MOTD |
1363 | sub command71 { |
eaace00e |
1364 | print "\nYou can now create the welcome message that is displayed\n"; |
1365 | print "every time a user logs on. You can use HTML or just plain\n"; |
dcc1cc82 |
1366 | print |
1367 | "text. If you do not wish to have one, just make it blank.\n\n(Type @ on a blank line to exit)\n"; |
eaace00e |
1368 | |
1369 | $new_motd = ""; |
1370 | do { |
1371 | print "] "; |
1372 | $line = <STDIN>; |
85645192 |
1373 | $line =~ s/[\r\n]//g; |
eaace00e |
1374 | if ( $line ne "@" ) { |
1375 | $line =~ s/ /\ \ /g; |
1376 | $line =~ s/\t/\ \ \ \ /g; |
1377 | $line =~ s/$/ /; |
d756b071 |
1378 | $line =~ s/\"/"/g; |
eaace00e |
1379 | |
1380 | $new_motd = $new_motd . $line; |
1381 | } |
1382 | } while ( $line ne "@" ); |
1383 | return $new_motd; |
3f8fe68e |
1384 | } |
911ad01c |
1385 | |
9d0c7bee |
1386 | ################# PLUGINS ################### |
1387 | |
1388 | sub command81 { |
85645192 |
1389 | $command =~ s/[\s\n\r]*//g; |
eaace00e |
1390 | if ( $command > 0 ) { |
1391 | $command = $command - 1; |
1392 | if ( $command <= $#plugins ) { |
1393 | @newplugins = (); |
1394 | $ct = 0; |
1395 | while ( $ct <= $#plugins ) { |
1396 | if ( $ct != $command ) { |
1397 | @newplugins = ( @newplugins, $plugins[$ct] ); |
1398 | } |
1399 | $ct++; |
9d0c7bee |
1400 | } |
eaace00e |
1401 | @plugins = @newplugins; |
1402 | } elsif ( $command <= $#plugins + $#unused_plugins + 1 ) { |
1403 | $num = $command - $#plugins - 1; |
1404 | @newplugins = @plugins; |
1405 | $ct = 0; |
1406 | while ( $ct <= $#unused_plugins ) { |
1407 | if ( $ct == $num ) { |
1408 | @newplugins = ( @newplugins, $unused_plugins[$ct] ); |
eaace00e |
1409 | } |
1410 | $ct++; |
9d0c7bee |
1411 | } |
eaace00e |
1412 | @plugins = @newplugins; |
1413 | } |
1414 | } |
1415 | return @plugins; |
1416 | } |
9d0c7bee |
1417 | |
911ad01c |
1418 | ################# FOLDERS ################### |
1419 | |
1420 | # default_folder_prefix |
1421 | sub command21 { |
eaace00e |
1422 | print "Some IMAP servers (UW, for example) store mail and folders in\n"; |
1423 | print "your user space in a separate subdirectory. This is where you\n"; |
1424 | print "specify what that directory is.\n"; |
1425 | print "\n"; |
1426 | print "EXAMPLE: mail/"; |
1427 | print "\n"; |
1428 | print "NOTE: If you use Cyrus, or some server that would not use this\n"; |
1429 | print " option, you must set this to 'none'.\n"; |
1430 | print "\n"; |
1431 | print "[$WHT$default_folder_prefix$NRM]: $WHT"; |
1432 | $new_default_folder_prefix = <STDIN>; |
1433 | |
1434 | if ( $new_default_folder_prefix eq "\n" ) { |
1435 | $new_default_folder_prefix = $default_folder_prefix; |
1436 | } else { |
d52532d5 |
1437 | $new_default_folder_prefix =~ s/[\r\n]//g; |
eaace00e |
1438 | } |
d52532d5 |
1439 | if ( ( $new_default_folder_prefix =~ /^\s*$/ ) || ( $new_default_folder_prefix =~ m/^none$/i ) ) { |
eaace00e |
1440 | $new_default_folder_prefix = ""; |
1441 | } else { |
d52532d5 |
1442 | # add the trailing delimiter only if we know what the server is. |
ce9f808b |
1443 | if (($imap_server_type eq 'cyrus' and |
1444 | $optional_delimiter eq 'detect') or |
1445 | ($imap_server_type eq 'courier' and |
1446 | $optional_delimiter eq 'detect')) { |
d52532d5 |
1447 | $new_default_folder_prefix =~ s/\.*$/\./; |
ce9f808b |
1448 | } elsif ($imap_server_type eq 'uw' and |
1449 | $optional_delimiter eq 'detect') { |
d52532d5 |
1450 | $new_default_folder_prefix =~ s/\/*$/\//; |
0e21688d |
1451 | } |
eaace00e |
1452 | } |
1453 | return $new_default_folder_prefix; |
911ad01c |
1454 | } |
1455 | |
1456 | # Show Folder Prefix |
1457 | sub command22 { |
eaace00e |
1458 | print "It is possible to set up the default folder prefix as a user\n"; |
1459 | print "specific option, where each user can specify what their mail\n"; |
1460 | print "folder is. If you set this to false, they will never see the\n"; |
1461 | print "option, but if it is true, this option will appear in the\n"; |
1462 | print "'options' section.\n"; |
1463 | print "\n"; |
1464 | print "NOTE: You set the default folder prefix in option '1' of this\n"; |
1465 | print " section. That will be the default if the user doesn't\n"; |
1466 | print " specify anything different.\n"; |
1467 | print "\n"; |
1468 | |
35aaf666 |
1469 | if ( lc($show_prefix_option) eq 'true' ) { |
eaace00e |
1470 | $default_value = "y"; |
1471 | } else { |
1472 | $default_value = "n"; |
1473 | } |
1474 | print "\n"; |
1475 | print "Show option (y/n) [$WHT$default_value$NRM]: $WHT"; |
1476 | $new_show = <STDIN>; |
1477 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1478 | $show_prefix_option = 'true'; |
eaace00e |
1479 | } else { |
35aaf666 |
1480 | $show_prefix_option = 'false'; |
eaace00e |
1481 | } |
1482 | return $show_prefix_option; |
911ad01c |
1483 | } |
1484 | |
598294a7 |
1485 | # Trash Folder |
f7b1b3b1 |
1486 | sub command23a { |
eaace00e |
1487 | print "You can now specify where the default trash folder is located.\n"; |
1488 | print "On servers where you do not want this, you can set it to anything\n"; |
1489 | print "and set option 6 to false.\n"; |
1490 | print "\n"; |
1491 | print "This is relative to where the rest of your email is kept. You do\n"; |
1492 | print "not need to worry about their mail directory. If this folder\n"; |
1493 | print "would be ~/mail/trash on the filesystem, you only need to specify\n"; |
1494 | print "that this is 'trash', and be sure to put 'mail/' in option 1.\n"; |
1495 | print "\n"; |
1496 | |
1497 | print "[$WHT$trash_folder$NRM]: $WHT"; |
1498 | $new_trash_folder = <STDIN>; |
1499 | if ( $new_trash_folder eq "\n" ) { |
1500 | $new_trash_folder = $trash_folder; |
1501 | } else { |
85645192 |
1502 | $new_trash_folder =~ s/[\r\n]//g; |
eaace00e |
1503 | } |
1504 | return $new_trash_folder; |
911ad01c |
1505 | } |
1506 | |
598294a7 |
1507 | # Sent Folder |
f7b1b3b1 |
1508 | sub command23b { |
eaace00e |
1509 | print "This is where messages that are sent will be stored. SquirrelMail\n"; |
1510 | print "by default puts a copy of all outgoing messages in this folder.\n"; |
1511 | print "\n"; |
1512 | print "This is relative to where the rest of your email is kept. You do\n"; |
1513 | print "not need to worry about their mail directory. If this folder\n"; |
1514 | print "would be ~/mail/sent on the filesystem, you only need to specify\n"; |
1515 | print "that this is 'sent', and be sure to put 'mail/' in option 1.\n"; |
1516 | print "\n"; |
1517 | |
1518 | print "[$WHT$sent_folder$NRM]: $WHT"; |
1519 | $new_sent_folder = <STDIN>; |
1520 | if ( $new_sent_folder eq "\n" ) { |
1521 | $new_sent_folder = $sent_folder; |
1522 | } else { |
85645192 |
1523 | $new_sent_folder =~ s/[\r\n]//g; |
eaace00e |
1524 | } |
1525 | return $new_sent_folder; |
911ad01c |
1526 | } |
1527 | |
598294a7 |
1528 | # Draft Folder |
f7b1b3b1 |
1529 | sub command23c { |
eaace00e |
1530 | print "You can now specify where the default draft folder is located.\n"; |
1531 | print "On servers where you do not want this, you can set it to anything\n"; |
1532 | print "and set option 9 to false.\n"; |
1533 | print "\n"; |
1534 | print "This is relative to where the rest of your email is kept. You do\n"; |
1535 | print "not need to worry about their mail directory. If this folder\n"; |
1536 | print "would be ~/mail/drafts on the filesystem, you only need to specify\n"; |
1537 | print "that this is 'drafts', and be sure to put 'mail/' in option 1.\n"; |
1538 | print "\n"; |
1539 | |
1540 | print "[$WHT$draft_folder$NRM]: $WHT"; |
1541 | $new_draft_folder = <STDIN>; |
1542 | if ( $new_draft_folder eq "\n" ) { |
1543 | $new_draft_folder = $draft_folder; |
1544 | } else { |
85645192 |
1545 | $new_draft_folder =~ s/[\r\n]//g; |
eaace00e |
1546 | } |
1547 | return $new_draft_folder; |
f7b1b3b1 |
1548 | } |
1549 | |
598294a7 |
1550 | # default move to trash |
f7b1b3b1 |
1551 | sub command24a { |
eaace00e |
1552 | print "By default, should messages get moved to the trash folder? You\n"; |
1553 | print "can specify the default trash folder in option 3. If this is set\n"; |
1554 | print "to false, messages will get deleted immediately without moving\n"; |
1555 | print "to the trash folder.\n"; |
1556 | print "\n"; |
1557 | print "Trash folder is currently: $trash_folder\n"; |
1558 | print "\n"; |
1559 | |
35aaf666 |
1560 | if ( lc($default_move_to_trash) eq 'true' ) { |
eaace00e |
1561 | $default_value = "y"; |
1562 | } else { |
1563 | $default_value = "n"; |
1564 | } |
1565 | print "By default, move to trash (y/n) [$WHT$default_value$NRM]: $WHT"; |
1566 | $new_show = <STDIN>; |
1567 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1568 | $default_move_to_trash = 'true'; |
eaace00e |
1569 | } else { |
35aaf666 |
1570 | $default_move_to_trash = 'false'; |
eaace00e |
1571 | } |
1572 | return $default_move_to_trash; |
2f287147 |
1573 | } |
1574 | |
598294a7 |
1575 | # default move to sent |
f7b1b3b1 |
1576 | sub command24b { |
eaace00e |
1577 | print "By default, should messages get moved to the sent folder? You\n"; |
1578 | print "can specify the default sent folder in option 4. If this is set\n"; |
1579 | print "to false, messages will get sent and no copy will be made.\n"; |
1580 | print "\n"; |
6517cfd0 |
1581 | print "Sent folder is currently: $sent_folder\n"; |
eaace00e |
1582 | print "\n"; |
1583 | |
35aaf666 |
1584 | if ( lc($default_move_to_sent) eq 'true' ) { |
eaace00e |
1585 | $default_value = "y"; |
1586 | } else { |
1587 | $default_value = "n"; |
1588 | } |
1589 | print "By default, move to sent (y/n) [$WHT$default_value$NRM]: $WHT"; |
1590 | $new_show = <STDIN>; |
1591 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1592 | $default_move_to_sent = 'true'; |
eaace00e |
1593 | } else { |
35aaf666 |
1594 | $default_move_to_sent = 'false'; |
eaace00e |
1595 | } |
1596 | return $default_move_to_sent; |
2f287147 |
1597 | } |
1598 | |
f7b1b3b1 |
1599 | # default save as draft |
1600 | sub command24c { |
eaace00e |
1601 | print "By default, should the save to draft option be shown? You can\n"; |
1602 | print "specify the default drafts folder in option 5. If this is set\n"; |
1603 | print "to false, users will not be shown the save to draft option.\n"; |
1604 | print "\n"; |
1605 | print "Drafts folder is currently: $draft_folder\n"; |
1606 | print "\n"; |
1607 | |
35aaf666 |
1608 | if ( lc($default_move_to_draft) eq 'true' ) { |
eaace00e |
1609 | $default_value = "y"; |
1610 | } else { |
1611 | $default_value = "n"; |
1612 | } |
1613 | print "By default, save as draft (y/n) [$WHT$default_value$NRM]: $WHT"; |
1614 | $new_show = <STDIN>; |
1615 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1616 | $default_save_as_draft = 'true'; |
eaace00e |
1617 | } else { |
35aaf666 |
1618 | $default_save_as_draft = 'false'; |
eaace00e |
1619 | } |
1620 | return $default_save_as_draft; |
f7b1b3b1 |
1621 | } |
1622 | |
598294a7 |
1623 | # List special folders first |
2f287147 |
1624 | sub command27 { |
eaace00e |
1625 | print "SquirrelMail has what we call 'special folders' that are not\n"; |
1626 | print "manipulated and viewed like normal folders. Some examples of\n"; |
1627 | print "these folders would be INBOX, Trash, Sent, etc. This option\n"; |
1628 | print "Simply asks if you want these folders listed first in the folder\n"; |
1629 | print "listing.\n"; |
1630 | print "\n"; |
1631 | |
35aaf666 |
1632 | if ( lc($list_special_folders_first) eq 'true' ) { |
eaace00e |
1633 | $default_value = "y"; |
1634 | } else { |
1635 | $default_value = "n"; |
1636 | } |
1637 | print "\n"; |
1638 | print "List first (y/n) [$WHT$default_value$NRM]: $WHT"; |
1639 | $new_show = <STDIN>; |
1640 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1641 | $list_special_folders_first = 'true'; |
eaace00e |
1642 | } else { |
35aaf666 |
1643 | $list_special_folders_first = 'false'; |
eaace00e |
1644 | } |
1645 | return $list_special_folders_first; |
911ad01c |
1646 | } |
1647 | |
598294a7 |
1648 | # Show special folders color |
2f287147 |
1649 | sub command28 { |
eaace00e |
1650 | print "SquirrelMail has what we call 'special folders' that are not\n"; |
1651 | print "manipulated and viewed like normal folders. Some examples of\n"; |
1652 | print "these folders would be INBOX, Trash, Sent, etc. This option\n"; |
1653 | print "wants to know if we should display special folders in a\n"; |
1654 | print "color than the other folders.\n"; |
1655 | print "\n"; |
1656 | |
35aaf666 |
1657 | if ( lc($use_special_folder_color) eq 'true' ) { |
eaace00e |
1658 | $default_value = "y"; |
1659 | } else { |
1660 | $default_value = "n"; |
1661 | } |
1662 | print "\n"; |
1663 | print "Show color (y/n) [$WHT$default_value$NRM]: $WHT"; |
1664 | $new_show = <STDIN>; |
1665 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1666 | $use_special_folder_color = 'true'; |
eaace00e |
1667 | } else { |
35aaf666 |
1668 | $use_special_folder_color = 'false'; |
eaace00e |
1669 | } |
1670 | return $use_special_folder_color; |
911ad01c |
1671 | } |
1672 | |
598294a7 |
1673 | # Auto expunge |
2f287147 |
1674 | sub command29 { |
eaace00e |
1675 | print "The way that IMAP handles deleting messages is as follows. You\n"; |
1676 | print "mark the message as deleted, and then to 'really' delete it, you\n"; |
1677 | print "expunge it. This option asks if you want to just have messages\n"; |
1678 | print "marked as deleted, or if you want SquirrelMail to expunge the \n"; |
1679 | print "messages too.\n"; |
1680 | print "\n"; |
1681 | |
35aaf666 |
1682 | if ( lc($auto_expunge) eq 'true' ) { |
eaace00e |
1683 | $default_value = "y"; |
1684 | } else { |
1685 | $default_value = "n"; |
1686 | } |
1687 | print "Auto expunge (y/n) [$WHT$default_value$NRM]: $WHT"; |
1688 | $new_show = <STDIN>; |
1689 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1690 | $auto_expunge = 'true'; |
eaace00e |
1691 | } else { |
35aaf666 |
1692 | $auto_expunge = 'false'; |
eaace00e |
1693 | } |
1694 | return $auto_expunge; |
911ad01c |
1695 | } |
1696 | |
598294a7 |
1697 | # Default sub of inbox |
2f287147 |
1698 | sub command210 { |
eaace00e |
1699 | print "Some IMAP servers (Cyrus) have all folders as subfolders of INBOX.\n"; |
1700 | print "This can cause some confusion in folder creation for users when\n"; |
1701 | print "they try to create folders and don't put it as a subfolder of INBOX\n"; |
1702 | print "and get permission errors. This option asks if you want folders\n"; |
1703 | print "to be subfolders of INBOX by default.\n"; |
1704 | print "\n"; |
1705 | |
35aaf666 |
1706 | if ( lc($default_sub_of_inbox) eq 'true' ) { |
eaace00e |
1707 | $default_value = "y"; |
1708 | } else { |
1709 | $default_value = "n"; |
1710 | } |
1711 | print "Default sub of INBOX (y/n) [$WHT$default_value$NRM]: $WHT"; |
1712 | $new_show = <STDIN>; |
1713 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1714 | $default_sub_of_inbox = 'true'; |
eaace00e |
1715 | } else { |
35aaf666 |
1716 | $default_sub_of_inbox = 'false'; |
eaace00e |
1717 | } |
1718 | return $default_sub_of_inbox; |
911ad01c |
1719 | } |
1720 | |
598294a7 |
1721 | # Show contain subfolder option |
2f287147 |
1722 | sub command211 { |
eaace00e |
1723 | print "Some IMAP servers (UW) make it so that there are two types of\n"; |
1724 | print "folders. Those that contain messages, and those that contain\n"; |
1725 | print "subfolders. If this is the case for your server, set this to\n"; |
1726 | print "true, and it will ask the user whether the folder they are\n"; |
1727 | print "creating contains subfolders or messages.\n"; |
1728 | print "\n"; |
1729 | |
35aaf666 |
1730 | if ( lc($show_contain_subfolders_option) eq 'true' ) { |
eaace00e |
1731 | $default_value = "y"; |
1732 | } else { |
1733 | $default_value = "n"; |
1734 | } |
1735 | print "Show option (y/n) [$WHT$default_value$NRM]: $WHT"; |
1736 | $new_show = <STDIN>; |
1737 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1738 | $show_contain_subfolders_option = 'true'; |
eaace00e |
1739 | } else { |
35aaf666 |
1740 | $show_contain_subfolders_option = 'false'; |
eaace00e |
1741 | } |
1742 | return $show_contain_subfolders_option; |
911ad01c |
1743 | } |
1744 | |
598294a7 |
1745 | # Default Unseen Notify |
24fc5dd2 |
1746 | sub command212 { |
eaace00e |
1747 | print "This option specifies where the users will receive notification\n"; |
1748 | print "about unseen messages by default. This is of course an option that\n"; |
1749 | print "can be changed on a user level.\n"; |
1750 | print " 1 = No notification\n"; |
1751 | print " 2 = Only on the INBOX\n"; |
1752 | print " 3 = On all folders\n"; |
1753 | print "\n"; |
1754 | |
1755 | print "Which one should be default (1,2,3)? [$WHT$default_unseen_notify$NRM]: $WHT"; |
1756 | $new_show = <STDIN>; |
85645192 |
1757 | if ( $new_show =~ /^[123]\n/i ) { |
eaace00e |
1758 | $default_unseen_notify = $new_show; |
1759 | } |
85645192 |
1760 | $default_unseen_notify =~ s/[\r\n]//g; |
eaace00e |
1761 | return $default_unseen_notify; |
24fc5dd2 |
1762 | } |
1763 | |
598294a7 |
1764 | # Default Unseen Type |
24fc5dd2 |
1765 | sub command213 { |
eaace00e |
1766 | print "Here you can define the default way that unseen messages will be displayed\n"; |
1767 | print "to the user in the folder listing on the left side.\n"; |
1768 | print " 1 = Only unseen messages (4)\n"; |
1769 | print " 2 = Unseen and Total messages (4/27)\n"; |
1770 | print "\n"; |
1771 | |
1772 | print "Which one should be default (1,2)? [$WHT$default_unseen_type$NRM]: $WHT"; |
1773 | $new_show = <STDIN>; |
85645192 |
1774 | if ( $new_show =~ /^[12]\n/i ) { |
eaace00e |
1775 | $default_unseen_type = $new_show; |
1776 | } |
85645192 |
1777 | $default_unseen_type =~ s/[\r\n]//g; |
eaace00e |
1778 | return $default_unseen_type; |
24fc5dd2 |
1779 | } |
1780 | |
f7bfc9de |
1781 | # Auto create special folders |
1782 | sub command214 { |
eaace00e |
1783 | print "Would you like the Sent, Trash, and Drafts folders to be created\n"; |
1784 | print "automatically print for you when a user logs in? If the user\n"; |
1785 | print "accidentally deletes their special folders, this option will\n"; |
1786 | print "automatically create it again for them.\n"; |
1787 | print "\n"; |
1788 | |
35aaf666 |
1789 | if ( lc($auto_create_special) eq 'true' ) { |
eaace00e |
1790 | $default_value = "y"; |
1791 | } else { |
1792 | $default_value = "n"; |
1793 | } |
1794 | print "Auto create special folders? (y/n) [$WHT$default_value$NRM]: $WHT"; |
1795 | $new_show = <STDIN>; |
1796 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1797 | $auto_create_special = 'true'; |
eaace00e |
1798 | } else { |
35aaf666 |
1799 | $auto_create_special = 'false'; |
eaace00e |
1800 | } |
1801 | return $auto_create_special; |
f7bfc9de |
1802 | } |
1803 | |
598294a7 |
1804 | # Automatically delete folders |
4e85a37f |
1805 | sub command215 { |
d04165f3 |
1806 | if ( $imap_server_type eq "uw" ) { |
1807 | print "UW IMAP servers will not allow folders containing mail to also contain folders.\n"; |
1808 | print "Deleting folders will bypass the trash folder and be immediately deleted\n\n"; |
98468fba |
1809 | print "If this is not the correct value for your server,\n"; |
1810 | print "please use option D on the Main Menu to configure your server correctly.\n\n"; |
2eec12b5 |
1811 | print "Press any key to continue...\n"; |
1812 | $new_delete = <STDIN>; |
35aaf666 |
1813 | $delete_folder = 'true'; |
598294a7 |
1814 | } else { |
d04165f3 |
1815 | if ( $imap_server_type eq "courier" ) { |
1816 | print "Courier (or Courier-IMAP) IMAP servers may not support "; |
1817 | print "subfolders of Trash. \n"; |
1818 | print "Specifically, if Courier is set to always move messages to Trash, \n"; |
1819 | print "Trash will be treated by Courier as a special folder that does not \n"; |
1820 | print "allow subfolders. \n\n"; |
1821 | print "Please verify your Courier configuration, and test folder deletion \n"; |
598294a7 |
1822 | print "when changing this setting.\n\n"; |
d04165f3 |
1823 | } |
1824 | |
1825 | print "Are subfolders of the Trash supported by your IMAP server?\n"; |
1826 | print "If so, should deleted folders be sent to Trash?\n"; |
1827 | print "If not, say no (deleted folders should not be sent to Trash)\n\n"; |
1828 | # reversal of logic. |
1829 | # question was: Should folders be automatically deleted instead of sent to trash.. |
598294a7 |
1830 | # we've changed the question to make it more clear, |
1831 | # and are here handling that to avoid changing the answers.. |
35aaf666 |
1832 | if ( lc($delete_folder) eq 'true' ) { |
2eec12b5 |
1833 | $default_value = "n"; |
d04165f3 |
1834 | } else { |
1835 | $default_value = "y"; |
2eec12b5 |
1836 | } |
d04165f3 |
1837 | print "Send deleted folders to Trash? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2eec12b5 |
1838 | $new_delete = <STDIN>; |
1839 | if ( ( $new_delete =~ /^y\n/i ) || ( ( $new_delete =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1840 | $delete_folder = 'false'; |
d04165f3 |
1841 | } else { |
35aaf666 |
1842 | $delete_folder = 'true'; |
2eec12b5 |
1843 | } |
eaace00e |
1844 | } |
1845 | return $delete_folder; |
1846 | } |
24fc5dd2 |
1847 | |
ca85aabe |
1848 | #noselect fix |
1849 | sub command216 { |
1850 | print "Some IMAP server allow subfolders to exist even if the parent\n"; |
1851 | print "folders do not. This fixes some problems with the folder list\n"; |
1852 | print "when this is the case, causing the /NoSelect folders to be displayed\n"; |
1853 | print "\n"; |
1854 | |
35aaf666 |
1855 | if ( lc($noselect_fix_enable) eq 'true' ) { |
ca85aabe |
1856 | $default_value = "y"; |
1857 | } else { |
1858 | $default_value = "n"; |
1859 | } |
1860 | print "enable noselect fix? (y/n) [$WHT$noselect_fix_enable$NRM]: $WHT"; |
1861 | $noselect_fix_enable = <STDIN>; |
1862 | if ( ( $noselect_fix_enable =~ /^y\n/i ) || ( ( $noselect_fix_enable =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
1863 | $noselect_fix_enable = 'true'; |
ca85aabe |
1864 | } else { |
35aaf666 |
1865 | $noselect_fix_enable = 'false'; |
ca85aabe |
1866 | } |
1867 | return $noselect_fix_enable; |
1868 | } |
ccfb2029 |
1869 | ############# GENERAL OPTIONS ##################### |
1870 | |
ccfb2029 |
1871 | # Data directory |
3392dc86 |
1872 | sub command33a { |
e6566358 |
1873 | print "Specify the location for your data directory.\n"; |
1874 | print "The path name can be absolute or relative (to the config directory).\n"; |
1875 | print "It doesn't matter. Here are two examples:\n"; |
1876 | print " Absolute: /var/spool/data/\n"; |
598294a7 |
1877 | print " Relative: ../data/\n"; |
8bd9e0dd |
1878 | print "Relative paths to directories outside of the SquirrelMail distribution\n"; |
e6566358 |
1879 | print "will be converted to their absolute path equivalents in config.php.\n\n"; |
30e9932c |
1880 | print "Note: There are potential security risks with having a writeable directory\n"; |
e6566358 |
1881 | print "under the web server's root directory (ex: /home/httpd/html).\n"; |
1882 | print "For this reason, it is recommended to put the data directory\n"; |
2eec12b5 |
1883 | print "in an alternate location of your choice. \n"; |
1884 | print "\n"; |
1885 | |
eaace00e |
1886 | print "[$WHT$data_dir$NRM]: $WHT"; |
1887 | $new_data_dir = <STDIN>; |
1888 | if ( $new_data_dir eq "\n" ) { |
1889 | $new_data_dir = $data_dir; |
1890 | } else { |
85645192 |
1891 | $new_data_dir =~ s/[\r\n]//g; |
eaace00e |
1892 | } |
1893 | if ( $new_data_dir =~ /^\s*$/ ) { |
1894 | $new_data_dir = ""; |
1895 | } else { |
1896 | $new_data_dir =~ s/\/*$//g; |
1897 | $new_data_dir =~ s/$/\//g; |
1898 | } |
1899 | return $new_data_dir; |
ccfb2029 |
1900 | } |
1901 | |
1902 | # Attachment directory |
3392dc86 |
1903 | sub command33b { |
eaace00e |
1904 | print "Path to directory used for storing attachments while a mail is\n"; |
e6566358 |
1905 | print "being sent. The path name can be absolute or relative (to the config directory).\n"; |
1906 | print "It doesn't matter. Here are two examples:\n"; |
1907 | print " Absolute: /var/spool/attach/\n"; |
1908 | print " Relative: ../attach/\n"; |
1909 | print "Relative paths to directories outside of the SquirrelMail distribution\n"; |
1910 | print "will be converted to their absolute path equivalents in config.php.\n\n"; |
1911 | print "Note: There are a few security considerations regarding this\n"; |
eaace00e |
1912 | print "directory:\n"; |
1913 | print " 1. It should have the permission 733 (rwx-wx-wx) to make it\n"; |
1914 | print " impossible for a random person with access to the webserver\n"; |
1915 | print " to list files in this directory. Confidential data might\n"; |
1916 | print " be laying around in there.\n"; |
e6566358 |
1917 | print " Depending on your user:group assignments, 730 (rwx-wx---)\n"; |
1918 | print " may be possible, and more secure (e.g. root:apache)\n"; |
eaace00e |
1919 | print " 2. Since the webserver is not able to list the files in the\n"; |
1920 | print " content is also impossible for the webserver to delete files\n"; |
1921 | print " lying around there for too long.\n"; |
1922 | print " 3. It should probably be another directory than the data\n"; |
1923 | print " directory specified in option 3.\n"; |
1924 | print "\n"; |
1925 | |
1926 | print "[$WHT$attachment_dir$NRM]: $WHT"; |
1927 | $new_attachment_dir = <STDIN>; |
1928 | if ( $new_attachment_dir eq "\n" ) { |
1929 | $new_attachment_dir = $attachment_dir; |
1930 | } else { |
85645192 |
1931 | $new_attachment_dir =~ s/[\r\n]//g; |
eaace00e |
1932 | } |
1933 | if ( $new_attachment_dir =~ /^\s*$/ ) { |
1934 | $new_attachment_dir = ""; |
1935 | } else { |
1936 | $new_attachment_dir =~ s/\/*$//g; |
1937 | $new_attachment_dir =~ s/$/\//g; |
1938 | } |
1939 | return $new_attachment_dir; |
ccfb2029 |
1940 | } |
1941 | |
3392dc86 |
1942 | sub command33c { |
eaace00e |
1943 | print "The directory hash level setting allows you to configure the level\n"; |
598294a7 |
1944 | print "of hashing that SquirrelMail employs in your data and attachment\n"; |
eaace00e |
1945 | print "directories. This value must be an integer ranging from 0 to 4.\n"; |
598294a7 |
1946 | print "When this value is set to 0, SquirrelMail will simply store all\n"; |
eaace00e |
1947 | print "files as normal in the data and attachment directories. However,\n"; |
1948 | print "when set to a value from 1 to 4, a simple hashing scheme will be\n"; |
1949 | print "used to organize the files in this directory. In short, the crc32\n"; |
1950 | print "value for a username will be computed. Then, up to the first 4\n"; |
1951 | print "digits of the hash, as set by this configuration value, will be\n"; |
1952 | print "used to directory hash the files for that user in the data and\n"; |
1953 | print "attachment directory. This allows for better performance on\n"; |
1954 | print "servers with larger numbers of users.\n"; |
1955 | print "\n"; |
1956 | |
1957 | print "[$WHT$dir_hash_level$NRM]: $WHT"; |
1958 | $new_dir_hash_level = <STDIN>; |
1959 | if ( $new_dir_hash_level eq "\n" ) { |
1960 | $new_dir_hash_level = $dir_hash_level; |
1961 | } else { |
85645192 |
1962 | $new_dir_hash_level =~ s/[\r\n]//g; |
eaace00e |
1963 | } |
1964 | if ( ( int($new_dir_hash_level) < 0 ) |
1965 | || ( int($new_dir_hash_level) > 4 ) |
1966 | || !( int($new_dir_hash_level) eq $new_dir_hash_level ) ) { |
1967 | print "Invalid Directory Hash Level.\n"; |
1968 | print "Value must be an integer ranging from 0 to 4\n"; |
1969 | print "Hit enter to continue.\n"; |
1970 | $enter_key = <STDIN>; |
1971 | |
1972 | $new_dir_hash_level = $dir_hash_level; |
1973 | } |
1974 | |
1975 | return $new_dir_hash_level; |
3392dc86 |
1976 | } |
ccfb2029 |
1977 | |
1978 | sub command35 { |
eaace00e |
1979 | print "This is the default size (in pixels) of the left folder list.\n"; |
1980 | print "Default is 200, but you can set it to whatever you wish. This\n"; |
1981 | print "is a user preference, so this will only show up as their default.\n"; |
1982 | print "\n"; |
1983 | print "[$WHT$default_left_size$NRM]: $WHT"; |
1984 | $new_default_left_size = <STDIN>; |
1985 | if ( $new_default_left_size eq "\n" ) { |
1986 | $new_default_left_size = $default_left_size; |
1987 | } else { |
85645192 |
1988 | $new_default_left_size =~ s/[\r\n]//g; |
eaace00e |
1989 | } |
1990 | return $new_default_left_size; |
ccfb2029 |
1991 | } |
1992 | |
985f7c88 |
1993 | sub command36 { |
eaace00e |
1994 | print "Some IMAP servers only have lowercase letters in the usernames\n"; |
1995 | print "but they still allow people with uppercase to log in. This\n"; |
1996 | print "causes a problem with the user's preference files. This option\n"; |
1997 | print "transparently changes all usernames to lowercase."; |
1998 | print "\n"; |
1999 | |
35aaf666 |
2000 | if ( lc($force_username_lowercase) eq 'true' ) { |
eaace00e |
2001 | $default_value = "y"; |
2002 | } else { |
2003 | $default_value = "n"; |
2004 | } |
2005 | print "Convert usernames to lowercase (y/n) [$WHT$default_value$NRM]: $WHT"; |
2006 | $new_show = <STDIN>; |
2007 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2008 | return 'true'; |
eaace00e |
2009 | } |
35aaf666 |
2010 | return 'false'; |
985f7c88 |
2011 | } |
2012 | |
0d15cd19 |
2013 | sub command37 { |
eaace00e |
2014 | print ""; |
2015 | print "\n"; |
985f7c88 |
2016 | |
35aaf666 |
2017 | if ( lc($default_use_priority) eq 'true' ) { |
eaace00e |
2018 | $default_value = "y"; |
2019 | } else { |
2020 | $default_value = "n"; |
2021 | } |
2022 | |
2023 | print "Allow users to specify priority of outgoing mail (y/n) [$WHT$default_value$NRM]: $WHT"; |
2024 | $new_show = <STDIN>; |
2025 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2026 | return 'true'; |
eaace00e |
2027 | } |
35aaf666 |
2028 | return 'false'; |
826b7f71 |
2029 | } |
2030 | |
eaace00e |
2031 | sub command38 { |
2032 | print ""; |
2033 | print "\n"; |
2034 | |
35aaf666 |
2035 | if ( lc($default_hide_attribution) eq 'true' ) { |
eaace00e |
2036 | $default_value = "y"; |
2037 | } else { |
2038 | $default_value = "n"; |
2039 | } |
2040 | |
2041 | print "Hide SM attributions (y/n) [$WHT$default_value$NRM]: $WHT"; |
2042 | $new_show = <STDIN>; |
2043 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2044 | return 'true'; |
eaace00e |
2045 | } |
35aaf666 |
2046 | return 'false'; |
eaace00e |
2047 | } |
826b7f71 |
2048 | |
8c21da0c |
2049 | sub command39 { |
eaace00e |
2050 | print ""; |
2051 | print "\n"; |
2052 | |
35aaf666 |
2053 | if ( lc($default_use_mdn) eq 'true' ) { |
eaace00e |
2054 | $default_value = "y"; |
2055 | } else { |
2056 | $default_value = "n"; |
2057 | } |
2058 | |
2059 | print "Enable support for read/delivery receipt support (y/n) [$WHT$default_value$NRM]: $WHT"; |
2060 | $new_show = <STDIN>; |
2061 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2062 | return 'true'; |
eaace00e |
2063 | } |
35aaf666 |
2064 | return 'false'; |
8c21da0c |
2065 | } |
2066 | |
8a7d0669 |
2067 | sub command310 { |
2eec12b5 |
2068 | print "This allows you to prevent the editing of the user's name and "; |
2069 | print "email address. This is mainly useful when used with the "; |
8a7d0669 |
2070 | print "retrieveuserdata plugin\n"; |
2071 | print "\n"; |
eaace00e |
2072 | |
35aaf666 |
2073 | if ( lc($edit_identity) eq 'true' ) { |
8a7d0669 |
2074 | $default_value = "y"; |
2075 | } else { |
2076 | $default_value = "n"; |
2077 | } |
2eec12b5 |
2078 | print "Allow editing of user's identity? (y/n) [$WHT$default_value$NRM]: $WHT"; |
8a7d0669 |
2079 | $new_edit = <STDIN>; |
eaace00e |
2080 | if ( ( $new_edit =~ /^y\n/i ) || ( ( $new_edit =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2081 | $edit_identity = 'true'; |
2082 | $edit_name = 'true'; |
8a7d0669 |
2083 | } else { |
35aaf666 |
2084 | $edit_identity = 'false'; |
2eec12b5 |
2085 | $edit_name = command311(); |
8a7d0669 |
2086 | } |
2087 | return $edit_identity; |
2088 | } |
2089 | |
2090 | sub command311 { |
2eec12b5 |
2091 | print "As a follow-up, this option allows you to choose if the user "; |
2092 | print "can edit their full name even when you don't want them to "; |
2093 | print "change their username\n"; |
8a7d0669 |
2094 | print "\n"; |
2095 | |
35aaf666 |
2096 | if ( lc($edit_name) eq 'true' ) { |
8a7d0669 |
2097 | $default_value = "y"; |
2098 | } else { |
2099 | $default_value = "n"; |
2100 | } |
2101 | print "Allow editing of the users full name? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2102 | $new_edit = <STDIN>; |
eaace00e |
2103 | if ( ( $new_edit =~ /^y\n/i ) || ( ( $new_edit =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2104 | $edit_name = 'true'; |
8a7d0669 |
2105 | } else { |
35aaf666 |
2106 | $edit_name = 'false'; |
8a7d0669 |
2107 | } |
2108 | return $edit_name; |
2109 | } |
8c21da0c |
2110 | |
7c612fdd |
2111 | sub command312 { |
2112 | print "This option allows you to choose if users can use thread sorting\n"; |
2113 | print "Your IMAP server must support the THREAD command for this to work\n"; |
35aaf666 |
2114 | print "PHP versions later than 4.0.3 recommended\n"; |
7c612fdd |
2115 | print "\n"; |
2116 | |
35aaf666 |
2117 | if ( lc($allow_thread_sort) eq 'true' ) { |
7c612fdd |
2118 | $default_value = "y"; |
2119 | } else { |
2120 | $default_value = "n"; |
2121 | } |
2122 | print "Allow server side thread sorting? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2123 | $allow_thread_sort = <STDIN>; |
2124 | if ( ( $allow_thread_sort =~ /^y\n/i ) || ( ( $allow_thread_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2125 | $allow_thread_sort = 'true'; |
7c612fdd |
2126 | } else { |
35aaf666 |
2127 | $allow_thread_sort = 'false'; |
7c612fdd |
2128 | } |
2129 | return $allow_thread_sort; |
2130 | } |
2131 | |
aa0da530 |
2132 | sub command313 { |
2133 | print "This option allows you to choose if SM uses server-side sorting\n"; |
2134 | print "Your IMAP server must support the SORT command for this to work\n"; |
2135 | print "\n"; |
2136 | |
aacc7bec |
2137 | if ( lc($allow_server_sort) eq 'true' ) { |
aa0da530 |
2138 | $default_value = "y"; |
2139 | } else { |
2140 | $default_value = "n"; |
2141 | } |
aacc7bec |
2142 | print "Allow server-side sorting? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2143 | $allow_server_sort = <STDIN>; |
2144 | if ( ( $allow_server_sort =~ /^y\n/i ) || ( ( $allow_server_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
2145 | $allow_server_sort = 'true'; |
aa0da530 |
2146 | } else { |
aacc7bec |
2147 | $allow_server_sort = 'false'; |
aa0da530 |
2148 | } |
aacc7bec |
2149 | return $allow_server_sort; |
aa0da530 |
2150 | } |
2151 | |
65ffb3ce |
2152 | sub command314 { |
2153 | print "This option allows you to choose if SM uses charset search\n"; |
2154 | print "Your IMAP server must support the SEARCH CHARSET command for this to work\n"; |
2155 | print "\n"; |
2156 | |
35aaf666 |
2157 | if ( lc($allow_charset_search) eq 'true' ) { |
65ffb3ce |
2158 | $default_value = "y"; |
2159 | } else { |
2160 | $default_value = "n"; |
2161 | } |
2162 | print "Allow charset searching? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2163 | $allow_charset_search = <STDIN>; |
2164 | if ( ( $allow_charset_search =~ /^y\n/i ) || ( ( $allow_charset_search =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2165 | $allow_charset_search = 'true'; |
65ffb3ce |
2166 | } else { |
35aaf666 |
2167 | $allow_charset_search = 'false'; |
65ffb3ce |
2168 | } |
2169 | return $allow_charset_search; |
2170 | } |
2171 | |
4ecd3a70 |
2172 | # command315 (UID support) obsoleted. |
3c7ee482 |
2173 | |
de74555e |
2174 | # advanced search option |
6c499577 |
2175 | sub command316 { |
66bfb27b |
2176 | print "This option allows you to control the use of advanced search form.\n"; |
0f1b00b8 |
2177 | print " 0 = enable basic search only\n"; |
2178 | print " 1 = enable advanced search only\n"; |
2179 | print " 2 = enable both\n"; |
2180 | print "\n"; |
2181 | |
2182 | print "Allowed search (0,1,2)? [$WHT$allow_advanced_search$NRM]: $WHT"; |
2183 | $new_allow_advanced_search = <STDIN>; |
85645192 |
2184 | if ( $new_allow_advanced_search =~ /^[012]\n/i ) { |
0f1b00b8 |
2185 | $allow_advanced_search = $new_allow_advanced_search; |
de74555e |
2186 | } |
85645192 |
2187 | $allow_advanced_search =~ s/[\r\n]//g; |
66bfb27b |
2188 | return $allow_advanced_search; |
de74555e |
2189 | } |
2190 | |
2191 | |
2192 | sub command317 { |
35aaf666 |
2193 | print "This option allows you to change the name of the PHP session used\n"; |
2194 | print "by SquirrelMail. Unless you know what you are doing, you probably\n"; |
2195 | print "don't need or want to change this from the default of SQMSESSID.\n"; |
6c499577 |
2196 | print "[$WHT$session_name$NRM]: $WHT"; |
2197 | $new_session_name = <STDIN>; |
35aaf666 |
2198 | chomp($new_session_name); |
6614128e |
2199 | if ( $new_session_name eq "" ) { |
6c499577 |
2200 | $new_session_name = $session_name; |
2201 | } |
2202 | return $new_session_name; |
2203 | } |
2204 | |
dcc1cc82 |
2205 | |
65ffb3ce |
2206 | |
ccfb2029 |
2207 | sub command41 { |
2eec12b5 |
2208 | print "\nDefine the themes that you wish to use. If you have added "; |
2209 | print "a theme of your own, just follow the instructions (?) about how to add "; |
eaace00e |
2210 | print "them. You can also change the default theme.\n"; |
2211 | print "[theme] command (?=help) > "; |
2212 | $input = <STDIN>; |
85645192 |
2213 | $input =~ s/[\r\n]//g; |
eaace00e |
2214 | while ( $input ne "d" ) { |
2215 | if ( $input =~ /^\s*l\s*/i ) { |
2216 | $count = 0; |
2217 | while ( $count <= $#theme_name ) { |
2218 | if ( $count == $theme_default ) { |
2219 | print " *"; |
2220 | } else { |
2221 | print " "; |
2222 | } |
2eec12b5 |
2223 | if ( $count < 10 ) { |
2224 | print " "; |
2225 | } |
eaace00e |
2226 | $name = $theme_name[$count]; |
2eec12b5 |
2227 | $num_spaces = 35 - length($name); |
eaace00e |
2228 | for ( $i = 0 ; $i < $num_spaces ; $i++ ) { |
2229 | $name = $name . " "; |
2230 | } |
2231 | |
2232 | print " $count. $name"; |
2233 | print "($theme_path[$count])\n"; |
2234 | |
2235 | $count++; |
ccfb2029 |
2236 | } |
eaace00e |
2237 | } elsif ( $input =~ /^\s*m\s*[0-9]+/i ) { |
2238 | $old_def = $theme_default; |
2239 | $theme_default = $input; |
2240 | $theme_default =~ s/^\s*m\s*//; |
2241 | if ( ( $theme_default > $#theme_name ) || ( $theme_default < 0 ) ) { |
2242 | print "Cannot set default theme to $theme_default. That theme does not exist.\n"; |
2243 | $theme_default = $old_def; |
ccfb2029 |
2244 | } |
eaace00e |
2245 | } elsif ( $input =~ /^\s*\+/ ) { |
2246 | print "What is the name of this theme: "; |
2247 | $name = <STDIN>; |
85645192 |
2248 | $name =~ s/[\r\n]//g; |
eaace00e |
2249 | $theme_name[ $#theme_name + 1 ] = $name; |
2250 | print "Be sure to put ../themes/ before the filename.\n"; |
2251 | print "What file is this stored in (ex: ../themes/default_theme.php): "; |
2252 | $name = <STDIN>; |
85645192 |
2253 | $name =~ s/[\r\n]//g; |
eaace00e |
2254 | $theme_path[ $#theme_path + 1 ] = $name; |
2255 | } elsif ( $input =~ /^\s*-\s*[0-9]?/ ) { |
2256 | if ( $input =~ /[0-9]+\s*$/ ) { |
2257 | $rem_num = $input; |
2258 | $rem_num =~ s/^\s*-\s*//g; |
2259 | $rem_num =~ s/\s*$//; |
2260 | } else { |
2261 | $rem_num = $#theme_name; |
ccfb2029 |
2262 | } |
eaace00e |
2263 | if ( $rem_num == $theme_default ) { |
2264 | print "You cannot remove the default theme!\n"; |
2265 | } else { |
2266 | $count = 0; |
2267 | @new_theme_name = (); |
2268 | @new_theme_path = (); |
2269 | while ( $count <= $#theme_name ) { |
2270 | if ( $count != $rem_num ) { |
2271 | @new_theme_name = ( @new_theme_name, $theme_name[$count] ); |
2272 | @new_theme_path = ( @new_theme_path, $theme_path[$count] ); |
2273 | } |
2274 | $count++; |
2275 | } |
2276 | @theme_name = @new_theme_name; |
2277 | @theme_path = @new_theme_path; |
2278 | if ( $theme_default > $rem_num ) { |
2279 | $theme_default--; |
2280 | } |
8442ac08 |
2281 | } |
eaace00e |
2282 | } elsif ( $input =~ /^\s*t\s*/i ) { |
2283 | print "\nStarting detection...\n\n"; |
2284 | |
2285 | opendir( DIR, "../themes" ); |
2286 | @files = grep { /\.php$/i } readdir(DIR); |
2287 | $cnt = 0; |
2288 | while ( $cnt <= $#files ) { |
2289 | $filename = "../themes/" . $files[$cnt]; |
2290 | if ( $filename ne "../themes/index.php" ) { |
2291 | $found = 0; |
2292 | for ( $x = 0 ; $x <= $#theme_path ; $x++ ) { |
2293 | if ( $theme_path[$x] eq $filename ) { |
2294 | $found = 1; |
2295 | } |
2296 | } |
2297 | if ( $found != 1 ) { |
2298 | print "** Found theme: $filename\n"; |
2299 | print " What is its name? "; |
2300 | $nm = <STDIN>; |
85645192 |
2301 | $nm =~ s/[\n\r]//g; |
eaace00e |
2302 | $theme_name[ $#theme_name + 1 ] = $nm; |
2303 | $theme_path[ $#theme_path + 1 ] = $filename; |
2304 | } |
2305 | } |
2306 | $cnt++; |
8442ac08 |
2307 | } |
eaace00e |
2308 | print "\n"; |
2309 | for ( $cnt = 0 ; $cnt <= $#theme_path ; $cnt++ ) { |
2310 | $filename = $theme_path[$cnt]; |
2311 | if ( !( -e $filename ) ) { |
2312 | print " Removing $filename (file not found)\n"; |
2313 | $offset = 0; |
2314 | @new_theme_name = (); |
2315 | @new_theme_path = (); |
2316 | for ( $x = 0 ; $x < $#theme_path ; $x++ ) { |
2317 | if ( $theme_path[$x] eq $filename ) { |
2318 | $offset = 1; |
2319 | } |
2320 | if ( $offset == 1 ) { |
2321 | $new_theme_name[$x] = $theme_name[ $x + 1 ]; |
2322 | $new_theme_path[$x] = $theme_path[ $x + 1 ]; |
2323 | } else { |
2324 | $new_theme_name[$x] = $theme_name[$x]; |
2325 | $new_theme_path[$x] = $theme_path[$x]; |
2326 | } |
2327 | } |
2328 | @theme_name = @new_theme_name; |
2329 | @theme_path = @new_theme_path; |
2330 | } |
2331 | } |
2332 | print "\nDetection complete!\n\n"; |
2333 | |
2334 | closedir DIR; |
2335 | } elsif ( $input =~ /^\s*\?\s*/ ) { |
2336 | print ".-------------------------.\n"; |
2337 | print "| t (detect themes) |\n"; |
2338 | print "| + (add theme) |\n"; |
2339 | print "| - N (remove theme) |\n"; |
2340 | print "| m N (mark default) |\n"; |
2341 | print "| l (list themes) |\n"; |
2342 | print "| d (done) |\n"; |
2343 | print "`-------------------------'\n"; |
2344 | } |
2345 | print "[theme] command (?=help) > "; |
2346 | $input = <STDIN>; |
85645192 |
2347 | $input =~ s/[\r\n]//g; |
eaace00e |
2348 | } |
2349 | } |
ccfb2029 |
2350 | |
6f3bfa54 |
2351 | # Theme - CSS file |
2352 | sub command42 { |
eaace00e |
2353 | print "You may specify a cascading style-sheet (CSS) file to be included\n"; |
2354 | print "on each html page generated by SquirrelMail. The CSS file is useful\n"; |
2355 | print "for specifying a site-wide font. If you're not familiar with CSS\n"; |
2356 | print "files, leave this blank.\n"; |
2357 | print "\n"; |
2358 | print "To clear out an existing value, just type a space for the input.\n"; |
2359 | print "\n"; |
25be56ab |
2360 | print "Please be aware of the following: \n"; |
2361 | print " - Relative URLs are relative to the config dir\n"; |
2362 | print " to use the themes directory, use ../themes/css/newdefault.css\n"; |
2363 | print " - To specify a css file defined outside the SquirrelMail source tree\n"; |
2364 | print " use the absolute URL the webserver would use to include the file\n"; |
2365 | print " e.g. http://some.host.com/css/mystyle.css or /css/mystyle.css\n"; |
8bd9e0dd |
2366 | print "\n"; |
eaace00e |
2367 | print "[$WHT$theme_css$NRM]: $WHT"; |
2368 | $new_theme_css = <STDIN>; |
6f3bfa54 |
2369 | |
eaace00e |
2370 | if ( $new_theme_css eq "\n" ) { |
2371 | $new_theme_css = $theme_css; |
2372 | } else { |
85645192 |
2373 | $new_theme_css =~ s/[\r\n]//g; |
eaace00e |
2374 | } |
2375 | $new_theme_css =~ s/^\s*//; |
2376 | return $new_theme_css; |
2377 | } |
6f3bfa54 |
2378 | |
1e0628fb |
2379 | sub command61 { |
eaace00e |
2380 | print "You can now define different LDAP servers.\n"; |
2381 | print "[ldap] command (?=help) > "; |
2382 | $input = <STDIN>; |
85645192 |
2383 | $input =~ s/[\r\n]//g; |
eaace00e |
2384 | while ( $input ne "d" ) { |
2385 | if ( $input =~ /^\s*l\s*/i ) { |
2386 | $count = 0; |
2387 | while ( $count <= $#ldap_host ) { |
2388 | print "$count. $ldap_host[$count]\n"; |
2389 | print " base: $ldap_base[$count]\n"; |
2390 | if ( $ldap_charset[$count] ) { |
2391 | print " charset: $ldap_charset[$count]\n"; |
2392 | } |
2393 | if ( $ldap_port[$count] ) { |
2394 | print " port: $ldap_port[$count]\n"; |
2395 | } |
2396 | if ( $ldap_name[$count] ) { |
2397 | print " name: $ldap_name[$count]\n"; |
2398 | } |
2399 | if ( $ldap_maxrows[$count] ) { |
2400 | print " maxrows: $ldap_maxrows[$count]\n"; |
2401 | } |
30e9932c |
2402 | if ( $ldap_binddn[$count] ) { |
2403 | print " binddn: $ldap_binddn[$count]\n"; |
2404 | if ( $ldap_bindpw[$count] ) { |
2405 | print " bindpw: $ldap_bindpw[$count]\n"; |
2406 | } |
2407 | } |
35aaf666 |
2408 | if ( $ldap_protocol[$count] ) { |
30e9932c |
2409 | print " protocol: $ldap_protocol[$count]\n"; |
2410 | } |
2411 | |
eaace00e |
2412 | print "\n"; |
2413 | $count++; |
a93b12ba |
2414 | } |
eaace00e |
2415 | } elsif ( $input =~ /^\s*\+/ ) { |
2416 | $sub = $#ldap_host + 1; |
2417 | |
2418 | print "First, we need to have the hostname or the IP address where\n"; |
2419 | print "this LDAP server resides. Example: ldap.bigfoot.com\n"; |
2420 | print "hostname: "; |
2421 | $name = <STDIN>; |
85645192 |
2422 | $name =~ s/[\r\n]//g; |
eaace00e |
2423 | $ldap_host[$sub] = $name; |
2424 | |
2425 | print "\n"; |
2426 | |
2427 | print "Next, we need the server root (base dn). For this, an empty\n"; |
2428 | print "string is allowed.\n"; |
2429 | print "Example: ou=member_directory,o=netcenter.com\n"; |
2430 | print "base: "; |
2431 | $name = <STDIN>; |
85645192 |
2432 | $name =~ s/[\r\n]//g; |
eaace00e |
2433 | $ldap_base[$sub] = $name; |
2434 | |
2435 | print "\n"; |
2436 | |
2437 | print "This is the TCP/IP port number for the LDAP server. Default\n"; |
2438 | print "port is 389. This is optional. Press ENTER for default.\n"; |
2439 | print "port: "; |
2440 | $name = <STDIN>; |
85645192 |
2441 | $name =~ s/[\r\n]//g; |
eaace00e |
2442 | $ldap_port[$sub] = $name; |
2443 | |
2444 | print "\n"; |
2445 | |
2446 | print "This is the charset for the server. Default is utf-8. This\n"; |
2447 | print "is also optional. Press ENTER for default.\n"; |
2448 | print "charset: "; |
2449 | $name = <STDIN>; |
85645192 |
2450 | $name =~ s/[\r\n]//g; |
eaace00e |
2451 | $ldap_charset[$sub] = $name; |
2452 | |
2453 | print "\n"; |
2454 | |
2455 | print "This is the name for the server, used to tag the results of\n"; |
2456 | print "the search. Default it \"LDAP: hostname\". Press ENTER for default\n"; |
2457 | print "name: "; |
2458 | $name = <STDIN>; |
85645192 |
2459 | $name =~ s/[\r\n]//g; |
eaace00e |
2460 | $ldap_name[$sub] = $name; |
2461 | |
2462 | print "\n"; |
2463 | |
2464 | print "You can specify the maximum number of rows in the search result.\n"; |
2465 | print "Default is unlimited. Press ENTER for default.\n"; |
2466 | print "maxrows: "; |
2467 | $name = <STDIN>; |
85645192 |
2468 | $name =~ s/[\r\n]//g; |
eaace00e |
2469 | $ldap_maxrows[$sub] = $name; |
2470 | |
a93b12ba |
2471 | print "\n"; |
eaace00e |
2472 | |
30e9932c |
2473 | print "If your LDAP server does not like anonymous logins, you can specify bind DN.\n"; |
2474 | print "Default is none, anonymous bind. Press ENTER for default.\n"; |
2475 | print "binddn: "; |
2476 | $name = <STDIN>; |
85645192 |
2477 | $name =~ s/[\r\n]//g; |
30e9932c |
2478 | $ldap_binddn[$sub] = $name; |
2479 | |
2480 | print "\n"; |
2481 | |
2482 | if ( $ldap_binddn[$sub] ne '' ) { |
2483 | |
2484 | print "Now, please specify password for that DN.\n"; |
2485 | print "bindpw: "; |
2486 | $name = <STDIN>; |
85645192 |
2487 | $name =~ s/[\r\n]//g; |
30e9932c |
2488 | $ldap_bindpw[$sub] = $name; |
2489 | |
2490 | print "\n"; |
2491 | } |
2492 | |
35aaf666 |
2493 | print "You can specify bind protocol version here.\n"; |
30e9932c |
2494 | print "Default protocol version depends on your php ldap settings.\n"; |
35aaf666 |
2495 | print "Press ENTER for default.\n"; |
30e9932c |
2496 | print "protocol: "; |
2497 | $name = <STDIN>; |
85645192 |
2498 | $name =~ s/[\r\n]//g; |
30e9932c |
2499 | $ldap_protocol[$sub] = $name; |
2500 | |
2501 | print "\n"; |
2502 | |
eaace00e |
2503 | } elsif ( $input =~ /^\s*-\s*[0-9]?/ ) { |
2504 | if ( $input =~ /[0-9]+\s*$/ ) { |
2505 | $rem_num = $input; |
2506 | $rem_num =~ s/^\s*-\s*//g; |
2507 | $rem_num =~ s/\s*$//; |
2508 | } else { |
2509 | $rem_num = $#ldap_host; |
2510 | } |
2511 | $count = 0; |
2512 | @new_ldap_host = (); |
2513 | @new_ldap_base = (); |
2514 | @new_ldap_port = (); |
2515 | @new_ldap_name = (); |
2516 | @new_ldap_charset = (); |
2517 | @new_ldap_maxrows = (); |
30e9932c |
2518 | @new_ldap_bindpw = (); |
2519 | @new_ldap_binddn = (); |
2520 | @new_ldap_protocol = (); |
eaace00e |
2521 | |
2522 | while ( $count <= $#ldap_host ) { |
2523 | if ( $count != $rem_num ) { |
2524 | @new_ldap_host = ( @new_ldap_host, $ldap_host[$count] ); |
2525 | @new_ldap_base = ( @new_ldap_base, $ldap_base[$count] ); |
2526 | @new_ldap_port = ( @new_ldap_port, $ldap_port[$count] ); |
2527 | @new_ldap_name = ( @new_ldap_name, $ldap_name[$count] ); |
2528 | @new_ldap_charset = ( @new_ldap_charset, $ldap_charset[$count] ); |
2529 | @new_ldap_maxrows = ( @new_ldap_maxrows, $ldap_maxrows[$count] ); |
30e9932c |
2530 | @new_ldap_binddn = ( @new_ldap_binddn, $ldap_binddn[$count] ); |
2531 | @new_ldap_bindpw = ( @new_ldap_bindpw, $ldap_bindpw[$count] ); |
2532 | @new_ldap_protocol = ( @new_ldap_protocol, $ldap_protocol[$count] ); |
eaace00e |
2533 | } |
2534 | $count++; |
1e0628fb |
2535 | } |
eaace00e |
2536 | @ldap_host = @new_ldap_host; |
2537 | @ldap_base = @new_ldap_base; |
2538 | @ldap_port = @new_ldap_port; |
2539 | @ldap_name = @new_ldap_name; |
2540 | @ldap_charset = @new_ldap_charset; |
2541 | @ldap_maxrows = @new_ldap_maxrows; |
30e9932c |
2542 | @ldap_binddn = @new_ldap_binddn; |
2543 | @ldap_bindpw = @new_ldap_bindpw; |
2544 | @ldap_protocol = @new_ldap_protocol; |
2545 | |
eaace00e |
2546 | } elsif ( $input =~ /^\s*\?\s*/ ) { |
2547 | print ".-------------------------.\n"; |
2548 | print "| + (add host) |\n"; |
2549 | print "| - N (remove host) |\n"; |
2550 | print "| l (list hosts) |\n"; |
2551 | print "| d (done) |\n"; |
2552 | print "`-------------------------'\n"; |
2553 | } |
2554 | print "[ldap] command (?=help) > "; |
2555 | $input = <STDIN>; |
85645192 |
2556 | $input =~ s/[\r\n]//g; |
eaace00e |
2557 | } |
2558 | } |
1e0628fb |
2559 | |
3806fa52 |
2560 | sub command62 { |
eaace00e |
2561 | print "Some of our developers have come up with very good javascript interface\n"; |
2562 | print "for searching through address books, however, our original goals said\n"; |
2563 | print "that we would be 100% HTML. In order to make it possible to use their\n"; |
2564 | print "interface, and yet stick with our goals, we have also written a plain\n"; |
2565 | print "HTML version of the search. Here, you can choose which version to use.\n"; |
2566 | print "\n"; |
2567 | print "This is just the default value. It is also a user option that each\n"; |
2568 | print "user can configure individually\n"; |
2569 | print "\n"; |
2570 | |
35aaf666 |
2571 | if ( lc($default_use_javascript_addr_book) eq 'true' ) { |
eaace00e |
2572 | $default_value = "y"; |
2573 | } else { |
35aaf666 |
2574 | $default_use_javascript_addr_book = 'false'; |
eaace00e |
2575 | $default_value = "n"; |
2576 | } |
2577 | print "Use javascript version by default (y/n) [$WHT$default_value$NRM]: $WHT"; |
2578 | $new_show = <STDIN>; |
2579 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2580 | $default_use_javascript_addr_book = 'true'; |
eaace00e |
2581 | } else { |
35aaf666 |
2582 | $default_use_javascript_addr_book = 'false'; |
eaace00e |
2583 | } |
2584 | return $default_use_javascript_addr_book; |
3806fa52 |
2585 | } |
1e0628fb |
2586 | |
4272758c |
2587 | # global filebased address book |
2588 | sub command63 { |
2589 | print "If you want to use global file address book, then you\n"; |
2590 | print "must set this option to a valid value. If option does\n"; |
2591 | print "not have path elements, system assumes that file is\n"; |
2592 | print "stored in data directory. If relative path is set, it is\n"; |
598294a7 |
2593 | print "relative to main SquirrelMail directory. If value is empty,\n"; |
4272758c |
2594 | print "address book is not enabled.\n"; |
2595 | print "\n"; |
2596 | |
2597 | print "[$WHT$abook_global_file$NRM]: $WHT"; |
2598 | $new_abook_global_file = <STDIN>; |
2599 | if ( $new_abook_global_file eq "\n" ) { |
2600 | $new_abook_global_file = $abook_global_file; |
2601 | } else { |
2602 | $new_abook_global_file =~ s/[\r\n]//g; |
2603 | } |
2604 | return $new_abook_global_file; |
2605 | } |
2606 | |
2607 | # writing into global filebased abook control |
2608 | sub command64 { |
7eb64c3e |
2609 | print "This setting controls writing into global file address\n"; |
2610 | print "book options. Address book file must be writeable by\n"; |
2611 | print "webserver's user, if you want to enable this option.\n"; |
4272758c |
2612 | print "\n"; |
2613 | |
2614 | if ( lc($abook_global_file_writeable) eq 'true' ) { |
2615 | $default_value = "y"; |
2616 | } else { |
2617 | $abook_global_file_writeable = 'false'; |
2618 | $default_value = "n"; |
2619 | } |
7eb64c3e |
2620 | print "Allow writing into global file address book (y/n) [$WHT$default_value$NRM]: $WHT"; |
4272758c |
2621 | $new_show = <STDIN>; |
2622 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
2623 | $abook_global_file_writeable = 'true'; |
2624 | } else { |
2625 | $abook_global_file_writeable = 'false'; |
2626 | } |
2627 | return $abook_global_file_writeable; |
2628 | } |
2629 | |
71d3f882 |
2630 | # listing of global filebased abook control |
2631 | sub command65 { |
2632 | print "This setting controls listing of global file address\n"; |
2633 | print "book in addresses page.\n"; |
2634 | print "\n"; |
2635 | |
2636 | if ( lc($abook_global_file_listing) eq 'true' ) { |
2637 | $default_value = "y"; |
2638 | } else { |
2639 | $abook_global_file_listing = 'false'; |
2640 | $default_value = "n"; |
2641 | } |
2642 | print "Allow listing of global file address book (y/n) [$WHT$default_value$NRM]: $WHT"; |
2643 | $new_show = <STDIN>; |
2644 | if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
2645 | $abook_global_file_listing = 'true'; |
2646 | } else { |
2647 | $abook_global_file_listing = 'false'; |
2648 | } |
2649 | return $abook_global_file_listing; |
2650 | } |
2651 | |
497203d4 |
2652 | sub command91 { |
eaace00e |
2653 | print "If you want to store your users address book details in a database then\n"; |
2654 | print "you need to set this DSN to a valid value. The format for this is:\n"; |
2655 | print "mysql://user:pass\@hostname/dbname\n"; |
2656 | print "Where mysql can be one of the databases PHP supports, the most common\n"; |
2657 | print "of these are mysql, msql and pgsql\n"; |
2658 | print "If the DSN is left empty (hit space and then return) the database\n"; |
2659 | print "related code for address books will not be used\n"; |
2660 | print "\n"; |
2661 | |
2662 | if ( $addrbook_dsn eq "" ) { |
2663 | $default_value = "Disabled"; |
2664 | } else { |
2665 | $default_value = $addrbook_dsn; |
2666 | } |
2667 | print "[$WHT$addrbook_dsn$NRM]: $WHT"; |
2668 | $new_dsn = <STDIN>; |
2669 | if ( $new_dsn eq "\n" ) { |
2670 | $new_dsn = ""; |
2671 | } else { |
85645192 |
2672 | $new_dsn =~ s/[\r\n]//g; |
eaace00e |
2673 | $new_dsn =~ s/^\s+$//g; |
2674 | } |
2675 | return $new_dsn; |
497203d4 |
2676 | } |
ccfb2029 |
2677 | |
4f40a59d |
2678 | sub command92 { |
eaace00e |
2679 | print "This is the name of the table you want to store the address book\n"; |
2680 | print "data in, it defaults to 'address'\n"; |
2681 | print "\n"; |
2682 | print "[$WHT$addrbook_table$NRM]: $WHT"; |
2683 | $new_table = <STDIN>; |
2684 | if ( $new_table eq "\n" ) { |
2685 | $new_table = $addrbook_table; |
2686 | } else { |
85645192 |
2687 | $new_table =~ s/[\r\n]//g; |
eaace00e |
2688 | } |
2689 | return $new_table; |
4f40a59d |
2690 | } |
2691 | |
3499f99f |
2692 | sub command93 { |
2693 | print "If you want to store your users preferences in a database then\n"; |
2694 | print "you need to set this DSN to a valid value. The format for this is:\n"; |
2695 | print "mysql://user:pass\@hostname/dbname\n"; |
2696 | print "Where mysql can be one of the databases PHP supports, the most common\n"; |
2697 | print "of these are mysql, msql and pgsql\n"; |
2698 | print "If the DSN is left empty (hit space and then return) the database\n"; |
2699 | print "related code for address books will not be used\n"; |
2700 | print "\n"; |
2701 | |
eaace00e |
2702 | if ( $prefs_dsn eq "" ) { |
3499f99f |
2703 | $default_value = "Disabled"; |
2704 | } else { |
2705 | $default_value = $prefs_dsn; |
2706 | } |
2707 | print "[$WHT$prefs_dsn$NRM]: $WHT"; |
2708 | $new_dsn = <STDIN>; |
eaace00e |
2709 | if ( $new_dsn eq "\n" ) { |
3499f99f |
2710 | $new_dsn = ""; |
2711 | } else { |
85645192 |
2712 | $new_dsn =~ s/[\r\n]//g; |
3499f99f |
2713 | $new_dsn =~ s/^\s+$//g; |
2714 | } |
2715 | return $new_dsn; |
2716 | } |
2717 | |
2718 | sub command94 { |
2719 | print "This is the name of the table you want to store the preferences\n"; |
99a6c222 |
2720 | print "data in, it defaults to 'userprefs'\n"; |
3499f99f |
2721 | print "\n"; |
2722 | print "[$WHT$prefs_table$NRM]: $WHT"; |
2723 | $new_table = <STDIN>; |
eaace00e |
2724 | if ( $new_table eq "\n" ) { |
3499f99f |
2725 | $new_table = $prefs_table; |
2726 | } else { |
85645192 |
2727 | $new_table =~ s/[\r\n]//g; |
3499f99f |
2728 | } |
2729 | return $new_table; |
eaace00e |
2730 | } |
3499f99f |
2731 | |
99a6c222 |
2732 | sub command95 { |
2733 | print "This is the name of the field in which you want to store the\n"; |
2734 | print "username of the person the prefs are for. It default to 'user'\n"; |
2735 | print "which clashes with a reserved keyword in PostgreSQL so this\n"; |
2736 | print "will need to be changed for that database at least\n"; |
2737 | print "\n"; |
2738 | print "[$WHT$prefs_user_field$NRM]: $WHT"; |
2739 | $new_field = <STDIN>; |
2740 | if ( $new_field eq "\n" ) { |
2741 | $new_field = $prefs_user_field; |
2742 | } else { |
85645192 |
2743 | $new_field =~ s/[\r\n]//g; |
99a6c222 |
2744 | } |
2745 | return $new_field; |
2746 | } |
2747 | |
2748 | sub command96 { |
2749 | print "This is the name of the field in which you want to store the\n"; |
2750 | print "preferences keyword. It defaults to 'prefkey'\n"; |
2751 | print "\n"; |
2752 | print "[$WHT$prefs_key_field$NRM]: $WHT"; |
2753 | $new_field = <STDIN>; |
2754 | if ( $new_field eq "\n" ) { |
2755 | $new_field = $prefs_key_field; |
2756 | } else { |
85645192 |
2757 | $new_field =~ s/[\r\n]//g; |
99a6c222 |
2758 | } |
2759 | return $new_field; |
2760 | } |
2761 | |
2762 | sub command97 { |
2763 | print "This is the name of the field in which you want to store the\n"; |
2764 | print "preferences value. It defaults to 'prefval'\n"; |
2765 | print "\n"; |
2766 | print "[$WHT$prefs_val_field$NRM]: $WHT"; |
2767 | $new_field = <STDIN>; |
2768 | if ( $new_field eq "\n" ) { |
2769 | $new_field = $prefs_val_field; |
2770 | } else { |
85645192 |
2771 | $new_field =~ s/[\r\n]//g; |
99a6c222 |
2772 | } |
2773 | return $new_field; |
2774 | } |
2775 | |
30e9932c |
2776 | sub command98 { |
2777 | print "If you want to store your global address book in a database then\n"; |
2778 | print "you need to set this DSN to a valid value. The format for this is:\n"; |
2779 | print "mysql://user:pass\@hostname/dbname\n"; |
2780 | print "Where mysql can be one of the databases PHP supports, the most common\n"; |
2781 | print "of these are mysql, msql and pgsql\n"; |
2782 | print "If the DSN is left empty (hit space and then return) the database\n"; |
2783 | print "related code for global SQL address book will not be used\n"; |
2784 | print "\n"; |
2785 | |
2786 | if ( $addrbook_global_dsn eq "" ) { |
2787 | $default_value = "Disabled"; |
2788 | } else { |
2789 | $default_value = $addrbook_global_dsn; |
2790 | } |
2791 | print "[$WHT$addrbook_global_dsn$NRM]: $WHT"; |
2792 | $new_dsn = <STDIN>; |
2793 | if ( $new_dsn eq "\n" ) { |
2794 | $new_dsn = ""; |
2795 | } else { |
85645192 |
2796 | $new_dsn =~ s/[\r\n]//g; |
30e9932c |
2797 | $new_dsn =~ s/^\s+$//g; |
2798 | } |
2799 | return $new_dsn; |
2800 | } |
2801 | |
2802 | sub command99 { |
2803 | print "This is the name of the table you want to store the global address book\n"; |
6e00b127 |
2804 | print "data in. Default table name is 'global_abook'. Address book uses same\n"; |
2805 | print "database format as personal address book.\n"; |
30e9932c |
2806 | print "\n"; |
2807 | print "[$WHT$addrbook_global_table$NRM]: $WHT"; |
2808 | $new_table = <STDIN>; |
2809 | if ( $new_table eq "\n" ) { |
2810 | $new_table = $addrbook_global_table; |
2811 | } else { |
85645192 |
2812 | $new_table =~ s/[\r\n]//g; |
30e9932c |
2813 | } |
2814 | return $new_table; |
2815 | } |
2816 | |
2817 | sub command910 { |
2818 | print "This option controls users\' ability to add or modify records stored \n"; |
2819 | print "in global address book\n"; |
2820 | |
35aaf666 |
2821 | if ( lc($addrbook_global_writeable) eq 'true' ) { |
30e9932c |
2822 | $default_value = "y"; |
2823 | } else { |
2824 | $default_value = "n"; |
2825 | } |
2826 | print "Allow writing into global address book? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2827 | $addrbook_global_writeable = <STDIN>; |
2828 | if ( ( $addrbook_global_writeable =~ /^y\n/i ) || ( ( $addrbook_global_writeable =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2829 | $addrbook_global_writeable = 'true'; |
30e9932c |
2830 | } else { |
35aaf666 |
2831 | $addrbook_global_writeable = 'false'; |
30e9932c |
2832 | } |
2833 | return $addrbook_global_writeable; |
2834 | } |
2835 | |
2836 | sub command911 { |
2837 | print "Enable this option if you want to see listing of addresses stored \n"; |
2838 | print "in global address book\n"; |
2839 | |
35aaf666 |
2840 | if ( lc($addrbook_global_listing) eq 'true' ) { |
30e9932c |
2841 | $default_value = "y"; |
2842 | } else { |
2843 | $default_value = "n"; |
2844 | } |
2845 | print "Allow listing of global address book? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2846 | $addrbook_global_listing = <STDIN>; |
2847 | if ( ( $addrbook_global_listing =~ /^y\n/i ) || ( ( $addrbook_global_listing =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2848 | $addrbook_global_listing = 'true'; |
30e9932c |
2849 | } else { |
35aaf666 |
2850 | $addrbook_global_listing = 'false'; |
30e9932c |
2851 | } |
2852 | return $addrbook_global_listing; |
2853 | } |
2854 | |
2855 | |
39d3ec89 |
2856 | # Default language |
2857 | sub commandA1 { |
2858 | print "SquirrelMail attempts to set the language in many ways. If it\n"; |
2859 | print "can not figure it out in another way, it will default to this\n"; |
2860 | print "language. Please use the code for the desired language.\n"; |
2861 | print "\n"; |
2862 | print "[$WHT$squirrelmail_default_language$NRM]: $WHT"; |
2863 | $new_squirrelmail_default_language = <STDIN>; |
2864 | if ( $new_squirrelmail_default_language eq "\n" ) { |
2865 | $new_squirrelmail_default_language = $squirrelmail_default_language; |
2866 | } else { |
85645192 |
2867 | $new_squirrelmail_default_language =~ s/[\r\n]//g; |
39d3ec89 |
2868 | $new_squirrelmail_default_language =~ s/^\s+$//g; |
2869 | } |
2870 | return $new_squirrelmail_default_language; |
2871 | } |
2872 | # Default Charset |
2873 | sub commandA2 { |
fe48c808 |
2874 | print "This option controls what character set is used when sending\n"; |
2875 | print "mail and when sending HTML to the browser. Option works only\n"; |
2876 | print "with US English (en_US) translation. Other translations use\n"; |
2877 | print "charsets that are set in functions/i18n.php.\n"; |
39d3ec89 |
2878 | print "\n"; |
2879 | |
2880 | print "[$WHT$default_charset$NRM]: $WHT"; |
2881 | $new_default_charset = <STDIN>; |
2882 | if ( $new_default_charset eq "\n" ) { |
2883 | $new_default_charset = $default_charset; |
2884 | } else { |
85645192 |
2885 | $new_default_charset =~ s/[\r\n]//g; |
39d3ec89 |
2886 | } |
2887 | return $new_default_charset; |
2888 | } |
2889 | # Alternative language names |
2890 | sub commandA3 { |
2891 | print "Enable this option if you want to see localized language names in\n"; |
2892 | print "language selection box. Note, that if don't limit list of available\n"; |
2893 | print "languages, this option can trigger installation of foreign language\n"; |
2894 | print "support modules in some browsers.\n"; |
2895 | print "\n"; |
2896 | |
35aaf666 |
2897 | if ( lc($show_alternative_names) eq 'true' ) { |
39d3ec89 |
2898 | $default_value = "y"; |
2899 | } else { |
2900 | $default_value = "n"; |
2901 | } |
2902 | print "Show alternative language names? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2903 | $show_alternative_names = <STDIN>; |
2904 | if ( ( $show_alternative_names =~ /^y\n/i ) || ( ( $show_alternative_names =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2905 | $show_alternative_names = 'true'; |
39d3ec89 |
2906 | } else { |
35aaf666 |
2907 | $show_alternative_names = 'false'; |
39d3ec89 |
2908 | } |
2909 | return $show_alternative_names; |
2910 | } |
2911 | # Available languages |
2912 | sub commandA4 { |
2913 | print "This option allows to limit number of languages available in\n"; |
2914 | print "language selection box. You can enter as code of every language that\n"; |
2915 | print "you want to enable. Language codes should be separated by space. If you\n"; |
2916 | print "enter name unsupported by SquirrelMail, it will be ignored. If you enter\n"; |
2917 | print "special key \'all\' - all languages available in SquirrelMail will be\n"; |
2918 | print "listed. If you enter special key \'none\' - user won't be able to change"; |
2919 | print "language and interface will use language set it \"Default language\" option.\n"; |
2920 | print "\n"; |
fe48c808 |
2921 | print "You can find valid language names in doc/i18n.txt.\n"; |
39d3ec89 |
2922 | print "\n"; |
2923 | print "[$WHT$available_languages$NRM]: $WHT"; |
2924 | $new_available_languages = <STDIN>; |
2925 | if ( $new_available_languages eq "\n" ) { |
2926 | $new_available_languages = $available_languages; |
2927 | } else { |
85645192 |
2928 | $new_available_languages =~ s/[\r\n]//g; |
39d3ec89 |
2929 | $new_available_languages =~ s/^\s+$//g; |
2930 | } |
2931 | return $new_available_languages; |
2932 | } |
f03f6ee7 |
2933 | # Aggressive decoding |
39d3ec89 |
2934 | sub commandA5 { |
2935 | print "Enable this option if you want to use CPU and memory intensive decoding\n"; |
2936 | print "functions. This option allows reading multibyte charset, that are used\n"; |
2937 | print "in Eastern Asia. SquirrelMail will try to use recode functions here,\n"; |
2938 | print "even when you have disabled use of recode in Tweaks section.\n"; |
2939 | print "\n"; |
2940 | |
f03f6ee7 |
2941 | if ( lc($aggressive_decoding) eq 'true' ) { |
39d3ec89 |
2942 | $default_value = "y"; |
2943 | } else { |
2944 | $default_value = "n"; |
2945 | } |
f03f6ee7 |
2946 | print "Enable aggressive decoding? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2947 | $aggressive_decoding = <STDIN>; |
2948 | if ( ( $aggressive_decoding =~ /^y\n/i ) || ( ( $aggressive_decoding =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
2949 | $aggressive_decoding = 'true'; |
39d3ec89 |
2950 | } else { |
f03f6ee7 |
2951 | $aggressive_decoding = 'false'; |
39d3ec89 |
2952 | } |
f03f6ee7 |
2953 | return $aggressive_decoding; |
39d3ec89 |
2954 | } |
2955 | |
6d3689f5 |
2956 | # Lossy encoding |
f03f6ee7 |
2957 | sub commandA6 { |
6d3689f5 |
2958 | print "Enable this option if you want to allow lossy charset encoding in message\n"; |
f03f6ee7 |
2959 | print "composition pages. This option allows charset conversions when output\n"; |
2960 | print "charset does not support all symbols used in original charset. Symbols\n"; |
2961 | print "unsupported by output charset will be replaced with question marks.\n"; |
2962 | print "\n"; |
2963 | |
6d3689f5 |
2964 | if ( lc($lossy_encoding) eq 'true' ) { |
f03f6ee7 |
2965 | $default_value = "y"; |
2966 | } else { |
2967 | $default_value = "n"; |
2968 | } |
6d3689f5 |
2969 | print "Enable lossy encoding? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2970 | $lossy_encoding = <STDIN>; |
2971 | if ( ( $lossy_encoding =~ /^y\n/i ) || ( ( $lossy_encoding =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
2972 | $lossy_encoding = 'true'; |
f03f6ee7 |
2973 | } else { |
6d3689f5 |
2974 | $lossy_encoding = 'false'; |
f03f6ee7 |
2975 | } |
6d3689f5 |
2976 | return $lossy_encoding; |
f03f6ee7 |
2977 | } |
2978 | |
2979 | |
39d3ec89 |
2980 | # Advanced tree |
2981 | sub commandB1 { |
2982 | print "Enable this option if you want to use DHTML based folder listing.\n"; |
2983 | print "Code is experimental, works only with some browsers and there might\n"; |
2984 | print "be some glitches.\n"; |
2985 | print "\n"; |
2986 | |
35aaf666 |
2987 | if ( lc($advanced_tree) eq 'true' ) { |
39d3ec89 |
2988 | $default_value = "y"; |
2989 | } else { |
2990 | $default_value = "n"; |
2991 | } |
2992 | print "Use advanced tree in folder listing? (y/n) [$WHT$default_value$NRM]: $WHT"; |
2993 | $advanced_tree = <STDIN>; |
2994 | if ( ( $advanced_tree =~ /^y\n/i ) || ( ( $advanced_tree =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
2995 | $advanced_tree = 'true'; |
39d3ec89 |
2996 | } else { |
35aaf666 |
2997 | $advanced_tree = 'false'; |
39d3ec89 |
2998 | } |
2999 | return $advanced_tree; |
3000 | } |
3001 | # Oldway |
3002 | sub commandB2 { |
f4b91fcf |
3003 | print "Setting \$oldway to false causes left_main.php to use the new\n"; |
39d3ec89 |
3004 | print "experimental way of getting the mailbox-tree.\n"; |
3005 | print "\n"; |
3006 | |
35aaf666 |
3007 | if ( lc($oldway) eq 'true' ) { |
39d3ec89 |
3008 | $default_value = "y"; |
3009 | } else { |
3010 | $default_value = "n"; |
3011 | } |
411cd12d |
3012 | print "Use old way of folder list display? (y/n) [$WHT$default_value$NRM]: $WHT"; |
39d3ec89 |
3013 | $oldway = <STDIN>; |
3014 | if ( ( $oldway =~ /^y\n/i ) || ( ( $oldway =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
3015 | $oldway = 'true'; |
39d3ec89 |
3016 | } else { |
35aaf666 |
3017 | $oldway = 'false'; |
39d3ec89 |
3018 | } |
3019 | return $oldway; |
3020 | } |
6395c46d |
3021 | # use icons |
39d3ec89 |
3022 | sub commandB3 { |
6395c46d |
3023 | print "Enabling this option will cause icons to be used instead of text\n"; |
3024 | print "markers next to each message in mailbox lists that represent\n"; |
3025 | print "new, read, flagged, and deleted messages, as well as those that\n"; |
3026 | print "have been replied to and forwarded. Icons are also used next to\n"; |
3027 | print "(un)expanded folders in the folder list (Oldway = false). These\n"; |
3028 | print "icons are quite small, but will obviously be more of a resource\n"; |
3029 | print "drain than text markers.\n"; |
3030 | print "\n"; |
3031 | |
35aaf666 |
3032 | if ( lc($use_icons) eq 'true' ) { |
6395c46d |
3033 | $default_value = "y"; |
3034 | } else { |
3035 | $default_value = "n"; |
3036 | } |
3037 | print "Use icons? (y/n) [$WHT$default_value$NRM]: $WHT"; |
3038 | $use_icons = <STDIN>; |
3039 | if ( ( $use_icons =~ /^y\n/i ) || ( ( $use_icons =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
3040 | $use_icons = 'true'; |
6395c46d |
3041 | } else { |
35aaf666 |
3042 | $use_icons = 'false'; |
6395c46d |
3043 | } |
3044 | return $use_icons; |
3045 | } |
3046 | # php recode |
3047 | sub commandB4 { |
39d3ec89 |
3048 | print "Enable this option if you want to use php recode functions to read\n"; |
3049 | print "emails written in charset that differs from the one that is set in\n"; |
3050 | print "translation selected by user. Code is experimental, it might cause\n"; |
3051 | print "errors, if email contains charset unsupported by recode or if your\n"; |
3052 | print "php does not have recode support.\n"; |
3053 | print "\n"; |
3054 | |
35aaf666 |
3055 | if ( lc($use_php_recode) eq 'true' ) { |
39d3ec89 |
3056 | $default_value = "y"; |
3057 | } else { |
3058 | $default_value = "n"; |
3059 | } |
ad9d110a |
3060 | print "Use php recode functions? (y/n) [$WHT$default_value$NRM]: $WHT"; |
39d3ec89 |
3061 | $use_php_recode = <STDIN>; |
3062 | if ( ( $use_php_recode =~ /^y\n/i ) || ( ( $use_php_recode =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
3063 | $use_php_recode = 'true'; |
39d3ec89 |
3064 | } else { |
35aaf666 |
3065 | $use_php_recode = 'false'; |
39d3ec89 |
3066 | } |
3067 | return $use_php_recode; |
3068 | } |
3069 | # php iconv |
6395c46d |
3070 | sub commandB5 { |
39d3ec89 |
3071 | print "Enable this option if you want to use php iconv functions to read\n"; |
3072 | print "emails written in charset that differs from the one that is set in\n"; |
3073 | print "translation selected by user. Code is experimental, it works only\n"; |
3074 | print "with translations that use utf-8 charset. Code might cause errors,\n"; |
3075 | print "if email contains charset unsupported by iconv or if your php does\n"; |
3076 | print "not have iconv support.\n"; |
3077 | print "\n"; |
3078 | |
35aaf666 |
3079 | if ( lc($use_php_iconv) eq 'true' ) { |
39d3ec89 |
3080 | $default_value = "y"; |
3081 | } else { |
3082 | $default_value = "n"; |
3083 | } |
ad9d110a |
3084 | print "Use php iconv functions? (y/n) [$WHT$default_value$NRM]: $WHT"; |
39d3ec89 |
3085 | $use_php_iconv = <STDIN>; |
3086 | if ( ( $use_php_iconv =~ /^y\n/i ) || ( ( $use_php_iconv =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
35aaf666 |
3087 | $use_php_iconv = 'true'; |
39d3ec89 |
3088 | } else { |
35aaf666 |
3089 | $use_php_iconv = 'false'; |
39d3ec89 |
3090 | } |
3091 | return $use_php_iconv; |
3092 | } |
3093 | |
71d3f882 |
3094 | # configtest block |
3095 | sub commandB6 { |
3096 | print "Enable this option if you want to check SquirrelMail configuration\n"; |
3097 | print "remotely with configtest.php script.\n"; |
3098 | print "\n"; |
3099 | |
3100 | if ( lc($allow_remote_configtest) eq 'true' ) { |
3101 | $default_value = "y"; |
3102 | } else { |
3103 | $default_value = "n"; |
3104 | } |
3105 | print "Allow remote configuration tests? (y/n) [$WHT$default_value$NRM]: $WHT"; |
3106 | $allow_remote_configtest = <STDIN>; |
3107 | if ( ( $allow_remote_configtest =~ /^y\n/i ) || ( ( $allow_remote_configtest =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { |
3108 | $allow_remote_configtest = 'true'; |
3109 | } else { |
3110 | $allow_remote_configtest = 'false'; |
3111 | } |
3112 | return $allow_remote_configtest; |
3113 | } |
3114 | |
3115 | |
39d3ec89 |
3116 | |
ccfb2029 |
3117 | sub save_data { |
ebd13f55 |
3118 | $tab = " "; |
eaace00e |
3119 | if ( open( CF, ">config.php" ) ) { |
ebd13f55 |
3120 | print CF "<?php\n"; |
3121 | print CF "\n"; |
eaace00e |
3122 | |
ebd13f55 |
3123 | print CF "/**\n"; |
3124 | print CF " * SquirrelMail Configuration File\n"; |
3125 | print CF " * Created using the configure script, conf.pl\n"; |
3126 | print CF " */\n"; |
3127 | print CF "\n"; |
93c06fa2 |
3128 | print CF "global \$version;\n"; |
598294a7 |
3129 | |
ebd13f55 |
3130 | if ($print_config_version) { |
eaace00e |
3131 | print CF "\$config_version = '$print_config_version';\n"; |
ebd13f55 |
3132 | } |
35aaf666 |
3133 | # integer |
254ded61 |
3134 | print CF "\$config_use_color = $config_use_color;\n"; |
ebd13f55 |
3135 | print CF "\n"; |
598294a7 |
3136 | |
35aaf666 |
3137 | # string |
d756b071 |
3138 | print CF "\$org_name = \"$org_name\";\n"; |
254ded61 |
3139 | # string |
35aaf666 |
3140 | print CF "\$org_logo = " . &change_to_SM_path($org_logo) . ";\n"; |
b6e0c3b6 |
3141 | $org_logo_width |= 0; |
3142 | $org_logo_height |= 0; |
35aaf666 |
3143 | # string |
6c2d0a35 |
3144 | print CF "\$org_logo_width = '$org_logo_width';\n"; |
3145 | # string |
35aaf666 |
3146 | print CF "\$org_logo_height = '$org_logo_height';\n"; |
3147 | # string that can contain variables. |
12947430 |
3148 | print CF "\$org_title = \"$org_title\";\n"; |
35aaf666 |
3149 | # string |
8bd9e0dd |
3150 | print CF "\$signout_page = " . &change_to_SM_path($signout_page) . ";\n"; |
35aaf666 |
3151 | # string |
3d043efc |
3152 | print CF "\$frame_top = '$frame_top';\n"; |
ebd13f55 |
3153 | print CF "\n"; |
eaace00e |
3154 | |
0ae4c1f2 |
3155 | print CF "\$provider_uri = '$provider_uri';\n"; |
3156 | print CF "\n"; |
3157 | |
3158 | print CF "\$provider_name = '$provider_name';\n"; |
3159 | print CF "\n"; |
3160 | |
35aaf666 |
3161 | # string that can contain variables |
254ded61 |
3162 | print CF "\$motd = \"$motd\";\n"; |
ebd13f55 |
3163 | print CF "\n"; |
598294a7 |
3164 | |
35aaf666 |
3165 | # string |
ebd13f55 |
3166 | print CF "\$squirrelmail_default_language = '$squirrelmail_default_language';\n"; |
35aaf666 |
3167 | # string |
39d3ec89 |
3168 | print CF "\$default_charset = '$default_charset';\n"; |
35aaf666 |
3169 | # boolean |
6cbbd722 |
3170 | print CF "\$show_alternative_names = $show_alternative_names;\n"; |
35aaf666 |
3171 | # string |
39d3ec89 |
3172 | print CF "\$available_languages = '$available_languages';\n"; |
35aaf666 |
3173 | # boolean |
f03f6ee7 |
3174 | print CF "\$aggressive_decoding = $aggressive_decoding;\n"; |
3175 | # boolean |
6d3689f5 |
3176 | print CF "\$lossy_encoding = $lossy_encoding;\n"; |
ebd13f55 |
3177 | print CF "\n"; |
eaace00e |
3178 | |
35aaf666 |
3179 | # string |
ebd13f55 |
3180 | print CF "\$domain = '$domain';\n"; |
35aaf666 |
3181 | # string |
ebd13f55 |
3182 | print CF "\$imapServerAddress = '$imapServerAddress';\n"; |
35aaf666 |
3183 | # integer |
254ded61 |
3184 | print CF "\$imapPort = $imapPort;\n"; |
35aaf666 |
3185 | # boolean |
254ded61 |
3186 | print CF "\$useSendmail = $useSendmail;\n"; |
35aaf666 |
3187 | # string |
ebd13f55 |
3188 | print CF "\$smtpServerAddress = '$smtpServerAddress';\n"; |
35aaf666 |
3189 | # integer |
254ded61 |
3190 | print CF "\$smtpPort = $smtpPort;\n"; |
35aaf666 |
3191 | # string |
ebd13f55 |
3192 | print CF "\$sendmail_path = '$sendmail_path';\n"; |
35aaf666 |
3193 | # boolean |
47a29326 |
3194 | # print CF "\$use_authenticated_smtp = $use_authenticated_smtp;\n"; |
35aaf666 |
3195 | # boolean |
254ded61 |
3196 | print CF "\$pop_before_smtp = $pop_before_smtp;\n"; |
35aaf666 |
3197 | # string |
ebd13f55 |
3198 | print CF "\$imap_server_type = '$imap_server_type';\n"; |
35aaf666 |
3199 | # boolean |
374726c9 |
3200 | print CF "\$invert_time = $invert_time;\n"; |
35aaf666 |
3201 | # string |
ebd13f55 |
3202 | print CF "\$optional_delimiter = '$optional_delimiter';\n"; |
35aaf666 |
3203 | #boolean |
3204 | print CF "\$skip_SM_header = $skip_SM_header;\n"; |
ebd13f55 |
3205 | print CF "\n"; |
eaace00e |
3206 | |
35aaf666 |
3207 | # string |
ebd13f55 |
3208 | print CF "\$default_folder_prefix = '$default_folder_prefix';\n"; |
35aaf666 |
3209 | # string |
ebd13f55 |
3210 | print CF "\$trash_folder = '$trash_folder';\n"; |
35aaf666 |
3211 | # string |
ebd13f55 |
3212 | print CF "\$sent_folder = '$sent_folder';\n"; |
35aaf666 |
3213 | # string |
ebd13f55 |
3214 | print CF "\$draft_folder = '$draft_folder';\n"; |
35aaf666 |
3215 | # boolean |
254ded61 |
3216 | print CF "\$default_move_to_trash = $default_move_to_trash;\n"; |
35aaf666 |
3217 | # boolean |
254ded61 |
3218 | print CF "\$default_move_to_sent = $default_move_to_sent;\n"; |
35aaf666 |
3219 | # boolean |
254ded61 |
3220 | print CF "\$default_save_as_draft = $default_save_as_draft;\n"; |
35aaf666 |
3221 | # boolean |
254ded61 |
3222 | print CF "\$show_prefix_option = $show_prefix_option;\n"; |
35aaf666 |
3223 | # boolean |
254ded61 |
3224 | print CF "\$list_special_folders_first = $list_special_folders_first;\n"; |
35aaf666 |
3225 | # boolean |
254ded61 |
3226 | print CF "\$use_special_folder_color = $use_special_folder_color;\n"; |
35aaf666 |
3227 | # boolean |
254ded61 |
3228 | print CF "\$auto_expunge = $auto_expunge;\n"; |
35aaf666 |
3229 | # boolean |
254ded61 |
3230 | print CF "\$default_sub_of_inbox = $default_sub_of_inbox;\n"; |
35aaf666 |
3231 | # boolean |
254ded61 |
3232 | print CF "\$show_contain_subfolders_option = $show_contain_subfolders_option;\n"; |
35aaf666 |
3233 | # integer |
254ded61 |
3234 | print CF "\$default_unseen_notify = $default_unseen_notify;\n"; |
35aaf666 |
3235 | # integer |
254ded61 |
3236 | print CF "\$default_unseen_type = $default_unseen_type;\n"; |
35aaf666 |
3237 | # boolean |
254ded61 |
3238 | print CF "\$auto_create_special = $auto_create_special;\n"; |
35aaf666 |
3239 | # boolean |
254ded61 |
3240 | print CF "\$delete_folder = $delete_folder;\n"; |
ca85aabe |
3241 | # boolean |
3242 | print CF "\$noselect_fix_enable = $noselect_fix_enable;\n"; |
3243 | |
ebd13f55 |
3244 | print CF "\n"; |
eaace00e |
3245 | |
35aaf666 |
3246 | # string |
8bd9e0dd |
3247 | print CF "\$data_dir = " . &change_to_SM_path($data_dir) . ";\n"; |
35aaf666 |
3248 | # string that can contain a variable |
8bd9e0dd |
3249 | print CF "\$attachment_dir = " . &change_to_SM_path($attachment_dir) . ";\n"; |
35aaf666 |
3250 | # integer |
254ded61 |
3251 | print CF "\$dir_hash_level = $dir_hash_level;\n"; |
35aaf666 |
3252 | # string |
80519ece |
3253 | print CF "\$default_left_size = '$default_left_size';\n"; |
35aaf666 |
3254 | # boolean |
254ded61 |
3255 | print CF "\$force_username_lowercase = $force_username_lowercase;\n"; |
35aaf666 |
3256 | # boolean |
254ded61 |
3257 | print CF "\$default_use_priority = $default_use_priority;\n"; |
35aaf666 |
3258 | # boolean |
254ded61 |
3259 | print CF "\$hide_sm_attributions = $hide_sm_attributions;\n"; |
35aaf666 |
3260 | # boolean |
254ded61 |
3261 | print CF "\$default_use_mdn = $default_use_mdn;\n"; |
35aaf666 |
3262 | # boolean |
254ded61 |
3263 | print CF "\$edit_identity = $edit_identity;\n"; |
35aaf666 |
3264 | # boolean |
254ded61 |
3265 | print CF "\$edit_name = $edit_name;\n"; |
35aaf666 |
3266 | # boolean |
254ded61 |
3267 | print CF "\$allow_thread_sort = $allow_thread_sort;\n"; |
35aaf666 |
3268 | # boolean |
aacc7bec |
3269 | print CF "\$allow_server_sort = $allow_server_sort;\n"; |
66bfb27b |
3270 | # boolean |
3c7ee482 |
3271 | print CF "\$allow_charset_search = $allow_charset_search;\n"; |
0f1b00b8 |
3272 | # integer |
3273 | print CF "\$allow_advanced_search = $allow_advanced_search;\n"; |
ebd13f55 |
3274 | print CF "\n"; |
598294a7 |
3275 | |
35aaf666 |
3276 | # all plugins are strings |
eaace00e |
3277 | for ( $ct = 0 ; $ct <= $#plugins ; $ct++ ) { |
a1b036d6 |
3278 | print CF "\$plugins[] = '$plugins[$ct]';\n"; |
ebd13f55 |
3279 | } |
3280 | print CF "\n"; |
eaace00e |
3281 | |
35aaf666 |
3282 | # strings |
8bd9e0dd |
3283 | print CF "\$theme_css = " . &change_to_SM_path($theme_css) . ";\n"; |
35aaf666 |
3284 | if ( $theme_default eq '' ) { $theme_default = '0'; } |
57c6fabc |
3285 | print CF "\$theme_default = $theme_default;\n"; |
3286 | |
eaace00e |
3287 | for ( $count = 0 ; $count <= $#theme_name ; $count++ ) { |
8bd9e0dd |
3288 | print CF "\$theme[$count]['PATH'] = " . &change_to_SM_path($theme_path[$count]) . ";\n"; |
ed65d11b |
3289 | # escape theme name so it can contain single quotes. |
3290 | $esc_name = $theme_name[$count]; |
3291 | $esc_name =~ s/\\/\\\\/g; |
3292 | $esc_name =~ s/'/\\'/g; |
3293 | print CF "\$theme[$count]['NAME'] = '$esc_name';\n"; |
ebd13f55 |
3294 | } |
3295 | print CF "\n"; |
eaace00e |
3296 | |
96862638 |
3297 | ## Address books |
3298 | # boolean |
ebd13f55 |
3299 | print CF "\$default_use_javascript_addr_book = $default_use_javascript_addr_book;\n"; |
eaace00e |
3300 | for ( $count = 0 ; $count <= $#ldap_host ; $count++ ) { |
3301 | print CF "\$ldap_server[$count] = array(\n"; |
35aaf666 |
3302 | # string |
eaace00e |
3303 | print CF " 'host' => '$ldap_host[$count]',\n"; |
35aaf666 |
3304 | # string |
eaace00e |
3305 | print CF " 'base' => '$ldap_base[$count]'"; |
3306 | if ( $ldap_name[$count] ) { |
3307 | print CF ",\n"; |
35aaf666 |
3308 | # string |
eaace00e |
3309 | print CF " 'name' => '$ldap_name[$count]'"; |
3310 | } |
3311 | if ( $ldap_port[$count] ) { |
3312 | print CF ",\n"; |
35aaf666 |
3313 | # integer |
254ded61 |
3314 | print CF " 'port' => $ldap_port[$count]"; |
eaace00e |
3315 | } |
3316 | if ( $ldap_charset[$count] ) { |
3317 | print CF ",\n"; |
35aaf666 |
3318 | # string |
eaace00e |
3319 | print CF " 'charset' => '$ldap_charset[$count]'"; |
3320 | } |
3321 | if ( $ldap_maxrows[$count] ) { |
3322 | print CF ",\n"; |
35aaf666 |
3323 | # integer |
254ded61 |
3324 | print CF " 'maxrows' => $ldap_maxrows[$count]"; |
eaace00e |
3325 | } |
30e9932c |
3326 | if ( $ldap_binddn[$count] ) { |
3327 | print CF ",\n"; |
3328 | # string |
3329 | print CF " 'binddn' => '$ldap_binddn[$count]'"; |
3330 | if ( $ldap_bindpw[$count] ) { |
3331 | print CF ",\n"; |
3332 | # string |
3333 | print CF " 'bindpw' => '$ldap_bindpw[$count]'"; |
3334 | } |
3335 | } |
3336 | if ( $ldap_protocol[$count] ) { |
3337 | print CF ",\n"; |
35aaf666 |
3338 | # integer |
30e9932c |
3339 | print CF " 'protocol' => $ldap_protocol[$count]"; |
3340 | } |
eaace00e |
3341 | print CF "\n"; |
3342 | print CF ");\n"; |
3343 | print CF "\n"; |
ebd13f55 |
3344 | } |
b622e1b8 |
3345 | |
35aaf666 |
3346 | # string |
4f40a59d |
3347 | print CF "\$addrbook_dsn = '$addrbook_dsn';\n"; |
35aaf666 |
3348 | # string |
4f40a59d |
3349 | print CF "\$addrbook_table = '$addrbook_table';\n\n"; |
35aaf666 |
3350 | # string |
3499f99f |
3351 | print CF "\$prefs_dsn = '$prefs_dsn';\n"; |
35aaf666 |
3352 | # string |
99a6c222 |
3353 | print CF "\$prefs_table = '$prefs_table';\n"; |
35aaf666 |
3354 | # string |
99a6c222 |
3355 | print CF "\$prefs_user_field = '$prefs_user_field';\n"; |
35aaf666 |
3356 | # string |
99a6c222 |
3357 | print CF "\$prefs_key_field = '$prefs_key_field';\n"; |
35aaf666 |
3358 | # string |
30e9932c |
3359 | print CF "\$prefs_val_field = '$prefs_val_field';\n\n"; |
35aaf666 |
3360 | # string |
30e9932c |
3361 | print CF "\$addrbook_global_dsn = '$addrbook_global_dsn';\n"; |
35aaf666 |
3362 | # string |
30e9932c |
3363 | print CF "\$addrbook_global_table = '$addrbook_global_table';\n"; |
35aaf666 |
3364 | # boolean |
4272758c |
3365 | print CF "\$addrbook_global_writeable = $addrbook_global_writeable;\n"; |
35aaf666 |
3366 | # boolean |
30e9932c |
3367 | print CF "\$addrbook_global_listing = $addrbook_global_listing;\n\n"; |
4272758c |
3368 | # string |
3369 | print CF "\$abook_global_file = '$abook_global_file';\n"; |
3370 | # boolean |
3371 | print CF "\$abook_global_file_writeable = $abook_global_file_writeable;\n\n"; |
71d3f882 |
3372 | # boolean |
3373 | print CF "\$abook_global_file_listing = $abook_global_file_listing;\n\n"; |
35aaf666 |
3374 | # boolean |
6395c46d |
3375 | print CF "\$no_list_for_subscribe = $no_list_for_subscribe;\n"; |
47a29326 |
3376 | |
35aaf666 |
3377 | # string |
6395c46d |
3378 | print CF "\$smtp_auth_mech = '$smtp_auth_mech';\n"; |
35aaf666 |
3379 | # string |
6395c46d |
3380 | print CF "\$imap_auth_mech = '$imap_auth_mech';\n"; |
35aaf666 |
3381 | # boolean |
6395c46d |
3382 | print CF "\$use_imap_tls = $use_imap_tls;\n"; |
35aaf666 |
3383 | # boolean |
6395c46d |
3384 | print CF "\$use_smtp_tls = $use_smtp_tls;\n"; |
35aaf666 |
3385 | # string |
6395c46d |
3386 | print CF "\$session_name = '$session_name';\n"; |
6c499577 |
3387 | |
35aaf666 |
3388 | print CF "\n"; |
3389 | |
3390 | # boolean |
3391 | print CF "\$advanced_tree = $advanced_tree;\n"; |
3392 | print CF "\n"; |
3393 | # boolean |
3394 | print CF "\$oldway = $oldway;\n"; |
3395 | print CF "\n"; |
3396 | # boolean |
3397 | print CF "\$use_icons = $use_icons;\n"; |
3398 | print CF "\n"; |
3399 | # boolean |
3400 | print CF "\$use_php_recode = $use_php_recode;\n"; |
3401 | print CF "\n"; |
3402 | # boolean |
3403 | print CF "\$use_php_iconv = $use_php_iconv;\n"; |
71d3f882 |
3404 | print CF "\n"; |
3405 | # boolean |
3406 | print CF "\$allow_remote_configtest = $allow_remote_configtest;\n"; |
35aaf666 |
3407 | print CF "\n"; |
3408 | |
3409 | print CF "\@include SM_PATH . 'config/config_local.php';\n"; |
598294a7 |
3410 | |
35aaf666 |
3411 | print CF "\n/**\n"; |
3412 | print CF " * Make sure there are no characters after the PHP closing\n"; |
3413 | print CF " * tag below (including newline characters and whitespace).\n"; |
3414 | print CF " * Otherwise, that character will cause the headers to be\n"; |
3415 | print CF " * sent and regular output to begin, which will majorly screw\n"; |
3416 | print CF " * things up when we try to send more headers later.\n"; |
3417 | print CF " */\n"; |
3418 | print CF "?>"; |
598294a7 |
3419 | |
35aaf666 |
3420 | close CF; |
ebd13f55 |
3421 | |
35aaf666 |
3422 | print "Data saved in config.php\n"; |
ebd13f55 |
3423 | } else { |
3424 | print "Error saving config.php: $!\n"; |
3425 | } |
911ad01c |
3426 | } |
a93b12ba |
3427 | |
3428 | sub set_defaults { |
f8c17cdd |
3429 | clear_screen(); |
eaace00e |
3430 | print $WHT. "SquirrelMail Configuration : " . $NRM; |
3431 | if ( $config == 1 ) { print "Read: config.php"; } |
3432 | elsif ( $config == 2 ) { print "Read: config_default.php"; } |
3433 | print "\n"; |
3434 | print "---------------------------------------------------------\n"; |
3435 | |
3436 | print "While we have been building SquirrelMail, we have discovered some\n"; |
3437 | print "preferences that work better with some servers that don't work so\n"; |
3438 | print "well with others. If you select your IMAP server, this option will\n"; |
3439 | print "set some pre-defined settings for that server.\n"; |
3440 | print "\n"; |
3441 | print "Please note that you will still need to go through and make sure\n"; |
3442 | print "everything is correct. This does not change everything. There are\n"; |
3443 | print "only a few settings that this will change.\n"; |
3444 | print "\n"; |
3445 | |
3446 | $continue = 0; |
3447 | while ( $continue != 1 ) { |
3448 | print "Please select your IMAP server:\n"; |
b39825f0 |
3449 | print " cyrus = Cyrus IMAP server\n"; |
3450 | print " uw = University of Washington's IMAP server\n"; |
3451 | print " exchange = Microsoft Exchange IMAP server\n"; |
3452 | print " courier = Courier IMAP server\n"; |
3453 | print " macosx = Mac OS X Mailserver\n"; |
3454 | print " hmailserver = hMailServer\n"; |
3455 | print " mercury32 = Mercury/32\n"; |
3456 | print " quit = Do not change anything\n"; |
eaace00e |
3457 | print "Command >> "; |
3458 | $server = <STDIN>; |
85645192 |
3459 | $server =~ s/[\r\n]//g; |
eaace00e |
3460 | |
3461 | print "\n"; |
3462 | if ( $server eq "cyrus" ) { |
3463 | $imap_server_type = "cyrus"; |
3464 | $default_folder_prefix = ""; |
3465 | $trash_folder = "INBOX.Trash"; |
3466 | $sent_folder = "INBOX.Sent"; |
3467 | $draft_folder = "INBOX.Drafts"; |
3468 | $show_prefix_option = false; |
3469 | $default_sub_of_inbox = true; |
3470 | $show_contain_subfolders_option = false; |
3471 | $optional_delimiter = "."; |
3472 | $disp_default_folder_prefix = "<none>"; |
b79b84c2 |
3473 | $force_username_lowercase = false; |
eaace00e |
3474 | |
3475 | $continue = 1; |
3476 | } elsif ( $server eq "uw" ) { |
3477 | $imap_server_type = "uw"; |
3478 | $default_folder_prefix = "mail/"; |
3479 | $trash_folder = "Trash"; |
3480 | $sent_folder = "Sent"; |
3481 | $draft_folder = "Drafts"; |
3482 | $show_prefix_option = true; |
3483 | $default_sub_of_inbox = false; |
3484 | $show_contain_subfolders_option = true; |
3485 | $optional_delimiter = "/"; |
3486 | $disp_default_folder_prefix = $default_folder_prefix; |
2eec12b5 |
3487 | $delete_folder = true; |
b79b84c2 |
3488 | $force_username_lowercase = true; |
598294a7 |
3489 | |
eaace00e |
3490 | $continue = 1; |
3491 | } elsif ( $server eq "exchange" ) { |
3492 | $imap_server_type = "exchange"; |
3493 | $default_folder_prefix = ""; |
3494 | $default_sub_of_inbox = true; |
3495 | $trash_folder = "INBOX/Deleted Items"; |
3496 | $sent_folder = "INBOX/Sent Items"; |
3497 | $drafts_folder = "INBOX/Drafts"; |
3498 | $show_prefix_option = false; |
3499 | $show_contain_subfolders_option = false; |
3500 | $optional_delimiter = "detect"; |
3501 | $disp_default_folder_prefix = "<none>"; |
b79b84c2 |
3502 | $force_username_lowercase = true; |
eaace00e |
3503 | |
3504 | $continue = 1; |
3505 | } elsif ( $server eq "courier" ) { |
3506 | $imap_server_type = "courier"; |
3507 | $default_folder_prefix = "INBOX."; |
3508 | $trash_folder = "Trash"; |
3509 | $sent_folder = "Sent"; |
3510 | $draft_folder = "Drafts"; |
3511 | $show_prefix_option = false; |
3512 | $default_sub_of_inbox = false; |
3513 | $show_contain_subfolders_option = false; |
3514 | $optional_delimiter = "."; |
3515 | $disp_default_folder_prefix = $default_folder_prefix; |
2eec12b5 |
3516 | $delete_folder = true; |
b79b84c2 |
3517 | $force_username_lowercase = false; |
598294a7 |
3518 | |
cfe486a7 |
3519 | $continue = 1; |
3520 | } elsif ( $server eq "macosx" ) { |
3521 | $imap_server_type = "macosx"; |
3522 | $default_folder_prefix = "INBOX/"; |
3523 | $trash_folder = "Trash"; |
3524 | $sent_folder = "Sent"; |
3525 | $draft_folder = "Drafts"; |
3526 | $show_prefix_option = false; |
3527 | $default_sub_of_inbox = true; |
3528 | $show_contain_subfolders_option = false; |
3529 | $optional_delimiter = "detect"; |
3530 | $allow_charset_search = false; |
3531 | $disp_default_folder_prefix = $default_folder_prefix; |
eaace00e |
3532 | |
063ed2b1 |
3533 | $continue = 1; |
b39825f0 |
3534 | } elsif ( $server eq "hmailserver" ) { |
3535 | $imap_server_type = "hmailserver"; |
946b11e9 |
3536 | $default_folder_prefix = ""; |
3537 | $trash_folder = "INBOX.Trash"; |
3538 | $sent_folder = "INBOX.Sent"; |
3539 | $draft_folder = "INBOX.Drafts"; |
3540 | $show_prefix_option = false; |
3541 | $default_sub_of_inbox = true; |
3542 | $show_contain_subfolders_option = false; |
3543 | $optional_delimiter = "detect"; |
3544 | $allow_charset_search = false; |
3545 | $disp_default_folder_prefix = $default_folder_prefix; |
e50f5ac2 |
3546 | $delete_folder = false; |
3547 | $force_username_lowercase = false; |
b39825f0 |
3548 | |
e50f5ac2 |
3549 | $continue = 1; |
063ed2b1 |
3550 | } elsif ( $server eq "mercury32" ) { |
3551 | $imap_server_type = "mercury32"; |
3552 | $default_folder_prefix = ""; |
3553 | $trash_folder = "INBOX.Trash"; |
3554 | $sent_folder = "INBOX.Sent"; |
3555 | $draft_folder = "INBOX.Drafts"; |
3556 | $show_prefix_option = false; |
3557 | $default_sub_of_inbox = true; |
3558 | $show_contain_subfolders_option = true; |
3559 | $optional_delimiter = "detect"; |
3560 | $delete_folder = true; |
3561 | $force_username_lowercase = true; |
3562 | |
eaace00e |
3563 | $continue = 1; |
3564 | } elsif ( $server eq "quit" ) { |
3565 | $continue = 1; |
3566 | } else { |
3567 | $disp_default_folder_prefix = $default_folder_prefix; |
3568 | print "Unrecognized server: $server\n"; |
3569 | print "\n"; |
3570 | } |
3571 | |
3572 | print " imap_server_type = $imap_server_type\n"; |
3573 | print " default_folder_prefix = $disp_default_folder_prefix\n"; |
3574 | print " trash_folder = $trash_folder\n"; |
3575 | print " sent_folder = $sent_folder\n"; |
3576 | print " draft_folder = $draft_folder\n"; |
3577 | print " show_prefix_option = $show_prefix_option\n"; |
3578 | print " default_sub_of_inbox = $default_sub_of_inbox\n"; |
3579 | print "show_contain_subfolders_option = $show_contain_subfolders_option\n"; |
3580 | print " optional_delimiter = $optional_delimiter\n"; |
2eec12b5 |
3581 | print " delete_folder = $delete_folder\n"; |
b79b84c2 |
3582 | print " force_username_lowercase = $force_username_lowercase\n"; |
eaace00e |
3583 | } |
b79b84c2 |
3584 | print "\nPress enter to continue..."; |
eaace00e |
3585 | $tmp = <STDIN>; |
a93b12ba |
3586 | } |
8bd9e0dd |
3587 | |
8bd9e0dd |
3588 | # This subroutine corrects relative paths to ensure they |
3589 | # will work within the SM space. If the path falls within |
598294a7 |
3590 | # the SM directory tree, the SM_PATH variable will be |
8bd9e0dd |
3591 | # prepended to the path, if not, then the path will be |
e6566358 |
3592 | # converted to an absolute path, e.g. |
2222aed0 |
3593 | # '../images/logo.gif' --> SM_PATH . 'images/logo.gif' |
a2a74376 |
3594 | # '../../someplace/data' --> '/absolute/path/someplace/data' |
2222aed0 |
3595 | # 'images/logo.gif' --> SM_PATH . 'config/images/logo.gif' |
3596 | # '/absolute/path/logo.gif' --> '/absolute/path/logo.gif' |
3597 | # 'http://whatever/' --> 'http://whatever' |
b72da239 |
3598 | # $some_var/path --> "$some_var/path" |
8bd9e0dd |
3599 | sub change_to_SM_path() { |
3600 | my ($old_path) = @_; |
3601 | my $new_path = ''; |
3602 | my @rel_path; |
3603 | my @abs_path; |
3604 | my $subdir; |
3605 | |
3606 | # If the path is absolute, don't bother. |
3607 | return "\'" . $old_path . "\'" if ( $old_path eq ''); |
a28a56da |
3608 | return "\'" . $old_path . "\'" if ( $old_path =~ /^(\/|http)/ ); |
d3fb3870 |
3609 | return "\'" . $old_path . "\'" if ( $old_path =~ /^\w:\// ); |
25be56ab |
3610 | return $old_path if ( $old_path =~ /^\'(\/|http)/ ); |
d3fb3870 |
3611 | return $old_path if ( $old_path =~ /^\'\w:\// ); |
b72da239 |
3612 | return $old_path if ( $old_path =~ /^SM_PATH/); |
598294a7 |
3613 | |
b72da239 |
3614 | if ( $old_path =~ /^\$/ ) { |
3615 | # check if it's a single var, or a $var/path combination |
3616 | # if it's $var/path, enclose in "" |
3617 | if ( $old_path =~ /\// ) { |
3618 | return '"'.$old_path.'"'; |
3619 | } |
3620 | return $old_path; |
3621 | } |
598294a7 |
3622 | |
25be56ab |
3623 | # Remove remaining ' |
3624 | $old_path =~ s/\'//g; |
598294a7 |
3625 | |
8bd9e0dd |
3626 | # For relative paths, split on '../' |
3627 | @rel_path = split(/\.\.\//, $old_path); |
3628 | |
3629 | if ( $#rel_path > 1 ) { |
3630 | # more than two levels away. Make it absolute. |
a2a74376 |
3631 | @abs_path = split(/\//, $dir); |
598294a7 |
3632 | |
a2a74376 |
3633 | # Lop off the relative pieces of the absolute path.. |
3634 | for ( $i = 0; $i <= $#rel_path; $i++ ) { |
3635 | pop @abs_path; |
3636 | shift @rel_path; |
3637 | } |
3638 | push @abs_path, @rel_path; |
1df76076 |
3639 | $new_path = "\'" . join('/', @abs_path) . "\'"; |
8bd9e0dd |
3640 | } elsif ( $#rel_path > 0 ) { |
3641 | # it's within the SM tree, prepend SM_PATH |
3642 | $new_path = $old_path; |
3643 | $new_path =~ s/^\.\.\//SM_PATH . \'/; |
25be56ab |
3644 | $new_path .= "\'"; |
8bd9e0dd |
3645 | } else { |
3646 | # Last, it's a relative path without any leading '.' |
598294a7 |
3647 | # Prepend SM_PATH and config, since the paths are |
35aaf666 |
3648 | # relative to the config directory |
e6566358 |
3649 | $new_path = "SM_PATH . \'config/" . $old_path . "\'"; |
8bd9e0dd |
3650 | } |
8bd9e0dd |
3651 | return $new_path; |
3652 | } |
3653 | |
e6566358 |
3654 | |
3655 | # Change SM_PATH to admin-friendly version, e.g.: |
3656 | # SM_PATH . 'images/logo.gif' --> '../images/logo.gif' |
3657 | # SM_PATH . 'config/some.php' --> 'some.php' |
3658 | # '/absolute/path/logo.gif' --> '/absolute/path/logo.gif' |
3659 | # 'http://whatever/' --> 'http://whatever' |
8bd9e0dd |
3660 | sub change_to_rel_path() { |
3661 | my ($old_path) = @_; |
e6566358 |
3662 | my $new_path = $old_path; |
8bd9e0dd |
3663 | |
3664 | if ( $old_path =~ /^SM_PATH/ ) { |
8bd9e0dd |
3665 | $new_path =~ s/^SM_PATH . \'/\.\.\//; |
b72da239 |
3666 | $new_path =~ s/\.\.\/config\///; |
8bd9e0dd |
3667 | } |
3668 | |
3669 | return $new_path; |
3670 | } |
b47821fb |
3671 | |
3672 | sub detect_auth_support { |
3673 | # Attempts to auto-detect if a specific auth mechanism is supported. |
3674 | # Called by 'command112a' and 'command112b' |
3675 | # ARGS: service-name (IMAP or SMTP), host:port, mech-name (ie. CRAM-MD5) |
3676 | |
35aaf666 |
3677 | # Misc setup |
3678 | use IO::Socket; |
3679 | my $service = shift; |
3680 | my $host = shift; |
3681 | my $mech = shift; |
3682 | # Sanity checks |
3683 | if ((!defined($service)) or (!defined($host)) or (!defined($mech))) { |
3684 | # Error - wrong # of args |
3685 | print "BAD ARGS!\n"; |
3686 | return undef; |
3687 | } |
598294a7 |
3688 | |
35aaf666 |
3689 | if ($service eq 'SMTP') { |
5d28b77e |
3690 | $cmd = "AUTH $mech\r\n"; |
3691 | $logout = "QUIT\r\n"; |
35aaf666 |
3692 | } elsif ($service eq 'IMAP') { |
3693 | $cmd = "A01 AUTHENTICATE $mech\n"; |
3694 | $logout = "C01 LOGOUT\n"; |
3695 | } else { |
3696 | # unknown service - whoops. |
3697 | return undef; |
3698 | } |
3699 | |
3700 | # Get this show on the road |
b47821fb |
3701 | my $sock=IO::Socket::INET->new($host); |
3702 | if (!defined($sock)) { |
3703 | # Connect failed |
3704 | return undef; |
3705 | } |
35aaf666 |
3706 | my $discard = <$sock>; # Server greeting/banner - who cares.. |
3707 | |
3708 | if ($service eq 'SMTP') { |
3709 | # Say hello first.. |
5d28b77e |
3710 | print $sock "HELO $domain\r\n"; |
35aaf666 |
3711 | $discard = <$sock>; # Yeah yeah, you're happy to see me.. |
3712 | } |
3713 | print $sock $cmd; |
3714 | |
3715 | my $response = <$sock>; |
3716 | chomp($response); |
3717 | if (!defined($response)) { |
3718 | return undef; |
3719 | } |
3720 | |
3721 | # So at this point, we have a response, and it is (hopefully) valid. |
3722 | if ($service eq 'SMTP') { |
3723 | if (($response =~ /^535/) or ($response =~/^502/)) { |
3724 | # Not supported |
5d28b77e |
3725 | print $sock $logout; |
35aaf666 |
3726 | close $sock; |
3727 | return 'NO'; |
3728 | } elsif ($response =~ /^503/) { |
3729 | #Something went wrong |
3730 | return undef; |
3731 | } |
3732 | } elsif ($service eq 'IMAP') { |
3733 | if ($response =~ /^A01/) { |
3734 | # Not supported |
5d28b77e |
3735 | print $sock $logout; |
35aaf666 |
3736 | close $sock; |
3737 | return 'NO'; |
3738 | } |
3739 | } else { |
3740 | # Unknown service - this shouldn't be able to happen. |
3741 | close $sock; |
3742 | return undef; |
3743 | } |
3744 | |
3745 | # If it gets here, the mech is supported |
3746 | print $sock "*\n"; # Attempt to cancel authentication |
3747 | print $sock $logout; # Try to log out, but we don't really care if this fails |
3748 | close $sock; |
3749 | return 'YES'; |
b47821fb |
3750 | } |
f8c17cdd |
3751 | |
3752 | sub clear_screen() { |
3753 | if ( $^O =~ /^mswin/i) { |
3754 | system "cls"; |
3755 | } else { |
3756 | system "clear"; |
3757 | } |
3758 | } |