From 9e40a624aae21eb26cda975df66cb84e3ba53f6e Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 21 May 2007 10:15:34 +0000 Subject: [PATCH] Added logging to fax extensions git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6417 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../blocklists/class_blocklistManagement.inc | 17 +++++++++++++++-- plugins/gofax/faxaccount/class_gofaxAccount.inc | 17 +++++++++++++++++ plugins/gofax/faxreports/class_faxreport.inc | 7 +++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc index a002dfcb8..7fd5512c7 100644 --- a/plugins/gofax/blocklists/class_blocklistManagement.inc +++ b/plugins/gofax/blocklists/class_blocklistManagement.inc @@ -21,6 +21,7 @@ class blocklist extends plugin var $attributes = array("cn", "description"); var $objectclasses = array(); var $DivListBlocklist = NULL; + var $view_logged = FALSE; function blocklist ($config, $ui) { @@ -279,7 +280,7 @@ class blocklist extends plugin ***************/ /* Handle interactions: delete */ - if (isset($_POST['delete_number']) && count($_POST['numbers']) > 0){ + if (isset($_POST['delete_number']) && isset($_POST['numbers']) && count($_POST['numbers']) > 0){ $this->delNumber ($_POST['numbers']); } @@ -323,7 +324,13 @@ class blocklist extends plugin if($this->dn){ $dn = $this->dn; - + + /* Log view */ + if(!$this->view_logged){ + $this->view_logged = TRUE; + @log::log("view","users/".get_class($this),$this->dn); + } + /* set Account states, this is nescessary for get_allowed_bases */ $this->initially_was_account= true; $this->is_account = true; @@ -460,6 +467,7 @@ class blocklist extends plugin $this->description= ""; $this->cn= ""; $this->base= $_SESSION['CurrentMainBase']; + $this->view_logged = FALSE; $this->goFaxBlocklist= array(); } @@ -518,6 +526,9 @@ class blocklist extends plugin { $ldap= $this->config->get_ldap_link(); $ldap->rmDir($this->dn); + + @log::log("remove","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of blocklist with dn '%s' failed."),$this->dn)); $this->clear_fields(); $this->handle_post_events("remove"); @@ -622,12 +633,14 @@ class blocklist extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify($this->attrs); + @log::log("modify","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events("modify"); } else { $ldap->cd($this->config->current['BASE']); $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $ldap->cd($this->dn); $ldap->add($this->attrs); + @log::log("create","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events("add"); } show_ldap_error($ldap->get_error(), sprintf(_("Saving of blocklist with dn '%s' failed."),$this->dn)); diff --git a/plugins/gofax/faxaccount/class_gofaxAccount.inc b/plugins/gofax/faxaccount/class_gofaxAccount.inc index 1b1b26b44..50a3c9b37 100644 --- a/plugins/gofax/faxaccount/class_gofaxAccount.inc +++ b/plugins/gofax/faxaccount/class_gofaxAccount.inc @@ -37,6 +37,7 @@ class gofaxAccount extends plugin var $in_blocklist_dialog= FALSE; var $out_blocklist_dialog= FALSE; var $current_blocklist= array(); + var $view_logged = FALSE; /* Copy & paste variables */ var $CopyPasteVars=array("facsimileTelephoneNumber");//,"goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups"); @@ -111,6 +112,13 @@ class gofaxAccount extends plugin { /* Call parent execute */ plugin::execute(); + + /* Log view */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + @log::log("view","users/".get_class($this),$this->dn); + } + /* Hickert : 11.11.05 * Added to be able to handle department selection in divSelelect */ @@ -621,6 +629,8 @@ class gofaxAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + @log::log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/fax account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -741,6 +751,13 @@ class gofaxAccount extends plugin $this->cleanup(); $ldap->modify ($this->attrs); + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/fax account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/gofax/faxreports/class_faxreport.inc b/plugins/gofax/faxreports/class_faxreport.inc index c7ac755b0..2bc248c5d 100644 --- a/plugins/gofax/faxreports/class_faxreport.inc +++ b/plugins/gofax/faxreports/class_faxreport.inc @@ -17,6 +17,7 @@ class faxreport extends plugin var $report_list = array(); var $ui = NULL; var $range = 20; + var $view_logged = FALSE; /* Constant stuff */ var $status= array( "SENT", "MAILED", "SERROR", "RERROR", "SBLOCK", "RBLOCK", @@ -64,6 +65,12 @@ class faxreport extends plugin /* Call parent execute */ plugin::execute(); + /* Log view */ + if(!$this->view_logged){ + $this->view_logged = TRUE; + @log::log("view","users/".get_class($this),$this->dn); + } + /************ Variable initialisation ************/ -- 2.30.2