From ec3d9abb92487aab666cab95d6f5b3d4e9d23dbb Mon Sep 17 00:00:00 2001
From: cfoe <cfoe@ispconfig3>
Date: Thu, 24 May 2012 03:00:18 -0400
Subject: [PATCH] added missing lang-string top_menu_mailuser + changed umlaut code to utf8 chars
---
server/lib/classes/db_mysql.inc.php | 55 +++++++++++++++++++++----------------------------------
1 files changed, 21 insertions(+), 34 deletions(-)
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 6269798..54561c0 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -1,4 +1,3 @@
-
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
@@ -226,10 +225,10 @@
if(is_array($record_old) && count($record_old) > 0) {
foreach($record_old as $key => $val) {
// if(!isset($record_new[$key]) || $record_new[$key] != $val) {
- if($record_new[$key] != $val) {
+ if(@$record_new[$key] != $val) {
// Record has changed
$diffrec_full['old'][$key] = $val;
- $diffrec_full['new'][$key] = $record_new[$key];
+ $diffrec_full['new'][$key] = @$record_new[$key];
$diff_num++;
} else {
$diffrec_full['old'][$key] = $val;
@@ -253,24 +252,10 @@
return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full);
}
-
- if($diff_num > 0) {
- //print_r($diff_num);
- //print_r($diffrec_full);
- $diffstr = $app->db->quote(serialize($diffrec_full));
- if(isset($_SESSION)) {
- $username = $app->db->quote($_SESSION['s']['user']['username']);
- } else {
- $username = 'admin';
- }
- $dbidx = $primary_field.':'.$primary_id;
-
- if($action == 'INSERT') $action = 'i';
- if($action == 'UPDATE') $action = 'u';
- if($action == 'DELETE') $action = 'd';
- $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
- $app->db->query($sql);
- }
+
+ //** Function to fill the datalog with a full differential record.
+ public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new) {
+ global $app,$conf;
// Insert backticks only for incomplete table names.
if(stristr($db_table,'.')) {
@@ -289,19 +274,21 @@
if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
- if($diff_num > 0) {
- //print_r($diff_num);
- //print_r($diffrec_full);
- $diffstr = $app->db->quote(serialize($diffrec_full));
- $username = $app->db->quote($_SESSION['s']['user']['username']);
- $dbidx = $primary_field.':'.$primary_id;
+ if($diff_num > 0) {
+ $diffstr = $app->db->quote(serialize($diffrec_full));
+ if(isset($_SESSION)) {
+ $username = $app->db->quote($_SESSION['s']['user']['username']);
+ } else {
+ $username = 'admin';
+ }
+ $dbidx = $primary_field.':'.$primary_id;
- if($action == 'INSERT') $action = 'i';
- if($action == 'UPDATE') $action = 'u';
- if($action == 'DELETE') $action = 'd';
- $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
- $app->db->query($sql);
- }
+ if($action == 'INSERT') $action = 'i';
+ if($action == 'UPDATE') $action = 'u';
+ if($action == 'DELETE') $action = 'd';
+ $sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
+ $app->db->query($sql);
+ }
return true;
}
@@ -605,4 +592,4 @@
}
- ?>
+ ?>
\ No newline at end of file
--
Gitblit v1.9.1