summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: acdf450)
raw | patch | inline | side by side (parent: acdf450)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 14 May 2007 12:35:47 +0000 (12:35 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 14 May 2007 12:35:47 +0000 (12:35 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6370 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_log.inc | patch | blob | history |
diff --git a/include/class_log.inc b/include/class_log.inc
index b46a5adc90bc5d6ba861d9be3073adefdfa06fe7..2a9810f38e4845f909253886fa6aff2ef14f1b22 100644 (file)
--- a/include/class_log.inc
+++ b/include/class_log.inc
/* Create data object */
$entry = array();
$entry['timestamp'] = time();
- $entry['user'] =$ui->dn;
- $entry['action'] = $action;
- $entry['objecttype'] = $objecttype;
- $entry['object'] = $object;
- $entry['changes'] = $changes;
- $entry['result'] = $result;
+ $entry['user'] = $ui->dn;
+ $entry['action'] = $action;
+ $entry['objecttype']= $objecttype;
+ $entry['object'] = $object;
+ $entry['changes'] = $changes;
+ $entry['result'] = $result;
- /* Start logging for configured methods */
- if(isset($this->config->current['LOGGING']) && preg_match("/(^|,)syslog(,|$)/i",$this->config->current['LOGGING'])){
- @log::log_into_syslog($entry);
+ /* Check if all given values are valid */
+ $msgs = @log::check($entry);
+ if(count($msgs)){
+ foreach($msgs as $msg){
+ trigger_error("Logging failed, reason was: ".$msg);
+ }
+ }else{
+
+ /* Start logging for configured methods */
+ if(isset($this->config->current['LOGGING']) && preg_match("/(^|,)syslog(,|$)/i",$this->config->current['LOGGING'])){
+ @log::log_into_syslog($entry);
+ }
+ if(isset($this->config->current['LOGGING']) && preg_match("/(^|,)mysql(,|$)/i",$this->config->current['LOGGING'])){
+ @log::log_into_db($entry);
+ }
+ }
+ }
+
+
+ function check($entry = array())
+ {
+ $msgs = array();
+ if(!isset($entry['user']) || empty($entry['user'])){
+ $msgs[] = "Currently active user is empty.";
}
- if(isset($this->config->current['LOGGING']) && preg_match("/(^|,)mysql(,|$)/i",$this->config->current['LOGGING'])){
- @log::log_into_db($entry);
+
+ if(!isset($entry['action']) || !in_array($entry['action'],array("modify","create","remove","copy","snapshot"))){
+ $msgs[] = "Invalid option specified '".$entry['action']."'";
}
+
+ if(!isset($entry['objecttype']) || empty($entry['objecttype'])){
+ $msgs[] = "Specified objectType is empty or invalid.";
+ }
+
+ return($msgs);
}