Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 11 → Rev 18

/blog/index.php
1,30 → 1,39
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Blog Posts', '../');
$page->drawHeader();
write('<h3>Blog</h3>');
$page->drawMenuItem('Computing', 'index.php?cat=Computing');
$page->drawMiddle();
 
if ($page->isUserGM($page->getLoggedInUser()))
{
write('<p class="bold"><a href="add-post.php">Add Post</a></p>');
write('<br />');
}
 
$ids = $page->findIDs('BlogPosts');
for ($i = 0; $i < count($ids); $i++)
{
$id = $ids[$i];
$post = $page->getBlogPost($id);
write('<h3>' . $post->title. '</h3>');
write('<h5 style="color: #666666;">Posted On ' . date('l j F Y', $post->datePosted) . ' by ' . $post->user->name . ' (' . $post->user->username . ')</h5>');
write('<p>' . $post->content . '</p>');
}
 
$page->drawFooter();
 
?>
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Blog Posts', '../');
$page->drawHeader();
write('<h3>Blog</h3>');
$page->drawMenuItem('Computing', 'index.php?cat=Computing');
$page->drawMiddle();
 
if ($page->isUserGM($page->getLoggedInUser()))
{
write('<p class="bold"><a href="add-post.php">Add Post</a></p>');
write('<br />');
}
 
if (isset($_GET['post']))
{
 
}
else
{
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1');
for ($i = 0; $i < count($ids); $i++)
{
$id = $ids[$i];
$post = $page->getBlogPost($id);
if ($post->ParentID == -1)
{
write('<h3>' . $post->title. '</h3>');
write('<h5 style="color: #666666;">Posted On ' . date('l j F Y', $post->datePosted) . ' by ' . $post->user->name . ' (' . $post->user->username . ')</h5>');
write('<p>' . $post->content . '</p>');
}
}
}
 
$page->drawFooter();
 
?>
/admin/index.php
9,16 → 9,16
$page->checkLoggedIn();
$user = $page->getLoggedInUser();
 
write('<h3><a href="account.php?id=' . $user->ID. '">Manage Account</a></h3>');
write('<h4><a href="account.php?id=' . $user->ID. '">Manage Account</a></h4>');
 
if ($page->isUserAdmin($user))
{
write('<h3><a href="all-accounts.php">Manage All Accounts</a></h3>');
write('<h3><a href="all-blog-posts.php">Manage All Blog Posts</a></h3>');
write('<h3><a href="all-blog-comments.php">Manage All Blog Comments</a></h3>');
write('<h3><a href="all-forum-categories.php">Manage All Forum Categories</a></h3>');
write('<h3><a href="all-forum-topics.php">Manage All Forum Topics</a></h3>');
write('<h3><a href="all-forum-posts.php">Manage All Forum Posts</a></h3>');
write('<h4><a href="all-accounts.php">Manage All Accounts</a></h4>');
write('<h4><a href="all-blog-posts.php">Manage All Blog Posts</a></h4>');
write('<h4><a href="all-blog-comments.php">Manage All Blog Comments</a></h4>');
write('<h4><a href="all-forum-categories.php">Manage All Forum Categories</a></h4>');
write('<h4><a href="all-forum-topics.php">Manage All Forum Topics</a></h4>');
write('<h4><a href="all-forum-posts.php">Manage All Forum Posts</a></h4>');
}
 
$page->drawFooter();
/install.sql
18,23 → 18,12
CREATE TABLE BlogPosts
(
ID INT NOT NUll AUTO_INCREMENT,
ParentID INT,
AuthorID INT,
Title TEXT,
Content TEXT,
DatePosted DATETIME,
Category TEXT,
PRIMARY KEY(ID)
);
 
CREATE TABLE BlogComments
(
ID INT NOT NUll AUTO_INCREMENT,
ParentID INT,
AuthorID INT,
PostID INT,
Title TEXT,
Content TEXT,
DatePosted DATETIME,
Spam BOOLEAN,
PRIMARY KEY(ID)
);
83,4 → 72,4
);
 
INSERT INTO Users VALUES (1, 0, "admin", SHA1("password"), "admins@tim32.org", "Tim32 Admin", 0);
INSERT INTO BlogPosts VALUES(1, 1, "Welcome to Tim32!", "Welcome to the new Tim32 website! It has had a complete design re-think to make it simpler and easier to use!", NOW(), "Tim32");
INSERT INTO BlogPosts VALUES(1, -1, 1, "Welcome to Tim32!", "Welcome to the new Tim32 website! It has had a complete design re-think to make it simpler and easier to use!", NOW(), "Tim32", FALSE);
/index.php
22,7 → 22,7
 
<?php
 
$ids = $page->findIDs('BlogPosts');
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1');
for ($i = 0; $i < 5 && $i < count($ids); $i++)
{
$id = $ids[$i];
/_taios.php
268,6 → 268,28
$this->drawError('Cannot find blog post, #' . $id);
}
function getGetID()
{
$id = $_GET['id'];
if (empty($id))
{
$id = 1;
}
return $id;
}
function getPostID()
{
$id = $_POSt['id'];
if (empty($id))
{
$id = 1;
}
return $id;
}
}
 
class User