Subversion Repositories taios

Rev

Rev 136 | Rev 415 | 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();
16 freddie 8
$page->drawMiddle();
9
 
10
if ($page->isUserGM($page->getLoggedInUser()))
11
{
47 freddie 12
    write('<p class="bold"><a href="add-post.php?id=-1">Add Post</a></p>');
16 freddie 13
    write('<br />');
14
}
15
 
136 tom 16
$query = 'WHERE ParentID = -1';
62 tom 17
 
18
if (isset($_GET['cat']))
19
{
63 tom 20
    $query = $query . ' AND Category = "' . $_GET['cat'] . '"';
68 tom 21
    write('<p>Only showing blog posts from the ' . $_GET['cat'] . ' category. <a href="index.php">Reset Filtering</a></p><br />');
62 tom 22
}
23
 
136 tom 24
$query = $query . " ORDER BY DatePosted DESC";
134 tom 25
 
62 tom 26
$ids = $page->findIDs('BlogPosts', $query);
22 freddie 27
for ($i = 0; $i < count($ids); $i++)
16 freddie 28
{
22 freddie 29
    $id = $ids[$i];
30
    $post = $page->getBlogPost($id);
120 tom 31
 
104 tom 32
    write('<a href="post.php?id=' . $id . '"><h3>' . $post->title. '</h3></a>');
22 freddie 33
    write('<h5 style="color: #666666;">Posted On ' . date('l j F Y', $post->datePosted) . ' by ' . $post->user->name . ' (' . $post->user->username . ')</h5>');
175 tom 34
    write('<p>' . $page->replaceBBCode($post->content) . '</p>');
120 tom 35
    write('<br />');
16 freddie 36
}
37
 
38
$page->drawFooter();
39
 
40
?>