aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/docs/CHANGELOG.html1
-rw-r--r--phpBB/includes/search/fulltext_native.php23
2 files changed, 13 insertions, 11 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index d0f72a9784..d0de2c9a50 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -111,6 +111,7 @@
<li>[Feature] Added 'AGO' setting to relative date strings. For example: posted 14 minutes ago. (Patch by BartVB)</li>
<li>[Sec] Fixed an issue where deactivated accounts could be re-activated without the required privileges. (Reported by Jorick)</li>
<li>[Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)</li>
+ <li>[Fix] Use a left join for the topics table on search to avoid trouble with FROM syntax on some databases (Bug #37005)</li>
</ul>
<a name="v302"></a><h3>1.ii. Changes since 3.0.2</h3>
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index 0a3fe3754f..b1a035ff43 100644
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -455,6 +455,7 @@ class fulltext_native extends search_backend
);
$title_match = '';
+ $left_join_topics = false;
$group_by = true;
// Build some display specific sql strings
switch ($fields)
@@ -464,7 +465,7 @@ class fulltext_native extends search_backend
$group_by = false;
// no break
case 'firstpost':
- $sql_array['FROM'][TOPICS_TABLE] = 't';
+ $left_join_topics = true;
$sql_where[] = 'p.post_id = t.topic_first_post_id';
break;
@@ -476,11 +477,7 @@ class fulltext_native extends search_backend
if ($type == 'topics')
{
- if (!isset($sql_array['FROM'][TOPICS_TABLE]))
- {
- $sql_array['FROM'][TOPICS_TABLE] = 't';
- $sql_where[] = 'p.topic_id = t.topic_id';
- }
+ $left_join_topics = true;
$group_by = true;
}
@@ -688,11 +685,7 @@ class fulltext_native extends search_backend
break;
case 't':
- if (!isset($sql_array['FROM'][TOPICS_TABLE]))
- {
- $sql_array['FROM'][TOPICS_TABLE] = 't';
- $sql_where[] = 'p.topic_id = t.topic_id';
- }
+ $left_join_topics = true;
break;
case 'f':
@@ -700,6 +693,14 @@ class fulltext_native extends search_backend
$sql_where[] = 'f.forum_id = p.forum_id';
break;
}
+
+ if ($left_join_topics)
+ {
+ $sql_array['LEFT_JOIN'][$left_join_topics] = array(
+ 'FROM' => TOPICS_TABLE => 't',
+ 'ON' => 'p.topic_id = t.topic_id'
+ );
+ }
$sql_array['WHERE'] = implode(' AND ', $sql_where);
$sql_array['GROUP_BY'] = ($group_by) ? (($type == 'posts') ? 'p.post_id' : 'p.topic_id') . ', ' . $sort_by_sql[$sort_key] : '';