aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.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/functions_admin.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/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php32
1 files changed, 23 insertions, 9 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 7b3c7e68f1..2df3c37f9b 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -1733,15 +1733,29 @@ function cache_moderators()
$ug_id_ary = array_keys($hold_ary);
// Remove users who have group memberships with DENY moderator permissions
- $sql = 'SELECT a.forum_id, ug.user_id
- FROM (' . ACL_OPTIONS_TABLE . ' o, ' . ACL_GROUPS_TABLE . ' a, ' . USER_GROUP_TABLE . ' ug)
- LEFT JOIN ' . ACL_ROLES_DATA_TABLE . ' r ON (a.auth_role_id = r.role_id)
- WHERE (o.auth_option_id = a.auth_option_id OR o.auth_option_id = r.auth_option_id)
- AND ((a.auth_setting = ' . ACL_NO . ' AND r.auth_setting IS NULL)
- OR r.auth_setting = ' . ACL_NO . ')
- AND a.group_id = ug.group_id
- AND ug.user_id IN (' . implode(', ', $ug_id_ary) . ")
- AND o.auth_option LIKE 'm\_%'";
+ $sql = $db->sql_build_query('SELECT', array(
+ 'SELECT' => 'a.forum_id, ug.user_id',
+
+ 'FROM' => array(
+ ACL_OPTIONS_TABLE => 'o',
+ USER_GROUP_TABLE => 'ug',
+ ACL_GROUPS_TABLE => 'a'
+ ),
+
+ 'LEFT_JOIN' => array(
+ array(
+ 'FROM' => array(ACL_ROLES_DATA_TABLE => 'r'),
+ 'ON' => 'a.auth_role_id = r.role_id'
+ )
+ ),
+
+ 'WHERE' => '(o.auth_option_id = a.auth_option_id OR o.auth_option_id = r.auth_option_id)
+ AND ((a.auth_setting = ' . ACL_NO . ' AND r.auth_setting IS NULL)
+ OR r.auth_setting = ' . ACL_NO . ')
+ AND a.group_id = ug.group_id
+ AND ug.user_id IN (' . implode(', ', $ug_id_ary) . ")
+ AND o.auth_option LIKE 'm\_%'",
+ ));
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))