From f03f6ee71bffc0c660edbc75e67acc4dff040051 Mon Sep 17 00:00:00 2001 From: tokul Date: Fri, 27 Aug 2004 12:46:59 +0000 Subject: [PATCH] agresive_decoding changed to aggressive_decoding. added loosy_encoding to conf.pl and other configuration scripts. added phpdoc since tags to some options. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7969 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 3 ++ config/conf.pl | 53 ++++++++++++++++++++++++------- config/config_default.php | 26 +++++++++++++-- functions/i18n.php | 10 +++--- plugins/administrator/defines.php | 4 ++- 5 files changed, 75 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index d280214f..9dcfe87e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -90,6 +90,9 @@ Version 1.5.1 -- CVS mailbox_display_button_action to promote the new location - Making delete button, when viewing a message, consider which page was viewed before. + - $agresive_decoding configuration option changed to $aggressive_decoding. + Fixed spelling. + - Added $loosy_encoding option (provides fix for #806698) Version 1.5.0 -------------------- diff --git a/config/conf.pl b/config/conf.pl index 549b9d3d..aa844940 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -306,7 +306,8 @@ $imap_auth_mech = 'login' if ( !$imap_auth_mech ); $session_name = 'SQMSESSID' if ( !$session_name ); $show_alternative_names = 'false' if ( !$show_alternative_names ); $available_languages = 'all' if ( !$available_languages ); -$agresive_decoding = 'false' if ( !$agresive_decoding ); +$aggressive_decoding = 'false' if ( !$aggressive_decoding ); +$loosy_encoding = 'false' if ( !$loosy_encoding ); $advanced_tree = 'false' if ( !$advanced_tree ); $oldway = 'false' if ( !$oldway ); $use_icons = 'false' if ( !$use_icons ); @@ -572,7 +573,8 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) { print "2. Default Charset : $WHT$default_charset$NRM\n"; print "3. Show alternative language names : $WHT$show_alternative_names$NRM\n"; print "4. Available languages : $WHT$available_languages$NRM\n"; - print "5. Use agresive decoding : $WHT$agresive_decoding$NRM\n"; + print "5. Enable aggressive decoding : $WHT$aggressive_decoding$NRM\n"; + print "6. Enable loosy encoding : $WHT$loosy_encoding$NRM\n"; print "\n"; print "R Return to Main Menu\n"; } elsif ( $menu == 11 ) { @@ -732,7 +734,8 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) { elsif ( $command == 2 ) { $default_charset = commandA2(); } elsif ( $command == 3 ) { $show_alternative_names = commandA3(); } elsif ( $command == 4 ) { $available_languages = commandA4(); } - elsif ( $command == 5 ) { $agresive_decoding = commandA5(); } + elsif ( $command == 5 ) { $aggressive_decoding = commandA5(); } + elsif ( $command == 6 ) { $loosy_encoding = commandA6(); } } elsif ( $menu == 11 ) { if ( $command == 1 ) { $advanced_tree = commandB1(); } elsif ( $command == 2 ) { $oldway = commandB2(); } @@ -2854,7 +2857,7 @@ sub commandA4 { } return $new_available_languages; } -# Agresive decoding +# Aggressive decoding sub commandA5 { print "Enable this option if you want to use CPU and memory intensive decoding\n"; print "functions. This option allows reading multibyte charset, that are used\n"; @@ -2862,21 +2865,45 @@ sub commandA5 { print "even when you have disabled use of recode in Tweaks section.\n"; print "\n"; - if ( lc($agresive_decoding) eq 'true' ) { + if ( lc($aggressive_decoding) eq 'true' ) { $default_value = "y"; } else { $default_value = "n"; } - print "Use agresive decoding? (y/n) [$WHT$default_value$NRM]: $WHT"; - $agresive_decoding = ; - if ( ( $agresive_decoding =~ /^y\n/i ) || ( ( $agresive_decoding =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { - $agresive_decoding = 'true'; + print "Enable aggressive decoding? (y/n) [$WHT$default_value$NRM]: $WHT"; + $aggressive_decoding = ; + if ( ( $aggressive_decoding =~ /^y\n/i ) || ( ( $aggressive_decoding =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { + $aggressive_decoding = 'true'; } else { - $agresive_decoding = 'false'; + $aggressive_decoding = 'false'; } - return $agresive_decoding; + return $aggressive_decoding; } +# Loosy encoding +sub commandA6 { + print "Enable this option if you want to allow loosy charset encoding in message\n"; + print "composition pages. This option allows charset conversions when output\n"; + print "charset does not support all symbols used in original charset. Symbols\n"; + print "unsupported by output charset will be replaced with question marks.\n"; + print "\n"; + + if ( lc($loosy_encoding) eq 'true' ) { + $default_value = "y"; + } else { + $default_value = "n"; + } + print "Enable loosy encoding? (y/n) [$WHT$default_value$NRM]: $WHT"; + $loosy_encoding = ; + if ( ( $loosy_encoding =~ /^y\n/i ) || ( ( $loosy_encoding =~ /^\n/ ) && ( $default_value eq "y" ) ) ) { + $loosy_encoding = 'true'; + } else { + $loosy_encoding = 'false'; + } + return $loosy_encoding; +} + + # Advanced tree sub commandB1 { print "Enable this option if you want to use DHTML based folder listing.\n"; @@ -3049,7 +3076,9 @@ sub save_data { # string print CF "\$available_languages = '$available_languages';\n"; # boolean - print CF "\$agresive_decoding = $agresive_decoding;\n"; + print CF "\$aggressive_decoding = $aggressive_decoding;\n"; + # boolean + print CF "\$loosy_encoding = $loosy_encoding;\n"; print CF "\n"; # string diff --git a/config/config_default.php b/config/config_default.php index 9eb27e94..b93b36c6 100644 --- a/config/config_default.php +++ b/config/config_default.php @@ -823,6 +823,7 @@ $default_charset = 'iso-8859-1'; * 'all' (all languages are available) and 'none' (language selection * is disabled, interface is set to $squirrelmail_default_language * @global string $available_languages + * @since 1.5.0 */ $available_languages = 'all'; @@ -832,18 +833,31 @@ $available_languages = 'all'; * This options allows displaying native language names in language * selection box. * @global bool $show_alternative_names + * @since 1.5.0 */ $show_alternative_names = false; /** - * Agresive Decoding Control + * Aggressive Decoding Control * * This option enables reading of Eastern multibyte encodings. * Functions that provide this support are very cpu and memory intensive. * Don't enable this option unless you really need it. - * @global bool $agresive_decoding + * @global bool $aggressive_decoding + * @since 1.5.1 */ -$agresive_decoding = false; +$aggressive_decoding = false; + +/** + * Loosy Encoding Control + * + * This option allows charset conversions when output charset does not support + * all symbols used in original charset. Symbols unsupported by output charset + * will be replaced with question marks. + * @global bool $loosy_encoding + * @since 1.5.1 + */ +$loosy_encoding = false; /*** Tweaks ***/ /** @@ -851,8 +865,10 @@ $agresive_decoding = false; * * Use experimental DHTML folder listing * @global bool $advanced_tree + * @since 1.5.0 */ $advanced_tree = false; + /** * Older listing way control * @@ -860,6 +876,7 @@ $advanced_tree = false; * @global bool $oldway */ $oldway = false; + /** * Message Icons control * @@ -878,8 +895,10 @@ $use_icons = false; * Don't enable this option if you are not sure about availability of * recode support. * @global bool $use_php_recode + * @since 1.5.0 */ $use_php_recode = false; + /** * PHP iconv functions control * @@ -890,6 +909,7 @@ $use_php_recode = false; * Don't enable this option if you are not sure about availability of * iconv support. * @global bool $use_php_iconv + * @since 1.5.0 */ $use_php_iconv = false; diff --git a/functions/i18n.php b/functions/i18n.php index 6766968a..fd850229 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -36,7 +36,7 @@ require_once(SM_PATH . 'functions/global.php'); */ function charset_decode ($charset, $string) { global $languages, $squirrelmail_language, $default_charset; - global $use_php_recode, $use_php_iconv, $agresive_decoding; + global $use_php_recode, $use_php_iconv, $aggressive_decoding; if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'] . '_decode')) { @@ -93,8 +93,8 @@ function charset_decode ($charset, $string) { $string = htmlspecialchars ($string); /* controls cpu and memory intensive decoding cycles */ - if (! isset($agresive_decoding) || $agresive_decoding=="" ) { - $agresive_decoding=false; } + if (! isset($aggressive_decoding) || $aggressive_decoding=="" ) { + $aggressive_decoding=false; } $decode=fixcharset($charset); $decodefile=SM_PATH . 'functions/decode/' . $decode . '.php'; @@ -1148,9 +1148,9 @@ endswitch; * @return bool is it possible to convert to user's charset */ function is_conversion_safe($input_charset) { - global $languages, $sm_notAlias, $default_charset, $enable_loosy_encoding; + global $languages, $sm_notAlias, $default_charset, $loosy_encoding; - if (isset($enable_loosy_encoding) && $enable_loosy_encoding ) + if (isset($loosy_encoding) && $loosy_encoding ) return true; // convert to lower case diff --git a/plugins/administrator/defines.php b/plugins/administrator/defines.php index a1c4dd9f..272e0381 100644 --- a/plugins/administrator/defines.php +++ b/plugins/administrator/defines.php @@ -317,7 +317,9 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"), '$available_languages' => array( 'name' => _("Available languages"), 'type' => SMOPT_TYPE_STRING, 'size' => 40 ), - '$agresive_decoding' => array( 'name' => _("Use agresive decoding"), + '$aggressive_decoding' => array( 'name' => _("Enable aggressive decoding"), + 'type' => SMOPT_TYPE_BOOLEAN ), + '$loosy_encoding' => array( 'name' => _("Enable loosy encoding"), 'type' => SMOPT_TYPE_BOOLEAN ), 'Group10' => array( 'name' => _("Tweaks"), 'type' => SMOPT_TYPE_TITLE ), -- 2.25.1