From 1d6499d6c8d9ce69914fbe9258868f2ef30a6177 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sun, 4 Jun 2006 03:06:36 +0000 Subject: Bug 340139: When adding a new attachment, data inserted in the bugs_activity table are quoted - Patch by Frédéric Buclin r=bkor, r=ghendricks, r=vladd a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- attachment.cgi | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'attachment.cgi') diff --git a/attachment.cgi b/attachment.cgi index bbccbd912..087b267e1 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -1075,15 +1075,12 @@ sub insert # Make sure the person we are taking the bug from gets mail. $owner = $oldvalues[4]; - - @oldvalues = map($dbh->quote($_), @oldvalues); - @newvalues = map($dbh->quote($_), @newvalues); - + # Update the bug record. Note that this doesn't involve login_name. - $dbh->do("UPDATE bugs SET delta_ts = ?, " . - join(", ", map("$fields[$_] = $newvalues[$_]", (0..3))) . - " WHERE bug_id = ?", undef, ($timestamp, $bugid)); - + $dbh->do('UPDATE bugs SET delta_ts = ?, ' . + join(', ', map("$fields[$_] = ?", (0..3))) . ' WHERE bug_id = ?', + undef, ($timestamp, map($newvalues[$_], (0..3)) , $bugid)); + # If the bug was a dupe, we have to remove its entry from the # 'duplicates' table. $dbh->do('DELETE FROM duplicates WHERE dupe = ?', undef, $bugid); @@ -1091,17 +1088,11 @@ sub insert # We store email addresses in the bugs_activity table rather than IDs. $oldvalues[0] = $oldvalues[4]; $newvalues[0] = $newvalues[4]; - - # Add the changes to the bugs_activity table - my $sth = $dbh->prepare("INSERT INTO bugs_activity - (bug_id, who, bug_when, fieldid, removed, added) - VALUES (?,?,?,?,?,?)"); for (my $i = 0; $i < 4; $i++) { if ($oldvalues[$i] ne $newvalues[$i]) { - my $fieldid = get_field_id($fields[$i]); - $sth->execute($bugid, $userid, $timestamp, - $fieldid, $oldvalues[$i], $newvalues[$i]); + LogActivityEntry($bugid, $fields[$i], $oldvalues[$i], + $newvalues[$i], $userid, $timestamp); } } } -- cgit v1.2.3-24-g4f1b