Code

Slight speedup for fix and convert (10%)
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sat, 1 Nov 2008 18:02:53 +0000 (18:02 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sat, 1 Nov 2008 18:02:53 +0000 (18:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12854 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_ldap.inc

index 2a0055bee7aa430756e8b230da21458903f3f859..8aa793cf1125952f874194a2b039c73393ce72ad 100644 (file)
@@ -90,11 +90,9 @@ class LDAP{
       /   => SL                                                                  */
   static function convert($dn)
   {
-    if (SPECIALS_OVERRIDE == TRUE){
-      $tmp= preg_replace(array("/\\\\,/", "/\\\\2C/", "/\(/", "/\)/", "/\//"),
-                           array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL"),
-                           $dn);
-      return (preg_replace('/,\s+/', ',', $tmp));
+    if (SPECIALS_OVERRIDE === TRUE){
+      return preg_replace('/,\s+/', ',', str_replace(array('\\\\,', '\\\\2C', '\(/', '/\)', '\/'),
+                           array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL"), $dn));
     } else {
       return ($dn);
     }
@@ -107,10 +105,9 @@ class LDAP{
      servers seem to take it the correct way.                                  */
   static function fix($dn)
   {
-    if (SPECIALS_OVERRIDE == TRUE){
-      return (preg_replace(array("/\001CO/", "/\001OB/", "/\001CB/", "/\001SL/"),
-                           array("\,", "(", ")", "/"),
-                           $dn));
+    if (SPECIALS_OVERRIDE === TRUE){
+      return (str_replace(array('\001CO', '\001OB', '\001CB', '\001SL'),
+                           array('\,', '(', ')', '/'), $dn));
     } else {
       return ($dn);
     }