summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php12
1 files changed, 4 insertions, 8 deletions
diff --git a/index.php b/index.php
index d86ebe81f..123548110 100644
--- a/index.php
+++ b/index.php
@@ -4,16 +4,12 @@ include_once "includes/common.inc";
if (variable_get(dev_timing, 0)) timer_start();
-// Initialize/pre-process variables:
-$number = ($user->nodes) ? $user->nodes : 10;
-$date = ($date > 0) ? $date : time();
+$result = db_query("SELECT nid FROM node WHERE type = 'story' AND status = '$status[posted]' AND timestamp <= ". ($date > 0 ? $date : time()) ." ". ($category ? "AND cid = '$category'" : "") ." ". ($topic ? "AND tid = '$topic'" : "") ." ORDER BY timestamp DESC LIMIT ". ($user->nodes ? $user->nodes : 10));
-// Perform query:
-$result = db_query("SELECT n.*, s.*, u.userid, COUNT(c.lid) AS comments FROM node n LEFT JOIN story s ON n.nid = s.nid LEFT JOIN comments c ON n.nid = c.lid LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[posted]' AND n.type = 'story' ". ($section ? "AND s.section = '$section' " : "") ."AND n.timestamp <= $date GROUP BY n.nid ORDER BY n.timestamp DESC LIMIT $number");
-
-// Display nodes:
$theme->header();
-while ($story = db_fetch_object($result)) $theme->story($story);
+while ($node = db_fetch_object($result)) {
+ node_view(node_get_object("nid", $node->nid));
+}
$theme->footer();
if (variable_get(dev_timing, 0)) timer_print();