one more update. message_details strings
[squirrelmail.git] / config / conf.pl
index e7d998a97e047cddd495c5c7dfa8fa56a64b00e6..aa844940010caba1f4a2ec983a225c922e8b54d0 100755 (executable)
@@ -171,6 +171,9 @@ while ( $line = <FILE> ) {
         $options[1] =~ s/[\'|\"];\s*$//;
         $options[1] =~ s/;$//;
         $options[1] =~ s/^[\'|\"]//;
+        # de-escape escaped strings
+        $options[1] =~ s/\\'/'/g;
+        $options[1] =~ s/\\\\/\\/g;
 
         if ( $options[0] =~ /^theme\[[0-9]+\]\[['|"]PATH['|"]\]/ ) {
             $sub = $options[0];
@@ -286,9 +289,10 @@ $provider_name = ''                     if ( !$provider_name );
 $edit_identity = 'true'                 if ( !$edit_identity );
 $edit_name = 'true'                     if ( !$edit_name );
 $allow_thread_sort = 'false'            if ( !$allow_thread_sort );
-$disable_server_sort = 'false'          if ( !$disable_server_sort );
+$allow_server_sort = 'false'            if ( !$allow_server_sort );
 $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) ;
 $prefs_user_field = 'user'              if ( !$prefs_user_field );
 $prefs_key_field = 'prefkey'            if ( !$prefs_key_field );
 $prefs_val_field = 'prefval'            if ( !$prefs_val_field );
@@ -302,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 );
@@ -474,9 +479,10 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
         print "8.  Allow use of receipts       : $WHT$default_use_mdn$NRM\n";
         print "9.  Allow editing of identity   : $WHT$edit_identity$NRM/$WHT$edit_name$NRM\n";
         print "10. Allow server thread sort    : $WHT$allow_thread_sort$NRM\n";
-        print "11. Disable server-side sorting : $WHT$disable_server_sort$NRM\n";
+        print "11. Allow server-side sorting   : $WHT$allow_server_sort$NRM\n";
         print "12. Allow server charset search : $WHT$allow_charset_search$NRM\n";
-    print "13. PHP session name            : $WHT$session_name$NRM\n";
+        print "13. Allow advanced search       : $WHT$allow_advanced_search$NRM\n";
+        print "14. PHP session name            : $WHT$session_name$NRM\n";
         print "\n";
         print "R   Return to Main Menu\n";
     } elsif ( $menu == 5 ) {
@@ -567,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 ) {
@@ -583,9 +590,9 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
         print "R   Return to Main Menu\n";
     }
     if ( $config_use_color == 1 ) {
-        print "C.  Turn color off\n";
+        print "C   Turn color off\n";
     } else {
-        print "C.  Turn color on\n";
+        print "C   Turn color on\n";
     }
     print "S   Save data\n";
     print "Q   Quit\n";
@@ -698,7 +705,8 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
             elsif ( $command == 10 ) { $allow_thread_sort        = command312(); }
             elsif ( $command == 11 ) { $allow_server_sort        = command313(); }
             elsif ( $command == 12 ) { $allow_charset_search     = command314(); }
-            elsif ( $command == 13 ) { $session_name             = command316(); }
+            elsif ( $command == 13 ) { $allow_advanced_search    = command316(); }
+            elsif ( $command == 14 ) { $session_name             = command317(); }
         } elsif ( $menu == 5 ) {
             if ( $command == 1 ) { command41(); }
             elsif ( $command == 2 ) { $theme_css = command42(); }
@@ -726,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(); }
@@ -2104,19 +2113,19 @@ sub command313 {
     print "Your IMAP server must support the SORT  command for this to work\n";
     print "\n";
 
-    if ( lc($disable_server_sort) eq 'true' ) {
+    if ( lc($allow_server_sort) eq 'true' ) {
         $default_value = "y";
     } else {
         $default_value = "n";
     }
-    print "Disable server-side sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
-    $disable_server_sort = <STDIN>;
-    if ( ( $disable_server_sort =~ /^y\n/i ) || ( ( $disable_server_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
-        $disable_server_sort = 'true';
+    print "Allow server-side sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
+    $allow_server_sort = <STDIN>;
+    if ( ( $allow_server_sort =~ /^y\n/i ) || ( ( $allow_server_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+        $allow_server_sort = 'true';
     } else {
-        $disable_server_sort = 'false';
+        $allow_server_sort = 'false';
     }
-    return $disable_server_sort;
+    return $allow_server_sort;
 }
 
 sub command314 {
@@ -2141,7 +2150,25 @@ sub command314 {
 
 # command315 (UID support) obsoleted.
 
+# advanced search option
 sub command316 {
+    print "This option allows you to control the use of advanced search form.\n";
+    print "  0 = enable basic search only\n";
+    print "  1 = enable advanced search only\n";
+    print "  2 = enable both\n";
+    print "\n";
+
+    print "Allowed search (0,1,2)? [$WHT$allow_advanced_search$NRM]: $WHT";
+    $new_allow_advanced_search = <STDIN>;
+    if ( $new_allow_advanced_search =~ /^[0|1|2]\n/i ) {
+        $allow_advanced_search = $new_allow_advanced_search;
+    }
+    $allow_advanced_search =~ s/[\r|\n]//g;
+    return $allow_advanced_search;
+}
+
+
+sub command317 {
     print "This option allows you to change the name of the PHP session used\n";
     print "by SquirrelMail.  Unless you know what you are doing, you probably\n";
     print "don't need or want to change this from the default of SQMSESSID.\n";
@@ -2830,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";
@@ -2838,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 = <STDIN>;
-    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 = <STDIN>;
+    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 = <STDIN>;
+    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";
@@ -3025,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
@@ -3118,9 +3171,11 @@ sub save_data {
     # boolean
         print CF "\$allow_thread_sort        = $allow_thread_sort;\n";
     # boolean
-        print CF "\$disable_server_sort      = $disable_server_sort;\n";
-        # boolean
+        print CF "\$allow_server_sort        = $allow_server_sort;\n";
+    # boolean
         print CF "\$allow_charset_search     = $allow_charset_search;\n";
+    # integer
+        print CF "\$allow_advanced_search    = $allow_advanced_search;\n";
         print CF "\n";
     
     # all plugins are strings
@@ -3136,7 +3191,11 @@ sub save_data {
 
         for ( $count = 0 ; $count <= $#theme_name ; $count++ ) {
             print CF "\$theme[$count]['PATH'] = " . &change_to_SM_path($theme_path[$count]) . ";\n";
-            print CF "\$theme[$count]['NAME'] = '$theme_name[$count]';\n";
+            # escape theme name so it can contain single quotes.
+            $esc_name =  $theme_name[$count];
+            $esc_name =~ s/\\/\\\\/g;
+            $esc_name =~ s/'/\\'/g;
+            print CF "\$theme[$count]['NAME'] = '$esc_name';\n";
         }
         print CF "\n";