X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_log.inc;h=33e58523a94abddb8a76b4cd4bf8edc1fcc187d9;hb=c24abf1e4216c3cea0eff19346e6c7da1a346e47;hp=f255bd5ad0af7caa3221e0cc98b2e1812bbecaf1;hpb=7bbe835091582eb8d6ea377534573275aa58aaf2;p=gosa.git diff --git a/gosa-core/include/class_log.inc b/gosa-core/include/class_log.inc index f255bd5ad..33e58523a 100644 --- a/gosa-core/include/class_log.inc +++ b/gosa-core/include/class_log.inc @@ -52,11 +52,11 @@ class log { } $entry = array(); - if(!session::is_set('config')){ + if(!session::global_is_set('config')){ $entry['user']= "unkown"; }else{ - $this->config = session::get('config'); + $this->config = session::global_get('config'); $ui = get_userinfo(); $entry['user']= @$ui->dn; } @@ -76,7 +76,7 @@ class log { $entry['changes'] = $changes; $entry['result'] = $result; - if($this->config->get_cfg_value("logging") == "" && empty($entry['user'])){ + if(!isset($this->config) || ( $this->config->get_cfg_value("logging") == "" && empty($entry['user']))){ $entry['user'] = "unknown"; } @@ -90,16 +90,18 @@ class log { }else{ - if ($this->config->get_cfg_value("logging") == ""){ - $this->log_into_syslog($entry); - }else{ - - /* Start logging for configured methods */ - if(preg_match("/(^|,)syslog(,|$)/i",$this->config->get_cfg_value("logging"))){ + if (isset ($this->config)){ + if ($this->config->get_cfg_value("logging") == ""){ $this->log_into_syslog($entry); - } - if(preg_match("/(^|,)mysql(,|$)/i",$this->config->get_cfg_value("logging"))){ - $this->log_into_db($entry); + }else{ + + /* Start logging for configured methods */ + if(preg_match("/(^|,)syslog(,|$)/i",$this->config->get_cfg_value("logging"))){ + $this->log_into_syslog($entry); + } + if(preg_match("/(^|,)mysql(,|$)/i",$this->config->get_cfg_value("logging"))){ + $this->log_into_db($entry); + } } } } @@ -125,7 +127,12 @@ class log { /* This function is used to into the systems syslog */ function log_into_syslog($entry) { - $str = $entry['user']." ".$entry['action']." ".$entry['object']." from type ".$entry['objecttype']." ".$entry['changes']." : Result was ".$entry['result']; + $str= ""; + if (empty($entry['object']) && empty($entry['changes'])) { + $str = "(".$entry['action'].") ".$entry['objecttype'].": ".$entry['result']; + } else { + $str = "(".$entry['action'].") ".$entry['object']." of type ".$entry['objecttype']." ".$entry['changes'].": ".$entry['result']; + } gosa_log($str); } @@ -157,6 +164,7 @@ class log { /* Connect to the database */ + ini_set("mysql.connect_timeout",5); $con = @mysql_pconnect($server_name,$server['USER'],$server['PWD']); if(!$con){ $error = msgPool::dbconnect(_("MySQL logging"),mysql_error());