diff --git a/include/class_config.inc b/include/class_config.inc
index a23183f6f7d3a2c09529710888bbdbecf1e0aa77..fd77e2dddb90b5a5ee2bc42118e15bf8fdf84256 100644
--- a/include/class_config.inc
+++ b/include/class_config.inc
@@ -590,7 +590,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 6e991721c940b3256d616bc685acebf738ac537b..7aca428a5c1ebada3976e05848e48b3a8b5d7ca5 100644
--- a/include/class_filterLDAP.inc
+++ b/include/class_filterLDAP.inc
@@ -148,9 +148,7 @@ class filterLDAP
       /* Crawl through result entries and perform the migration to the
          result array */
       while ($attrs = $ldap->fetch()) {
-        $dn = $ldap->getDN();
-
-        $attrs['dn'] = $dn;
+        $dn = $attrs['dn'];
 
         /* Skip ACL checks if we are forced to skip those checks */
         if (!$checkAcl) {
@@ -160,7 +158,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 00c2f051b0f7c7a675199612160d3c3e329852fd..77ee3aa9c8e536957637d81d81a22f518e1986d7 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -922,10 +922,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 9f131f53508a40ca9526269219bfb9393f04e4f5..6dcba662916edb658e0e79a0966fb570d71c73f8 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 != '') {
@@ -1632,8 +1626,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 57140cb393226c9dc9947fd86e1e7ac1b99e1b75..5808ee8db7c1980e2d23af862ef6ce0f5b674d1b 100644
--- a/include/class_objects.inc
+++ b/include/class_objects.inc
@@ -276,7 +276,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 fd0413031924f8ce57eb8095a827c964e21e387f..c43edf1aa4848cd38435b696974cf16eaebc9f78 100644
--- a/include/class_userinfo.inc
+++ b/include/class_userinfo.inc
@@ -310,7 +310,7 @@ class userinfo
   */
   function is_copyable($dn, $object)
   {
-    return preg_match('/r/', $this->get_complete_category_acls($dn, $object));
+    return strpos($this->get_complete_category_acls($dn, $object), 'r');
   }
 
 
@@ -327,8 +327,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);
   }
 
@@ -344,7 +344,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');
   }
 
 
@@ -364,8 +364,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);
   }
@@ -385,11 +385,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;
   }
 
   /*!
@@ -412,9 +413,9 @@ class userinfo
      */
     if ($this->ignore_acl_for_current_user()) {
       if ($skip_write) {
-        return "rcdm";
+        return 'rcdm';
       }
-      return "rwcdm";
+      return 'rwcdm';
     }
 
     /* Push cache answer? */
@@ -430,14 +431,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
@@ -449,7 +450,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);
@@ -458,18 +459,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 */
@@ -513,7 +513,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]);
             }
@@ -540,7 +540,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])) {
 
@@ -804,8 +804,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 3dd6fe3e384df49c78d7b7f5a6ca767c777e0599..ea6c79c8082831df13c5b8fcbe6b05f155e78e51 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -569,7 +569,7 @@ function ldap_login_user ($username, $password)
   }
 
   /* got user dn, fill acl's */
-  $ui = new userinfo($ldap->getDN());
+  $ui = new userinfo($attrs['dn']);
 
   /* password check, bind as user with supplied password  */
   $ldap->disconnect();
@@ -711,12 +711,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']);
   }
 }
 
@@ -2845,10 +2845,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 f8a52819f815b206ee11ec31dcc65d494ce09004..b48ec7b19a70cef38f89304bb7744678419a66d5 100644
--- a/plugins/personal/posix/class_posixAccount.inc
+++ b/plugins/personal/posix/class_posixAccount.inc
@@ -351,7 +351,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);
@@ -678,7 +678,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']);
       }
     }
   }