X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=config%2Fconf.pl;h=1249e022b9ea2d769d0031fc5c1a0d58a6e9a820;hp=894a2b19666a8c2b806e3737e83ca06434f35653;hb=6f4c512ccb2cf15e432ff0eb9b194c09613a9aa1;hpb=02473e22f55751d172fd081c55a1c29af870fb98 diff --git a/config/conf.pl b/config/conf.pl index 894a2b19..1249e022 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -1,7 +1,7 @@ #!/usr/bin/env perl # conf.pl # -# Copyright (c) 1999-2006 The SquirrelMail Project Team +# Copyright (c) 1999-2007 The SquirrelMail Project Team # Licensed under the GNU GPL. For full terms see COPYING. # # A simple configure script to configure SquirrelMail @@ -385,7 +385,7 @@ $delete_folder = 'false' if ( !$delete_folder ); $noselect_fix_enable = 'false' if ( !$noselect_fix_enable ); $frame_top = "_top" if ( !$frame_top ); $provider_uri = '' if ( !$provider_uri ); -$provider_name = '' if ( !$provider_name ); +$provider_name = '' if ( !$provider_name || $provider_name eq 'SquirrelMail'); $no_list_for_subscribe = 'false' if ( !$no_list_for_subscribe ); $allow_charset_search = 'true' if ( !$allow_charset_search ); $allow_advanced_search = 0 if ( !$allow_advanced_search) ; @@ -469,6 +469,10 @@ $config_location_base = '' if ( !$config_location_base ); $smtp_sitewide_user = '' if ( !$smtp_sitewide_user ); $smtp_sitewide_pass = '' if ( !$smtp_sitewide_pass ); $icon_theme_def = '' if ( !$icon_theme_def ); +$disable_plugins = 'false' if ( !$disable_plugins ); +$disable_plugins_user = '' if ( !$disable_plugins_user ); +$only_secure_cookies = 'true' if ( !$only_secure_cookies ); +$ask_user_info = 'true' if ( !$ask_user_info ); if ( $ARGV[0] eq '--install-plugin' ) { print "Activating plugin " . $ARGV[1] . "\n"; @@ -501,6 +505,22 @@ if ( $ARGV[0] eq '--install-plugin' ) { exit(0); } + + +#################################################################################### + +# used in multiple places, define once +$list_supported_imap_servers = + " bincimap = Binc IMAP server\n" . + " courier = Courier IMAP server\n" . + " cyrus = Cyrus IMAP server\n" . + " dovecot = Dovecot Secure IMAP server\n" . + " exchange = Microsoft Exchange IMAP server\n" . + " hmailserver = hMailServer\n" . + " macosx = Mac OS X Mailserver\n" . + " mercury32 = Mercury/32\n" . + " uw = University of Washington's IMAP server\n"; + ##################################################################################### if ( $config_use_color == 1 ) { $WHT = "\x1B[37;1m"; @@ -544,7 +564,7 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) { print "5. Signout Page : $WHT$signout_page$NRM\n"; print "6. Top Frame : $WHT$frame_top$NRM\n"; print "7. Provider link : $WHT$provider_uri$NRM\n"; - print "8. Provider name : $WHT$provider_name$NRM\n"; + print "8. Provider link text : $WHT$provider_name$NRM\n"; print "\n"; print "R Return to Main Menu\n"; @@ -639,24 +659,25 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) { print "R Return to Main Menu\n"; } elsif ( $menu == 4 ) { print $WHT. "General Options\n" . $NRM; - print "1. Data Directory : $WHT$data_dir$NRM\n"; - print "2. Attachment Directory : $WHT$attachment_dir$NRM\n"; - print "3. Directory Hash Level : $WHT$dir_hash_level$NRM\n"; - print "4. Default Left Size : $WHT$default_left_size$NRM\n"; - print "5. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n"; - print "6. Allow use of priority : $WHT$default_use_priority$NRM\n"; - print "7. Hide SM attributions : $WHT$hide_sm_attributions$NRM\n"; - print "8. Allow use of receipts : $WHT$default_use_mdn$NRM\n"; - print "9. Allow editing of identity : $WHT$edit_identity$NRM\n"; - print " Allow editing of name : $WHT$edit_name$NRM\n"; - print " Remove username from header : $WHT$hide_auth_header$NRM\n"; - print "10. Disable server thread sort : $WHT$disable_thread_sort$NRM\n"; - print "11. Disable server-side sorting : $WHT$disable_server_sort$NRM\n"; - print "12. Allow server charset search : $WHT$allow_charset_search$NRM\n"; - print "13. Allow advanced search : $WHT$allow_advanced_search$NRM\n"; - print "14. PHP session name : $WHT$session_name$NRM\n"; - print "15. Time zone configuration : $WHT$time_zone_type$NRM\n"; - print "16. Location base : $WHT$config_location_base$NRM\n"; + print "1. Data Directory : $WHT$data_dir$NRM\n"; + print "2. Attachment Directory : $WHT$attachment_dir$NRM\n"; + print "3. Directory Hash Level : $WHT$dir_hash_level$NRM\n"; + print "4. Default Left Size : $WHT$default_left_size$NRM\n"; + print "5. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n"; + print "6. Allow use of priority : $WHT$default_use_priority$NRM\n"; + print "7. Hide SM attributions : $WHT$hide_sm_attributions$NRM\n"; + print "8. Allow use of receipts : $WHT$default_use_mdn$NRM\n"; + print "9. Allow editing of identity : $WHT$edit_identity$NRM\n"; + print " Allow editing of name : $WHT$edit_name$NRM\n"; + print " Remove username from header : $WHT$hide_auth_header$NRM\n"; + print "10. Disable server thread sort : $WHT$disable_thread_sort$NRM\n"; + print "11. Disable server-side sorting : $WHT$disable_server_sort$NRM\n"; + print "12. Allow server charset search : $WHT$allow_charset_search$NRM\n"; + print "13. Allow advanced search : $WHT$allow_advanced_search$NRM\n"; + print "14. PHP session name : $WHT$session_name$NRM\n"; + print "15. Time zone configuration : $WHT$time_zone_type$NRM\n"; + print "16. Location base : $WHT$config_location_base$NRM\n"; + print "17. Only secure cookies if poss. : $WHT$only_secure_cookies$NRM\n"; print "\n"; print "R Return to Main Menu\n"; } elsif ( $menu == 5 ) { @@ -692,12 +713,18 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) { print "\n"; print "R Return to Main Menu\n"; } elsif ( $menu == 8 ) { - print $WHT. "Plugins\n" . $NRM; + if (lc($disable_plugins) eq 'true' && $disable_plugins_user ne '') { + print $WHT. "Plugins (WARNING: All plugins are currently disabled\n for the user \"$disable_plugins_user\"!)\n" . $NRM; + } elsif (lc($disable_plugins) eq 'true') { + print $WHT. "Plugins (WARNING: All plugins are currently disabled!)\n" . $NRM; + } else { + print $WHT. "Plugins\n" . $NRM; + } print " Installed Plugins\n"; $num = 0; for ( $count = 0 ; $count <= $#plugins ; $count++ ) { $num = $count + 1; - print " $num. $plugins[$count]\n"; + print " $num. $plugins[$count]" . get_plugin_version($plugins[$count]) . "\n"; } print "\n Available Plugins:\n"; opendir( DIR, "../plugins" ); @@ -721,11 +748,19 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) { for ( $i = 0 ; $i <= $#unused_plugins ; $i++ ) { $num = $num + 1; - print " $num. $unused_plugins[$i]\n"; + print " $num. $unused_plugins[$i]" . get_plugin_version($unused_plugins[$i]) . "\n"; } closedir DIR; print "\n"; + if (lc($disable_plugins) eq 'true' && $disable_plugins_user ne '') { + print "E Enable active plugins (all plugins currently\n disabled for the user \"$disable_plugins_user\")\n"; + } elsif (lc($disable_plugins) eq 'true') { + print "E Enable active plugins (all plugins currently\n disabled)\n"; + } else { + print "D Disable all plugins\n"; + } + print "U Set the user for whom plugins can be disabled\n"; print "R Return to Main Menu\n"; } elsif ( $menu == 9 ) { print $WHT. "Database\n" . $NRM; @@ -756,6 +791,7 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) { } elsif ( $menu == 11 ) { print $WHT. "Interface tweaks\n" . $NRM; print "1. Display html mails in iframe : $WHT$use_iframe$NRM\n"; + print "2. Ask user info on first login : $WHT$ask_user_info$NRM\n"; print "\n"; print $WHT. "PHP tweaks\n" . $NRM; print "4. Use php recode functions : $WHT$use_php_recode$NRM\n"; @@ -888,6 +924,7 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) { elsif ( $command == 14 ) { $session_name = command317(); } elsif ( $command == 15 ) { $time_zone_type = command318(); } elsif ( $command == 16 ) { $config_location_base = command_config_location_base(); } + elsif ( $command == 17 ) { $only_secure_cookies = command319(); } } elsif ( $menu == 5 ) { if ( $command == 1 ) { $use_icons = commandB3(); } # elsif ( $command == 3 ) { $icon_theme_def = commandB7(); } @@ -906,7 +943,10 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) { } elsif ( $menu == 7 ) { if ( $command == 1 ) { $motd = command71(); } } elsif ( $menu == 8 ) { - if ( $command =~ /^[0-9]+/ ) { @plugins = command81(); } + if ( $command =~ /^[0-9]+/ ) { @plugins = command81(); } + elsif ( $command eq "u" ) { $disable_plugins_user = command82(); } + elsif ( $command eq "d" ) { $disable_plugins = 'true'; } + elsif ( $command eq "e" ) { $disable_plugins = 'false'; } } elsif ( $menu == 9 ) { if ( $command == 1 ) { $addrbook_dsn = command91(); } elsif ( $command == 2 ) { $addrbook_table = command92(); } @@ -927,6 +967,7 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) { elsif ( $command == 5 ) { $lossy_encoding = commandA5(); } } elsif ( $menu == 11 ) { if ( $command == 1 ) { $use_iframe = commandB2(); } + elsif ( $command == 2 ) { $ask_user_info = command_ask_user_info(); } elsif ( $command == 4 ) { $use_php_recode = commandB4(); } elsif ( $command == 5 ) { $use_php_iconv = commandB5(); } elsif ( $command == 6 ) { $allow_remote_configtest = commandB6(); } @@ -1069,8 +1110,8 @@ sub command6 { # Default link to provider sub command7 { - print "Here you can set the link on the right of the page.\n"; - print "If empty, it will link to the SquirrelMail About page.\n"; + print "Here you can set the link on the top-right of the message list.\n"; + print "If empty, it will not be displayed.\n"; print "\n"; print "[$WHT$provider_uri$NRM]: $WHT"; $new_provider_uri = ; @@ -1084,13 +1125,13 @@ sub command7 { } sub command8 { - print "Here you can set the name of the link on the right of the page.\n"; - print "The default is 'SquirrelMail'\n"; + print "Here you can set the name of the link on the top-right of the message list.\n"; + print "The default is empty (do not display anything).'\n"; print "\n"; print "[$WHT$provider_name$NRM]: $WHT"; $new_provider_name = ; if ( $new_provider_name eq "\n" ) { - $new_provider_name = 'SquirrelMail'; + $new_provider_name = ''; } else { $new_provider_name =~ s/[\r\n]//g; $new_provider_name =~ s/^\s+$//g; @@ -1112,7 +1153,7 @@ sub command11 { if ( $new_domain eq "\n" ) { $new_domain = $domain; } else { - $new_domain =~ s/[\r\n]//g; + $new_domain =~ s/\s//g; } return $new_domain; } @@ -1252,14 +1293,7 @@ sub command19 { print "these servers. If you would like to use them, please select your\n"; print "IMAP server. If you do not wish to use these work-arounds, you can\n"; print "set this to \"other\", and none will be used.\n"; - print " courier = Courier IMAP server\n"; - print " cyrus = Cyrus IMAP server\n"; - print " dovecot = Dovecot Secure IMAP server\n"; - print " exchange = Microsoft Exchange IMAP server\n"; - print " hmailserver = hMailServer\n"; - print " macosx = Mac OS X Mailserver\n"; - print " mercury32 = Mercury Mail Transport System\n"; - print " uw = University of Washington's IMAP server\n"; + print $list_supported_imap_servers; print "\n"; print " other = Not one of the above servers\n"; print "\n"; @@ -1690,6 +1724,25 @@ sub command81 { return @plugins; } +# disable_plugins_user +sub command82 { + print "When all active plugins are disabled, they can be disabled only\n"; + print "for the one user named here. If left blank, plugins will be\n"; + print "disabled for ALL users. This setting has no effect if plugins\n"; + print "are not disabled.\n"; + print "\n"; + print "This must be the exact IMAP login name for the desired user.\n"; + print "\n"; + print "[$WHT$disable_plugins_user$NRM]: $WHT"; + $new_disable_plugins_user = ; + if ( $new_disable_plugins_user eq "\n" ) { + $new_disable_plugins_user = $disable_plugins_user; + } else { + $new_disable_plugins_user =~ s/[\r\n]//g; + } + return $new_disable_plugins_user; +} + ################# FOLDERS ################### # default_folder_prefix @@ -2320,7 +2373,7 @@ sub command38 { print ""; print "\n"; - if ( lc($default_hide_attribution) eq 'true' ) { + if ( lc($hide_sm_attributions) eq 'true' ) { $default_value = "y"; } else { $default_value = "n"; @@ -2576,6 +2629,32 @@ sub command_config_location_base { return $config_location_base; } +# only_secure_cookies (since 1.5.2) +sub command319 { + print "This option allows you to specify that if a user session is initiated\n"; + print "under a secure (HTTPS, SSL-encrypted) connection, the cookies given to\n"; + print "the browser will ONLY be transmitted via a secure connection henceforth.\n\n"; + print "Generally this is a Good Thing, and should NOT be disabled. However,\n"; + print "if you intend to use the Secure Login or Show SSL Link plugins to\n"; + print "encrypt the user login, but not the rest of the SquirrelMail session,\n"; + print "this can be turned off. Think twice before doing so.\n"; + print "\n"; + + if ( lc($only_secure_cookies) eq 'true' ) { + $default_value = "y"; + } else { + $default_value = "n"; + } + print "Transmit cookies only on secure connection when available? (y/n) [$WHT$default_value$NRM]: $WHT"; + $only_secure_cookies = ; + if ( ( $only_secure_cookies =~ /^y\n/i ) || ( ( $only_secure_cookies =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { + $only_secure_cookies = 'true'; + } else { + $only_secure_cookies = 'false'; + } + return $only_secure_cookies; +} + sub command_userThemes { print "\nDefine the user themes that you wish to use. If you have added\n"; @@ -4080,6 +4159,30 @@ sub commandB2 { } return $use_iframe; } + +# ask user info +sub command_ask_user_info { + print "New users need to supply their real name and email address to\n"; + print "send out proper mails. When this option is enabled, a user that\n"; + print "logs in for the first time will be redirected to the Personal\n"; + print "Options screen and asked to supply their personal data.\n"; + print "\n"; + + if ( lc($ask_user_info) eq 'true' ) { + $default_value = "y"; + } else { + $default_value = "n"; + } + print "Ask user info? (y/n) [$WHT$default_value$NRM]: $WHT"; + $ask_user_info = ; + if ( ( $ask_user_info =~ /^y\n/i ) || ( ( $ask_user_info =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { + $ask_user_info = 'true'; + } else { + $ask_user_info = 'false'; + } + return $ask_user_info; +} + # use icons sub commandB3 { print "Enabling this option will cause icons to be used instead of text\n"; @@ -4367,6 +4470,11 @@ sub save_data { # string print CF "\$config_location_base = '$config_location_base';\n"; print CF "\n"; + # boolean + print CF "\$disable_plugins = $disable_plugins;\n"; + # string + print CF "\$disable_plugins_user = '$disable_plugins_user';\n"; + print CF "\n"; # all plugins are strings for ( $ct = 0 ; $ct <= $#plugins ; $ct++ ) { @@ -4562,29 +4670,31 @@ sub save_data { print CF "\$no_list_for_subscribe = $no_list_for_subscribe;\n"; # string - print CF "\$smtp_auth_mech = '$smtp_auth_mech';\n"; - print CF "\$smtp_sitewide_user = '". quote_single($smtp_sitewide_user) ."';\n"; - print CF "\$smtp_sitewide_pass = '". quote_single($smtp_sitewide_pass) ."';\n"; + print CF "\$smtp_auth_mech = '$smtp_auth_mech';\n"; + print CF "\$smtp_sitewide_user = '". quote_single($smtp_sitewide_user) ."';\n"; + print CF "\$smtp_sitewide_pass = '". quote_single($smtp_sitewide_pass) ."';\n"; # string - print CF "\$imap_auth_mech = '$imap_auth_mech';\n"; + print CF "\$imap_auth_mech = '$imap_auth_mech';\n"; # boolean - print CF "\$use_imap_tls = $use_imap_tls;\n"; + print CF "\$use_imap_tls = $use_imap_tls;\n"; # boolean - print CF "\$use_smtp_tls = $use_smtp_tls;\n"; + print CF "\$use_smtp_tls = $use_smtp_tls;\n"; # string - print CF "\$session_name = '$session_name';\n"; + print CF "\$session_name = '$session_name';\n"; + # boolean + print CF "\$only_secure_cookies = $only_secure_cookies;\n"; print CF "\n"; # boolean print CF "\$use_iframe = $use_iframe;\n"; - print CF "\n"; + # boolean + print CF "\$ask_user_info = $ask_user_info;\n"; # boolean print CF "\$use_icons = $use_icons;\n"; print CF "\n"; # boolean print CF "\$use_php_recode = $use_php_recode;\n"; - print CF "\n"; # boolean print CF "\$use_php_iconv = $use_php_iconv;\n"; print CF "\n"; @@ -4624,15 +4734,7 @@ sub set_defaults { $continue = 0; while ( $continue != 1 ) { print "Please select your IMAP server:\n"; - print " bincimap = Binc IMAP server\n"; - print " courier = Courier IMAP server\n"; - print " cyrus = Cyrus IMAP server\n"; - print " dovecot = Dovecot Secure IMAP server\n"; - print " exchange = Microsoft Exchange IMAP server\n"; - print " hmailserver = hMailServer\n"; - print " macosx = Mac OS X Mailserver\n"; - print " mercury32 = Mercury/32\n"; - print " uw = University of Washington's IMAP server\n"; + print $list_supported_imap_servers; print "\n"; print " quit = Do not change anything\n"; print "\n"; @@ -5029,6 +5131,68 @@ sub quote_single($) { return $string; } +# determine a plugin's version number +# +# parses the setup.php file, looking for the +# version string in the _info() or the +# _version functions. +# +sub get_plugin_version() { + + my $plugin_name = shift(@_); + + $setup_file = '../plugins/' . $plugin_name . '/setup.php'; + if ( -e "$setup_file" ) { + # Make sure that file is readable + if (! -r "$setup_file") { + print "\n"; + print "WARNING:\n"; + print "The file \"$setup_file\" was found, but you don't\n"; + print "have rights to read it. The plugin \""; + print $plugin_name . "\" may not work correctly until you fix this.\n"; + print "\nPress enter to continue"; + $ctu = ; + print "\n"; + next; + } + + $version = ' '; +# FIXME: grep the file instead of reading it into memory? + $whole_file = ''; + open( FILE, "$setup_file" ); + while ( $line = ) { + $whole_file .= $line; + } + close(FILE); + + # ideally, there is a version in the _info function... + # + if ($whole_file =~ /('version'\s*=>\s*['"](.*?)['"])/) { + $version .= $2; + + # this assumes there is only one function that returns + # a static string in the setup file + # + } elsif ($whole_file =~ /(return\s*['"](.*?)['"])/) { + $version .= $2; + } + + return $version; + + } else { + print "\n"; + print "WARNING:\n"; + print "The file \"$setup_file\" was not found.\n"; + print "The plugin \"" . $plugin_name; + print "\" may not work correctly until you fix this.\n"; + print "\nPress enter to continue"; + $ctu = ; + print "\n"; + next; + } + +} + # parses the setup.php files for all activated plugins and # builds static plugin hooks array so we don't have to load # ALL plugins are runtime and build the hook array on every