Deleting private message attachments could delete post attachments. #42815

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9379 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Chris Smith 2009-03-16 22:39:37 +00:00
parent 272cde8251
commit b933bc87e2
2 changed files with 11 additions and 1 deletions

View file

@ -120,6 +120,7 @@
<li>[Fix] Fix wrong bot ip check if bot ip was wrongly entered by admin. (Bug #42485)</li> <li>[Fix] Fix wrong bot ip check if bot ip was wrongly entered by admin. (Bug #42485)</li>
<li>[Fix] Fix javascript errors in simple header (prosilver) by adding forum_fn.js and the corresponding variables. (Bug #42135)</li> <li>[Fix] Fix javascript errors in simple header (prosilver) by adding forum_fn.js and the corresponding variables. (Bug #42135)</li>
<li>[Fix] Set connection encoding for MySQL versions 4.1.0 to 4.1.2. This may fix some conversion issues with special characters. (Bug #41805)</li> <li>[Fix] Set connection encoding for MySQL versions 4.1.0 to 4.1.2. This may fix some conversion issues with special characters. (Bug #41805)</li>
<li>[Fix] Deleting private message attachments could delete post attachments. (Bug #42815)</li>
<li>[Change] Allow download of conflicting file for later reference in automatic updater</li> <li>[Change] Allow download of conflicting file for later reference in automatic updater</li>
<li>[Change] Default difference view is now 'inline' instead of 'side by side'</li> <li>[Change] Default difference view is now 'inline' instead of 'side by side'</li>
<li>[Change] Added new option for merging differences to conflicting files in automatic updater</li> <li>[Change] Added new option for merging differences to conflicting files in automatic updater</li>

View file

@ -814,11 +814,14 @@ function delete_attachments($mode, $ids, $resync = true)
return false; return false;
} }
$sql_where = '';
switch ($mode) switch ($mode)
{ {
case 'post': case 'post':
case 'message': case 'message':
$sql_id = 'post_msg_id'; $sql_id = 'post_msg_id';
$sql_where = ' AND in_message = ' . ($mode == 'message' ? 1 : 0);
break; break;
case 'topic': case 'topic':
@ -842,6 +845,9 @@ function delete_attachments($mode, $ids, $resync = true)
$sql = 'SELECT post_msg_id, topic_id, in_message, physical_filename, thumbnail, filesize, is_orphan $sql = 'SELECT post_msg_id, topic_id, in_message, physical_filename, thumbnail, filesize, is_orphan
FROM ' . ATTACHMENTS_TABLE . ' FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set($sql_id, $ids); WHERE ' . $db->sql_in_set($sql_id, $ids);
$sql .= $sql_where;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
@ -867,6 +873,9 @@ function delete_attachments($mode, $ids, $resync = true)
// Delete attachments // Delete attachments
$sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set($sql_id, $ids); WHERE ' . $db->sql_in_set($sql_id, $ids);
$sql .= $sql_where;
$db->sql_query($sql); $db->sql_query($sql);
$num_deleted = $db->sql_affectedrows(); $num_deleted = $db->sql_affectedrows();