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