Adding write support to address book ldap backend. Patch by David Hardeman
[squirrelmail.git] / config / conf.pl
index 14b8e4f88e21abcdec92400eb38ca474de8de7d9..4ca3a082b5e458ba5a5f20d1e6e693e2c4bdace8 100755 (executable)
@@ -286,6 +286,11 @@ while ( $line = <FILE> ) {
                     $tmp =~ s/[\'\"]?,?\s*$//;
                     $tmp =~ s/[\'\"]?\);\s*$//;
                     $listing = $tmp;
+                } elsif ( $tmp =~ /^\s*[\'\"]writeable[\'\"]/i ) {
+                    $tmp =~ s/^\s*[\'\"]writeable[\'\"]\s*=>\s*[\'\"]?//i;
+                    $tmp =~ s/[\'\"]?,?\s*$//;
+                    $tmp =~ s/[\'\"]?\);\s*$//;
+                    $writeable = $tmp;
                 } elsif ( $tmp =~ /^\s*[\'\"]search_tree[\'\"]/i ) {
                     $tmp =~ s/^\s*[\'\"]search_tree[\'\"]\s*=>\s*[\'\"]?//i;
                     $tmp =~ s/[\'\"]?,?\s*$//;
@@ -310,6 +315,7 @@ while ( $line = <FILE> ) {
             $ldap_protocol[$sub] = $protocol;
             $ldap_limit_scope[$sub] = $limit_scope;
             $ldap_listing[$sub] = $listing;
+            $ldap_writeable[$sub] = $writeable;
             $ldap_search_tree[$sub] = $search_tree;
             $ldap_starttls[$sub] = $starttls;
         } elsif ( $options[0] =~ /^(data_dir|attachment_dir|theme_css|org_logo|signout_page)$/ ) {
@@ -366,7 +372,8 @@ $show_alternative_names = 'false'       if ( !$show_alternative_names );
 # implementation changes. options are provided by limit_languages plugin
 # $available_languages = 'all'            if ( !$available_languages );
 $aggressive_decoding = 'false'          if ( !$aggressive_decoding );
-$advanced_tree = 'false'                if ( !$advanced_tree );
+# available only in 1.5.0 and 1.5.1
+# $advanced_tree = 'false'                if ( !$advanced_tree );
 $use_php_recode = 'false'               if ( !$use_php_recode );
 $use_php_iconv = 'false'                if ( !$use_php_iconv );
 
@@ -687,16 +694,15 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) {
         print "R   Return to Main Menu\n";
     } elsif ( $menu == 11 ) {
     print $WHT. "Interface tweaks\n" . $NRM;
-    print "1.  Advanced tree                : $WHT$advanced_tree$NRM\n";
-    print "2.  Display html mails in iframe : $WHT$use_iframe$NRM\n";
-    print "3.  Use Icons                    : $WHT$use_icons$NRM\n";
+    print "1.  Display html mails in iframe : $WHT$use_iframe$NRM\n";
+    print "2.  Use Icons                    : $WHT$use_icons$NRM\n";
     print "\n";
     print $WHT. "PHP tweaks\n" . $NRM;
-    print "4.  Use php recode functions     : $WHT$use_php_recode$NRM\n";
-    print "5.  Use php iconv functions      : $WHT$use_php_iconv$NRM\n";
+    print "3.  Use php recode functions     : $WHT$use_php_recode$NRM\n";
+    print "4.  Use php iconv functions      : $WHT$use_php_iconv$NRM\n";
     print "\n";
     print $WHT. "Configuration tweaks\n" . $NRM;
-    print "6.  Allow remote configtest     : $WHT$allow_remote_configtest$NRM\n";
+    print "5.  Allow remote configtest     : $WHT$allow_remote_configtest$NRM\n";
     print "\n";
         print "R   Return to Main Menu\n";
     }
@@ -856,12 +862,11 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) {
             elsif ( $command == 4 ) { $aggressive_decoding           = commandA4(); }
             elsif ( $command == 5 ) { $lossy_encoding                = commandA5(); }
         } elsif ( $menu == 11 ) {
-            if    ( $command == 1 ) { $advanced_tree  = commandB1(); }
-            if    ( $command == 2 ) { $use_iframe     = commandB2(); }
-            elsif ( $command == 3 ) { $use_icons      = commandB3(); }
-            elsif ( $command == 4 ) { $use_php_recode = commandB4(); }
-            elsif ( $command == 5 ) { $use_php_iconv  = commandB5(); }
-            elsif ( $command == 6 ) { $allow_remote_configtest = commandB6(); }
+            if    ( $command == 1 ) { $use_iframe     = commandB2(); }
+            elsif ( $command == 2 ) { $use_icons      = commandB3(); }
+            elsif ( $command == 3 ) { $use_php_recode = commandB4(); }
+            elsif ( $command == 4 ) { $use_php_iconv  = commandB5(); }
+            elsif ( $command == 5 ) { $allow_remote_configtest = commandB6(); }
         }
     }
 }
@@ -1019,7 +1024,7 @@ 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 "The default is 'SquirrelMail'\n";
     print "\n";
     print "[$WHT$provider_name$NRM]: $WHT";
     $new_provider_name = <STDIN>;
@@ -1028,6 +1033,7 @@ sub command8 {
     } else {
         $new_provider_name =~ s/[\r\n]//g;
         $new_provider_name =~ s/^\s+$//g;
+        $new_provider_name =~ s/\'/\\'/g;
     }
     return $new_provider_name;
 }
@@ -2929,6 +2935,9 @@ sub command61 {
                 if ( $ldap_listing[$count] ) {
                     print "     listing: $ldap_listing[$count]\n";
                 }
+                if ( $ldap_writeable[$count] ) {
+                    print "   writeable: $ldap_writeable[$count]\n";
+                }
                 if ( $ldap_search_tree[$count] ) {
                     print " search_tree: $ldap_search_tree[$count]\n";
                 }
@@ -3048,7 +3057,6 @@ sub command61 {
               print "Number of displayed entries is limited by maxrows setting.\n";
               print "\n";
               print "Don't enable this option for public LDAP directories.\n";
-              print "This feature is experimental.\n";
               print "\n";
               print "Allow listing of LDAP directory? (y/N):";
               $name = <STDIN>;
@@ -3061,6 +3069,23 @@ sub command61 {
 
               print "\n";
 
+              print "You can control write access to LDAP address book here. This option can\n";
+              print "be useful if you run small LDAP server and want to provide writable\n";
+              print "shared address book stored in LDAP to users of webmail interface.\n";
+              print "\n";
+              print "Don't enable this option for public LDAP directories.\n";
+              print "\n";
+              print "Allow writing to LDAP directory? (y/N):";
+              $name = <STDIN>;
+              if ( $name =~ /^y\n/i ) {
+                $name = 'true';
+              } else {
+                $name = 'false';
+              }
+              $ldap_writeable[$sub] = $name;
+
+              print "\n";
+
               print "You can specify an additional search filter.\n";
               print "This could be something like \"(objectclass=posixAccount)\".\n";
               print "No filtering is performed by default. Press ENTER for default.\n";
@@ -3137,6 +3162,7 @@ sub command61 {
             @new_ldap_protocol = ();
             @new_ldap_limit_scope = ();
             @new_ldap_listing = ();
+            @new_ldap_writeable = ();
             @new_ldap_search_tree = ();
             @new_ldap_starttls = ();
 
@@ -3154,6 +3180,7 @@ sub command61 {
                     @new_ldap_protocol  = ( @new_ldap_protocol,  $ldap_protocol[$count] );
                     @new_ldap_limit_scope = ( @new_ldap_limit_scope,  $ldap_limit_scope[$count] );
                     @new_ldap_listing = ( @new_ldap_listing, $ldap_listing[$count] );
+                    @new_ldap_writeable = ( @new_ldap_writeable, $ldap_writeable[$count] );
                     @new_ldap_search_tree = ( @new_ldap_search_tree, $ldap_search_tree[$count] );
                     @new_ldap_starttls = ( @new_ldap_starttls, $ldap_starttls[$count] );
                 }
@@ -3171,6 +3198,7 @@ sub command61 {
             @ldap_protocol = @new_ldap_protocol;
             @ldap_limit_scope = @new_ldap_limit_scope;
             @ldap_listing = @new_ldap_listing;
+            @ldap_writeable = @new_ldap_writeable;
             @ldap_search_tree = @new_ldap_search_tree;
             @ldap_starttls = @new_ldap_starttls;
 
@@ -3524,7 +3552,7 @@ sub commandA2 {
     print "This option controls what character set is used when sending\n";
     print "mail and when sending HTML to the browser. Option works only\n";
     print "with US English (en_US) translation. Other translations use\n";
-    print "charsets that are set in functions/i18n.php.\n";
+    print "charsets that are set in translation settings.\n";
     print "\n";
 
     print "[$WHT$default_charset$NRM]: $WHT";
@@ -3604,28 +3632,6 @@ sub commandA5 {
     return $lossy_encoding;
 }
 
-
-# Advanced tree
-sub commandB1 {
-    print "Enable this option if you want to use DHTML based folder listing.\n";
-    print "Code is experimental, works only with some browsers and there might\n";
-    print "be some glitches.\n";
-    print "\n";
-
-    if ( lc($advanced_tree) eq 'true' ) {
-        $default_value = "y";
-    } else {
-        $default_value = "n";
-    }
-    print "Use advanced tree in folder listing? (y/n) [$WHT$default_value$NRM]: $WHT";
-    $advanced_tree = <STDIN>;
-    if ( ( $advanced_tree =~ /^y\n/i ) || ( ( $advanced_tree =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
-        $advanced_tree = 'true';
-    } else {
-        $advanced_tree = 'false';
-    }
-    return $advanced_tree;
-}
 # display html emails in iframe
 sub commandB2 {
     print "This option can enable html email rendering inside iframe.\n";
@@ -4014,6 +4020,11 @@ sub save_data {
                 # boolean
                 print CF "    'listing' => $ldap_listing[$count]";
             }
+           if ( $ldap_writeable[$count] ) {
+                print CF ",\n";
+                # boolean
+                print CF "    'writeable' => $ldap_writeable[$count]";
+            }
             if ( $ldap_search_tree[$count] ) {
                 print CF ",\n";
                 # integer
@@ -4079,9 +4090,6 @@ sub save_data {
 
         print CF "\n";
 
-        # boolean
-        print CF "\$advanced_tree = $advanced_tree;\n";
-        print CF "\n";
         # boolean
         print CF "\$use_iframe = $use_iframe;\n";
         print CF "\n";