diff --git a/include/class_config.inc b/include/class_config.inc
index b92b42ddf626187ec2994a7ed126893f3594516c..7ba2ceebd7efbb97019b19a5fdd902764c681748 100644
--- a/include/class_config.inc
+++ b/include/class_config.inc
@@ -593,7 +593,7 @@ class config  {
         continue;
       }
 
-      $dn   = $ldap->getDN();
+      $dn   = $attrs['dn'];
       $data = objects::infos($oc);
       $this->department_info[$dn] = array(
         'img'         => $data['icon'],
diff --git a/include/class_filterLDAP.inc b/include/class_filterLDAP.inc
index cf1584f0e0a2da84c7e8e5b139788af13cc46ab4..e359cbcc7a6ef620eab8dea3ce0a3fceeba519ae 100644
--- a/include/class_filterLDAP.inc
+++ b/include/class_filterLDAP.inc
@@ -167,14 +167,7 @@ class filterLDAP {
       /* Crawl through result entries and perform the migration to the
          result array */
       while ($attrs = $ldap->fetch()) {
-        $dn = $ldap->getDN();
-
-        /* Convert dn into a printable format */
-        if ($flags & GL_CONVERT) {
-          $attrs["dn"] = convert_department_dn($dn);
-        } else {
-          $attrs["dn"] = $dn;
-        }
+        $dn = $attrs['dn'];
 
         /* Skip ACL checks if we are forced to skip those checks */
         if ($flags & GL_NO_ACL_CHECK) {
@@ -184,7 +177,7 @@ class filterLDAP {
           $obj = $parent->headpage->getObjectTypeInfos($dn, $attrs);
           if (isset($obj['category'])) {
             $o = $obj['category'].'/'.$obj['class'];
-            if (preg_match('/r/', $ui->get_permissions($dn, $o))) {
+            if (strpos($ui->get_permissions($dn, $o), 'r')) {
               $result[] = $attrs;
             }
           } else {
diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 9a43ced0a4b3e2b75d7c26c037c3089ab07a772c..ca6829eda1d95bd81b51441aa11f7a9721921da4 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -911,10 +911,9 @@ class LDAP
     $delarray = array();
 
     /* Get sorted list of dn's to delete */
-    $this->search ($srp, "(objectClass=*)");
-    while ($this->fetch($srp)) {
-      $deldn            = $this->getDN($srp);
-      $delarray[$deldn] = strlen($deldn);
+    $this->search($srp, '(objectClass=*)');
+    while ($attrs = $this->fetch($srp)) {
+      $delarray[$attrs['dn']] = strlen($attrs['dn']);
     }
     arsort($delarray);
     reset($delarray);
diff --git a/include/class_ldapMultiplexer.inc b/include/class_ldapMultiplexer.inc
index f7faa9e23930a5ac561670fbf82d6294d3bdb8cb..89c1fddecd37a0b1b1f571f8d6bc8398180ead16 100644
--- a/include/class_ldapMultiplexer.inc
+++ b/include/class_ldapMultiplexer.inc
@@ -60,7 +60,7 @@ class ldapMultiplexer {
   public function __call($methodName, $parameters)
   {
     /* Add resource pointer if the mentioned methods are used */
-    if (preg_match('/^(search|ls|cat|fetch|clearResult|resetResult|count|getDN|recursive_remove|rmdir_recursive|create_missing_trees|import_single_entry|import_complete_ldif)$/', $methodName)) {
+    if (in_array($methodName, array('search','ls','cat','fetch','clearResult','resetResult','count','getDN','recursive_remove','rmdir_recursive','create_missing_trees','import_single_entry','import_complete_ldif'))) {
       array_unshift($parameters, $this->sr);
     }
 
diff --git a/include/class_listing.inc b/include/class_listing.inc
index f02c0d07bcc1196d39b4edd80cf02b8df5c55dae..886e3e3cd341222784f8e20754395b7baa6577b1 100644
--- a/include/class_listing.inc
+++ b/include/class_listing.inc
@@ -442,8 +442,8 @@ class listing
 
         // Save rendered column
         $sort = preg_replace('/.*>([^<]+)<.*$/', '$1', $renderedCell);
-        $sort = preg_replace('/&nbsp;/', '', $sort);
-        if (preg_match('/</', $sort)) {
+        $sort = str_replace('&nbsp;', '', $sort);
+        if (strpos($sort, '<')) {
           $sort = '';
         }
         $this->entries[$row]['_sort'.$index] = $sort;
@@ -719,32 +719,30 @@ class listing
         $classes  = "";
         $components = explode(';', $cfg);
         foreach ($components as $part) {
-          if (preg_match("/^r$/", $part)) {
-            $res .= "text-align:right;";
-            continue;
-          }
-          if (preg_match("/^l$/", $part)) {
-            $res .= "text-align:left;";
-            continue;
-          }
-          if (preg_match("/^c$/", $part)) {
-            $res .= "text-align:center;";
-            continue;
-          }
-          if (preg_match("/^o$/", $part)) {
-            $classes .= "optional ";
-            continue;
-          }
-          if (preg_match("/^[0-9]+(|px|%)(-d)?$/", $part)) {
-            if (!preg_match('/-d$/', $part)) {
-              /* d suffix means dynamic, ie no fixed width */
-              $res .= "width:$part;";
-            } else {
-              /* Remove the -d suffix */
-              $part = preg_replace('/-d$/', '', $part);
-            }
-            $res .= "min-width:$part;";
-            continue;
+          switch ($part) {
+            case 'r':
+              $res .= 'text-align:right;';
+              break;
+            case 'l':
+              $res .= 'text-align:left;';
+              break;
+            case 'c':
+              $res .= 'text-align:center;';
+              break;
+            case 'o':
+              $classes .= 'optional ';
+              break;
+            default:
+              if (preg_match('/^[0-9]+(|px|%)(-d)?$/', $part)) {
+                if (!preg_match('/-d$/', $part)) {
+                  /* d suffix means dynamic, ie no fixed width */
+                  $res .= "width:$part;";
+                } else {
+                  /* Remove the -d suffix */
+                  $part = preg_replace('/-d$/', '', $part);
+                }
+                $res .= "min-width:$part;";
+              }
           }
         }
 
@@ -1062,16 +1060,14 @@ class listing
         }
       }
 
-      // Render normal entries as usual
       if ($action['type'] == 'entry') {
+        // Render normal entries as usual
         $label = $this->processElementFilter('label', $action['name'], $action['label'], $this->entries[$row], $row);
         $image = $this->processElementFilter('image', $action['name'], $action['image'], $this->entries[$row], $row);
         $result .= '<input class="center" type="image" src="'.htmlentities($image, ENT_COMPAT, 'UTF-8').'" title="'.$label.'" alt="'.$label.'" '.
                  'name="listing_'.$action['name'].'_'.$row.'"/>';
-      }
-
-      // Handle special types
-      if (($action['type'] == 'copypaste') || ($action['type'] == 'snapshot')) {
+      } elseif (($action['type'] == 'copypaste') || ($action['type'] == 'snapshot')) {
+        // Handle special types
         $objectType = $this->getObjectTypeInfos($dn, $this->entries[$row]);
         $category   = $class = NULL;
         if ($objectType) {
@@ -1128,11 +1124,9 @@ class listing
    */
   function filterLink()
   {
-    $result = "&nbsp;";
-
-    $row = func_get_arg(0);
-    $pid = $this->pid;
-    $dn = LDAP::fix(func_get_arg(1));
+    $row    = func_get_arg(0);
+    $pid    = $this->pid;
+    $dn     = LDAP::fix(func_get_arg(1));
     $params = array(func_get_arg(2));
 
     // Collect sprintf params
@@ -1146,7 +1140,7 @@ class listing
       }
     }
 
-    $result = "&nbsp;";
+    $result = '&nbsp;';
     if (count($params) > 1) {
       $trans  = call_user_func_array('sprintf', $params);
       if ($trans != '') {
@@ -1620,8 +1614,8 @@ class listing
 
     // Switch flags to on if there's at least one category which allows read/paste
     foreach ($this->categories as $category) {
-      $read   = $read || preg_match('/r/', $ui->get_category_permissions($this->base, $category));
-      $paste  = $paste || $ui->is_pasteable($this->base, $category) == 1;
+      $read   = $read || strpos($ui->get_category_permissions($this->base, $category), 'r');
+      $paste  = $paste || ($ui->is_pasteable($this->base, $category) == 1);
     }
 
     // Draw entries that allow copy and cut
diff --git a/include/class_objects.inc b/include/class_objects.inc
index a01114b53399261cdcb6fc240933f9b1296286c5..666f407d5ba1b4ddd1a1871237ee897b038e088d 100644
--- a/include/class_objects.inc
+++ b/include/class_objects.inc
@@ -244,7 +244,7 @@ class objects
       $ldap->search('(objectClass=fdTemplate)', array('cn'));
       if ($ldap->count() != 0) {
         while ($attrs = $ldap->fetch()) {
-          $dn = $ldap->getDN();
+          $dn = $attrs['dn'];
           if ($requiredPermissions != '') {
             if (!preg_match('/'.$requiredPermissions.'/', $ui->get_permissions($dn, $infos['aclCategory'].'/'.'template'))) {
               continue;
diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc
index 8679becdd57159263f7cb5f7460a2d2b33ebd3a1..b0df6ac63a30d8ade00e04a495b1e8a682147475 100644
--- a/include/class_userinfo.inc
+++ b/include/class_userinfo.inc
@@ -318,7 +318,7 @@ class userinfo
   */
   function is_copyable($dn, $object, $class)
   {
-    return preg_match("/r/", $this->get_complete_category_acls($dn, $object));
+    return strpos($this->get_complete_category_acls($dn, $object), 'r');
   }
 
 
@@ -335,8 +335,8 @@ class userinfo
    */
   function is_cutable($dn, $object, $class)
   {
-    $remove = preg_match('/d/', $this->get_permissions($dn, $object.'/'.$class));
-    $read   = preg_match('/r/', $this->get_complete_category_acls($dn, $object));
+    $remove = strpos($this->get_permissions($dn, $object.'/'.$class), 'd');
+    $read   = strpos($this->get_complete_category_acls($dn, $object), 'r');
     return ($remove && $read);
   }
 
@@ -352,7 +352,7 @@ class userinfo
    */
   function is_pasteable($dn, $object)
   {
-    return preg_match("/w/", $this->get_complete_category_acls($dn, $object));
+    return strpos($this->get_complete_category_acls($dn, $object), 'w');
   }
 
 
@@ -372,8 +372,8 @@ class userinfo
     }
     $r = $w = TRUE;
     foreach ($object as $category) {
-      $w &= preg_match("/w/", $this->get_complete_category_acls($dn, $category));
-      $r &= preg_match("/r/", $this->get_complete_category_acls($dn, $category));
+      $w &= strpos($this->get_complete_category_acls($dn, $category), 'w');
+      $r &= strpos($this->get_complete_category_acls($dn, $category), 'r');
     }
     return ($r && $w);
   }
@@ -393,11 +393,12 @@ class userinfo
     if (!is_array($object)) {
       $object = array($object);
     }
-    $r = TRUE;
     foreach ($object as $category) {
-      $r &= preg_match("/r/", $this->get_complete_category_acls($dn, $category));
+      if (!strpos($this->get_complete_category_acls($dn, $category), 'r')) {
+        return FALSE;
+      }
     }
-    return $r;
+    return TRUE;
   }
 
   /*!
@@ -420,9 +421,9 @@ class userinfo
      */
     if ($this->ignore_acl_for_current_user()) {
       if ($skip_write) {
-        return "rcdm";
+        return 'rcdm';
       }
-      return "rwcdm";
+      return 'rwcdm';
     }
 
     /* Push cache answer? */
@@ -438,14 +439,14 @@ class userinfo
     /* Detect the set of ACLs we have to check for this object
      */
     $adn = $dn;
-    while (!isset($this->ACLperPath[$adn]) && (strpos($adn, ",") !== FALSE)) {
+    while (!isset($this->ACLperPath[$adn]) && (strpos($adn, ',') !== FALSE)) {
       $adn = preg_replace("/^[^,]*+,/", "", $adn);
     }
     if (isset($this->ACLperPath[$adn])) {
       $ACL = $this->ACLperPath[$adn];
     } else {
-      $ACL_CACHE["$dn+$object+$attribute"] = "";
-      return "";
+      $ACL_CACHE["$dn+$object+$attribute"] = '';
+      return '';
     }
 
     /* If we do not need to respect any user-filter settings
@@ -457,7 +458,7 @@ class userinfo
       if (isset($ACL_CACHE["$dn+$object+$attribute"])) {
         $ret = $ACL_CACHE["$dn+$object+$attribute"];
         if (!isset($ACL_CACHE["$orig_dn+$object+$attribute"])) {
-          $ACL_CACHE["$orig_dn+$object+$attribute"] = $ACL_CACHE["$dn+$object+$attribute"];
+          $ACL_CACHE["$orig_dn+$object+$attribute"] = $ret;
         }
         if ($skip_write) {
           $ret = str_replace('w', '', $ret);
@@ -466,18 +467,17 @@ class userinfo
       }
     }
 
-    /* Get ldap object, for later filter checks
-     */
+    /* Get ldap object, for later filter checks */
     $ldap = $config->get_ldap_link();
 
-    $acl = array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => "");
+    $acl = array('r' => '', 'w' => '', 'c' => '', 'd' => '', 'm' => '', 'a' => '');
 
     /* Build dn array */
     $path = explode(',', $dn);
     $path = array_reverse($path);
 
     /* Walk along the path to evaluate the acl */
-    $cpath = "";
+    $cpath = '';
     foreach ($path as $element) {
 
       /* Clean potential ACLs for each level */
@@ -521,7 +521,7 @@ class userinfo
           /* If attribute is "", we want to know, if we've *any* permissions here...
               Merge global class ACLs [0] with attributes specific ACLs [attribute].
            */
-          if ($attribute == "" && isset($subacl['acl'][$object])) {
+          if (($attribute == '') && isset($subacl['acl'][$object])) {
             foreach ($subacl['acl'][$object] as $attr => $dummy) {
               $acl = $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$object][$attr]);
             }
@@ -548,7 +548,7 @@ class userinfo
 
           /* Category ACLs    (e.g. $object = "user/0")
            */
-          if (strstr($object, "/0")) {
+          if (strstr($object, '/0')) {
             $ocs = preg_replace("/\/0$/", "", $object);
             if (isset($config->data['CATEGORIES'][$ocs])) {
 
@@ -810,8 +810,8 @@ class userinfo
           $tmp = $this->get_permissions($dn, $category.'/'.$oc);
           $types = $acl;
           for ($i = 0, $l = strlen($types); $i < $l; $i++) {
-            if (!preg_match('/'.$types[$i].'/', $tmp)) {
-              $acl = preg_replace('/'.$types[$i].'/', '', $acl);
+            if (!strpos($tmp, $types[$i])) {
+              $acl = str_replace($types[$i], '', $acl);
             }
           }
         }
diff --git a/include/functions.inc b/include/functions.inc
index 74d4f4788034f6d486900dfed4f3daabaf7f09a9..53eb21ff78294665a7523f5c138d7f4bc73dfc33 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -597,7 +597,7 @@ function ldap_login_user ($username, $password)
   }
 
   /* got user dn, fill acl's */
-  $ui = new userinfo($config, $ldap->getDN());
+  $ui = new userinfo($config, $attrs['dn']);
 
   /* password check, bind as user with supplied password  */
   $ldap->disconnect();
@@ -738,12 +738,12 @@ function del_lock ($object)
   $ldap = $config->get_ldap_link();
   $ldap->cd(get_ou('lockRDN').get_ou('fusiondirectoryRDN').$config->current['BASE']);
   $ldap->search('(&(objectClass=fdLockEntry)(fdObjectDn='.base64_encode($object).'))', array('fdObjectDn'));
-  $ldap->fetch();
+  $attrs = $ldap->fetch();
   if (!$ldap->success()) {
     msg_dialog::display(_('LDAP error'), msgPool::ldaperror($ldap->get_error(), $ldap->getDN(), LDAP_DEL, ERROR_DIALOG));
     return;
-  } elseif ($ldap->getDN() != '') {
-    $ldap->rmdir($ldap->getDN());
+  } elseif ($attrs['dn'] != '') {
+    $ldap->rmdir($attrs['dn']);
   }
 }
 
@@ -3193,10 +3193,10 @@ function get_next_id_pool($attrib)
     }
 
     /* Store old attrib and generate new */
-    $attrs = $ldap->fetch();
-    $dn = $ldap->getDN();
-    $oldAttr = $attrs[$attrib][0];
-    $newAttr = $oldAttr + 1;
+    $attrs    = $ldap->fetch();
+    $dn       = $attrs['dn'];
+    $oldAttr  = $attrs[$attrib][0];
+    $newAttr  = $oldAttr + 1;
 
     /* Sanity check */
     if ($newAttr >= $max) {
diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc
index e5dd5a894cccad90266070d23a821cb335a0fe8a..f10c9f77544b5575bba440feac27ee9dca3f5d6e 100644
--- a/plugins/personal/posix/class_posixAccount.inc
+++ b/plugins/personal/posix/class_posixAccount.inc
@@ -349,7 +349,7 @@ class posixAccount extends simplePlugin
           } else {
             $entry = $attrs['cn'][0].' ['.$attrs['description'][0].']';
           }
-          $groupMembership[$ldap->getDN()] = $entry;
+          $groupMembership[$attrs['dn']] = $entry;
         }
         asort($groupMembership);
         reset($groupMembership);
@@ -659,7 +659,7 @@ class posixAccount extends simplePlugin
     if ($ldap->count() != 0) {
       $attrs = $ldap->fetch();
       if ($attrs['cn'][0] == $this->getUid() && !isset($this->attrs['memberUid'])) {
-        $ldap->rmDir($ldap->getDN());
+        $ldap->rmDir($attrs['dn']);
       }
     }
   }