(root)/blog/index.php - Rev 522
Rev 493 |
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';
$args = array();
if (isset($_GET['cat'])) {
$query = $query . " AND Category = ?";
array_push($args, $_GET['cat']);
write
('<p>Only showing blog posts from the ' . htmlentities($_GET['cat'], ENT_QUOTES) . ' category. <a href="index.php">Reset Filtering</a></p><br />');
}
if (!$page->isUserGM($page->getLoggedInUser())) {
$query = $query . ' AND Category != "Drafts"';
}
$query = $query . " ORDER BY DatePosted DESC";
foreach ($page->findIDs('BlogPosts', $query, $args) as $id) {
$post = $page->getBlogPost($id);
$ids2 = $page->findIDs('BlogPosts', 'WHERE ParentID="' . $id . '"');
write
('<a href="post.php?id=' . $id . '"><h3>' . htmlentities($post->title, ENT_QUOTES). '</h3></a>');
write
('<h5 style="color: #666666;">Posted On ' . date('l j F Y', $post->datePosted) . ' by ' . htmlentities($post->user->name, ENT_QUOTES) . ' (' . htmlentities($post->user->username, ENT_QUOTES) . ')</h5>');
write
('<p>' . $page->replaceBBCode($post->content) . '</p>');
write
('<h5 style="color: #666666;"><a href="post.php?id=' . $id . '">' . count($ids2) . ' Comments</a></h5>');
write
('<br />');
}
$page->drawFooter();
?>