aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-05-09 00:18:38 +0200
committerTristan Darricau <github@nicofuma.fr>2014-05-09 00:18:38 +0200
commitf755f696069c48e40cba8163b04ea8537354283f (patch)
tree71e77914d30d17bdc4d7037a4f2fdba0b2ec40c0 /phpBB/phpbb
parent51c93aeb025a11930611a792b364502824314e03 (diff)
downloadforums-f755f696069c48e40cba8163b04ea8537354283f.tar
forums-f755f696069c48e40cba8163b04ea8537354283f.tar.gz
forums-f755f696069c48e40cba8163b04ea8537354283f.tar.bz2
forums-f755f696069c48e40cba8163b04ea8537354283f.tar.xz
forums-f755f696069c48e40cba8163b04ea8537354283f.zip
[ticket/12174] Update sql query
PHPBB3-12174
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/content_visibility.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index 420a43ec98..7cb7bd6922 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -440,7 +440,7 @@ class content_visibility
$update_topic_attachments_flag = false;
if ($post_id)
{
- $sql = 'SELECT 1 as nb_attachments
+ $sql = 'SELECT 1 as has_attachments
FROM ' . POSTS_TABLE . '
WHERE topic_id = ' . (int) $topic_id . '
AND post_attachment = 1
@@ -450,17 +450,18 @@ class content_visibility
if ($row = $this->db->sql_fetchrow($result))
{
- if ($row['nb_attachments'] == 0)
- {
- $update_topic_attachments_flag = true;
- $topic_update_array[] = 'topic_attachment = 0';
- }
- else if ($visibility == ITEM_APPROVED)
+ if ($visibility == ITEM_APPROVED)
{
$update_topic_attachments_flag = true;
$topic_update_array[] = 'topic_attachment = 1';
}
}
+ else
+ {
+ $update_topic_attachments_flag = true;
+ $topic_update_array[] = 'topic_attachment = 0';
+ }
+
$this->db->sql_freeresult($result);
}
@@ -468,8 +469,8 @@ class content_visibility
{
// Update the number for replies and posts, and update the attachments flag
$sql = 'UPDATE ' . $this->topics_table . '
- SET ' . implode(', ', $topic_update_array) . '
- WHERE topic_id = ' . (int) $topic_id;
+ SET ' . implode(', ', $topic_update_array) . '
+ WHERE topic_id = ' . (int) $topic_id;
$this->db->sql_query($sql);
}