Code

Added logging to addressbook
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 May 2007 10:26:04 +0000 (10:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 May 2007 10:26:04 +0000 (10:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6418 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/addressbook/class_addressbook.inc

index 19a3f0ecbf104b440bac6e7ffdfff84f24ded574..b9f5c72c13f4a428471a7125e86f18ff773965cf 100644 (file)
@@ -43,6 +43,7 @@ class addressbook extends plugin
        var $telephoneNumber          = "";
        var $facsimileTelephoneNumber = "";
        var $pager                    = "";
+  var $view_logged              = FALSE;
 
        /* attribute list for save action */
        var $attributes= array("sn", "givenName", "mail", "title",
@@ -78,7 +79,7 @@ class addressbook extends plugin
           "object_type"       => "*");
       register_global("phonefilter", $phonefilter);
     }
-    
+     
     $this->ui = get_userinfo();
   }
 
@@ -200,6 +201,7 @@ class addressbook extends plugin
         /* Delete request is permitted, perform LDAP action */
         $ldap= $this->config->get_ldap_link();
         $ldap->rmdir ($this->dn);
+        @log::log("remove","addressbook/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
         show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn));
         gosa_log ("Address book object'".$this->dn."' has been removed");
 
@@ -329,6 +331,11 @@ class addressbook extends plugin
         $_SESSION['saved_start']= $_GET['start'];
       }
       $this->dn = base64_decode($_GET['show']);
+      $this->view_logged =FALSE;
+      if(!$this->view_logged){
+        $this->view_logged = TRUE;
+        @log::log("view","addressbook/".get_class($this),$this->dn);
+      }
       $_SESSION['show_info']= base64_decode($_GET['show']);
     }
 
@@ -716,6 +723,7 @@ class addressbook extends plugin
   {
     /* Load base attributes */
     plugin::plugin ($this->config, $this->dn);
+    $this->view_logged = FALSE;
     $this->storage_base= preg_replace('/^[^,]+,/', '', preg_replace('/'.$this->abobjectclass.',/', '', $this->dn));
   }
 
@@ -753,6 +761,12 @@ class addressbook extends plugin
     if (show_ldap_error($ldap->get_error(), sprintf(_("Removing of addressbook entry '%s' failed."),$this->dn))){
       return (1);
     }
+
+    if($mode == "add"){
+      @log::log("create","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("modify","addressbook/".get_class($this),$this->dn, array_keys($this->attrs),$ldap->get_error());
+    }
   }