Subversion Repositories taios

Rev

Rev 482 | Rev 484 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
16 freddie 1
<?php
2
 
3
require '../_taios.php';
4
 
5
$page = new Taios_Page('Blog Posts', '../');
6
$page->drawHeader();
57 tom 7
$page->drawBlogCategoriesMenu();
416 tom 8
write('<br /><h3>RSS</h3>');
415 tom 9
$page->drawMenuItem('RSS Feed', 'blog/rss.php');
16 freddie 10
$page->drawMiddle();
11
 
12
if ($page->isUserGM($page->getLoggedInUser()))
13
{
47 freddie 14
    write('<p class="bold"><a href="add-post.php?id=-1">Add Post</a></p>');
16 freddie 15
    write('<br />');
16
}
17
 
136 tom 18
$query = 'WHERE ParentID = -1';
62 tom 19
 
20
if (isset($_GET['cat']))
21
{
63 tom 22
    $query = $query . ' AND Category = "' . $_GET['cat'] . '"';
68 tom 23
    write('<p>Only showing blog posts from the ' . $_GET['cat'] . ' category. <a href="index.php">Reset Filtering</a></p><br />');
62 tom 24
}
25
 
483 muzer 26
if(!$page->isUserGM($page->getLoggedInUser()))
27
{
28
    $query = $query . ' AND Category != "Drafts"';
29
}
30
 
136 tom 31
$query = $query . " ORDER BY DatePosted DESC";
134 tom 32
 
62 tom 33
$ids = $page->findIDs('BlogPosts', $query);
22 freddie 34
for ($i = 0; $i < count($ids); $i++)
16 freddie 35
{
22 freddie 36
    $id = $ids[$i];
37
    $post = $page->getBlogPost($id);
473 tom 38
 
475 tom 39
    $ids2 = $page->findIDs('BlogPosts', 'WHERE ParentID=' . $id);
120 tom 40
 
104 tom 41
    write('<a href="post.php?id=' . $id . '"><h3>' . $post->title. '</h3></a>');
22 freddie 42
    write('<h5 style="color: #666666;">Posted On ' . date('l j F Y', $post->datePosted) . ' by ' . $post->user->name . ' (' . $post->user->username . ')</h5>');
175 tom 43
    write('<p>' . $page->replaceBBCode($post->content) . '</p>');
482 muzer 44
    write('<h5 style="color: #666666;"><a href="post.php?id=' . $id . '">' . count($ids2) . ' Comments</a></h5>');
120 tom 45
    write('<br />');
16 freddie 46
}
47
 
48
$page->drawFooter();
49
 
50
?>