From: hickert Date: Thu, 7 Jul 2011 13:04:43 +0000 (+0000) Subject: Fixed encoding detection of the ldap backend. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9429d6d0498351cbbe3cee1aaa1b8e1974111e46;p=gosa.git Fixed encoding detection of the ldap backend. -Do not check encoding on each page reload, instead cache results. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20946 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index 5bd013a85..eae0753ce 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -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");