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