summaryrefslogtreecommitdiff
path: root/includes/bootstrap.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/bootstrap.inc')
-rw-r--r--includes/bootstrap.inc11
1 files changed, 4 insertions, 7 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 772eb5621..ad750be6d 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -824,13 +824,10 @@ function drupal_is_denied($type, $mask) {
// Because this function is called for every page request, both cached
// and non-cached pages, we tried to optimize it as much as possible.
// We deny access if the only matching records in the {access} table have
- // status 0. If any have status 1, or if there are no matching records,
- // we allow access.
- // We only select for records with status 0. If we have some of
- // these, we return 1 (denied). If no matching records or only ones
- // with status = 1, we get no return from db_result, so we return
- // (bool)NULL = 0 (allowed).
- return (bool) db_result(db_query_range("SELECT 1 FROM {access} WHERE type = '%s' AND LOWER('%s') LIKE LOWER(mask) AND status = 0", $type, $mask, 0, 1));
+ // status 0 (deny). If any have status 1 (allow), or if there are no
+ // matching records, we allow access.
+ $sql = "SELECT 1 FROM {access} WHERE type = '%s' AND LOWER('%s') LIKE LOWER(mask) AND status = %d";
+ return db_result(db_query_range($sql, $type, $mask, 0, 0, 1)) && !db_result(db_query_range($sql, $type, $mask, 1, 0, 1));
}
/**