diff --git a/include/class_baseSelector.inc b/include/class_baseSelector.inc
index 60c5909c9de83196fef9247c484331465fb3d391..049854bb4841332b5417f294e6067e4c0dc8fc26 100644
--- a/include/class_baseSelector.inc
+++ b/include/class_baseSelector.inc
@@ -1,5 +1,4 @@
 <?php
-
 /*
   This code is part of FusionDirectory (http://www.fusiondirectory.org/)
   Copyright (C) 2003-2010  Cajus Pollmeier
@@ -20,13 +19,11 @@
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 
-
 /*!
  * \file class_baseSelector.inc
  * Source code for Class Base Selector
  */
 
-
 /*!
  * \brief Class Base Selector
  */
@@ -35,8 +32,8 @@ class baseSelector {
   private $base;
   private $pid;
   private $action;
-  private $height= 500;
-  private $submitButton= true;
+  private $height       = 500;
+  private $submitButton = TRUE;
   protected $tree;
   protected $pathMapping;
   protected $lastState;
@@ -48,10 +45,10 @@ class baseSelector {
    *
    * \param String $base Empty string
    */
-  function __construct($bases, $base= "")
+  function __construct($bases, $base = "")
   {
     // Initialize pid
-    $this->pid= preg_replace("/[^0-9]/", "", microtime(TRUE));
+    $this->pid = preg_replace("/[^0-9]/", "", microtime(TRUE));
 
     // Transfer data
     $this->setBases($bases);
@@ -65,7 +62,7 @@ class baseSelector {
    */
   function setSubmitButton($flag)
   {
-    $this->submitButton= $flag;
+    $this->submitButton = $flag;
   }
 
   /*!
@@ -75,7 +72,7 @@ class baseSelector {
    */
   function setHeight($value)
   {
-    $this->height= $value;
+    $this->height = $value;
   }
 
   /*!
@@ -86,8 +83,8 @@ class baseSelector {
   function setBase($base)
   {
     if (isset($this->pathMapping[$base])) {
-      $this->base= $base;
-      $this->update(true);
+      $this->base = $base;
+      $this->update(TRUE);
     }
   }
 
@@ -122,18 +119,18 @@ class baseSelector {
   {
     global $config;
 
-    $this->pathMapping= array();
-    $selected= $this->base == $config->current['BASE']?"Selected":"";
-    $first= true;
-    $last_indent= 2;
+    $this->pathMapping = array();
+    $selected     = ($this->base == $config->current['BASE']?"Selected":"");
+    $first        = TRUE;
+    $last_indent  = 2;
 
     foreach ($bases as $base => $dummy) {
 
       // Build path style display
-      $elements= explode(',', substr($base, 0, strlen($base) - strlen($config->current['BASE'])));
-      $elements= array_reverse($elements, true);
+      $elements = explode(',', substr($base, 0, strlen($base) - strlen($config->current['BASE'])));
+      $elements = array_reverse($elements, TRUE);
 
-      $this->pathMapping[$base]= $base == $config->current['BASE']? '/' : ldap::fix(preg_replace('/(^|,)[a-z0-9]+=/i', '/', implode(',', $elements)));
+      $this->pathMapping[$base] = ($base == $config->current['BASE']? '/' : ldap::fix(preg_replace('/(^|,)[a-z0-9]+=/i', '/', implode(',', $elements))));
     }
 
     // Save bases to session for autocompletion
@@ -143,26 +140,26 @@ class baseSelector {
   /*!
    * \brief Update the base
    *
-   * \param Boolean $force false
+   * \param Boolean $force FALSE
    */
-  function update($force= false)
+  function update($force = FALSE)
   {
     global $config;
 
     // Analyze for base changes if needed
-    $this->action= null;
-    $last_base= $this->base;
-    if(isset($_REQUEST['BPID']) && $_REQUEST['BPID'] == $this->pid) {
+    $this->action = NULL;
+    $last_base    = $this->base;
+    if (isset($_REQUEST['BPID']) && $_REQUEST['BPID'] == $this->pid) {
       if (isset($_POST['bs_rebase_'.$this->pid]) && !empty($_POST['bs_rebase_'.$this->pid])) {
-        $new_base= base64_decode($_POST['bs_rebase_'.$this->pid]);
+        $new_base = base64_decode($_POST['bs_rebase_'.$this->pid]);
         if (isset($this->pathMapping[$new_base])) {
-          $this->base= $new_base;
-          $this->action= 'rebase';
+          $this->base   = $new_base;
+          $this->action = 'rebase';
         } else {
-          $this->lastState= false;
-          return false;
+          $this->lastState = FALSE;
+          return FALSE;
         }
-      }else{
+      } else {
         // Input field set?
         if (isset($_POST['bs_input_'.$this->pid])) {
 
@@ -170,11 +167,11 @@ class baseSelector {
           if ($this->submitButton && isset($_POST['submit_base_'.$this->pid.'_x']) || !$this->submitButton) {
 
             // Check if base is available
-            $this->lastState= false;
+            $this->lastState = FALSE;
             foreach ($this->pathMapping as $key => $path) {
               if (mb_strtolower($path) == mb_strtolower($_POST['bs_input_'.$this->pid])) {
-                $this->base= $key;
-                $this->lastState= true;
+                $this->base       = $key;
+                $this->lastState  = TRUE;
                 break;
               }
             }
@@ -186,25 +183,25 @@ class baseSelector {
 
     /* Skip if there's no change */
     if (($this->tree && $this->base == $last_base) && !$force) {
-      return true;
+      return TRUE;
     }
 
-    $link= "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($config->current['BASE'])."';  $('submit_tree_base_".$this->pid."').click();\"";
-    $this->tree= "<input type='text' size='35' name='bs_input_".$this->pid."' id='bs_input_".$this->pid."' onkeydown=\"\$('bs_".$this->pid."').hide()\" onfocus=\"\$('bs_".$this->pid."').hide()\" onmouseover=\"Element.clonePosition(\$('bs_".$this->pid."'), 'bs_input_".$this->pid."', {setHeight: false, setWidth: false, offsetTop:(Element.getHeight('bs_input_".$this->pid."'))});\$('bs_".$this->pid."').show();\" onmouseout=\"rtimer= Element.hide.delay(0.25, 'bs_".$this->pid."')\" value=\"".preg_replace('/"/', '&quot;',$this->pathMapping[$this->base])."\">";
+    $link = "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($config->current['BASE'])."';  $('submit_tree_base_".$this->pid."').click();\"";
+    $this->tree = "<input type='text' size='35' name='bs_input_".$this->pid."' id='bs_input_".$this->pid."' onkeydown=\"\$('bs_".$this->pid."').hide()\" onfocus=\"\$('bs_".$this->pid."').hide()\" onmouseover=\"Element.clonePosition(\$('bs_".$this->pid."'), 'bs_input_".$this->pid."', {setHeight: false, setWidth: false, offsetTop:(Element.getHeight('bs_input_".$this->pid."'))});\$('bs_".$this->pid."').show();\" onmouseout=\"rtimer= Element.hide.delay(0.25, 'bs_".$this->pid."')\" value=\"".preg_replace('/"/', '&quot;', $this->pathMapping[$this->base])."\">";
 
     // Autocompleter
-    $this->tree.= "<div id='autocomplete_".$this->pid."' class='autocomplete'></div>".
+    $this->tree .= "<div id='autocomplete_".$this->pid."' class='autocomplete'></div>".
                   "<script type='text/javascript'>".
                   "new Ajax.Autocompleter('bs_input_".$this->pid."', 'autocomplete_".$this->pid."', 'autocomplete.php?type=base', { minChars: 3, frequency: 0.5 });";
     if ($this->submitButton) {
-      $this->tree.= "$('bs_input_".$this->pid."').observe('keypress', function(event) { if(event.keyCode == Event.KEY_RETURN) { $('submit_base_".$this->pid."').click(); } });";
+      $this->tree .= "$('bs_input_".$this->pid."').observe('keypress', function(event) { if(event.keyCode == Event.KEY_RETURN) { $('submit_base_".$this->pid."').click(); } });";
     }
-    $this->tree.= "</script>";
+    $this->tree .= "</script>";
 
-    $selected= $this->base == $config->current['BASE']?"Selected":"";
-    $this->tree.= "<div class='treeList' style='display:none;max-height:".$this->height."px' id='bs_".$this->pid."' onmouseover=\"window.clearTimeout(rtimer);\" onmouseout=\"rtimer= Element.hide.delay(0.25, 'bs_".$this->pid."')\"><a class='treeList$selected' $link>/&nbsp;["._("Root")."]</a><ul class='treeList'>\n";
-    $first= true;
-    $last_indent= 2;
+    $selected     = $this->base == $config->current['BASE']?"Selected":"";
+    $this->tree   .= "<div class='treeList' style='display:none;max-height:".$this->height."px' id='bs_".$this->pid."' onmouseover=\"window.clearTimeout(rtimer);\" onmouseout=\"rtimer= Element.hide.delay(0.25, 'bs_".$this->pid."')\"><a class='treeList$selected' $link>/&nbsp;["._("Root")."]</a><ul class='treeList'>\n";
+    $first        = TRUE;
+    $last_indent  = 2;
 
     foreach ($this->pathMapping as $base => $dummy) {
 
@@ -214,49 +211,49 @@ class baseSelector {
       }
 
       // Build path style display
-      $elements= explode(',', substr($base, 0, strlen($base) - strlen($config->current['BASE'])));
+      $elements = explode(',', substr($base, 0, strlen($base) - strlen($config->current['BASE'])));
 
-      $indent= count($elements);
+      $indent = count($elements);
       if (!$first && ($indent == $last_indent)) {
-        $this->tree.= "</li>\n";
+        $this->tree .= "</li>\n";
       }
       if ($indent > $last_indent) {
-        $this->tree.= "<ul>\n";
+        $this->tree .= "<ul>\n";
       }
       if ($indent < $last_indent) {
-        for ($i= 0; $i < ($last_indent-$indent); $i++) {
-          $this->tree.= "</li></ul>\n";
+        for ($i = 0; $i < ($last_indent - $indent); $i++) {
+          $this->tree .= "</li></ul>\n";
         }
-        $this->tree.= "</li>\n";
+        $this->tree .= "</li>\n";
       }
-      $selected= $this->base == $base?" class='treeListSelected'":"";
-      $link= "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($base)."';$('submit_tree_base_".$this->pid."').click();\"";
-      $this->tree.= "<li><a$selected $link>".
+      $selected   = $this->base == $base?" class='treeListSelected'":"";
+      $link       = "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($base)."';$('submit_tree_base_".$this->pid."').click();\"";
+      $this->tree .= "<li><a$selected $link>".
                     "<img class='center' src='".$config->department_info[$base]['img']."'>&nbsp;".
                     $this->gennonbreaks($config->department_info[$base]['name']).
-                    ($config->department_info[$base]['description']==''?'':'&nbsp;<span class="informal">['.$this->gennonbreaks($config->department_info[$base]['description']).']</span>').
+                    ($config->department_info[$base]['description'] == ''?'':'&nbsp;<span class="informal">['.$this->gennonbreaks($config->department_info[$base]['description']).']</span>').
                     "</a>";
 
-      $last_indent= $indent;
-      $first= false;
+      $last_indent  = $indent;
+      $first        = FALSE;
     }
 
     // Close tree
-    for ($i= 0; $i<$last_indent; $i++) {
-      $this->tree.= "</li></ul>\n";
+    for ($i = 0; $i < $last_indent; $i++) {
+      $this->tree .= "</li></ul>\n";
     }
-    $this->tree.= "</div>\n";
+    $this->tree .= "</div>\n";
 
     // Draw submitter if required
     if ($this->submitButton) {
-      $this->tree.= "&nbsp;<input class='center' type='image' src='images/lists/submit.png' align='middle' title='"._("Submit")."' name='submit_base_".$this->pid."' id='submit_base_".$this->pid."' alt='"._("Submit")."'>";
+      $this->tree .= "&nbsp;<input class='center' type='image' src='images/lists/submit.png' align='middle' title='"._("Submit")."' name='submit_base_".$this->pid."' id='submit_base_".$this->pid."' alt='"._("Submit")."'>";
     }
-    $this->tree.= "<input type='submit' style='display:none' name='submit_tree_base_".$this->pid."' id='submit_tree_base_".$this->pid."'>";
-    $this->tree.= "<input type='hidden' name='bs_rebase_".$this->pid."' id='bs_rebase_".$this->pid."'>";
-    $this->tree.= "<input type='hidden' name='BPID' id='BPID' value='".$this->pid."'>";
+    $this->tree .= "<input type='submit' style='display:none' name='submit_tree_base_".$this->pid."' id='submit_tree_base_".$this->pid."'>";
+    $this->tree .= "<input type='hidden' name='bs_rebase_".$this->pid."' id='bs_rebase_".$this->pid."'>";
+    $this->tree .= "<input type='hidden' name='BPID' id='BPID' value='".$this->pid."'>";
 
-    $this->lastState= true;
-    return true;
+    $this->lastState = TRUE;
+    return TRUE;
   }
 
 
@@ -298,7 +295,7 @@ class baseSelector {
   function getAction()
   {
     // Do not do anything if this is not our BPID, or there's even no BPID available...
-    if(!isset($_REQUEST['BPID']) || $_REQUEST['BPID'] != $this->pid) {
+    if (!isset($_REQUEST['BPID']) || ($_REQUEST['BPID'] != $this->pid)) {
       return;
     }
 
@@ -306,9 +303,7 @@ class baseSelector {
       return array("targets" => array($this->base), "action" => $this->action);
     }
 
-    return null;
+    return NULL;
   }
-
 }
-
 ?>
diff --git a/include/class_management.inc b/include/class_management.inc
index 6423bb56b11510ac31f81bfcec3eebaad55598e4..bcce084f70490686010b6fd543c3431c7ff7fd0e 100644
--- a/include/class_management.inc
+++ b/include/class_management.inc
@@ -1,5 +1,4 @@
 <?php
-
 /*
   This code is part of FusionDirectory (http://www.fusiondirectory.org/)
   Copyright (C) 2003-2010  Cajus Pollmeier
@@ -171,58 +170,62 @@ class management
 
     // Handle actions (POSTs and GETs)
     $str = $this->handleActions($this->detectPostActions());
-    if($str) return($this->getHeader().$str);
+    if ($str) {
+      return $this->getHeader().$str;
+    }
 
     // Open single dialog objects
-    if(is_object($this->dialogObject)){
-      if(method_exists($this->dialogObject,'save_object')) $this->dialogObject->save_object();
-      if(method_exists($this->dialogObject,'execute')){
+    if (is_object($this->dialogObject)) {
+      if (method_exists($this->dialogObject, 'save_object')) {
+        $this->dialogObject->save_object();
+      }
+      if (method_exists($this->dialogObject, 'execute')) {
         $display = $this->dialogObject->execute();
-        $display.= $this->_getTabFooter();
-        return($this->getHeader().$display);
+        $display .= $this->_getTabFooter();
+        return $this->getHeader().$display;
       }
     }
 
     // Display tab object.
-    if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){
+    if ($this->tabObject instanceOf tabs) {
       $this->tabObject->save_object();
       $display = $this->tabObject->execute();
-      $display.= $this->_getTabFooter();
-      return($this->getHeader().$display);
+      $display .= $this->_getTabFooter();
+      return $this->getHeader().$display;
     }
 
     // Set current restore base for snapshot handling.
-    if(is_object($this->snapHandler)){
+    if (is_object($this->snapHandler)) {
       $bases = array();
-      foreach($this->storagePoints as $sp){
+      foreach ($this->storagePoints as $sp) {
         $bases[] = $sp.$this->headpage->getBase();
       }
 
       // No bases specified? Try base
-      if(!count($bases)) $bases[] = $this->headpage->getBase();
+      if (!count($bases)) $bases[] = $this->headpage->getBase();
 
       $this->snapHandler->setSnapshotBases($bases);
     }
 
     // Display list
-    return($this->renderList());
+    return $this->renderList();
   }
 
   function renderList()
   {
     $this->headpage->update();
     $display = $this->headpage->render();
-    return($this->getHeader().$display);
+    return $this->getHeader().$display;
   }
 
   function getHeadpage()
   {
-    return($this->headpage);
+    return $this->headpage;
   }
 
   function getFilter()
   {
-    return($this->filter);
+    return $this->filter;
   }
 
   /*!
@@ -262,7 +265,7 @@ class management
   protected function _getTabFooter()
   {
     // Do not display tab footer for non tab objects
-    if (!($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug)) {
+    if (!($this->tabObject instanceOf tabs)) {
       return "";
     }
 
@@ -282,7 +285,7 @@ class management
     // In case an of locked entry, we may have opened a read-only tab.
     $str = "";
     if (isset($this->tabObject->read_only) && $this->tabObject->read_only == TRUE) {
-      $str.= "<p style=\"text-align:right\">
+      $str .= "<p style=\"text-align:right\">
         <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
         </p>";
       return $str;
@@ -313,46 +316,46 @@ class management
    *
    * \param  Array   $all     A combination of both 'action' and 'target'.
    */
-  protected function removeEntryRequested($action="",$target=array(),$all=array())
+  protected function removeEntryRequested($action = "", $target = array(), $all = array())
   {
     $disallowed = array();
     $this->dns = array();
 
-    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Entry removel requested!");
+    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, "Entry removel requested!");
 
     // Check permissons for each target
-    foreach($target as $dn){
+    foreach ($target as $dn) {
       $acl = $this->ui->get_permissions($dn, $this->aclCategory."/".$this->aclPlugin);
-      if(preg_match("/d/",$acl)){
+      if (preg_match("/d/", $acl)) {
         $this->dns[] = $dn;
-      }else{
+      } else {
         $disallowed[] = $dn;
       }
     }
-    if(count($disallowed)){
-      msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
+    if (count($disallowed)) {
+      msg_dialog::display(_("Permission"), msgPool::permDelete($disallowed), INFO_DIALOG);
     }
 
     // We've at least one entry to delete.
-    if(count($this->dns)){
+    if (count($this->dns)) {
 
       // check locks
-      if ($user= get_multiple_locks($this->dns)){
-        return(gen_locked_message($user,$this->dns));
+      if ($user = get_multiple_locks($this->dns)) {
+        return gen_locked_message($user, $this->dns);
       }
 
       // Add locks
       $dns_names = array();
-      foreach($this->dns as $dn){
-        $dns_names[] =LDAP::fix($dn);
+      foreach ($this->dns as $dn) {
+        $dns_names[] = LDAP::fix($dn);
       }
       add_lock ($this->dns, $this->ui->dn);
 
       // Display confirmation dialog.
       $smarty = get_smarty();
-      $smarty->assign("info", msgPool::deleteInfo($dns_names,_($this->objectName)));
-      $smarty->assign("multiple", true);
-      return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      $smarty->assign("info", msgPool::deleteInfo($dns_names, _($this->objectName)));
+      $smarty->assign("multiple", TRUE);
+      return $smarty->fetch(get_template_path('remove.tpl', TRUE));
     }
   }
 
@@ -372,27 +375,28 @@ class management
    *
    * \param String $altAclCategory Empty string.
    */
-  function removeEntryConfirmed($action="",$target=array(),$all=array(),
-      $altTabClass="",$altTabType="",$altAclCategory="")
+  function removeEntryConfirmed($action = "", $target = array(), $all = array(),
+      $altTabClass = "", $altTabType = "", $altAclCategory = "")
   {
-    $tabType = $this->tabType;
-    $tabClass = $this->tabClass;
-    $aclCategory = $this->aclCategory;
-    if(!empty($altTabClass)) $tabClass = $altTabClass;
-    if(!empty($altTabType)) $tabType = $altTabType;
-    if(!empty($altAclCategory)) $aclCategory = $altAclCategory;
+    $tabType      = $this->tabType;
+    $tabClass     = $this->tabClass;
+    $aclCategory  = $this->aclCategory;
+
+    if (!empty($altTabClass)) $tabClass = $altTabClass;
+    if (!empty($altTabType)) $tabType = $altTabType;
+    if (!empty($altAclCategory)) $aclCategory = $altAclCategory;
 
-    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Entry removel confirmed!");
+    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, "Entry removel confirmed!");
 
-    foreach($this->dns as $key => $dn){
+    foreach ($this->dns as $key => $dn) {
 
       // Check permissions, are we allowed to remove this object?
       $acl = $this->ui->get_permissions($dn, $this->aclCategory."/".$this->aclPlugin);
-      if(preg_match("/d/",$acl)){
+      if (preg_match("/d/", $acl)) {
 
         // Delete the object
         $this->dn = $dn;
-        $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
+        $this->tabObject = new $tabClass($this->config, $this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
         $this->tabObject->set_acl_base($this->dn);
         $this->tabObject->parent = &$this;
         $this->tabObject->delete ();
@@ -401,7 +405,7 @@ class management
         del_lock($this->dn);
       } else {
         msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
-        new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        new log("security", "groups/".get_class($this), $dn, array(), "Tried to trick deletion.");
       }
     }
 
@@ -417,23 +421,23 @@ class management
    */
   function detectPostActions()
   {
-    if(!is_object($this->headpage)){
+    if (!is_object($this->headpage)) {
       trigger_error("No valid headpage given....!");
-      return(array());
+      return array();
     }
-    $action= $this->headpage->getAction();
-    if(isset($_POST['edit_apply']))  $action['action'] = "apply";
-    if(isset($_POST['edit_finish'])) $action['action'] = "save";
-    if(isset($_POST['edit_cancel'])) $action['action'] = "cancel";
-    if(isset($_POST['delete_confirmed'])) $action['action'] = "removeConfirmed";
-    if(isset($_POST['delete_cancel'])) $action['action'] = "cancelDelete";
+    $action = $this->headpage->getAction();
+    if (isset($_POST['edit_apply']))  $action['action'] = "apply";
+    if (isset($_POST['edit_finish'])) $action['action'] = "save";
+    if (isset($_POST['edit_cancel'])) $action['action'] = "cancel";
+    if (isset($_POST['delete_confirmed'])) $action['action'] = "removeConfirmed";
+    if (isset($_POST['delete_cancel'])) $action['action'] = "cancelDelete";
 
     // Detect Snapshot actions
-    if(isset($_POST['CreateSnapshot'])) $action['action'] = "saveSnapshot";
-    if(isset($_POST['CancelSnapshot'])) $action['action'] = "cancelSnapshot";
+    if (isset($_POST['CreateSnapshot'])) $action['action'] = "saveSnapshot";
+    if (isset($_POST['CancelSnapshot'])) $action['action'] = "cancelSnapshot";
     $matches = array();
-    foreach($_POST as $name => $value) {
-      if (preg_match("/^RestoreSnapshot_(.*)_[xy]/",$name,$matches)) {
+    foreach ($_POST as $name => $value) {
+      if (preg_match("/^RestoreSnapshot_(.*)_[xy]/", $name, $matches)) {
         $entry = intval($matches[1]);
         if (isset($this->dialogObject->last_list[$entry])) {
           $action['action'] = "restoreSnapshot";
@@ -452,10 +456,12 @@ class management
   function handleActions($action)
   {
     // Start action
-    if(isset($this->actions[$action['action']])){
+    if (isset($this->actions[$action['action']])) {
       $func = $this->actions[$action['action']];
-      if(!isset($action['targets']))$action['targets']= array();
-      return($this->$func($action['action'],$action['targets'],$action));
+      if (!isset($action['targets'])) {
+        $action['targets'] = array();
+      }
+      return $this->$func($action['action'], $action['targets'], $action);
     }
   }
 
@@ -469,18 +475,17 @@ class management
    *
    * \param  Array   $all     A combination of both 'action' and 'target'.
    */
-  function createSnapshotDialog($action="",$target=array(),$all=array())
+  function createSnapshotDialog($action = "", $target = array(), $all = array())
   {
-    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Snaptshot creation initiated!");
+    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, "Snaptshot creation initiated!");
 
-    foreach($target as $entry){
-      if(!empty($entry) && $this->ui->allow_snapshot_create($entry,$this->aclCategory)){
-        $this->dialogObject = new SnapShotDialog($this->config,$entry,$this);
+    foreach ($target as $entry) {
+      if (!empty($entry) && $this->ui->allow_snapshot_create($entry, $this->aclCategory)) {
+        $this->dialogObject = new SnapShotDialog($this->config, $entry, $this);
         $this->dialogObject->aclCategories = array($this->aclCategory);
         $this->dialogObject->parent = &$this;
-
-      }else{
-        msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to create a snapshot for %s."),$entry),
+      } else {
+        msg_dialog::display(_("Permission"), sprintf(_("You are not allowed to create a snapshot for %s."), $entry),
             ERROR_DIALOG);
       }
     }
@@ -497,19 +502,21 @@ class management
    *
    *  \param  Array   $all     A combination of both 'action' and 'target'.
    */
-  function saveSnapshot($action="",$target=array(),$all=array())
+  function saveSnapshot($action = "", $target = array(), $all = array())
   {
-    if(!is_object($this->dialogObject)) return;
+    if (!is_object($this->dialogObject)) {
+      return;
+    }
     $this->dialogObject->save_object();
     $msgs = $this->dialogObject->check();
-    if(count($msgs)){
-      foreach($msgs as $msg){
+    if (count($msgs)) {
+      foreach ($msgs as $msg) {
         msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
       }
-    }else{
-      $this->dn =  $this->dialogObject->dn;
-      $this->snapHandler->create_snapshot( $this->dn,$this->dialogObject->CurrentDescription);
-      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Snaptshot created!");
+    } else {
+      $this->dn = $this->dialogObject->dn;
+      $this->snapHandler->create_snapshot($this->dn, $this->dialogObject->CurrentDescription);
+      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "Snaptshot created!");
       $this->closeDialogs();
     }
   }
@@ -525,15 +532,15 @@ class management
    *
    * \param  Array   $all     A combination of both 'action' and 'target'.
    */
-  function restoreSnapshot($action="",$target=array(),$all=array())
+  function restoreSnapshot($action = "", $target = array(), $all = array())
   {
     $entry = array_pop($target);
-    if(!empty($entry) && $this->ui->allow_snapshot_restore($entry,$this->aclCategory)){
+    if (!empty($entry) && $this->ui->allow_snapshot_restore($entry, $this->aclCategory)) {
       $this->snapHandler->restore_snapshot($entry);
-      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Snaptshot restored!");
+      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "Snaptshot restored!");
       $this->closeDialogs();
-    }else{
-      msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),
+    } else {
+      msg_dialog::display(_("Permission"), sprintf(_("You are not allowed to restore a snapshot for %s."), $entry),
           ERROR_DIALOG);
     }
   }
@@ -549,47 +556,37 @@ class management
    *
    * \param  Array   $all'     A combination of both 'action' and 'target'.
    */
-  function restoreSnapshotDialog($action="",$target=array(),$all=array())
+  function restoreSnapshotDialog($action = "", $target = array(), $all = array())
   {
     // Set current restore base for snapshot handling.
-    if(is_object($this->snapHandler)){
+    if (is_object($this->snapHandler)) {
       $bases = array();
-      foreach($this->storagePoints as $sp){
+      foreach ($this->storagePoints as $sp) {
         $bases[] = $sp.$this->headpage->getBase();
       }
     }
 
     // No bases specified? Try base
-    if(!count($bases)) $bases[] = $this->headpage->getBase();
+    if (!count($bases)) $bases[] = $this->headpage->getBase();
 
-    // No target, open the restore removed object dialog.
-    if(!count($target)){
+    if (!count($target)) {
+      // No target, open the restore removed object dialog.
       $entry = $this->headpage->getBase();
-      if(!empty($entry) && $this->ui->allow_snapshot_restore($entry,$this->aclCategory)){
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$entry,"Snaptshot restoring initiated!");
-        $this->dialogObject = new SnapShotDialog($this->config,$entry,$this);
-        $this->dialogObject->set_snapshot_bases($bases);
-        $this->dialogObject->display_all_removed_objects = true;
-        $this->dialogObject->display_restore_dialog = true;
-        $this->dialogObject->parent = &$this;
-      }else{
-        msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),
-            ERROR_DIALOG);
-      }
-    }else{
-
+    } else {
       // Display the restore points for a given object.
       $entry = array_pop($target);
-      if(!empty($entry) && $this->ui->allow_snapshot_restore($entry,$this->aclCategory)){
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$entry,"Snaptshot restoring initiated!");
-        $this->dialogObject = new SnapShotDialog($this->config,$entry,$this);
-        $this->dialogObject->set_snapshot_bases($bases);
-        $this->dialogObject->display_restore_dialog = true;
-        $this->dialogObject->parent = &$this;
-      }else{
-        msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),
-            ERROR_DIALOG);
-      }
+    }
+
+    if (!empty($entry) && $this->ui->allow_snapshot_restore($entry, $this->aclCategory)) {
+      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $entry, "Snaptshot restoring initiated!");
+      $this->dialogObject = new SnapShotDialog($this->config, $entry, $this);
+      $this->dialogObject->set_snapshot_bases($bases);
+      $this->dialogObject->display_all_removed_objects  = !count($target);
+      $this->dialogObject->display_restore_dialog       = TRUE;
+      $this->dialogObject->parent                       = &$this;
+    } else {
+      msg_dialog::display(_("Permission"), sprintf(_("You are not allowed to restore a snapshot for %s."), $entry),
+          ERROR_DIALOG);
     }
   }
 
@@ -609,7 +606,7 @@ class management
    *
    * \param String $altAclCategory Empty string.
    */
-  function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+  function newEntry($action = "", $target = array(), $all = array(), $altTabClass = "", $altTabType = "", $altAclCategory = "")
   {
     /* To handle mutliple object types overload this method.
      * ...
@@ -617,9 +614,9 @@ class management
      *   registerAction('newGroup','newEntry');
      * ...
      *
-     * function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory)
+     * function newEntry($action = "", $target= array(), $all=array(), $altTabClass ="", $altTabType = "", $altAclCategory)
      * {
-     *   switch($action){
+     *   switch($action) {
      *     case 'newUser' : {
      *       mangement::newEntry($action,$target,$all,"usertabs","USERTABS","users");
      *     }
@@ -629,30 +626,30 @@ class management
      *   }
      * }
      **/
-    $tabType = $this->tabType;
-    $tabClass = $this->tabClass;
-    $aclCategory = $this->aclCategory;
-    if(!empty($altTabClass)) $tabClass = $altTabClass;
-    if(!empty($altTabType)) $tabType = $altTabType;
-    if(!empty($altAclCategory)) $aclCategory = $altAclCategory;
+    $tabType      = $this->tabType;
+    $tabClass     = $this->tabClass;
+    $aclCategory  = $this->aclCategory;
+    if (!empty($altTabClass)) $tabClass = $altTabClass;
+    if (!empty($altTabType)) $tabType = $altTabType;
+    if (!empty($altAclCategory)) $aclCategory = $altAclCategory;
 
     // Check locking & lock entry if required
-    $this->displayApplyBtn = FALSE;
-    $this->dn = "new";
-    $this->is_new = TRUE;
-    $this->is_single_edit = FALSE;
+    $this->displayApplyBtn  = FALSE;
+    $this->dn               = "new";
+    $this->is_new           = TRUE;
+    $this->is_single_edit   = FALSE;
 
     set_object_info($this->dn);
 
     // Open object.
-    if(empty($tabClass) || empty($tabType)){
+    if (empty($tabClass) || empty($tabType)) {
       // No tab type defined
-    }else{
+    } else {
       if (isset($this->config->data['TABS'][$tabType])) {
-        $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
+        $this->tabObject = new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
         $this->tabObject->set_acl_base($this->headpage->getBase());
         $this->tabObject->parent = &$this;
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Create new entry initiated!");
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "Create new entry initiated!");
       } else {
         msg_dialog::display(_("Error"), sprintf(_("No tab declaration for '%s' found in your configuration file. Cannot create plugin instance!"), $tabType), ERROR_DIALOG);
       }
@@ -675,7 +672,7 @@ class management
    *
    * \param String $altAclCategory Empty string.
    */
-  function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+  function editEntry($action = "", $target = array(), $all = array(), $altTabClass = "", $altTabType = "", $altAclCategory = "")
   {
     /* To handle mutliple object types overload this method.
      * ...
@@ -683,9 +680,9 @@ class management
      *   registerAction('editGroup','editEntry');
      * ...
      *
-     * function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory)
+     * function editEntry($action = "", $target= array(), $all=array(), $altTabClass ="", $altTabType = "", $altAclCategory)
      * {
-     *   switch($action){
+     *   switch($action) {
      *     case 'editUser' : {
      *       mangement::editEntry($action,$target,$all,"usertabs","USERTABS","users");
      *     }
@@ -698,40 +695,40 @@ class management
 
     // Do not create a new tabObject while there is already one opened,
     //  the user may have just pressed F5 to reload the page.
-    if(is_object($this->tabObject)){
+    if (is_object($this->tabObject)) {
       return;
     }
 
-    $tabType = $this->tabType;
-    $tabClass = $this->tabClass;
-    $aclCategory = $this->aclCategory;
-    if(!empty($altTabClass)) $tabClass = $altTabClass;
-    if(!empty($altTabType)) $tabType = $altTabType;
-    if(!empty($altAclCategory)) $aclCategory = $altAclCategory;
+    $tabType      = $this->tabType;
+    $tabClass     = $this->tabClass;
+    $aclCategory  = $this->aclCategory;
+    if (!empty($altTabClass)) $tabClass = $altTabClass;
+    if (!empty($altTabType)) $tabType = $altTabType;
+    if (!empty($altAclCategory)) $aclCategory = $altAclCategory;
 
     $this->displayApplyBtn = count($target) == 1;
 
     // Single edit - we only got one object dn.
     if (count($target) == 1) {
-      $this->is_new = FALSE;
+      $this->is_new         = FALSE;
       $this->is_single_edit = TRUE;
 
       // Get the dn of the object and creates lock
       $this->dn = array_pop($target);
       set_object_info($this->dn);
       $user = get_lock($this->dn);
-      if ($user != ""){
-        return(gen_locked_message ($user, $this->dn,TRUE));
+      if ($user != "") {
+        return gen_locked_message($user, $this->dn, TRUE);
       }
       add_lock ($this->dn, $this->ui->dn);
 
       // Open object.
-      if(empty($tabClass) || empty($tabType)){
+      if (empty($tabClass) || empty($tabType)) {
         trigger_error("We can't edit any object(s). 'tabClass' or 'tabType' is empty!");
-      }else{
+      } else {
         $tab = $tabClass;
         $this->tabObject = new $tab($this->config, $this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Edit entry initiated!");
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "Edit entry initiated!");
         $this->tabObject->set_acl_base($this->dn);
         $this->tabObject->parent = &$this;
       }
@@ -748,27 +745,27 @@ class management
    */
   protected function saveChanges()
   {
-    if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){
+    if ($this->tabObject instanceOf tabs) {
       $this->tabObject->save_object();
       $msgs = $this->tabObject->check();
-      if(count($msgs)){
+      if (count($msgs)) {
         msg_dialog::displayChecks($msgs);
-        return("");
-      }else{
+        return "";
+      } else {
         $this->tabObject->save();
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dns,"Entry saved!");
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dns, "Entry saved!");
         $this->remove_lock();
         $this->closeDialogs();
       }
-    }elseif($this->dialogObject instanceOf plugin){
+    } elseif ($this->dialogObject instanceOf plugin) {
       $this->dialogObject->save_object();
       $msgs = $this->dialogObject->check();
-      if(count($msgs)){
+      if (count($msgs)) {
         msg_dialog::displayChecks($msgs);
-        return("");
-      }else{
+        return "";
+      } else {
         $this->dialogObject->save();
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dns,"Entry saved!");
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dns, "Entry saved!");
         $this->remove_lock();
         $this->closeDialogs();
       }
@@ -783,15 +780,15 @@ class management
    */
   protected function applyChanges()
   {
-    if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){
+    if ($this->tabObject instanceOf tabs) {
       $this->tabObject->save_object();
       $msgs = $this->tabObject->check();
-      if(count($msgs)){
+      if (count($msgs)) {
         msg_dialog::displayChecks($msgs);
-        return("");
-      }else{
+        return "";
+      } else {
         $this->tabObject->save();
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dns,"Modifications applied!");
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dns, "Modifications applied!");
         $this->tabObject->re_init();
       }
     }
@@ -804,15 +801,17 @@ class management
    */
   protected function closeDialogs()
   {
-    $this->last_dn = $this->dn;
+    $this->last_dn  = $this->dn;
+    $this->dn       = "";
     $this->last_dns = $this->dns;
-    $this->last_tabObject = $this->tabObject;
-    $this->last_dialogObject = $this->dialogObject;
-    $this->dn = "";
-    $this->dns = array();
-    $this->tabObject = null;
-    $this->dialogObject = null;
-    $this->skipFooter = FALSE;
+    $this->dns      = array();
+
+    $this->last_tabObject     = $this->tabObject;
+    $this->tabObject          = NULL;
+    $this->last_dialogObject  = $this->dialogObject;
+    $this->dialogObject       = NULL;
+
+    $this->skipFooter   = FALSE;
     set_object_info();
   }
 
@@ -835,7 +834,7 @@ class management
    *          When the action/event new is send, the method 'createUser'
    *          will be called.
    */
-  function registerAction($action,$target)
+  function registerAction($action, $target)
   {
     $this->actions[$action] = $target;
   }
@@ -849,10 +848,10 @@ class management
    */
   function remove_lock()
   {
-    if(!empty($this->dn) && $this->dn != "new"){
+    if (!empty($this->dn) && $this->dn != "new") {
       del_lock($this->dn);
     }
-    if(count($this->dns)){
+    if (count($this->dns)) {
       del_lock($this->dns);
     }
   }
@@ -921,11 +920,11 @@ class management
           $aclPlugin = $altAclPlugin[$dn];
         }
 
-        if($action == "copy" && $this->ui->is_copyable($dn, $aclCategory, $aclPlugin)) {
+        if ($action == "copy" && $this->ui->is_copyable($dn, $aclCategory, $aclPlugin)) {
           $this->cpHandler->add_to_queue($dn, "copy", $tabClass, $tabType, $aclCategory);
           @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Entry copied!");
         }
-        if($action == "cut" && $this->ui->is_cutable($dn, $aclCategory, $aclPlugin)) {
+        if ($action == "cut" && $this->ui->is_cutable($dn, $aclCategory, $aclPlugin)) {
           $this->cpHandler->add_to_queue($dn, "cut", $tabClass, $tabType, $aclCategory);
           @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Entry cutted!");
         }
@@ -957,50 +956,14 @@ class management
    *
    * \param string $str The new filter
    */
-  function setFilter($str) {
+  function setFilter($str)
+  {
     $this->filter = $str;
   }
 
-  function postcreate() {
-      $this->handle_post_events('add');
-  }
-  function postmodify(){
-      $this->handle_post_events('modify');
-  }
-  function postremove(){
-      $this->handle_post_events('remove');
-  }
-
   function is_modal_dialog()
   {
-      return(is_object($this->tabObject) || is_object($this->dialogObject));
-  }
-
-  /*!
-   * \brief    Forward command execution request
-   *             to the correct method.
-   */
-  function handle_post_events($mode, $addAttrs= array())
-  {
-      if(!in_array($mode, array('add','remove','modify'))){
-          trigger_error(sprintf("Invalid post event type given %s! Valid types are [add,modify,remove].", $mode));
-          return;
-      }
-      switch ($mode){
-          case "add":
-              plugin::callHook($this,"POSTCREATE", $addAttrs);
-          break;
-
-          case "modify":
-              plugin::callHook($this,"POSTMODIFY", $addAttrs);
-          break;
-
-          case "remove":
-              plugin::callHook($this,"POSTREMOVE", $addAttrs);
-          break;
-      }
+    return (is_object($this->tabObject) || is_object($this->dialogObject));
   }
 }
-
-// vism:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
diff --git a/include/class_plugin.inc b/include/class_plugin.inc
index c1f45a87886108da6f4c52db86f6f59b8c2b6551..fc0c9a150692499385076de93b70b1e1c97c3140 100644
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
@@ -707,36 +707,6 @@ class plugin
     return $display;
   }
 
-  /*!
-   * \brief Executes commands after an object has been created
-   *
-   * \param array $add_attrs
-   */
-  function postcreate($add_attrs = array())
-  {
-    return self::callHook ($this, "POSTCREATE", $add_attrs);
-  }
-
-  /*!
-   * \brief Execute commands after an object has been modified
-   *
-   * \param array $add_attrs
-   */
-  function postmodify($add_attrs = array())
-  {
-    return self::callHook ($this, "POSTMODIFY", $add_attrs);
-  }
-
-  /*!
-   * \brief Executes a command after an object has been removed
-   *
-   * \param array $add_attrs
-   */
-  function postremove($add_attrs = array())
-  {
-    return self::callHook ($this, "POSTREMOVE", $add_attrs);
-  }
-
   /*!
    * \brief Executes a command after an object has been copied
    */
@@ -1167,31 +1137,43 @@ class plugin
     return (TRUE);
   }
 
-
   /*! \brief Forward command execution requests
-   *         to the post hook execution method.
+   *         to the pre/post hook execution method.
+   *
+   * \param  string  $when must be PRE or POST
+   *
+   * \param  string  $mode add, remove or modify
+   *
+   * \param  array  $addAttrs
    */
-  function handle_post_events($mode, $addAttrs = array())
+  protected function handle_hooks($when, $mode, $addAttrs = array())
   {
-    if (!in_array($mode, array('add','remove','modify'))) {
-      trigger_error(sprintf("Invalid post event type given %s! Valid types are [add,modify,remove].", $mode));
-      return;
-    }
     switch ($mode) {
-      case "add":
-        plugin::callHook($this, "POSTCREATE", $addAttrs);
+      case 'add':
+        plugin::callHook($this, $when.'CREATE', $addAttrs);
       break;
 
-      case "modify":
-        plugin::callHook($this, "POSTMODIFY", $addAttrs);
+      case 'modify':
+        plugin::callHook($this, $when.'MODIFY', $addAttrs);
       break;
 
-      case "remove":
-        plugin::callHook($this, "POSTREMOVE", $addAttrs);
+      case 'remove':
+        plugin::callHook($this, $when.'REMOVE', $addAttrs);
+      break;
+
+      default:
+        trigger_error(sprintf('Invalid %s event type given %s! Valid types are [add,modify,remove].', strtolower($when), $mode));
       break;
     }
   }
 
+  /*! \brief Forward command execution requests
+   *         to the post hook execution method.
+   */
+  function handle_post_events($mode, $addAttrs = array())
+  {
+    return $this->handle_hooks('POST', $mode, $addAttrs);
+  }
 
   /*!
    *  \brief Forward command execution requests
@@ -1199,23 +1181,7 @@ class plugin
    */
   function handle_pre_events($mode, $addAttrs = array())
   {
-    if (!in_array($mode, array('add','remove','modify'))) {
-      trigger_error(sprintf("Invalid pre event type given %s! Valid types are [add,modify,remove].", $mode));
-      return;
-    }
-    switch ($mode) {
-      case "add":
-        plugin::callHook($this, "PRECREATE", $addAttrs);
-      break;
-
-      case "modify":
-        plugin::callHook($this, "PREMODIFY", $addAttrs);
-      break;
-
-      case "remove":
-        plugin::callHook($this, "PREREMOVE", $addAttrs);
-      break;
-    }
+    return $this->handle_hooks('PRE', $mode, $addAttrs);
   }
 
 
diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc
index 4c25034f22182dd4138bec5314214b7cf371382c..d2902d315e6f8f8c9373eaa9afc9158157570331 100644
--- a/include/class_userinfo.inc
+++ b/include/class_userinfo.inc
@@ -1,5 +1,4 @@
 <?php
-
 /*
   This code is part of FusionDirectory (http://www.fusiondirectory.org/)
   Copyright (C) 2003-2010  Cajus Pollmeier
@@ -133,7 +132,7 @@ class userinfo
       $aclp[$attrs['dn']] = substr_count($attrs['dn'], ',');
       $aclc[$attrs['dn']] = array();
       $ol = array();
-      for ($i = 0; $i<$attrs['gosaAclEntry']['count']; $i++) {
+      for ($i = 0; $i < $attrs['gosaAclEntry']['count']; $i++) {
         $ol = array_merge($ol, acl::explodeAcl($attrs['gosaAclEntry'][$i]));
       }
       $aclc[$attrs['dn']] = $ol;
@@ -141,25 +140,25 @@ class userinfo
 
     /* Resolve roles here.
      */
-    foreach($aclc as $dn => $data){
-      foreach($data as $prio => $aclc_value)  {
-        if($aclc_value['type'] == "role"){
+    foreach ($aclc as $dn => $data) {
+      foreach ($data as $prio => $aclc_value) {
+        if ($aclc_value['type'] == "role") {
 
           unset($aclc[$dn][$prio]);
 
-          $ldap->cat($aclc_value['acl'],array("gosaAclTemplate"));
+          $ldap->cat($aclc_value['acl'], array("gosaAclTemplate"));
           $attrs = $ldap->fetch();
 
-          if(isset($attrs['gosaAclTemplate'])){
-            for($i= 0; $i<$attrs['gosaAclTemplate']['count']; $i++){
+          if (isset($attrs['gosaAclTemplate'])) {
+            for ($i = 0; $i < $attrs['gosaAclTemplate']['count']; $i++) {
               $tmp = @acl::explodeAcl($attrs['gosaAclTemplate'][$i]);
 
-              foreach($tmp as $new_acl){
+              foreach ($tmp as $new_acl) {
 
                 /* Keep non role attributes here! */
-                $new_acl['filter'] = $aclc_value['filter'];
+                $new_acl['filter']  = $aclc_value['filter'];
                 $new_acl['members'] = $aclc_value['members'];
-                $aclc[$dn][] =$new_acl;
+                $aclc[$dn][]        = $new_acl;
               }
             }
           }
@@ -171,41 +170,39 @@ class userinfo
     asort($aclp);
 
     /* Sort in tree order */
-    foreach ($aclp as $dn => $acl){
+    foreach ($aclp as $dn => $acl) {
       /* Check if we need to keep this ACL */
-      foreach($aclc[$dn] as $idx => $type){
-        $interresting= FALSE;
+      foreach ($aclc[$dn] as $idx => $type) {
+        $interresting = FALSE;
 
         /* No members? This ACL rule is deactivated ... */
-        if (!count($type['members'])){
-          $interresting= FALSE;
+        if (!count($type['members'])) {
+          $interresting = FALSE;
         } else {
-
           /* Inspect members... */
-          foreach ($type['members'] as $grp => $grpdsc){
-
+          foreach ($type['members'] as $grp => $grpdsc) {
             /* Some group inside the members that is relevant for us? */
-            if (in_array_ics(@LDAP::convert(preg_replace('/^G:/', '', $grp)), $this->groups)){
-              $interresting= TRUE;
+            if (in_array_ics(@LDAP::convert(preg_replace('/^G:/', '', $grp)), $this->groups)) {
+              $interresting = TRUE;
             }
 
             /* User inside the members? */
-            if (mb_strtoupper(preg_replace('/^U:/', '', $grp)) == mb_strtoupper($this->dn)){
-              $interresting= TRUE;
+            if (mb_strtoupper(preg_replace('/^U:/', '', $grp)) == mb_strtoupper($this->dn)) {
+              $interresting = TRUE;
             }
 
             /* Wildcard? */
-            if (preg_match('/^G:\*/',  $grp)){
-              $interresting= TRUE;
+            if (preg_match('/^G:\*/',  $grp)) {
+              $interresting = TRUE;
             }
           }
         }
 
-        if ($interresting){
-          if (!isset($this->ACL[$dn])){
-            $this->ACL[$dn]= array();
+        if ($interresting) {
+          if (!isset($this->ACL[$dn])) {
+            $this->ACL[$dn] = array();
           }
-          $this->ACL[$dn][$idx]= $type;
+          $this->ACL[$dn][$idx] = $type;
         }
       }
     }
@@ -225,42 +222,42 @@ class userinfo
        for objects in 'ou=base' we only have to apply on ACL.
      */
     $without_self_acl = $all_acl = array();
-    foreach($this->ACL as $dn => $acl){
-      $sdn =$dn;
-      $first= TRUE; // Run at least once
-      while(strpos($dn,",") !== FALSE || $first){
+    foreach ($this->ACL as $dn => $acl) {
+      $sdn    = $dn;
+      $first  = TRUE; // Run at least once
+      while ((strpos($dn, ",") !== FALSE) || $first) {
         $first = FALSE;
-        if(isset($this->ACL[$dn])){
-          $all_acl[$sdn][$dn] = $this->ACL[$dn];
-          $without_self_acl[$sdn][$dn] = $this->ACL[$dn];
-          foreach($without_self_acl[$sdn][$dn] as $acl_id => $acl_set){
+        if (isset($this->ACL[$dn])) {
+          $all_acl[$sdn][$dn]           = $this->ACL[$dn];
+          $without_self_acl[$sdn][$dn]  = $this->ACL[$dn];
+          foreach ($without_self_acl[$sdn][$dn] as $acl_id => $acl_set) {
 
             /* Remember which ACL set has speicial user filter
              */
-            if(isset($acl_set['filter']{1})){
+            if (isset($acl_set['filter']{1})) {
               $this->ACLperPath_usesFilter[$sdn] = TRUE;
             }
 
             /* Remove all acl entries which are especially for the current user (self acl)
              */
-            foreach($acl_set['acl'] as $object => $object_acls){
-              if(isset($object_acls[0]) && strpos($object_acls[0],"s") !== FALSE){
+            foreach ($acl_set['acl'] as $object => $object_acls) {
+              if (isset($object_acls[0]) && (strpos($object_acls[0], "s") !== FALSE)) {
                 unset($without_self_acl[$sdn][$dn][$acl_id]['acl'][$object]);
               }
             }
           }
         }
-        $dn = preg_replace("/^[^,]*+,/","",$dn);
+        $dn = preg_replace("/^[^,]*+,/", "", $dn);
       }
     }
-    $this->ACLperPath =$without_self_acl;
+    $this->ACLperPath = $without_self_acl;
 
     /* Append Self entry */
     $dn = $this->dn;
-    while(strpos($dn,",") && !isset($all_acl[$dn])){
-      $dn = preg_replace("/^[^,]*+,/","",$dn);
+    while (strpos($dn, ",") && !isset($all_acl[$dn])) {
+      $dn = preg_replace("/^[^,]*+,/", "", $dn);
     }
-    if(isset($all_acl[$dn])){
+    if (isset($all_acl[$dn])) {
       $this->ACLperPath[$this->dn] = $all_acl[$dn];
     }
   }
@@ -272,7 +269,7 @@ class userinfo
    */
   function get_acl_target_objects()
   {
-    return(array_keys($this->ACLperPath));
+    return array_keys($this->ACLperPath);
   }
 
   /*!
@@ -288,7 +285,7 @@ class userinfo
    */
   function get_category_permissions($dn, $category, $any_acl = FALSE)
   {
-    return(@$this->get_permissions($dn,$category.'/0',""));
+    return @$this->get_permissions($dn, $category.'/0', "");
   }
 
 
@@ -305,7 +302,7 @@ class userinfo
   */
   function is_copyable($dn, $object, $class)
   {
-    return(preg_match("/r/",$this->has_complete_category_acls($dn, $object)));
+    return preg_match("/r/", $this->has_complete_category_acls($dn, $object));
   }
 
 
@@ -322,9 +319,9 @@ class userinfo
    */
   function is_cutable($dn, $object, $class)
   {
-    $remove = preg_match("/d/",$this->get_permissions($dn,$object."/".$class));
-    $read   = preg_match("/r/",$this->has_complete_category_acls($dn, $object));
-    return($remove && $read);
+    $remove = preg_match("/d/", $this->get_permissions($dn, $object."/".$class));
+    $read   = preg_match("/r/", $this->has_complete_category_acls($dn, $object));
+    return ($remove && $read);
   }
 
 
@@ -339,7 +336,7 @@ class userinfo
    */
   function is_pasteable($dn, $object)
   {
-    return(preg_match("/w/",$this->has_complete_category_acls($dn, $object)));
+    return preg_match("/w/", $this->has_complete_category_acls($dn, $object));
   }
 
 
@@ -354,15 +351,15 @@ class userinfo
    */
   function allow_snapshot_restore($dn, $object)
   {
-    if(!is_array($object)){
+    if (!is_array($object)) {
       $object = array($object);
     }
     $r = $w = TRUE;
-    foreach($object as $category){
-      $w &= preg_match("/w/",$this->has_complete_category_acls($dn, $category));
-      $r &= preg_match("/r/",$this->has_complete_category_acls($dn, $category));
+    foreach ($object as $category) {
+      $w &= preg_match("/w/", $this->has_complete_category_acls($dn, $category));
+      $r &= preg_match("/r/", $this->has_complete_category_acls($dn, $category));
     }
-    return($r && $w );
+    return ($r && $w);
   }
 
 
@@ -377,14 +374,14 @@ class userinfo
    */
   function allow_snapshot_create($dn, $object)
   {
-    if(!is_array($object)){
+    if (!is_array($object)) {
       $object = array($object);
     }
     $r = TRUE;
-    foreach($object as $category){
-      $r &= preg_match("/r/",$this->has_complete_category_acls($dn, $category));
+    foreach ($object as $category) {
+      $r &= preg_match("/r/", $this->has_complete_category_acls($dn, $category));
     }
-    return($r) ;
+    return $r;
   }
 
   /*!
@@ -399,56 +396,56 @@ class userinfo
    * \param bool $skip_write   Remove the write acl for this dn
    *
    */
-  function get_permissions($dn, $object, $attribute= "", $skip_write= FALSE)
+  function get_permissions($dn, $object, $attribute = "", $skip_write = FALSE)
   {
     /* If we are forced to skip ACLs checks for the current user
         then return all permissions.
      */
-    if($this->ignore_acl_for_current_user()){
-      if($skip_write){
-        return("rcdm");
+    if ($this->ignore_acl_for_current_user()) {
+      if ($skip_write) {
+        return "rcdm";
       }
-      return("rwcdm");
+      return "rwcdm";
     }
 
     /* Push cache answer? */
     $ACL_CACHE = &session::global_get('ACL_CACHE');
-    if (isset($ACL_CACHE["$dn+$object+$attribute"])){
+    if (isset($ACL_CACHE["$dn+$object+$attribute"])) {
       $ret = $ACL_CACHE["$dn+$object+$attribute"];
-      if($skip_write){
-        $ret = str_replace(array('w','c','d','m'), '',$ret);
+      if ($skip_write) {
+        $ret = str_replace(array('w','c','d','m'), '', $ret);
       }
-      return($ret);
+      return $ret;
     }
 
     /* Detect the set of ACLs we have to check for this object
      */
     $adn = $dn;
-    while(!isset($this->ACLperPath[$adn]) && strpos($adn,",") !== FALSE){
-      $adn = preg_replace("/^[^,]*+,/","",$adn);
+    while (!isset($this->ACLperPath[$adn]) && (strpos($adn, ",") !== FALSE)) {
+      $adn = preg_replace("/^[^,]*+,/", "", $adn);
     }
-    if(isset($this->ACLperPath[$adn])){
+    if (isset($this->ACLperPath[$adn])) {
       $ACL = $this->ACLperPath[$adn];
-    }else{
+    } else {
       $ACL_CACHE["$dn+$object+$attribute"] = "";
-      return("");
+      return "";
     }
 
     /* If we do not need to respect any user-filter settings
         we can skip the per object ACL checks.
      */
-    $orig_dn= $dn;
-    if(!isset($this->ACLperPath_usesFilter[$adn])){
+    $orig_dn = $dn;
+    if (!isset($this->ACLperPath_usesFilter[$adn])) {
       $dn = $adn;
-      if (isset($ACL_CACHE["$dn+$object+$attribute"])){
+      if (isset($ACL_CACHE["$dn+$object+$attribute"])) {
         $ret = $ACL_CACHE["$dn+$object+$attribute"];
-        if(!isset($ACL_CACHE["$orig_dn+$object+$attribute"])){
+        if (!isset($ACL_CACHE["$orig_dn+$object+$attribute"])) {
           $ACL_CACHE["$orig_dn+$object+$attribute"] = $ACL_CACHE["$dn+$object+$attribute"];
         }
-        if($skip_write){
-          $ret = str_replace('w','',$ret);
+        if ($skip_write) {
+          $ret = str_replace('w', '', $ret);
         }
-        return($ret);
+        return $ret;
       }
     }
 
@@ -456,116 +453,118 @@ class userinfo
      */
     $ldap = $this->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);
+    $path = explode(',', $dn);
+    $path = array_reverse($path);
 
     /* Walk along the path to evaluate the acl */
-    $cpath= "";
-    foreach ($path as $element){
+    $cpath = "";
+    foreach ($path as $element) {
 
       /* Clean potential ACLs for each level */
-      if(isset($this->config->idepartments[$cpath])){
-        $acl= $this->cleanACL($acl);
+      if (isset($this->config->idepartments[$cpath])) {
+        $acl = $this->cleanACL($acl);
       }
 
-      if ($cpath == ""){
-        $cpath= $element;
+      if ($cpath == "") {
+        $cpath = $element;
       } else {
-        $cpath= $element.','.$cpath;
+        $cpath = $element.','.$cpath;
       }
 
-      if (isset($ACL[$cpath])){
+      if (isset($ACL[$cpath])) {
 
         /* Inspect this ACL, place the result into ACL */
-        foreach ($ACL[$cpath] as $subacl){
+        foreach ($ACL[$cpath] as $subacl) {
 
           /* Reset? Just clean the ACL and turn over to the next one... */
-          if ($subacl['type'] == 'reset'){
-            $acl= $this->cleanACL($acl, TRUE);
+          if ($subacl['type'] == 'reset') {
+            $acl = $this->cleanACL($acl, TRUE);
             continue;
           }
 
-          if($subacl['type'] == "role") {
+          if ($subacl['type'] == "role") {
             echo "role skipped";
             continue;
           }
 
           /* With user filter */
-          if (isset($subacl['filter']) && !empty($subacl['filter'])){
+          if (isset($subacl['filter']) && !empty($subacl['filter'])) {
             $id = $dn."-".$subacl['filter'];
-            if(!isset($ACL_CACHE['FILTER'][$id])){
-              $ACL_CACHE['FILTER'][$id] = $ldap->object_match_filter($dn,$subacl['filter']);
+            if (!isset($ACL_CACHE['FILTER'][$id])) {
+              $ACL_CACHE['FILTER'][$id] = $ldap->object_match_filter($dn, $subacl['filter']);
             }
-            if(!$ACL_CACHE['FILTER'][$id]){
+            if (!$ACL_CACHE['FILTER'][$id]) {
               continue;
             }
           }
 
-          /* Self ACLs?
-           */
-          if($dn != $this->dn && isset($subacl['acl'][$object][0]) && (strpos($subacl['acl'][$object][0],"s") !== FALSE)){
+          /* Self ACLs? */
+          if (($dn != $this->dn) && isset($subacl['acl'][$object][0]) && (strpos($subacl['acl'][$object][0], "s") !== FALSE)) {
             continue;
           }
 
           /* 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])){
-            foreach($subacl['acl'][$object] as $attr => $dummy){
-              $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$object][$attr]);
+          if ($attribute == "" && isset($subacl['acl'][$object])) {
+            foreach ($subacl['acl'][$object] as $attr => $dummy) {
+              $acl = $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$object][$attr]);
             }
             continue;
           }
 
           /* Per attribute ACL? */
-          if (isset($subacl['acl'][$object][$attribute])){
-            $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$object][$attribute]);
+          if (isset($subacl['acl'][$object][$attribute])) {
+            $acl = $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$object][$attribute]);
             continue;
           }
 
           /* Per object ACL? */
-          if (isset($subacl['acl'][$object][0])){
-            $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$object][0]);
+          if (isset($subacl['acl'][$object][0])) {
+            $acl = $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$object][0]);
             continue;
           }
 
           /* Global ACL? */
-          if (isset($subacl['acl']['all'][0])){
-            $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl']['all'][0]);
+          if (isset($subacl['acl']['all'][0])) {
+            $acl = $this->mergeACL($acl, $subacl['type'], $subacl['acl']['all'][0]);
             continue;
           }
 
           /* Category ACLs    (e.g. $object = "user/0")
            */
-          if(strstr($object,"/0")){
-            $ocs = preg_replace("/\/0$/","",$object);
-            if(isset($this->ocMapping[$ocs])){
+          if (strstr($object, "/0")) {
+            $ocs = preg_replace("/\/0$/", "", $object);
+            if (isset($this->ocMapping[$ocs])) {
 
               /* if $attribute is "", then check every single attribute for this object.
                  if it is 0, then just check the object category ACL.
                */
-              if($attribute == ""){
-                foreach($this->ocMapping[$ocs] as $oc){
-                  if (isset($subacl['acl'][$ocs.'/'.$oc])){
-
-                      // Skip ACLs wich are defined for ourselfs only - if not checking against ($ui->dn)
-                      if(isset($subacl['acl'][$ocs.'/'.$oc][0]) &&
-                              $dn != $this->dn &&
-                              strpos($subacl['acl'][$ocs.'/'.$oc][0],"s") !== FALSE) continue;
+              if ($attribute == "") {
+                foreach ($this->ocMapping[$ocs] as $oc) {
+                  if (isset($subacl['acl'][$ocs.'/'.$oc])) {
+                    // Skip ACLs wich are defined for ourselfs only - if not checking against ($ui->dn)
+                    if (isset($subacl['acl'][$ocs.'/'.$oc][0]) &&
+                        ($dn != $this->dn) &&
+                        (strpos($subacl['acl'][$ocs.'/'.$oc][0], "s") !== FALSE)) {
+                      continue;
+                    }
 
-                    foreach($subacl['acl'][$ocs.'/'.$oc] as $attr => $dummy){
-                      $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$ocs.'/'.$oc][$attr]);
+                    foreach ($subacl['acl'][$ocs.'/'.$oc] as $attr => $dummy) {
+                      $acl = $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$ocs.'/'.$oc][$attr]);
                     }
                     continue;
                   }
                 }
-              }else{
-                if(isset($subacl['acl'][$ocs.'/'.$oc][0])){
-                  if($dn != $this->dn && strpos($subacl['acl'][$ocs.'/'.$oc][0],"s") !== FALSE) continue;
-                  $acl= $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$ocs.'/'.$oc][0]);
+              } else {
+                if (isset($subacl['acl'][$ocs.'/'.$oc][0])) {
+                  if (($dn != $this->dn) && (strpos($subacl['acl'][$ocs.'/'.$oc][0], "s") !== FALSE)) {
+                    continue;
+                  }
+                  $acl = $this->mergeACL($acl, $subacl['type'], $subacl['acl'][$ocs.'/'.$oc][0]);
                 }
               }
             }
@@ -578,26 +577,26 @@ class userinfo
     /* If the requested ACL is for a container object, then alter
         ACLs by applying cleanACL a last time.
      */
-    if(isset($this->config->idepartments[$dn])){
+    if (isset($this->config->idepartments[$dn])) {
       $acl = $this->cleanACL($acl);
     }
 
     /* Assemble string */
-    $ret= "";
-    foreach ($acl as $key => $value){
-      if ($value !== ""){
-        $ret.= $key;
+    $ret = "";
+    foreach ($acl as $key => $value) {
+      if ($value !== "") {
+        $ret .= $key;
       }
     }
 
-    $ACL_CACHE["$dn+$object+$attribute"]= $ret;
-    $ACL_CACHE["$orig_dn+$object+$attribute"]= $ret;
+    $ACL_CACHE["$dn+$object+$attribute"]      = $ret;
+    $ACL_CACHE["$orig_dn+$object+$attribute"] = $ret;
 
     /* Remove write if needed */
-    if ($skip_write){
-      $ret = str_replace(array('w','c','d','m'), '',$ret);
+    if ($skip_write) {
+      $ret = str_replace(array('w','c','d','m'), '', $ret);
     }
-    return ($ret);
+    return $ret;
   }
 
   /*!
@@ -617,46 +616,47 @@ class userinfo
     /* If we are forced to skip ACLs checks for the current user
         then return all departments as valid.
      */
-    if($this->ignore_acl_for_current_user()){
-      return(array_keys($this->config->idepartments));
+    if ($this->ignore_acl_for_current_user()) {
+      return array_keys($this->config->idepartments);
     }
 
     /* Use cached results if possilbe */
     $ACL_CACHE = &session::global_get('ACL_CACHE');
 
-    if(!is_array($module)){
+    if (!is_array($module)) {
       $module = array($module);
     }
 
     global $plist;
     $res = array();
-    foreach($module as $mod){
-      if(isset($ACL_CACHE['MODULE_DEPARTMENTS'][$mod])){
-        $res = array_merge($res,$ACL_CACHE['MODULE_DEPARTMENTS'][$mod]);
+    foreach ($module as $mod) {
+      if (isset($ACL_CACHE['MODULE_DEPARTMENTS'][$mod])) {
+        $res = array_merge($res, $ACL_CACHE['MODULE_DEPARTMENTS'][$mod]);
         continue;
       }
 
       $deps = array();
 
       /* Search for per object ACLs */
-      foreach($this->ACL as $dn => $infos){
-        foreach($infos as $info){
+      foreach ($this->ACL as $dn => $infos) {
+        foreach ($infos as $info) {
           $found = FALSE;
-          foreach($info['acl'] as $cat => $data){
-
+          foreach ($info['acl'] as $cat => $data) {
             /* Skip self acls? */
-            if($skip_self_acls && isset($data['0']) && (strpos($data['0'], "s") !== FALSE)) continue;
-            if(preg_match("/^".preg_quote($mod, '/')."/",$cat)){
-              $found =TRUE;
+            if ($skip_self_acls && isset($data['0']) && (strpos($data['0'], "s") !== FALSE)) {
+              continue;
+            }
+            if (preg_match("/^".preg_quote($mod, '/')."/", $cat)) {
+              $found = TRUE;
               break;
             }
           }
 
-          if($found && !isset($this->config->idepartments[$dn])){
-            while(!isset($this->config->idepartments[$dn]) && strpos($dn, ",")){
-              $dn = preg_replace("/^[^,]+,/","",$dn);
+          if ($found && !isset($this->config->idepartments[$dn])) {
+            while (!isset($this->config->idepartments[$dn]) && strpos($dn, ",")) {
+              $dn = preg_replace("/^[^,]+,/", "", $dn);
             }
-            if(isset($this->config->idepartments[$dn])){
+            if (isset($this->config->idepartments[$dn])) {
               $deps[$dn] = $dn;
             }
           }
@@ -664,24 +664,24 @@ class userinfo
       }
 
       /* For all gosaDepartments */
-      foreach ($this->config->departments as $dn){
-        if(isset($deps[$dn])) continue;
+      foreach ($this->config->departments as $dn) {
+        if (isset($deps[$dn])) continue;
         $acl = "";
-        if(strpos($mod, '/')){
-          $acl.=  $this->get_permissions($dn,$mod);
-        }else{
-          $acl.=  $this->get_category_permissions($dn,$mod,TRUE);
+        if (strpos($mod, '/')) {
+          $acl .= $this->get_permissions($dn, $mod);
+        } else {
+          $acl .= $this->get_category_permissions($dn, $mod, TRUE);
         }
-        if(!empty($acl)) {
+        if (!empty($acl)) {
           $deps[$dn] = $dn;
         }
       }
 
       $ACL_CACHE['MODULE_DEPARTMENTS'][$mod] = $deps;
-      $res = array_merge($res,$deps);
+      $res = array_merge($res, $deps);
     }
 
-    return (array_values($res));
+    return array_values($res);
   }
 
   /*!
@@ -695,70 +695,70 @@ class userinfo
    */
   function mergeACL($acl, $type, $newACL)
   {
-    $at= array("psub" => "p", "sub" => "s", "one" => "1");
+    $at = array("psub" => "p", "sub" => "s", "one" => "1");
 
-    if (strpos($newACL, 'w') !== FALSE && strpos($newACL, 'r') === FALSE){
+    if ((strpos($newACL, 'w') !== FALSE) && (strpos($newACL, 'r') === FALSE)) {
       $newACL .= "r";
     }
 
     /* Ignore invalid characters */
-    $newACL= preg_replace('/[^rwcdm]/', '', $newACL);
-
-    foreach(str_split($newACL) as $char){
+    $newACL = preg_replace('/[^rwcdm]/', '', $newACL);
 
+    foreach (str_split($newACL) as $char) {
       /* Skip "self" ACLs without combination of rwcdm, they have no effect.
          -self flag without read/write/create/...
        */
-      if(empty($char)) continue;
+      if (empty($char)) {
+        continue;
+      }
 
       /* Skip permanent and subtree entries */
-      if (preg_match('/[sp]/', $acl[$char])){
+      if (preg_match('/[sp]/', $acl[$char])) {
         continue;
       }
 
       if ($type == "base" && $acl[$char] != 1) {
-        $acl[$char]= 0;
+        $acl[$char] = 0;
       } else {
-        $acl[$char]= $at[$type];
+        $acl[$char] = $at[$type];
       }
     }
 
-    return ($acl);
+    return $acl;
   }
 
-/*!
- * \brief Clean acls
- *
- * \param $acl ACL to be cleaned
- *
- * \param boolean $reset FALSE
- */
-  function cleanACL($acl, $reset= FALSE)
+  /*!
+   * \brief Clean acls
+   *
+   * \param $acl ACL to be cleaned
+   *
+   * \param boolean $reset FALSE
+   */
+  function cleanACL($acl, $reset = FALSE)
   {
-    foreach ($acl as $key => $value){
-
+    foreach ($acl as $key => $value) {
       /* Continue, if value is empty or permanent */
-      if ($value == "" || $value == "p") {
-      continue;
+      if (($value == "") || ($value == "p")) {
+        continue;
       }
 
       /* Reset removes everything but 'p' */
-      if ($reset && $value != 'p'){
-        $acl[$key]= "";
+      if ($reset && $value != 'p') {
+        $acl[$key] = "";
         continue;
       }
 
       /* Decrease tree level */
-      if (is_int($value)){
-        if ($value){
+      if (is_int($value)) {
+        if ($value) {
           $acl[$key]--;
         } else {
-          $acl[$key]= "";
+          $acl[$key] = "";
         }
       }
     }
 
-    return ($acl);
+    return $acl;
   }
 
   /*!
@@ -778,37 +778,36 @@ class userinfo
    *
    * \return string return acl combined with boolean AND
    */
-  function has_complete_category_acls($dn,$category)
+  function has_complete_category_acls($dn, $category)
   {
     $acl    = "rwcdm";
     $types  = "rwcdm";
 
-    if(!is_string($category)){
+    if (!is_string($category)) {
       trigger_error("category must be string");
       $acl = "";
-    }else{
-      if(!isset($this->result_cache['has_complete_category_acls'][$dn][$category]))   {
-        if (isset($this->ocMapping[$category])){
-          foreach($this->ocMapping[$category] as $oc){
-
+    } else {
+      if (!isset($this->result_cache['has_complete_category_acls'][$dn][$category]))   {
+        if (isset($this->ocMapping[$category])) {
+          foreach ($this->ocMapping[$category] as $oc) {
             /* Skip objectClass '0' (e.g. users/0) get_permissions will ever return '' ??  */
-            if($oc == "0") continue;
-            $tmp =  $this->get_permissions($dn, $category."/".$oc);
-            for($i = 0, $l= strlen($types); $i < $l; $i++) {
-              if(!preg_match("/".$types[$i]."/",$tmp)){
-                $acl = preg_replace("/".$types[$i]."/","",$acl);
+            if ($oc == "0") continue;
+            $tmp = $this->get_permissions($dn, $category."/".$oc);
+            for ($i = 0, $l = strlen($types); $i < $l; $i++) {
+              if (!preg_match("/".$types[$i]."/", $tmp)) {
+                $acl = preg_replace("/".$types[$i]."/", "", $acl);
               }
             }
           }
-        }else{
+        } else {
           $acl = "";
         }
         $this->result_cache['has_complete_category_acls'][$dn][$category] = $acl;
-      }else{
+      } else {
         $acl = $this->result_cache['has_complete_category_acls'][$dn][$category];
       }
     }
-    return($acl);
+    return $acl;
   }
 
 
@@ -820,7 +819,7 @@ class userinfo
    */
   function ignore_acl_for_current_user()
   {
-    return($this->ignoreACL);
+    return $this->ignoreACL;
   }
 
   /*!
@@ -829,44 +828,44 @@ class userinfo
   function loginAllowed()
   {
     // Need to check restrictions?
-    if (count($this->restrictions)){
+    if (count($this->restrictions)) {
 
       // We have restrictions but cannot check them
-      if (!isset($_SERVER['REMOTE_ADDR'])){
-        return false;
+      if (!isset($_SERVER['REMOTE_ADDR'])) {
+        return FALSE;
       }
 
       // Move to binary...
-      $source= $_SERVER['REMOTE_ADDR'];
+      $source = $_SERVER['REMOTE_ADDR'];
       foreach ($this->restrictions as $restriction) {
 
         // Single IP
         if (preg_match('/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/', $restriction)) {
-           if ($source == $restriction){
-             return true;
-           }
+          if ($source == $restriction) {
+            return TRUE;
+          }
         }
 
         // Match with short netmask
         if (preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\/([0-9]+)$/', $restriction, $matches)) {
-          if (isIpInNet($source, $matches[1], long2ip(~(pow(2, (32-$matches[2]))-1)))) {
-            return true;
+          if (isIpInNet($source, $matches[1], long2ip(~(pow(2, (32 - $matches[2])) - 1)))) {
+            return TRUE;
           }
         }
 
         // Match with long netmask
         if (preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\/([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)$/', $restriction, $matches)) {
           if (isIpInNet($source, $matches[1], $matches[2])) {
-            return true;
+            return TRUE;
           }
         }
 
       }
 
-      return false;
+      return FALSE;
     }
 
-    return true;
+    return TRUE;
   }
 
   /*!
diff --git a/include/class_xml.inc b/include/class_xml.inc
index 5ca27851a3af6b239f0486237fff473c644e17a6..318ebd4c45d8e989ce3c4bd8608b36c16d8f1a26 100644
--- a/include/class_xml.inc
+++ b/include/class_xml.inc
@@ -38,33 +38,34 @@ class xml {
    *
    * \param string $schema Schema of the XML file
    */
-  static function validate($file, $schema) {
+  static function validate($file, $schema)
+  {
     // Enable user error handling
-    libxml_use_internal_errors(true);
+    libxml_use_internal_errors(TRUE);
 
-    $xml= new DOMDocument();
+    $xml = new DOMDocument();
     $xml->load($file);
 
     if (!$xml->schemaValidate($schema)) {
       $errors = libxml_get_errors();
       foreach ($errors as $error) {
-        $str= "";
+        $str = "";
         switch ($error->level) {
-            case LIBXML_ERR_WARNING:
-                $str= _("Warning")." ".$error->code.": ";
-                break;
-            case LIBXML_ERR_ERROR:
-                $str= _("Error")." ".$error->code.": ";
-                break;
-            case LIBXML_ERR_FATAL:
-                $str= _("Fatal error")." ".$error->code.": ";
-                break;
+          case LIBXML_ERR_WARNING:
+            $str = _("Warning")." ".$error->code.": ";
+            break;
+          case LIBXML_ERR_ERROR:
+            $str = _("Error")." ".$error->code.": ";
+            break;
+          case LIBXML_ERR_FATAL:
+            $str = _("Fatal error")." ".$error->code.": ";
+            break;
         }
-        $str.= trim($error->message);
+        $str .= trim($error->message);
         if ($error->file) {
-            $str.= " "._("in")." ".$error->file;
+            $str .= " "._("in")." ".$error->file;
         }
-        $str.= " "._("on line")." ".$error->line;
+        $str .= " "._("on line")." ".$error->line;
         msg_dialog::display(_("XML error"), $str, ERROR_DIALOG);
       }
       libxml_clear_errors();
@@ -80,128 +81,140 @@ class xml {
    *
    * \param string $priority Initialized at 'tag'
    */
-  static function xml2array($contents, $get_attributes=1, $priority = 'tag') {
-    if(!$contents) return array();
+  static function xml2array($contents, $get_attributes = 1, $priority = 'tag')
+  {
+    if (!$contents) {
+      return array();
+    }
 
-    if(!function_exists('xml_parser_create')) {
-        //print "'xml_parser_create()' function not found!";
-        return array();
+    if (!function_exists('xml_parser_create')) {
+      trigger_error('xml_parser_create function does not exists');
+      return array();
     }
 
     //Get the XML parser of PHP - PHP must have this module for the parser to work
     $parser = xml_parser_create('');
-    xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
+    xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); // http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
     xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
     xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
     xml_parse_into_struct($parser, trim($contents), $xml_values);
     xml_parser_free($parser);
 
-    if(!$xml_values) return;//Hmm...
+    if (!$xml_values) {
+      return;//Hmm...
+    }
 
     //Initializations
-    $xml_array = array();
-    $parents = array();
-    $opened_tags = array();
-    $arr = array();
+    $xml_array    = array();
+    $parents      = array();
+    $opened_tags  = array();
+    $arr          = array();
 
     $current = &$xml_array; //Refference
 
     //Go through the tags.
     $repeated_tag_index = array();//Multiple tags with same name will be turned into an array
-    foreach($xml_values as $data) {
-        unset($attributes,$value);//Remove existing values, or there will be trouble
-
-        //This command will extract these variables into the foreach scope
-        // tag(string), type(string), level(int), attributes(array).
-        extract($data);//We could use the array by itself, but this cooler.
-
-        $result = array();
-        $attributes_data = array();
+    foreach ($xml_values as $data) {
+      unset($attributes, $value);//Remove existing values, or there will be trouble
+
+      //This command will extract these variables into the foreach scope
+      // tag(string), type(string), level(int), attributes(array).
+      extract($data);//We could use the array by itself, but this cooler.
+
+      $result = array();
+      $attributes_data = array();
+
+      if (isset($value)) {
+        if ($priority == 'tag') {
+          $result = $value;
+        } else {
+          //Put the value in a assoc array if we are in the 'Attribute' mode
+          $result['value'] = $value;
+        }
+      }
 
-        if(isset($value)) {
-            if($priority == 'tag') $result = $value;
-            else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode
+      //Set the attributes too.
+      if (isset($attributes) and $get_attributes) {
+        foreach ($attributes as $attr => $val) {
+          if ($priority == 'tag') {
+            $attributes_data[$attr] = $val;
+          } else {
+            //Set all the attributes in a array called 'attr'
+            $result['attr'][$attr] = $val;
+          }
         }
+      }
 
-        //Set the attributes too.
-        if(isset($attributes) and $get_attributes) {
-            foreach($attributes as $attr => $val) {
-                if($priority == 'tag') $attributes_data[$attr] = $val;
-                else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
+      //See tag status and do the needed.
+      if ($type == "open") {//The starting of the tag '<tag>'
+        $parent[$level - 1] = &$current;
+        if (!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag
+          $current[$tag] = $result;
+          if ($attributes_data) {
+            $current[$tag. '_attr'] = $attributes_data;
+          }
+          $repeated_tag_index[$tag.'_'.$level] = 1;
+
+          $current = &$current[$tag];
+
+        } else { //There was another element with the same tag name
+
+          if (isset($current[$tag][0])) {//If there is a 0th element it is already an array
+            $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
+            $repeated_tag_index[$tag.'_'.$level]++;
+          } else {//This section will make the value an array if multiple tags with the same name appear together
+            $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
+            $repeated_tag_index[$tag.'_'.$level] = 2;
+
+            if (isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
+              $current[$tag]['0_attr'] = $current[$tag.'_attr'];
+              unset($current[$tag.'_attr']);
             }
+          }
+          $last_item_index  = $repeated_tag_index[$tag.'_'.$level] - 1;
+          $current          = &$current[$tag][$last_item_index];
         }
 
-        //See tag status and do the needed.
-        if($type == "open") {//The starting of the tag '<tag>'
-            $parent[$level-1] = &$current;
-            if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag
-                $current[$tag] = $result;
-                if($attributes_data) $current[$tag. '_attr'] = $attributes_data;
-                $repeated_tag_index[$tag.'_'.$level] = 1;
-
-                $current = &$current[$tag];
-
-            } else { //There was another element with the same tag name
-
-                if(isset($current[$tag][0])) {//If there is a 0th element it is already an array
-                    $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
-                    $repeated_tag_index[$tag.'_'.$level]++;
-                } else {//This section will make the value an array if multiple tags with the same name appear together
-                    $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
-                    $repeated_tag_index[$tag.'_'.$level] = 2;
-
-                    if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
-                        $current[$tag]['0_attr'] = $current[$tag.'_attr'];
-                        unset($current[$tag.'_attr']);
-                    }
-
-                }
-                $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1;
-                $current = &$current[$tag][$last_item_index];
+      } elseif ($type == "complete") { //Tags that ends in 1 line '<tag />'
+        //See if the key is already taken.
+        if (!isset($current[$tag])) { //New Key
+          $current[$tag]                        = $result;
+          $repeated_tag_index[$tag.'_'.$level]  = 1;
+          if ($priority == 'tag' and $attributes_data) {
+            $current[$tag. '_attr'] = $attributes_data;
+          }
+        } else { //If taken, put all things inside a list(array)
+          if (isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array...
+            // ...push the new element into that array.
+            $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
+
+            if ($priority == 'tag' and $get_attributes and $attributes_data) {
+                $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
             }
-
-        } elseif($type == "complete") { //Tags that ends in 1 line '<tag />'
-            //See if the key is already taken.
-            if(!isset($current[$tag])) { //New Key
-                $current[$tag] = $result;
-                $repeated_tag_index[$tag.'_'.$level] = 1;
-                if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data;
-
-            } else { //If taken, put all things inside a list(array)
-                if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array...
-
-                    // ...push the new element into that array.
-                    $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
-
-                    if($priority == 'tag' and $get_attributes and $attributes_data) {
-                        $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
-                    }
-                    $repeated_tag_index[$tag.'_'.$level]++;
-
-                } else { //If it is not an array...
-                    $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value
-                    $repeated_tag_index[$tag.'_'.$level] = 1;
-                    if($priority == 'tag' and $get_attributes) {
-                        if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
-
-                            $current[$tag]['0_attr'] = $current[$tag.'_attr'];
-                            unset($current[$tag.'_attr']);
-                        }
-
-                        if($attributes_data) {
-                            $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
-                        }
-                    }
-                    $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken
-                }
+            $repeated_tag_index[$tag.'_'.$level]++;
+
+          } else { //If it is not an array...
+            $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value
+            $repeated_tag_index[$tag.'_'.$level] = 1;
+            if ($priority == 'tag' and $get_attributes) {
+              if (isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
+                $current[$tag]['0_attr'] = $current[$tag.'_attr'];
+                unset($current[$tag.'_attr']);
+              }
+
+              if ($attributes_data) {
+                $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
+              }
             }
-
-        } elseif($type == 'close') { //End of tag '</tag>'
-            $current = &$parent[$level-1];
+            $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken
+          }
         }
+      } elseif ($type == 'close') { //End of tag '</tag>'
+        $current = &$parent[$level - 1];
+      }
     }
 
-    return($xml_array);
+    return $xml_array;
   }
 
 }
diff --git a/plugins/admin/departments/class_department.inc b/plugins/admin/departments/class_department.inc
index 71d2f6369d10a2d8d48dfde5cef2737a1a77b6a2..c39e71b84680e659fd9737d2d54abfaf14d964c0 100644
--- a/plugins/admin/departments/class_department.inc
+++ b/plugins/admin/departments/class_department.inc
@@ -23,125 +23,126 @@
 class department extends plugin
 {
   /* department attributes */
-  var $ou= "";
-  var $description= "";
-  var $base= "";
-  var $st= "";
-  var $l= "";
-  var $postalAddress= "";
-  var $businessCategory= "";
-  var $telephoneNumber= "";
-  var $facsimileTelephoneNumber= "";
-  var $is_administrational_unit= false;
-  var $gosaUnitTag= "";
-  var $view_logged = FALSE;
-
-  var $type ="organizationalUnit";
+  var $ou           = "";
+  var $description  = "";
+  var $base         = "";
+  var $st           = "";
+  var $l            = "";
+
+  var $postalAddress            = "";
+  var $businessCategory         = "";
+  var $telephoneNumber          = "";
+  var $facsimileTelephoneNumber = "";
+  var $is_administrational_unit = FALSE;
+  var $gosaUnitTag              = "";
+  var $view_logged              = FALSE;
+
+  var $type       = "organizationalUnit";
   var $namingAttr = "ou";
 
   /* Headpage attributes */
-  var $last_dep_sorting= "invalid";
-  var $departments= array();
-  var $must_be_tagged = false;
+  var $last_dep_sorting = "invalid";
+  var $departments      = array();
+  var $must_be_tagged   = FALSE;
 
   /* attribute list for save action */
-  var $attributes= array("ou", "description", "businessCategory", "st", "l", "postalAddress",
+  var $attributes = array("ou", "description", "businessCategory", "st", "l", "postalAddress",
       "telephoneNumber", "facsimileTelephoneNumber", "gosaUnitTag", "manager");
 
   /* Do not append the structural object classes here, they are added dynamically in the constructor */
-  var $objectclasses= array("top", "gosaDepartment");
-  var $structuralOC = array("organizationalUnit");
+  var $objectclasses  = array("top", "gosaDepartment");
+  var $structuralOC   = array("organizationalUnit");
 
-  var $initially_was_tagged = false;
-  var $orig_base = "";
-  var $orig_ou = "";
+  var $initially_was_tagged = FALSE;
+
+  var $orig_base  = "";
+  var $orig_ou    = "";
   var $baseSelector;
 
-  var $manager_enabled = FALSE;
-  var $manager_name ="";
-  var $manager ="";
+  var $manager_enabled  = FALSE;
+  var $manager_name     = "";
+  var $manager          = "";
 
   function department (&$config, $dn)
   {
-    /* Add the default structural obejct class 'locality' if this is a new entry
+    /* Add the default structural object class if this is a new entry
      */
     $ldap = $config->get_ldap_link();
     $ldap->cd($config->current['BASE']);
-    if($dn == "" || $dn == "new" || !$ldap->dn_exists($dn)){
-      $this->objectclasses = array_merge($this->structuralOC,$this->objectclasses);
-    }else{
+    if ($dn == "" || $dn == "new" || !$ldap->dn_exists($dn)) {
+      $this->objectclasses = array_merge($this->structuralOC, $this->objectclasses);
+    } else {
       $ldap->cat($dn, array("structuralObjectClass"));
-      $attrs= $ldap->fetch();
-      if(isset($attrs['structuralObjectClass']['count'])){
-        for($i = 0 ; $i < $attrs['structuralObjectClass']['count'] ; $i++){
+      $attrs = $ldap->fetch();
+      if (isset($attrs['structuralObjectClass']['count'])) {
+        for ($i = 0; $i < $attrs['structuralObjectClass']['count']; $i++) {
           $this->objectclasses[] = $attrs['structuralObjectClass'][$i];
         }
-      }else{
-
-        /* Could not detect structural object class for this object, fall back to the default 'locality'
+      } else {
+        /* Could not detect structural object class for this object, fall back to the default
          */
-        $this->objectclasses = array_merge($this->structuralOC,$this->objectclasses);
+        $this->objectclasses = array_merge($this->structuralOC, $this->objectclasses);
       }
     }
     $this->objectclasses = array_unique($this->objectclasses);
 
     plugin::plugin($config, $dn);
-    $this->is_account= TRUE;
-    $this->ui= get_userinfo();
-    $this->dn= $dn;
-    $this->orig_dn= $dn;
+    $this->is_account = TRUE;
+    $this->ui = get_userinfo();
+    $this->dn = $dn;
+    $this->orig_dn = $dn;
 
-    /* Save current naming attribuet
+    /* Save current naming attribute
      */
-    $nA      = $this->namingAttr;
-    $orig_nA = "orig_".$nA;
+    $nA             = $this->namingAttr;
+    $orig_nA        = "orig_".$nA;
     $this->$orig_nA = $this->$nA;
 
-    $this->config= $config;
+    $this->config = $config;
 
     /* Set base */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      if(session::is_set('CurrentMainBase')){
+    if ($this->dn == "new") {
+      $ui = get_userinfo();
+      if (session::is_set('CurrentMainBase')) {
         $this->base = session::get('CurrentMainBase');
-      }else{
-        $this->base= dn2base($ui->dn);
+      } else {
+        $this->base = dn2base($ui->dn);
       }
     } else {
-      $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
+      $this->base = preg_replace ("/^[^,]+,/", "", $this->dn);
     }
 
     $this->orig_base = $this->base;
 
     /* Is administrational Unit? */
-    if ($dn != "new" && in_array_ics('gosaAdministrativeUnit', $this->attrs['objectClass'])){
-      $this->is_administrational_unit= true;
-      $this->initially_was_tagged = true;
+    if ($dn != "new" && in_array_ics('gosaAdministrativeUnit', $this->attrs['objectClass'])) {
+      $this->is_administrational_unit = TRUE;
+      $this->initially_was_tagged     = TRUE;
     }
 
     /* Instanciate base selector */
-    $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
-    $this->baseSelector->setSubmitButton(false);
+    $this->baseSelector = new baseSelector($this->get_allowed_bases(), $this->base);
+    $this->baseSelector->setSubmitButton(FALSE);
     $this->baseSelector->setHeight(300);
-    $this->baseSelector->update(true);
+    $this->baseSelector->update(TRUE);
 
 
 
     // If the 'manager' attribute is present in gosaDepartment allow to manage it.
     $ldap = $this->config->get_ldap_link();
     $ocs = $ldap->get_objectclasses();
-    if(isset($ocs['gosaDepartment']['MAY']) && in_array('manager', $ocs['gosaDepartment']['MAY'])){
+    if (isset($ocs['gosaDepartment']['MAY']) && in_array('manager', $ocs['gosaDepartment']['MAY'])) {
       $this->manager_enabled = TRUE;
 
       // Detect the managers name
       $this->manager_name = "";
       $ldap = $this->config->get_ldap_link();
-      if(!empty($this->manager)){
+      if (!empty($this->manager)) {
         $ldap->cat($this->manager, array('cn'));
-        if($ldap->count()){
+        if ($ldap->count()) {
           $attrs = $ldap->fetch();
           $this->manager_name = $attrs['cn'][0];
-        }else{
+        } else {
           $this->manager_name = "("._("Unknown")."!): ".$this->manager;
         }
       }
@@ -154,33 +155,33 @@ class department extends plugin
     plugin::execute();
 
     /* Log view */
-    if($this->is_account && !$this->view_logged){
+    if ($this->is_account && !$this->view_logged) {
       $this->view_logged = TRUE;
-      new log("view","department/".get_class($this),$this->dn);
+      new log("view", "department/".get_class($this), $this->dn);
     }
 
     /* Reload departments */
     $this->config->get_departments($this->dn);
     $this->config->make_idepartments();
-    $smarty= get_smarty();
+    $smarty = get_smarty();
     $smarty->assign("usePrototype", "true");
 
     // Clear manager attribute if requested
-    if(preg_match("/ removeManager/i", " ".implode(array_keys($_POST),' ')." ")){
-      $this->manager = "";
+    if (preg_match("/ removeManager/i", " ".implode(array_keys($_POST), ' ')." ")) {
+      $this->manager      = "";
       $this->manager_name = "";
     }
 
     // Allow to manager manager attribute
-    if($this->manager_enabled){
+    if ($this->manager_enabled) {
 
       // Allow to select a new inetOrgPersion:manager
-      if(preg_match("/ editManager/i", " ".implode(array_keys($_POST),' ')." ")){
+      if (preg_match("/ editManager/i", " ".implode(array_keys($_POST), ' ')." ")) {
         $this->dialog = new singleUserSelect($this->config, get_userinfo());
       }
-      if($this->dialog && count($this->dialog->detectPostActions())){
+      if ($this->dialog && count($this->dialog->detectPostActions())) {
         $users = $this->dialog->detectPostActions();
-        if(isset($users['targets']) && count($users['targets'])){
+        if (isset($users['targets']) && count($users['targets'])) {
 
           $headpage = $this->dialog->getHeadpage();
           $dn = $users['targets'][0];
@@ -190,47 +191,49 @@ class department extends plugin
           $this->dialog = NULL;
         }
       }
-      if(isset($_POST['add_users_cancel'])){
+      if (isset($_POST['add_users_cancel'])) {
         $this->dialog = NULL;
       }
-      if($this->dialog) return($this->dialog->execute());
+      if ($this->dialog) {
+        return $this->dialog->execute();
+      }
     }
-    $smarty->assign("manager",$this->manager);
-    $smarty->assign("manager_name",$this->manager_name);
-    $smarty->assign("manager_enabled",$this->manager_enabled);
+    $smarty->assign("manager", $this->manager);
+    $smarty->assign("manager_name", $this->manager_name);
+    $smarty->assign("manager_enabled", $this->manager_enabled);
 
 
     $tmp = $this->plInfo();
-    foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
+    foreach ($tmp['plProvidedAcls'] as $name => $translation) {
+      $smarty->assign($name."ACL", $this->getacl($name));
     }
 
     /* Hide base selector, if this object represents the base itself
      */
     $smarty->assign("is_root_dse", FALSE);
-    if($this->dn == $this->config->current['BASE']){
+    if ($this->dn == $this->config->current['BASE']) {
       $smarty->assign("is_root_dse", TRUE);
       $nA = $this->namingAttr."ACL";
-      $smarty->assign($nA,$this->getacl($this->namingAttr,TRUE));
+      $smarty->assign($nA, $this->getacl($this->namingAttr, TRUE));
     }
 
     /* Hide all departments, that are subtrees of this department */
     $bases = $this->get_allowed_bases();
-    if(($this->dn == "new")||($this->dn == "")){
+    if (($this->dn == "new") || ($this->dn == "")) {
       $tmp = $bases;
-    }else{
+    } else {
       $tmp  = array();
-      foreach($bases as $dn=>$base){
+      foreach ($bases as $dn => $base) {
         /* Only attach departments which are not a subtree of this one */
-        if(!preg_match("/".preg_quote($this->dn)."/",$dn)){
-          $tmp[$dn]=$base;
+        if (!preg_match("/".preg_quote($this->dn)."/", $dn)) {
+          $tmp[$dn] = $base;
         }
       }
     }
     $this->baseSelector->setBases($tmp);
 
-    foreach ($this->attributes as $val){
-      $smarty->assign("$val", htmlentities($this->$val,ENT_COMPAT,'UTF-8'));
+    foreach ($this->attributes as $val) {
+      $smarty->assign("$val", htmlentities($this->$val, ENT_COMPAT, 'UTF-8'));
     }
     $smarty->assign("base", $this->baseSelector->render());
 
@@ -241,22 +244,22 @@ class department extends plugin
       $smarty->assign("gosaUnitTag", "");
     }
 
-    $smarty->assign("dep_type",$this->type);
+    $smarty->assign("dep_type", $this->type);
 
 
     $dep_types = departmentManagement::get_support_departments();
-    $tpl ="";
-    foreach($dep_types as $key => $data){
-      if($data['OC'] == $this->type){
+    $tpl = "";
+    foreach ($dep_types as $key => $data) {
+      if ($data['OC'] == $this->type) {
         $tpl = $data['TPL'];
         break;
       }
     }
-    if($tpl == "") {
+    if ($tpl == "") {
       trigger_error("No template specified for container type '".$this->type."', please update departmentManagement::get_support_departments().");
       $tpl = "generic.tpl";
     }
-    return($smarty->fetch (get_template_path($tpl, TRUE)));
+    return $smarty->fetch (get_template_path($tpl, TRUE));
   }
 
   function clear_fields()
@@ -264,18 +267,18 @@ class department extends plugin
     $this->dn   = "";
     $this->base = "";
 
-    foreach ($this->attributes as $val){
-      $this->$val= "";
+    foreach ($this->attributes as $val) {
+      $this->$val = "";
     }
   }
 
   function remove_from_parent()
   {
-    $ldap= $this->config->get_ldap_link();
+    $ldap = $this->config->get_ldap_link();
     $ldap->cd ($this->dn);
     $ldap->rmdir_recursive($this->dn);
-    new log("remove","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-    if (!$ldap->success()){
+    new log("remove", "department/".get_class($this), $this->dn, array_keys($this->attrs), $ldap->get_error());
+    if (!$ldap->success()) {
       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
     }
 
@@ -291,9 +294,9 @@ class department extends plugin
   /* Save data to object */
   function save_object()
   {
-    if (isset($_POST['dep_generic_posted'])){
+    if (isset($_POST['dep_generic_posted'])) {
 
-      $nA = $this->namingAttr;
+      $nA     = $this->namingAttr;
       $old_nA = $this->$nA;
 
       /* Create a base backup and reset the
@@ -303,31 +306,30 @@ class department extends plugin
       plugin::save_object();
       $this->base = $base_tmp;
 
-    /* Refresh base */
-    if ($this->acl_is_moveable($this->base)){
-      if (!$this->baseSelector->update()) {
-        msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
-      }
-      if ($this->base != $this->baseSelector->getBase()) {
-        $this->base= $this->baseSelector->getBase();
-        $this->is_modified= TRUE;
+      /* Refresh base */
+      if ($this->acl_is_moveable($this->base)) {
+        if (!$this->baseSelector->update()) {
+          msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+        }
+        if ($this->base != $this->baseSelector->getBase()) {
+          $this->base         = $this->baseSelector->getBase();
+          $this->is_modified  = TRUE;
+        }
       }
-    }
-
 
       /* Save tagging flag */
-      if ($this->acl_is_writeable("gosaUnitTag")){
-        if (isset($_POST['is_administrational_unit'])){
-          $this->is_administrational_unit= true;
+      if ($this->acl_is_writeable("gosaUnitTag")) {
+        if (isset($_POST['is_administrational_unit'])) {
+          $this->is_administrational_unit = TRUE;
         } else {
-          $this->is_administrational_unit= false;
+          $this->is_administrational_unit = FALSE;
         }
       }
 
       /* If this is the root directory service entry then avoid
          changing the naming attribute of this entry.
        */
-      if($this->dn == $this->config->current['BASE']){
+      if ($this->dn == $this->config->current['BASE']) {
         $this->$nA = $old_nA;
       }
     }
@@ -338,49 +340,49 @@ class department extends plugin
   function check()
   {
     /* Call common method to give check the hook */
-    $message= plugin::check();
+    $message = plugin::check();
 
     /* Check for presence of this department */
-    $ldap= $this->config->get_ldap_link();
+    $ldap = $this->config->get_ldap_link();
     $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn'));
-    if ($this->orig_dn == "new" && $ldap->count()){
-      $message[]= msgPool::duplicated(_("Name"));
-    } elseif ($this->orig_dn != $this->dn && $ldap->count()){
-      $message[]= msgPool::duplicated(_("Name"));
+    if ($this->orig_dn == "new" && $ldap->count()) {
+      $message[] = msgPool::duplicated(_("Name"));
+    } elseif ($this->orig_dn != $this->dn && $ldap->count()) {
+      $message[] = msgPool::duplicated(_("Name"));
     }
 
     /* All required fields are set? */
-    if ($this->ou == ""){
-      $message[]= msgPool::required(_("Name"));
+    if ($this->ou == "") {
+      $message[] = msgPool::required(_("Name"));
     }
-    if ($this->description == ""){
-      $message[]= msgPool::required(_("Description"));
+    if ($this->description == "") {
+      $message[] = msgPool::required(_("Description"));
     }
 
-    if(tests::is_department_name_reserved($this->ou,$this->base)){
-      $message[]= msgPool::reserved(_("Name"));
+    if (tests::is_department_name_reserved($this->ou, $this->base)) {
+      $message[] = msgPool::reserved(_("Name"));
     }
 
-    if (preg_match ('/[#+:=>\\\\\/]/', $this->ou)){
-      $message[]= msgPool::invalid(_("Name"), $this->ou, "/[^#+:=>\\\\\/]/");
+    if (preg_match ('/[#+:=>\\\\\/]/', $this->ou)) {
+      $message[] = msgPool::invalid(_("Name"), $this->ou, "/[^#+:=>\\\\\/]/");
     }
-    if (!tests::is_phone_nr($this->telephoneNumber)){
-      $message[]= msgPool::invalid(_("Phone"), $this->telephoneNumber, "/[\/0-9 ()+*-]/");
+    if (!tests::is_phone_nr($this->telephoneNumber)) {
+      $message[] = msgPool::invalid(_("Phone"), $this->telephoneNumber, "/[\/0-9 ()+*-]/");
     }
-    if (!tests::is_phone_nr($this->facsimileTelephoneNumber)){
-      $message[]= msgPool::invalid(_("Fax"), $this->facsimileTelephoneNumber, "/[\/0-9 ()+*-]/");
+    if (!tests::is_phone_nr($this->facsimileTelephoneNumber)) {
+      $message[] = msgPool::invalid(_("Fax"), $this->facsimileTelephoneNumber, "/[\/0-9 ()+*-]/");
     }
 
     // Check if a wrong base was supplied
-    if(!$this->baseSelector->checkLastBaseUpdate()){
-      $message[]= msgPool::check_base();;
+    if (!$this->baseSelector->checkLastBaseUpdate()) {
+      $message[] = msgPool::check_base();;
     }
 
     /* Check if we are allowed to create or move this object
      */
-    if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
+    if ($this->orig_dn == "new" && !$this->acl_is_createable($this->base)) {
       $message[] = msgPool::permCreate();
-    }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
+    } elseif ($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)) {
       $message[] = msgPool::permMove();
     }
 
@@ -388,105 +390,102 @@ class department extends plugin
   }
 
 
-    /* Save to LDAP */
-    function save()
-    {
-        $ldap= $this->config->get_ldap_link();
+  /* Save to LDAP */
+  function save()
+  {
+    $ldap = $this->config->get_ldap_link();
 
-        /* Ensure that ou is saved too, it is required by objectClass gosaDepartment
-         */
-        $nA = $this->namingAttr;
-        $this->ou = $this->$nA;
-
-        /* Add tag objects if needed */
-        if ($this->is_administrational_unit){
-
-            /* If this wasn't tagged before add oc an reset unit tag */
-            if(!$this->initially_was_tagged){
-                $this->objectclasses[]= "gosaAdministrativeUnit";
-                $this->gosaUnitTag= "";
-
-                /* It seams that this method is called twice,
-                   set this to true. to avoid adding this oc twice */
-                $this->initially_was_tagged = true;
-            }
-
-            if ($this->gosaUnitTag == ""){
-
-                /* It's unlikely, but check if already used... */
-                $try= 5;
-                $ldap->cd($this->config->current['BASE']);
-                while ($try--){
-
-                    /* Generate microtime stamp as tag */
-                    list($usec, $sec)= explode(" ", microtime());
-                    $time_stamp= preg_replace("/\./", "", $sec.$usec);
-
-                    $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag"));
-                    if ($ldap->count() == 0){
-                        break;
-                    }
-                }
-                if($try == 0) {
-                    msg_dialog::display(_("Fatal error"), _("Cannot find an unused tag for this administrative unit!"), WARNING_DIALOG);
-                    return;
-                }
-                $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec);
-            }
+    /* Ensure that ou is saved too, it is required by objectClass gosaDepartment
+     */
+    $nA       = $this->namingAttr;
+    $this->ou = $this->$nA;
+
+    /* Add tag objects if needed */
+    if ($this->is_administrational_unit) {
+      /* If this wasn't tagged before add oc an reset unit tag */
+      if (!$this->initially_was_tagged) {
+        $this->objectclasses[]  = "gosaAdministrativeUnit";
+        $this->gosaUnitTag      = "";
+
+        /* It seams that this method is called twice,
+           set this to TRUE. to avoid adding this oc twice */
+        $this->initially_was_tagged = TRUE;
+      }
+
+      if ($this->gosaUnitTag == "") {
+        /* It's unlikely, but check if already used... */
+        $try = 5;
+        $ldap->cd($this->config->current['BASE']);
+        while ($try--) {
+          /* Generate microtime stamp as tag */
+          list($usec, $sec) = explode(" ", microtime());
+          $time_stamp = preg_replace("/\./", "", $sec.$usec);
+
+          $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))", array("gosaUnitTag"));
+          if ($ldap->count() == 0) {
+            break;
+          }
         }
-        $this->skipTagging = TRUE;
-        plugin::save();
-
-        /* Remove tag information if needed */
-        if (!$this->is_administrational_unit && $this->initially_was_tagged){
-            $tmp= array();
-
-            /* Remove gosaAdministrativeUnit from this plugin */
-            foreach($this->attrs['objectClass'] as $oc){
-                if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
-                    continue;
-                }
-                if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){
-                    $tmp[]= $oc;
-                }
-            }
-            $this->attrs['objectClass']= $tmp;
-            $this->attrs['gosaUnitTag']= array();
-            $this->gosaUnitTag = "";
+        if ($try == 0) {
+          msg_dialog::display(_("Fatal error"), _("Cannot find an unused tag for this administrative unit!"), WARNING_DIALOG);
+          return;
         }
+        $this->gosaUnitTag = preg_replace("/\./", "", $sec.$usec);
+      }
+    }
+    $this->skipTagging = TRUE;
+    plugin::save();
 
+    /* Remove tag information if needed */
+    if (!$this->is_administrational_unit && $this->initially_was_tagged) {
+      $tmp = array();
 
-        /* Write back to ldap */
-        $ldap->cat($this->dn, array('dn'));
-        $ldap->cd($this->dn);
-
-        if ($ldap->count()){
-            $this->cleanup();
-            $ldap->modify ($this->attrs);
-            new log("modify","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
-            $this->handle_post_events('modify');
-        } else {
-            $ldap->add($this->attrs);
-            $this->handle_post_events('add');
-            new log("create","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      /* Remove gosaAdministrativeUnit from this plugin */
+      foreach ($this->attrs['objectClass'] as $oc) {
+        if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)) {
+          continue;
         }
-        if (!$ldap->success()){
-            msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
+        if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)) {
+          $tmp[] = $oc;
         }
+      }
+      $this->attrs['objectClass'] = $tmp;
+      $this->attrs['gosaUnitTag'] = array();
+      $this->gosaUnitTag = "";
+    }
+
 
-        /* The parameter forces only to set must_be_tagged, and don't touch any objects
-           This will be done later */
-        $this->tag_objects(true);
+    /* Write back to ldap */
+    $ldap->cat($this->dn, array('dn'));
+    $ldap->cd($this->dn);
 
-        return(false);
+    if ($ldap->count()) {
+      $this->cleanup();
+      $ldap->modify ($this->attrs);
+      new log("modify", "department/".get_class($this), $this->dn, array_keys($this->attrs), $ldap->get_error());
+      $this->handle_post_events('modify');
+    } else {
+      $ldap->add($this->attrs);
+      $this->handle_post_events('add');
+      new log("create", "department/".get_class($this), $this->dn, array_keys($this->attrs), $ldap->get_error());
+    }
+    if (!$ldap->success()) {
+      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
     }
 
+    /* The parameter forces only to set must_be_tagged, and don't touch any objects
+       This will be done later */
+    $this->tag_objects(TRUE);
+
+    return FALSE;
+  }
+
 
   /* Tag objects to have the gosaAdministrativeUnitTag */
-  function tag_objects($OnlySetTagFlag = false)
+  function tag_objects($OnlySetTagFlag = FALSE)
   {
-    if(!$OnlySetTagFlag){
-      $smarty= get_smarty();
+    if (!$OnlySetTagFlag) {
+      $smarty = get_smarty();
       /* Print out html introduction */
       echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
         <html>
@@ -497,14 +496,14 @@ class department extends plugin
         </head>
         <body style="background: none; margin:4px;" id="body" >
         ';
-      echo "<h3>".sprintf(_("Tagging '%s'."),"<i>".LDAP::fix($this->dn)."</i>")."</h3>";
+      echo "<h3>".sprintf(_("Tagging '%s'."), "<i>".LDAP::fix($this->dn)."</i>")."</h3>";
     }
 
-    $add= $this->is_administrational_unit;
-    $len= strlen($this->dn);
-    $ldap= $this->config->get_ldap_link();
+    $add  = $this->is_administrational_unit;
+    $len  = strlen($this->dn);
+    $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->dn);
-    if ($add){
+    if ($add) {
       $ldap->search('(!(&(objectClass=gosaAdministrativeUnitTag)(gosaUnitTag='.
                 $this->gosaUnitTag.')))', array('dn'));
     } else {
@@ -512,43 +511,42 @@ class department extends plugin
     }
 
     $objects = array();
-    while ($attrs= $ldap->fetch()){
+    while ($attrs = $ldap->fetch()) {
       $objects[] = $attrs;
     }
-    foreach($objects as $attrs){
-
+    foreach ($objects as $attrs) {
       /* Skip self */
-      if ($attrs['dn'] == $this->dn){
+      if ($attrs['dn'] == $this->dn) {
         continue;
       }
 
       /* Check for confilicting administrative units */
-      $fix= true;
-      foreach ($this->config->adepartments as $key => $tag){
+      $fix = TRUE;
+      foreach ($this->config->adepartments as $key => $tag) {
         /* This one is shorter than our dn, its not relevant... */
-        if ($len >= strlen($key)){
+        if ($len >= strlen($key)) {
           continue;
         }
 
         /* This one matches with the latter part. Break and don't fix this entry */
-        if (preg_match('/(^|,)'.preg_quote($key, '/').'$/', $attrs['dn'])){
-          $fix= false;
+        if (preg_match('/(^|,)'.preg_quote($key, '/').'$/', $attrs['dn'])) {
+          $fix = FALSE;
           break;
         }
       }
 
       /* Fix entry if needed */
-      if ($fix){
-        if($OnlySetTagFlag){
-          $this->must_be_tagged =true;
+      if ($fix) {
+        if ($OnlySetTagFlag) {
+          $this->must_be_tagged = TRUE;
           return;
         }
         $this->handle_object_tagging($attrs['dn'], $this->gosaUnitTag, TRUE );
-        echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+        echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>";
       }
     }
 
-    if(!$OnlySetTagFlag){
+    if (!$OnlySetTagFlag) {
       $this->must_be_tagged = FALSE;
       echo '<p class="seperator">&nbsp;</p>';
       echo "<div style='width:100%;text-align:right;'>".
@@ -558,16 +556,16 @@ class department extends plugin
         "<input type='hidden' name='php_c_check' value='1'>".
         "</form>".
         "</div>";
-      echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+      echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>";
     }
   }
 
 
   /* Move/Rename complete trees */
-  function recursive_move($src_dn, $dst_dn,$force = false)
+  function recursive_move($src_dn, $dst_dn, $force = FALSE)
   {
     /* Print header to have styles included */
-    $smarty= get_smarty();
+    $smarty = get_smarty();
 
     echo '  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
       <html>
@@ -578,28 +576,28 @@ class department extends plugin
       </head>
       <body style="background: none; margin:4px;" id="body" >
       ';
-    echo "<h3>".sprintf(_("Moving '%s' to '%s'"),"<i>".LDAP::fix($src_dn)."</i>","<i>".LDAP::fix($dst_dn)."</i>")."</h3>";
+    echo "<h3>".sprintf(_("Moving '%s' to '%s'"), "<i>".LDAP::fix($src_dn)."</i>", "<i>".LDAP::fix($dst_dn)."</i>")."</h3>";
 
 
     /* Check if the destination entry exists */
-    $ldap= $this->config->get_ldap_link();
+    $ldap = $this->config->get_ldap_link();
 
     /* Check if destination exists - abort */
     $ldap->cat($dst_dn, array('dn'));
-    if ($ldap->fetch()){
+    if ($ldap->fetch()) {
       trigger_error("Recursive_move ".LDAP::fix($dst_dn)." already exists.",
           E_USER_WARNING);
       echo sprintf("Recursive_move: '%s' already exists", LDAP::fix($dst_dn))."<br>";
-      return (FALSE);
+      return FALSE;
     }
 
     /* Perform a search for all objects to be moved */
-    $objects= array();
+    $objects = array();
     $ldap->cd($src_dn);
     $ldap->search("(objectClass=*)", array("dn"));
-    while($attrs= $ldap->fetch()){
-      $dn= $attrs['dn'];
-      $objects[$dn]= strlen($dn);
+    while ($attrs = $ldap->fetch()) {
+      $dn           = $attrs['dn'];
+      $objects[$dn] = strlen($dn);
     }
 
     /* Sort objects by indent level */
@@ -607,31 +605,31 @@ class department extends plugin
     reset($objects);
 
     /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
-    foreach ($objects as $object => $len){
+    foreach ($objects as $object => $len) {
 
 
-      $src= str_replace("\\","\\\\",$object);
-      $dst= preg_replace("/".str_replace("\\","\\\\",$src_dn)."$/", "$dst_dn", $object);
-      $dst= str_replace($src_dn,$dst_dn,$object);
+      $src = str_replace("\\", "\\\\", $object);
+      $dst = preg_replace("/".str_replace("\\", "\\\\", $src_dn)."$/", "$dst_dn", $object);
+      $dst = str_replace($src_dn, $dst_dn, $object);
 
       echo "<b>"._("Object").":</b> ".LDAP::fix($src)."<br>";
 
-      $this->update_acls($object, $dst,TRUE);
+      $this->update_acls($object, $dst, TRUE);
 
-      if (!$this->copy($src, $dst)){
-        echo "<font color='#FF0000'><br>".sprintf(_("FAILED to copy %s, aborting operation"),LDAP::fix($src))."</font>";
-        return (FALSE);
+      if (!$this->copy($src, $dst)) {
+        echo "<font color='#FF0000'><br>".sprintf(_("FAILED to copy %s, aborting operation"), LDAP::fix($src))."</font>";
+        return FALSE;
       }
-      echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+      echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>";
       flush();
     }
 
     /* Remove src_dn */
     $ldap->cd($src_dn);
     $ldap->recursive_remove();
-    $this->orig_dn  = $this->dn = $dst_dn;
-    $this->orig_base= $this->base;
-    $this->entryCSN = getEntryCSN($this->dn);
+    $this->orig_dn    = $this->dn = $dst_dn;
+    $this->orig_base  = $this->base;
+    $this->entryCSN   = getEntryCSN($this->dn);
 
     echo '<p class="seperator">&nbsp;</p>';
 
@@ -639,10 +637,10 @@ class department extends plugin
       <br><input type='submit' name='back' value='"._("Continue")."'>
       </form></div>";
 
-    echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+    echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>";
     echo "</body></html>";
 
-    return (TRUE);
+    return TRUE;
   }
 
 
@@ -674,75 +672,75 @@ class department extends plugin
     );
   }
 
-  function handle_object_tagging($dn= "", $tag= "", $show= false)
+  function handle_object_tagging($dn = "", $tag = "", $show = FALSE)
   {
     /* No dn? Self-operation... */
-    if ($dn == ""){
-      $dn= $this->dn;
+    if ($dn == "") {
+      $dn = $this->dn;
 
       /* No tag? Find it yourself... */
-      if ($tag == ""){
-        $len= strlen($dn);
+      if ($tag == "") {
+        $len = strlen($dn);
 
         @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "No tag for $dn - looking for one...", "Tagging");
-        $relevant= array();
-        foreach ($this->config->adepartments as $key => $ntag){
+        $relevant = array();
+        foreach ($this->config->adepartments as $key => $ntag) {
 
           /* This one is bigger than our dn, its not relevant... */
-          if ($len <= strlen($key)){
+          if ($len <= strlen($key)) {
             continue;
           }
 
           /* This one matches with the latter part. Break and don't fix this entry */
-          if (preg_match('/(^|,)'.preg_quote($key, '/').'$/', $dn)){
+          if (preg_match('/(^|,)'.preg_quote($key, '/').'$/', $dn)) {
             @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "DEBUG: Possibly relevant: $key", "Tagging");
-            $relevant[strlen($key)]= $ntag;
+            $relevant[strlen($key)] = $ntag;
             continue;
           }
 
         }
 
         /* If we've some relevant tags to set, just get the longest one */
-        if (count($relevant)){
+        if (count($relevant)) {
           ksort($relevant);
-          $tmp= array_keys($relevant);
-          $idx= end($tmp);
-          $tag= $relevant[$idx];
-          $this->gosaUnitTag= $tag;
+          $tmp  = array_keys($relevant);
+          $idx  = end($tmp);
+          $tag  = $relevant[$idx];
+          $this->gosaUnitTag = $tag;
         }
       }
     }
 
     /* Set tag? */
-    if ($tag != ""){
+    if ($tag != "") {
       /* Set objectclass and attribute */
-      $ldap= $this->config->get_ldap_link();
+      $ldap = $this->config->get_ldap_link();
       $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
-      $attrs= $ldap->fetch();
-      if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){
+      $attrs = $ldap->fetch();
+      if (isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag) {
         if ($show) {
           echo sprintf(_("Object '%s' is already tagged"), LDAP::fix($dn))."<br>";
           flush();
         }
         return;
       }
-      if (count($attrs)){
-        if ($show){
+      if (count($attrs)) {
+        if ($show) {
           echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, LDAP::fix($dn))."<br>";
           flush();
         }
-        $nattrs= array("gosaUnitTag" => $tag);
-        $nattrs['objectClass']= array();
-        for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
-          $oc= $attrs['objectClass'][$i];
-          if ($oc != "gosaAdministrativeUnitTag"){
-            $nattrs['objectClass'][]= $oc;
+        $nattrs = array("gosaUnitTag" => $tag);
+        $nattrs['objectClass'] = array();
+        for ($i = 0; $i < $attrs['objectClass']['count']; $i++) {
+          $oc = $attrs['objectClass'][$i];
+          if ($oc != "gosaAdministrativeUnitTag") {
+            $nattrs['objectClass'][] = $oc;
           }
         }
-        $nattrs['objectClass'][]= "gosaAdministrativeUnitTag";
+        $nattrs['objectClass'][] = "gosaAdministrativeUnitTag";
         $ldap->cd($dn);
         $ldap->modify($nattrs);
-        if (!$ldap->success()){
+        if (!$ldap->success()) {
           msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class()));
         }
       } else {
@@ -751,29 +749,29 @@ class department extends plugin
 
     } else {
       /* Remove objectclass and attribute */
-      $ldap= $this->config->get_ldap_link();
+      $ldap = $this->config->get_ldap_link();
       $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
-      $attrs= $ldap->fetch();
-      if (isset($attrs['objectClass']) && !in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])){
+      $attrs = $ldap->fetch();
+      if (isset($attrs['objectClass']) && !in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])) {
         @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "$dn is not tagged", "Tagging");
         return;
       }
-      if (count($attrs)){
-        if ($show){
+      if (count($attrs)) {
+        if ($show) {
           echo sprintf(_("Removing tag from object '%s'"), LDAP::fix($dn))."<br>";
           flush();
         }
-        $nattrs= array("gosaUnitTag" => array());
-        $nattrs['objectClass']= array();
-        for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
-          $oc= $attrs['objectClass'][$i];
-          if ($oc != "gosaAdministrativeUnitTag"){
-            $nattrs['objectClass'][]= $oc;
+        $nattrs = array("gosaUnitTag" => array());
+        $nattrs['objectClass'] = array();
+        for ($i = 0; $i < $attrs['objectClass']['count']; $i++) {
+          $oc = $attrs['objectClass'][$i];
+          if ($oc != "gosaAdministrativeUnitTag") {
+            $nattrs['objectClass'][] = $oc;
           }
         }
         $ldap->cd($dn);
         $ldap->modify($nattrs);
-        if (!$ldap->success()){
+        if (!$ldap->success()) {
           msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class()));
         }
       } else {
@@ -784,5 +782,4 @@ class department extends plugin
 
 }
 
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index 2ea0ac335cd7add9f75034a2a1bae758450322b3..bc7d00080899d7d6a617accbcbafece20ba30405 100644
--- a/plugins/admin/users/class_userManagement.inc
+++ b/plugins/admin/users/class_userManagement.inc
@@ -417,16 +417,6 @@ class userManagement extends management
       return "";
     }
 
-    if ($this->last_tabObject instanceOf multi_plug) {
-      foreach($this->last_tabObject->a_handles as $user) {
-        if ($user->password_change_needed()) {
-          $this->force_hash_type[$user->dn] = $user->by_object['user']->pw_storage;
-          $this->pwd_change_queue[] = $user->dn;
-        }
-      }
-      return $this->handlePasswordQueue();
-    }
-
     if (isset($this->last_tabObject->by_object['user']) && $this->last_tabObject->by_object['user']->password_change_needed()) {
       $this->force_hash_type[$this->last_tabObject->dn] = $this->last_tabObject->by_object['user']->pw_storage;
       $this->pwd_change_queue[] = $this->last_tabObject->dn;
diff --git a/setup/class_setup.inc b/setup/class_setup.inc
index f51fb78c2c7e5cfcc946a24ff5df64afe3527709..ecbfb334d3cef63d9ee9a1238991c47249190913 100644
--- a/setup/class_setup.inc
+++ b/setup/class_setup.inc
@@ -25,11 +25,11 @@ require_once("class_setupStep.inc");
 
 class setup
 {
-  var $i_steps  = 9;  // Number of setup steps
-  var $i_current= 1;  // Current step
-  var $i_last   = 1;  // Last setup step;
-  var $o_steps  = array();
-  var $captured_values = array();
+  var $i_steps          = 9;  // Number of setup steps
+  var $i_current        = 1;  // Current step
+  var $i_last           = 1;  // Last setup step;
+  var $o_steps          = array();
+  var $captured_values  = array();
 
   function setup()
   {
@@ -44,16 +44,17 @@ class setup
     $this->o_steps[$i++] = new Step_Config3();
     $this->o_steps[$i++] = new Step_Migrate();
     $this->o_steps[$i++] = new Step_Finish();
-    $this->i_steps = $i-1;
+
+    $this->i_steps = $i - 1;
 
     /* Ensure that setup is not reachable if fusiondirectory.conf exist (CONFIG_FILE) */
-    if(file_exists(CONFIG_DIR."/".CONFIG_FILE)){
+    if (file_exists(CONFIG_DIR."/".CONFIG_FILE)) {
       session::destroy();
-      header("Location: index.php")    ;
+      header("Location: index.php");
       exit();
     }
 
-    foreach($this->o_steps as $key => $step){
+    foreach ($this->o_steps as $key => $step) {
       $this->o_steps[$key]->parent = &$this;
     }
   }
@@ -64,21 +65,21 @@ class setup
      *  but only do this, if user is allowed to use the setup.
      * If setupStep_Welcome is_completed, we are allowed to view those infos-
      */
-    if(isset($_GET['info']) &&  preg_match("/Step_Welcome/i",get_class($this->o_steps[1])) && $this->o_steps[1]->is_completed()){
+    if (isset($_GET['info']) && preg_match("/Step_Welcome/i", get_class($this->o_steps[1])) && $this->o_steps[1]->is_completed()) {
       phpinfo();
       exit();
     }
 
     /* display step error msgs */
     $msgs = $this->o_steps[$this->i_current]->check();
-    foreach($msgs as $msg){
+    foreach ($msgs as $msg) {
       msg_dialog::display(_("Setup error"), $msg, ERROR_DIALOG);
     }
 
     $this->o_steps[$this->i_last]->set_active(FALSE);
     $this->o_steps[$this->i_current]->set_active();
     $content = $this->o_steps[$this->i_current]->execute();
-    return($content);
+    return $content;
   }
 
 
@@ -86,75 +87,75 @@ class setup
   function save_object()
   {
     /* Call save_object for current setup step */
-    $this->o_steps[$this->i_current] -> save_object();
+    $this->o_steps[$this->i_current]->save_object();
 
     /* Get attributes from setup step */
     $tmp = $this->o_steps[$this->i_current]->get_attributes();
-    foreach($tmp as $name => $value){
+    foreach ($tmp as $name => $value) {
       $this->captured_values[$name] = $value;
     }
 
     /* Set parent */
-    foreach($this->o_steps as $key => $value){
+    foreach ($this->o_steps as $key => $value) {
       $this->o_steps[$key]->parent = $this;
     }
 
     /* Check if image button requests next page */
-    foreach($_POST as $name => $value){
-      if(preg_match("/^next_(x|y)/",$name)){
+    foreach ($_POST as $name => $value) {
+      if (preg_match("/^next_(x|y)/", $name)) {
         $_POST['next'] = TRUE;
       }
-      if(preg_match("/^last_(x|y)/",$name)){
+      if (preg_match("/^last_(x|y)/", $name)) {
         $_POST['last'] = TRUE;
       }
     }
 
     /* Check if step was selected */
-    if(isset($_GET['step']) || isset($_POST['next']) || isset($_POST['last'])){
+    if (isset($_GET['step']) || isset($_POST['next']) || isset($_POST['last'])) {
 
       /* check if current setup step is completed now
           and activate the next step if possible */
-      for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
-        if($this->o_steps[$i]->is_completed()){
-          if(isset($this->o_steps[($i+1)])){
-            $this->o_steps[($i+1)]->set_enabled();
+      for ($i = 1; $i <= $this->i_steps; $i++) {
+        if ($this->o_steps[$i]->is_completed()) {
+          if (isset($this->o_steps[($i + 1)])) {
+            $this->o_steps[($i + 1)]->set_enabled();
           }
         } else {
-          $this->disable_steps_from($i+1);
+          $this->disable_steps_from($i + 1);
         }
       }
     }
 
     /* Disable all following steps, if one step isn't compelted right now .*/
-    for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
-      if($this->o_steps[$i]->is_completed()){
+    for ($i = 1; $i <= $this->i_steps; $i++) {
+      if ($this->o_steps[$i]->is_completed()) {
       } else {
-        $this->disable_steps_from($i+1);
+        $this->disable_steps_from($i + 1);
       }
     }
 
     $step = -1;
 
-    if(isset($_POST['setup_goto_step'])){
-      $step= $_POST['setup_goto_step'];
+    if (isset($_POST['setup_goto_step'])) {
+      $step = $_POST['setup_goto_step'];
     }
 
-    if(isset($_GET['step'])){
+    if (isset($_GET['step'])) {
       $step = $_GET['step'];
-    }elseif(isset($_POST['next'])){
+    } elseif (isset($_POST['next'])) {
       $step = $this->i_current + 1;
-    }elseif(isset($_POST['last'])){
+    } elseif (isset($_POST['last'])) {
       $step = $this->i_current - 1;
     }
 
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^step_[0-9]*$/",$name) && $once ){
-        $step = preg_replace("/^step_/","",$name);
+    $once = TRUE;
+    foreach ($_POST as $name => $value) {
+      if (preg_match("/^step_[0-9]*$/", $name) && $once) {
+        $step = preg_replace("/^step_/", "", $name);
       }
     }
 
-    if($this->selectable_step($step)){
+    if ($this->selectable_step($step)) {
       $this->i_last    = $this->i_current;
       $this->i_current = $step;
     }
@@ -163,15 +164,15 @@ class setup
 
   function disable_steps_from($start)
   {
-    $found = false;
-    foreach($this->o_steps as $key => $step){
-      if($key == $start){
-        $found = true;
+    $found = FALSE;
+    foreach ($this->o_steps as $key => $step) {
+      if ($key == $start) {
+        $found = TRUE;
       }
 
-      if($found){
-        $this->o_steps[$key]->set_enabled(false);
-        $this->o_steps[$key]->set_completed(false);
+      if ($found) {
+        $this->o_steps[$key]->set_enabled(FALSE);
+        $this->o_steps[$key]->set_completed(FALSE);
       }
     }
   }
@@ -181,28 +182,28 @@ class setup
   function get_navigation_html()
   {
     $str = "";
-    foreach($this->o_steps as $key => $step){
+    foreach ($this->o_steps as $key => $step) {
 
-      $step -> update_strings();
+      $step->update_strings();
 
-      $s_title    = $step -> get_title();
-      $s_info     = $step -> get_small_info();
-      $b_active   = $step -> is_active();
-      $b_enabled  = $step -> is_enabled();
-      $b_completed= $step -> is_completed();
+      $s_title      = $step->get_title();
+      $s_info       = $step->get_small_info();
+      $b_active     = $step->is_active();
+      $b_enabled    = $step->is_enabled();
+      $b_completed  = $step->is_completed();
 
-      if($b_completed){
+      if ($b_completed) {
         $s = "<img src='images/true.png' alt='"._("Completed")."' class='center'>&nbsp;";
       } else {
         $s = "<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(session::get('js')){
+      if (session::get('js')) {
 
-        $str .="<div >";
+        $str .= "<div >";
 
-        if($b_enabled){
-          if($b_active){
+        if ($b_enabled) {
+          if ($b_active) {
             $str .= "<div class='navigation_element_active'>";
             $str .= "<div class='navigation_title_active'>".$s.$s_title."</div>";
             $str .= "<div class='navigation_info'>".$s_info."</div>";
@@ -218,11 +219,11 @@ class setup
           $str .= "<div class='navigation_title_disabled'>".$s.$s_title."</div>";
           $str .= "</div>";
         }
-        $str .= "</div>" ;
+        $str .= "</div>";
       } else {
-        $str .="<div >";
-        if($b_enabled){
-          if($b_active){
+        $str .= "<div >";
+        if ($b_enabled) {
+          if ($b_active) {
             $str .= "<div class='navigation_element_active'>";
             $str .= "<input style='text-align: left; color: #00008F; font-weight: bold; width:100%;'
                         type='button' value='".$s_title."' name='step_".$key."'>";
@@ -238,10 +239,10 @@ class setup
           $str .= "<div class='navigation_title_disabled'>".$s_title."</div>";
           $str .= "</div>";
         }
-        $str .= "</div>" ;
+        $str .= "</div>";
       }
     }
-    return($str);
+    return $str;
   }
 
 
@@ -250,52 +251,49 @@ class setup
     /* Skip adding forward/backward button,
      *  if the currently opened step is a sub dialog
      */
-    if($this->o_steps[$this->i_current]->dialog){
-      $str ="";
+    if ($this->o_steps[$this->i_current]->dialog) {
+      $str = "";
     } else {
-      $str ="<p class='seperator' style='margin-bottom:10px;'>&nbsp;</p>";
-      $str.="   <div style='text-align:right;float:top;'>";
-      if(isset($this->o_steps[$this->i_current -1]) && $this->o_steps[$this->i_current -1]->is_enabled()){
+      $str = "<p class='seperator' style='margin-bottom:10px;'>&nbsp;</p>";
+      $str .= "   <div style='text-align:right;float:top;'>";
+      if (isset($this->o_steps[$this->i_current - 1]) && $this->o_steps[$this->i_current - 1]->is_enabled()) {
         $str .= "<input type='submit' name='last' value='".msgPool::backButton()."'>";
       } else {
         $str .= "<input type='button' name='last' value='".msgPool::backButton()."' disabled>";
       }
-      $str.= "&nbsp;";
-        $str .= "<input type='submit' name='next' value='"._("Next")."'>";
-      $str .="</div>";
+      $str .= "&nbsp;";
+      $str .= "<input type='submit' name='next' value='"._("Next")."'>";
+      $str .= "</div>";
     }
-    return($str);
+    return $str;
   }
 
 
   /* Create header entry */
   function get_header_html()
   {
-    $str=   $this->o_steps[$this->i_current]->print_header();
-    return ($str);
+    $str = $this->o_steps[$this->i_current]->print_header();
+    return $str;
   }
 
 
   /* Check if the given step id is valid and selectable */
   function selectable_step($id)
   {
-    if(isset($this->o_steps[$id]) && $this->o_steps[$id]->is_enabled()){
-      return(true);
+    if (isset($this->o_steps[$id]) && $this->o_steps[$id]->is_enabled()) {
+      return TRUE;
     }
-    return(false);
+    return FALSE;
   }
 
   function step_name_to_id($name)
   {
-    foreach($this->o_steps as $id => $class){
-      if(get_class($class) == $name){
-        return($id);
+    foreach ($this->o_steps as $id => $class) {
+      if (get_class($class) == $name) {
+        return $id;
       }
     }
-    return(0);
+    return 0;
   }
-
 }
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
diff --git a/setup/class_setupStep.inc b/setup/class_setupStep.inc
index c265decb552db564df4c46762c023c1d2adcbda8..0b8adee78c0595966a1a40fb80be4174bbf4aff9 100644
--- a/setup/class_setupStep.inc
+++ b/setup/class_setupStep.inc
@@ -1,5 +1,4 @@
 <?php
-
 /*
   This code is part of FusionDirectory (http://www.fusiondirectory.org/)
   Copyright (C) 2007 Fabian Hickert
@@ -25,9 +24,9 @@ class setup_step extends plugin
   var $s_title      = "Still undefined";
   var $s_title_long = "This is a still undefined long title";
   var $s_info       = "This info is still undefined. This setup step detect the type of your ldap for FusionDirectory.This is a basic requirement for fusiondirectory.";
-  var $is_active    = false;
-  var $is_enabled   = false;
-  var $is_completed = false;
+  var $is_active    = FALSE;
+  var $is_enabled   = FALSE;
+  var $is_completed = FALSE;
 
   var $header_image = "images/setup/user.png";
 
@@ -35,7 +34,7 @@ class setup_step extends plugin
   var $parent       = NULL;
   var $dialog       = FALSE;
 
-  function setup_step()
+  function __construct()
   {
   }
 
@@ -50,81 +49,67 @@ class setup_step extends plugin
 
   function get_title()
   {
-    return($this->s_title);
+    return $this->s_title;
   }
 
   function get_long_title()
   {
-    return($this->s_title_long);
+    return $this->s_title_long;
   }
 
   function get_small_info()
   {
-    return($this->s_info);
+    return $this->s_info;
   }
 
   function is_active()
   {
-    return($this->is_active);
+    return $this->is_active;
   }
 
   function is_enabled()
   {
-    return($this->is_enabled);
+    return $this->is_enabled;
   }
 
   function is_completed()
   {
-    return($this->is_completed);
+    return $this->is_completed;
   }
 
   function set_active($value = TRUE)
   {
-    if($value){
-      $this->is_active = TRUE;
-    } else {
-      $this->is_active = FALSE;
-    }
+    $this->is_active = ($value == TRUE);
   }
 
   function set_enabled($value = TRUE)
   {
-    if($value){
-      $this->is_enabled = TRUE;
-    } else {
-      $this->is_enabled = FALSE;
-    }
+    $this->is_enabled = ($value == TRUE);
   }
 
   function set_completed($value = TRUE)
   {
-    if($value){
-      $this->is_completed = TRUE;
-    } else {
-      $this->is_completed = FALSE;
-    }
+    $this->is_completed = ($value == TRUE);
   }
 
   /* Return attributes handled by this setup step */
   function get_attributes()
   {
     $tmp = array();
-    foreach($this->attributes as $attr){
+    foreach ($this->attributes as $attr) {
       $tmp[$attr] = $this->$attr;
     }
-    return($tmp);
+    return $tmp;
   }
 
   function print_header()
   {
-    $image= get_template_path($this->header_image);
-    $display= "<div style='padding:3px;'>";
-    $display.= "  <p class=\"center\" style=\"margin:0px 0px 0px 5px;padding:0px;font-size:24px;font-weight:bold;\"><img class=\"center\" src=\"$image\" align=\"middle\" alt=\"*\">&nbsp;".$this->s_title_long."</p>\n";
-    $display.= "</div>\n";
+    $image    = get_template_path($this->header_image);
+    $display  = "<div style='padding:3px;'>";
+    $display  .= "  <p class=\"center\" style=\"margin:0px 0px 0px 5px;padding:0px;font-size:24px;font-weight:bold;\"><img class=\"center\" src=\"$image\" align=\"middle\" alt=\"*\">&nbsp;".$this->s_title_long."</p>\n";
+    $display  .= "</div>\n";
 
-    return($display);
+    return $display;
   }
 }
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>