Code

Backported patch from 2.7
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 Sep 2011 07:48:10 +0000 (07:48 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 15 Sep 2011 07:48:10 +0000 (07:48 +0000)
-Fixed reloading of special-char-handling for ldap requests.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.7@20982 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_ldap.inc

index 9d32048e0adb7f0852048a30a509e8b747c6f4b1..0d30c00399bf3fc9ffc1bc71fd7b9bdf15596641 100644 (file)
@@ -115,6 +115,21 @@ class LDAP
      */
     static function updateSpecialCharHandling()
     {
+        global $config;
+
+        // Load results from the session if they exists.
+        if(session::is_set('LDAP::updateSpecialCharHandling')){
+            $data = session::get('LDAP::updateSpecialCharHandling');
+            $attrs = array("characterMap", "characterMapRegFrom", "characterMapRegTo", "readableMapRegFrom", "readableMapRegTo");
+            foreach($attrs as $attr){
+                LDAP::$$attr = $data[$attr];
+            }
+            
+            $attrs = array(implode(LDAP::$characterMapRegFrom,', '),implode(LDAP::$characterMapRegTo,', '));
+            @DEBUG(DEBUG_LDAP,__LINE__,__FUNCTION__,__FILE__,$attrs,"(Cached) Detected special-char handling for LDAP actions");
+            return;
+        }
+
         // Set a default character handling.
         LDAP::$characterMapRegFrom = array("/\001CO/", "/\001OB/", "/\001CB/", "/\001SL/", "/\001DQ/");
         LDAP::$characterMapRegTo = array("\,", "(", ")", "/", '\"');
@@ -150,6 +165,14 @@ class LDAP
                 LDAP::$characterMap = array();
             }
         }
+        
+        // Store results in the session.
+        $attrs = array("characterMap", "characterMapRegFrom", "characterMapRegTo", "readableMapRegFrom", "readableMapRegTo");
+        $data = array();
+        foreach($attrs as $attr){
+            $data[$attr] = LDAP::$$attr;
+        }
+        session::set("LDAP::updateSpecialCharHandling", $data);
 
         $attrs = array(implode(LDAP::$characterMapRegFrom,', '),implode(LDAP::$characterMapRegTo,', '));
         @DEBUG(DEBUG_LDAP,__LINE__,__FUNCTION__,__FILE__,$attrs,"Detected special-char handling for LDAP actions");