From 2e8f4ee81e6101a5acfb5ba3d5366e872ff19eca Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 9 Oct 2005 17:12:04 +0000 Subject: [PATCH] r514: - Now three different ID's that can be logged (bug, comment, attachment) - No longer use LOG_TIME, but TIMENOW --- attachment.php | 9 ++++++--- docs/schema_changes.sql | 6 +++++- editcomment.php | 4 ++-- editreport.php | 6 ------ includes/class_history.php | 13 ++++++++----- includes/init.php | 2 -- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/attachment.php b/attachment.php index 46ec744..4689b8f 100755 --- a/attachment.php +++ b/attachment.php @@ -100,8 +100,11 @@ if ($_POST['do'] == 'insert') array_walk($obsoletes, 'intval'); $db->query("UPDATE " . TABLE_PREFIX . "attachment SET obsolete = 1 WHERE attachmentid IN (" . implode(',', $obsoletes) . ") AND !obsolete AND bugid = $bug[bugid]"); - $log->arguments = array($attachmentid, $FILE['name'], implode(', ', $obsoletes)); - $log->log($log->diff($lang->string('Obsoleted attachments'), '', implode(', ', $obsoletes))); + foreach ($obsoletes AS $attachmentid) + { + $log->attachmentid = $attachmentid; + $log->log($log->diff('obsolete', 0, 1)); + } } // handle comment stuff @@ -177,7 +180,7 @@ if ($_POST['do'] == 'update') $diff[0] = array_diff_assoc($attachment, $hist[1]); $diff[1] = array_diff_assoc($hist[1], $attachment); - $log->arguments = array($attachment['attachmentid']); + $log->attachmentid = $attachment['attachmentid']; $log->log($log->diff('description', $diff[0]['description'], $diff[1]['description'])); $log->log($log->diff('obsolete', $diff[0]['obsolete'], $diff[1]['obsolete'])); diff --git a/docs/schema_changes.sql b/docs/schema_changes.sql index 714b06e..0211ede 100644 --- a/docs/schema_changes.sql +++ b/docs/schema_changes.sql @@ -54,4 +54,8 @@ ALTER TABLE `history` DROP `language`; ALTER TABLE `history` DROP `arguments`; -ALTER TABLE `user` ADD `showcolours` INT(2) UNSIGNED NOT NULL AFTER `showemail`; \ No newline at end of file +ALTER TABLE `user` ADD `showcolours` INT(2) UNSIGNED NOT NULL AFTER `showemail`; + +ALTER TABLE `history` ADD `attachmentid` INT(10) UNSIGNED NOT NULL AFTER `bugid`; + +ALTER TABLE `history` ADD `commentid` INT(10) UNSIGNED NOT NULL AFTER `attachmentid`; \ No newline at end of file diff --git a/editcomment.php b/editcomment.php index 18a5173..20b056c 100644 --- a/editcomment.php +++ b/editcomment.php @@ -80,8 +80,8 @@ if ($_POST['do'] == 'update') require_once('./includes/class_history.php'); $log = new History(); $log->bugid = $bug['bugid']; - $log->arguments = array($comment['commentid']); - $log->log(); + $log->commentid = $comment['commentid']; + $log->log($log->diff('text', $comment['comment_parsed'], $bugsys->in['comment_parsed'])); $log->log($log->diff('hidden', $comment['hidden'], intval($bugsys->in['hidden']))); $lastgood = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug[bugid] AND !hidden ORDER BY dateline DESC"); diff --git a/editreport.php b/editreport.php index 0e12da3..a88775c 100644 --- a/editreport.php +++ b/editreport.php @@ -302,12 +302,6 @@ if ($_POST['do'] == 'update') hiddenlastpostby = " . $bugsys->userinfo['userid'] . " WHERE bugid = " . intval($bugsys->in['bugid']) ); - - if ($hascomment) - { - $log->arguments = array($commentid); - $log->log(); - } } diff --git a/includes/class_history.php b/includes/class_history.php index 91629bb..8355408 100644 --- a/includes/class_history.php +++ b/includes/class_history.php @@ -13,7 +13,9 @@ class History { var $bugid = 0; - var $fieldid = 0; + var $attachmentid = 0; + var $commentid = 0; + var $allowempty = false; // ------------------------------------------------------------------- // -- Create a log entry @@ -23,7 +25,8 @@ class History global $bugsys; $this->bugid = intval($this->bugid); - $this->fieldid = intval($this->fieldid); + $this->attachmentid = intval($this->attachmentid); + $this->commentid = intval($this->commentid); if ($diffdata == -1) { @@ -37,10 +40,10 @@ class History $bugsys->db->query(" INSERT INTO " . TABLE_PREFIX . "history - (bugid, dateline, userid, field, fieldid, original, changed) + (bugid, attachmentid, commentid, dateline, userid, field, original, changed) VALUES - (" . $this->bugid . ", " . LOG_TIME . ", " . $bugsys->userinfo['userid'] . ", - '" . $bugsys->escape($diffdata['field']) . "', " . $this->fieldid . ", + (" . $this->bugid . ", " . $this->attachmentid . ", " . $this->commentid . ", " . TIMENOW . ", + " . $bugsys->userinfo['userid'] . ", '" . $bugsys->escape($diffdata['field']) . "', '" . $bugsys->escape($diffdata['initial']) . "', '" . $bugsys->escape($diffdata['final']) . "' )" ); diff --git a/includes/init.php b/includes/init.php index 3d834de..194f31c 100755 --- a/includes/init.php +++ b/includes/init.php @@ -54,8 +54,6 @@ define('COOKIE_PREFIX', $cookieprefix); unset($database, $servername, $username, $password, $usepconnect, $tableprefix, $cookieprefix); -define('LOG_TIME', time()); - require_once('./includes/functions_datastore.php'); require_once('./includes/functions.php'); -- 2.22.5