some plugins might use own hooks
[squirrelmail.git] / config / conf.pl
index 03f9c0ea6f0fb651195211e291c6293ebae5fc4e..5b191039eabaecaca04273925693dd58ea71349b 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];
@@ -289,6 +292,7 @@ $allow_thread_sort = 'false'            if ( !$allow_thread_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 );
@@ -476,7 +480,8 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
         print "10. Allow server thread sort    : $WHT$allow_thread_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 ) {
@@ -698,7 +703,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(); }
@@ -2141,7 +2147,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";
@@ -3119,8 +3143,10 @@ sub save_data {
         print CF "\$allow_thread_sort        = $allow_thread_sort;\n";
     # boolean
         print CF "\$allow_server_sort        = $allow_server_sort;\n";
-        # boolean
+    # 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 +3162,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";