index.php 677 Bytes
Newer Older
Dries's avatar
 
Dries committed
1
<?
Dries's avatar
Dries committed
2

3
include_once "includes/common.inc";
Dries's avatar
Dries committed
4

Dries's avatar
 
Dries committed
5
// Initialize/pre-process variables:
Dries's avatar
 
Dries committed
6
$number = ($user->stories) ? $user->stories : 10;
Dries's avatar
 
Dries committed
7
$date = ($date > 0) ? $date : time();
Dries's avatar
Dries committed
8

Dries's avatar
 
Dries committed
9
// Perform query:
Dries's avatar
 
Dries committed
10
$result = db_query("SELECT stories.*, users.userid, COUNT(comments.lid) AS comments FROM stories LEFT JOIN comments ON stories.id = comments.lid LEFT JOIN users ON stories.author = users.id WHERE stories.status = 2 ". ($section ? "AND section = '$section' " : "") ."AND stories.timestamp <= $date GROUP BY stories.id ORDER BY stories.timestamp DESC LIMIT $number");
Dries's avatar
Dries committed
11

Dries's avatar
 
Dries committed
12
// Display stories:
Dries's avatar
 
Dries committed
13
$theme->header();
Dries's avatar
 
Dries committed
14
while ($story = db_fetch_object($result)) $theme->story($story);
Dries's avatar
Dries committed
15 16
$theme->footer();

Kjartan's avatar
 
Kjartan committed
17
?>