Subversion Repositories taios

Rev

Rev 474 | Rev 478 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

require '../_taios.php';

$page = new Taios_Page('Blog Posts', '../');
$page->drawHeader();
$page->drawBlogCategoriesMenu();
write('<br /><h3>RSS</h3>');
$page->drawMenuItem('RSS Feed', 'blog/rss.php');
$page->drawMiddle();

if ($page->isUserGM($page->getLoggedInUser()))
{
    write('<p class="bold"><a href="add-post.php?id=-1">Add Post</a></p>');
    write('<br />');
}

$query = 'WHERE ParentID = -1';

if (isset($_GET['cat']))
{
    $query = $query . ' AND Category = "' . $_GET['cat'] . '"';
    write('<p>Only showing blog posts from the ' . $_GET['cat'] . ' category. <a href="index.php">Reset Filtering</a></p><br />');
}

$query = $query . " ORDER BY DatePosted DESC";

$ids = $page->findIDs('BlogPosts', $query);
for ($i = 0; $i < count($ids); $i++)
{
    $id = $ids[$i];
    $post = $page->getBlogPost($id);

    $comment_count = 0;
    $ids2 = $page->findIDs('BlogPosts', 'WHERE ParentID=' . $id);
    for ($i = 0; $i < count($ids2); $i++)
    {
        $comment_count++;
    }
   
    write('<a href="post.php?id=' . $id . '"><h3>' . $post->title. '</h3></a>');
    write('<h5 style="color: #666666;">Posted On ' . date('l j F Y', $post->datePosted) . ' by ' . $post->user->name . ' (' . $post->user->username . ')</h5>');
    write('<p>' . $page->replaceBBCode($post->content) . '</p>');
    write('<h5 style="color: #666666;">' . $comment_count . ' Comments</h5>');
    write('<br />');
}

$page->drawFooter();

?>