aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp/mcp_front.php
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-05-05 22:06:17 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-05-05 22:06:17 +0000
commit3d2a45ab049606701172c11552aa0c1006d2fbf1 (patch)
treeea65a291ac3901d723f33446c54e449e3218ea13 /phpBB/includes/mcp/mcp_front.php
parentb6ffae82b938eb3c40395234f14d79b53ba003c4 (diff)
downloadforums-3d2a45ab049606701172c11552aa0c1006d2fbf1.tar
forums-3d2a45ab049606701172c11552aa0c1006d2fbf1.tar.gz
forums-3d2a45ab049606701172c11552aa0c1006d2fbf1.tar.bz2
forums-3d2a45ab049606701172c11552aa0c1006d2fbf1.tar.xz
forums-3d2a45ab049606701172c11552aa0c1006d2fbf1.zip
I hope nothing broke!
- Added a query builder, it is currently only used for complex queries that involve a FROM clause with two tables and a left join - Changed some function calls in the DBAL - Made the viewtopic queries nicer git-svn-id: file:///svn/phpbb/trunk@5885 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/mcp/mcp_front.php')
-rw-r--r--phpBB/includes/mcp/mcp_front.php38
1 files changed, 28 insertions, 10 deletions
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index 653af87a45..f227dec9a6 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -123,16 +123,34 @@ function mcp_front_view($id, $mode, $action)
if ($total)
{
- $sql = 'SELECT r.*, p.post_id, p.post_subject, u.username, t.topic_id, t.topic_title, f.forum_id, f.forum_name
- FROM (' . REPORTS_TABLE . ' r, ' . REASONS_TABLE . ' rr,' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u)
- LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = p.forum_id)
- WHERE r.post_id = p.post_id
- AND r.report_closed = 0
- AND r.reason_id = rr.reason_id
- AND p.topic_id = t.topic_id
- AND r.user_id = u.user_id
- AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')
- ORDER BY p.post_id DESC';
+ $sql = $db->sql_build_query('SELECT', array(
+ 'SELECT' => 'r.*, p.post_id, p.post_subject, u.username, t.topic_id, t.topic_title, f.forum_id, f.forum_name',
+
+ 'FROM' => array(
+ REPORTS_TABLE => 'r',
+ REASONS_TABLE => 'rr',
+ TOPICS_TABLE => 't',
+ USERS_TABLE => 'u',
+ POSTS_TABLE => 'p'
+
+ ),
+
+ 'LEFT_JOIN' => array(
+ array(
+ 'FROM' => array(FORUMS_TABLE => 'f'),
+ 'ON' => 'f.forum_id = p.forum_id'
+ )
+ ),
+
+ 'WHERE' => 'r.post_id = p.post_id
+ AND r.report_closed = 0
+ AND r.reason_id = rr.reason_id
+ AND p.topic_id = t.topic_id
+ AND r.user_id = u.user_id
+ AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')',
+
+ 'ORDER_BY' => 'p.post_id DESC'
+ ));
$result = $db->sql_query_limit($sql, 5);
while ($row = $db->sql_fetchrow($result))