summaryrefslogtreecommitdiff
path: root/modules/archive
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-01-16 18:44:49 +0000
committerDries Buytaert <dries@buytaert.net>2005-01-16 18:44:49 +0000
commit971a0e24aa6344da7ae07f476ed3fb371bd744d0 (patch)
tree130b8c7e3e374b5edb7fa9ed91a80b890ab4275e /modules/archive
parentb04d46df4dfae84eab09f3f8a7f06cf462452711 (diff)
downloadbrdo-971a0e24aa6344da7ae07f476ed3fb371bd744d0.tar.gz
brdo-971a0e24aa6344da7ae07f476ed3fb371bd744d0.tar.bz2
- Patch #14731 by chx: made it possible to rewrite node queries.
Diffstat (limited to 'modules/archive')
-rw-r--r--modules/archive/archive.module8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/archive/archive.module b/modules/archive/archive.module
index 893a4b698..cbc722bcd 100644
--- a/modules/archive/archive.module
+++ b/modules/archive/archive.module
@@ -72,7 +72,9 @@ function archive_calendar($original = 0) {
$nextmonth = mktime(23, 59, 59, $month + 1, 1, $year);
$next = mktime(23, 59, 59, $month + 1, min(date('t', $nextmonth), $day), $year);
- $result = db_query('SELECT DISTINCT(n.nid), n.created FROM {node} n '. node_access_join_sql() .' WHERE n.status = 1 AND n.created > %d AND n.created < %d AND '. node_access_where_sql() .' ORDER BY n.created', $start_of_month, $end_of_month);
+ $sql = 'SELECT n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.created > %d AND n.created < %d ORDER BY n.created';
+ $sql = node_rewrite_sql($sql);
+ $result = db_query($sql, $start_of_month, $end_of_month);
$days_with_posts = array();
while ($day_with_post = db_fetch_object($result)) {
@@ -239,7 +241,9 @@ function archive_page($year = 0, $month = 0, $day = 0) {
if ($year && $month && $day) {
// Fetch nodes for the selected date, if one was specified.
- $result = db_query_range('SELECT DISTINCT(n.nid), n.created FROM {node} n '. node_access_join_sql() .' WHERE n.status = 1 AND n.created > %d AND n.created < %d AND '. node_access_where_sql() .' ORDER BY n.created', $date, $date_end, 0, 20);
+ $sql = 'SELECT n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.created > %d AND n.created < %d ORDER BY n.created';
+ $sql = node_rewrite_sql($sql);
+ $result = db_query_range($sql, $date, $date_end, 0, 20);
while ($nid = db_fetch_object($result)) {
$output .= node_view(node_load(array('nid' => $nid->nid)), 1);