From d87f76019fc231ec20d95126a7fee0487e7be5f0 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Tue, 14 Aug 2012 10:56:20 -0400 Subject: [PATCH] - Added new web folder named private to web folder layout. The folder is intended to store data that shall not be visible in the web directory, it is owned by the user of the web. - Changed ownership of web root directory to root user in all security modes to prevent symlink attacks. - Apache log files are now owned by user root. - Improved functions in system library. --- server/lib/classes/db_mysql.inc.php | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-) diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php index 602e1cc..d2b4dd6 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; @@ -275,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 = $this->quote(serialize($diffrec_full)); + if(isset($_SESSION)) { + $username = $this->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')"; + $this->query($sql); + } return true; } @@ -591,4 +592,4 @@ } - ?> + ?> \ No newline at end of file -- Gitblit v1.9.1