From f18d6c02b0e5b04915b1770cd4a5d7c814880683 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Mon, 12 Sep 2005 13:34:55 +0000 Subject: [PATCH] properly join. Thanks to nobody. --- include/functions_config.inc.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php index a231397..90c2d4a 100644 --- a/include/functions_config.inc.php +++ b/include/functions_config.inc.php @@ -1025,15 +1025,14 @@ function serendipity_ACLCheck($authorid, $artifact_id, $artifact_type, $artifact LEFT OUTER JOIN {$serendipity['dbPrefix']}authorgroups AS ag ON ag.authorid = ". (int)$authorid . " LEFT OUTER JOIN {$serendipity['dbPrefix']}access AS a - ON (a.artifact_id = " . (int)$artifact_id . " AND (ag.groupid = a.groupid OR a.groupid = 0) ) + ON ( a.artifact_type = '" . serendipity_db_escape_string($artifact_type) . "' + AND a.artifact_id = " . (int)$artifact_id . " + AND a.artifact_mode = '" . serendipity_db_escape_string($artifact_mode) . "' + AND (ag.groupid = a.groupid OR a.groupid = 0) + ) WHERE {$artifact_sql['cond']} - AND (( - a.artifact_type = '" . serendipity_db_escape_string($artifact_type) . "' - AND a.artifact_mode = '" . serendipity_db_escape_string($artifact_mode) . "' - ) - {$artifact_sql['where']} - ) + AND ( {$artifact_sql['where']} ) GROUP BY result"; $res = serendipity_db_query($sql, true, 'assoc'); @@ -1070,7 +1069,11 @@ function serendipity_ACL_SQL(&$cond, $append_category = false) { $cond['joins'] .= " LEFT JOIN {$serendipity['dbPrefix']}authorgroups AS acl_a ON acl_a.authorid = " . $read_id . " LEFT JOIN {$serendipity['dbPrefix']}access AS acl_acc - ON acl_acc.groupid = " . $read_id_sql; + ON ( acl_acc.artifact_mode = 'read' + AND acl_acc.artifact_type = 'category' + AND acl_acc.artifact_id = c.categoryid + AND acl_acc.groupid = " . $read_id_sql . " + )"; if (empty($cond['and'])) { $cond['and'] .= ' WHERE '; @@ -1080,9 +1083,6 @@ function serendipity_ACL_SQL(&$cond, $append_category = false) { $cond['and'] .= " ( c.categoryid IS NULL - OR (acl_acc.artifact_type = 'category' - AND acl_acc.artifact_mode = 'read' - AND acl_acc.artifact_id = c.categoryid) OR (acl_acc.artifact_id IS NULL AND (c.authorid = 0 OR c.authorid = " . $read_id . ") ) -- 2.39.5