From 8cf78b31b28b9183579c7939b947e1f7e9f5c2fa Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Thu, 12 Jan 2012 04:54:19 -0500 Subject: [PATCH] Merged revisions 2812-2883 from staböe branch. --- server/lib/classes/db_mysql.inc.php | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php index 47ee0d5..6269798 100644 --- a/server/lib/classes/db_mysql.inc.php +++ b/server/lib/classes/db_mysql.inc.php @@ -254,9 +254,23 @@ } - //** 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; + 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); + } // Insert backticks only for incomplete table names. if(stristr($db_table,'.')) { -- Gitblit v1.9.1