diff --git a/include/class_log.inc b/include/class_log.inc
index c2f05639157eacd1ee871a10ea50c1984da2c364..d9c3565f0df6f1c8a21b4823a4ccfbe2351f4a27 100644 (file)
--- a/include/class_log.inc
+++ b/include/class_log.inc
*/
function log($action,$objecttype,$object,$changes_array = array(),$result = TRUE)
{
*/
function log($action,$objecttype,$object,$changes_array = array(),$result = TRUE)
{
- $this->config = $_SESSION['config'];
- $ui = get_userinfo();
+ if(!is_array($changes_array)){
+ trigger_error("log(string,string,string,array(),bool). Forth parameter must be an array.");
+ $changes_array = array();
+ }
+
+ $entry = array();
+ if(!isset($_SESSION['config'])){
+ $entry['user']= "unkown";
+ }else{
+
+ $this->config = &$_SESSION['config'];
+ $ui = get_userinfo();
+ $entry['user']= @$ui->dn;
+ }
/* Create string out of changes */
$changes ="";
/* Create string out of changes */
$changes ="";
$changes = preg_replace("/,$/","",$changes );
/* Create data object */
$changes = preg_replace("/,$/","",$changes );
/* Create data object */
- $entry = array();
$entry['timestamp'] = time();
$entry['timestamp'] = time();
- $entry['user'] = @$ui->dn;
$entry['action'] = $action;
$entry['objecttype']= $objecttype;
$entry['object'] = $object;
$entry['action'] = $action;
$entry['objecttype']= $objecttype;
$entry['object'] = $object;
}
foreach($servers as $server_name => $server){
}
foreach($servers as $server_name => $server){
-
- $con = mysql_pconnect($server_name,$server['USER'],$server['PWD']);
+
+ $con = @mysql_pconnect($server_name,$server['USER'],$server['PWD']);
if(!$con){
if(!$con){
- print_red(sprintf(_("Could not connect to logging server %s."),$server['SERVER']));
+ print_red(sprintf(_("Could not connect to logging server %s."),$server_name));
}else{
$db = mysql_select_db($server['DB'],$con);
if(!$db){
}else{
$db = mysql_select_db($server['DB'],$con);
if(!$db){
- print_red(sprintf(_("Could not select database %s on server %s. Server ssys :%s"),$server['DB'],$server['SERVER'],mysql_error($con)));
+ print_red(sprintf(_("Could not select database %s on server %s. Server says :%s"),$server['DB'],$server['SERVER'],mysql_error($con)));
}else{
/* Create mysql syntax */
}else{
/* Create mysql syntax */
}
}
}
}
+ mysql_close($con);
}
}
}
}
}
}