index fa4482e6b3b97ad794f8abde63e86ee546fb8179..33e58523a94abddb8a76b4cd4bf8edc1fcc187d9 100644 (file)
}
$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;
}
$entry['changes'] = $changes;
$entry['result'] = $result;
- if(!isset($this->config->current['LOGGING']) && empty($entry['user'])){
+ if(!isset($this->config) || ( $this->config->get_cfg_value("logging") == "" && empty($entry['user']))){
$entry['user'] = "unknown";
}
}else{
- if(!isset($this->config->current['LOGGING'])){
- $this->log_into_syslog($entry);
- }else{
-
- /* Start logging for configured methods */
- if(isset($this->config->current['LOGGING']) && preg_match("/(^|,)syslog(,|$)/i",$this->config->current['LOGGING'])){
+ if (isset ($this->config)){
+ if ($this->config->get_cfg_value("logging") == ""){
$this->log_into_syslog($entry);
- }
- if(isset($this->config->current['LOGGING']) && preg_match("/(^|,)mysql(,|$)/i",$this->config->current['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);
+ }
}
}
}
/* 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);
}
/* 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());