/projects/index.php |
---|
File deleted |
/wiki/index.php |
---|
File deleted |
/forums/index.php |
---|
File deleted |
/photos/index.php |
---|
File deleted |
/admin/all-blog-posts.php |
---|
File deleted |
/admin/all-accounts.php |
---|
File deleted |
/admin/account-do.php |
---|
50,4 → 50,3 |
$page->redirect('account.php?id=' . $userID); |
?> |
/admin/account.php |
---|
57,4 → 57,3 |
$page->drawFooter(); |
?> |
/admin/index.php |
---|
15,7 → 15,7 |
{ |
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-projects.php">Manage All Projects</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>'); |
24,4 → 24,3 |
$page->drawFooter(); |
?> |
/blog/add-post.php |
---|
File deleted |
/blog/del-post.php |
---|
File deleted |
/blog/index.php |
---|
4,33 → 4,24 |
$page = new Taios_Page('Blog Posts', '../'); |
$page->drawHeader(); |
$page->drawBlogCategoriesMenu(); |
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?id=-1">Add Post</a></p>'); |
write('<p class="bold"><a href="add-post.php">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 />'); |
} |
$ids = $page->findIDs('BlogPosts', $query); |
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1'); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$id = $ids[$i]; |
$post = $page->getBlogPost($id); |
write('<a href="post.php?id=' . $id . '"><h3>' . $post->title. '</h3></a>'); |
write('<a href="post.php?id=' . $ids[$i] . '"><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>' . $post->content . '</p>'); |
write('<br />'); |
} |
/blog/post-add.php |
---|
0,0 → 1,56 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Blog Posts', '../'); |
if (isset($_POST['title']) && isset($_POST['content']) && isset($_POST['catagory']) && isset($_POST['parentID'])) |
{ |
$page->query('insert into BlogPosts VALUES(0, ' . $_POST['parentID'] . ', "' . $page->getLoggedInUser. '", "' . $_POST['title'] . '", "' . $_POST['content'] . '", NOW(), "' . $_POST['catagory'] . '", 0)'); |
$page->redirect("index.php"); |
} |
$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 />'); |
} |
?> |
<form action="post-add.php" method="post"> |
<table> |
<tr> |
<td class="bold">Title: </td> |
<td><input type="text" name="title" /></td> |
</tr> |
<tr> |
<td class="bold">Content: </td> |
<td><input type="text" name="content" /></td> |
</tr> |
<tr> |
<td class="bold">Catagory: </td> |
<td><input type="text" name="catagory" /></td> |
</tr> |
<?php |
write('<input type="hidden" name="parentID" value="' . $_GET['id'] . '"/>'); |
?> |
<tr> |
<td class="bold"></td> |
<td><input type="submit" value="Post" /></td> |
</tr> |
</table> |
</form> |
<?php |
$page->drawFooter(); |
?> |
/blog/post.php |
---|
4,13 → 4,22 |
$page = new Taios_Page('Blog Posts', '../'); |
if (!isset($_GET['id'])) |
$page->redirect("index.php"); |
$page->drawHeader(); |
$page->drawBlogCategoriesMenu(); |
write('<h3>Blog</h3>'); |
$page->drawMenuItem('Computing', 'index.php?cat=Computing'); |
$page->drawMiddle(); |
$page->drawBlogPostTree($page->getGetID(), true); |
if ($page->isUserGM($page->getLoggedInUser())) |
{ |
write('<p class="bold"><a href="add-post.php">Add Post</a></p>'); |
write('<br />'); |
} |
$page->drawBlogPostTree($_GET['id']); |
$page->drawFooter(); |
?> |
/_taios.php |
---|
51,7 → 51,7 |
write('<br />'); |
if ($this->isLoggedIn()) |
{ |
$this->drawMenuItem('Administration', 'admin/'); |
$this->drawMenuItem('Manage Account', 'admin/account.php?id=' . $this->getLoggedInUser()->ID); |
$this->drawMenuItem('Logout', 'logout-do.php'); |
} |
else |
67,7 → 67,7 |
function drawMenuItem($t, $u) |
{ |
write('<p><a href="' . $this->url . $u . '">' . $t . '</a></p>'); |
write('<p><a href="' . $this->url . $u . '"</a>' . $t . '</a></p>'); |
} |
function drawMiddle() |
95,7 → 95,7 |
$this->drawnFooter = true; |
} |
die(); |
// die(); |
} |
function drawError($text, $die = true) |
112,57 → 112,26 |
} |
} |
function drawBlogPostTree($id, $first = false) |
function drawBlogPostTree($id) |
{ |
$post = $this->getBlogPost($id); |
if ($first) |
write('<h3><a href="post.php?id=' . $id . '">' . $post->title. '</a> <a href="post.php?id=' . $post->parent->ID . '">^</a></h3>'); |
else |
write('<a href="post.php?id=' . $id . '"><h3>' . $post->title. '</h3></a>'); |
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>'); |
write('<br />'); |
if ($this->isUserNormal($this->getLoggedInUser())) |
{ |
echo '<p class="bold"><a href="add-post.php?id=' . $id . '">Add Comment</a>'; |
if ($this->isUserAdmin($this->getLoggedInUser()) || $this->getLoggedInUser() == $post->author->ID) |
echo ' · <a href="del-post.php?id=' . $id . '">Delete Post</a>'; |
write('</p><br />'); |
} |
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID=' . $id); |
for ($i = 0; $i < count($ids); $i++) |
{ |
write('<div class="indent">'); |
write('<p class="indent">'); |
$this->drawBlogPostTree($ids[$i]); |
write('</div>'); |
write('</p>'); |
} |
} |
function drawBlogCategoriesMenu() |
{ |
$cats = array(); |
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID = -1'); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$cat = $this->getBlogPost($ids[$i])->category; |
if (!in_array($cat, $cats)) |
{ |
array_push($cats, $cat); |
} |
} |
write('<h3>Categories</h3>'); |
for ($i = 0; $i < count($cats); $i++) |
{ |
$this->drawMenuItem($cats[$i], 'blog/index.php?cat=' . $cats[$i]); |
} |
} |
function redirect($u) |
function redirect($url) |
{ |
header('Location: ' . $u); |
header('Location: ' . $url); |
die(); |
} |
313,8 → 282,7 |
{ |
$post->parent = $this->getBlogPost($row['ParentID']); |
} |
$post->author = $this->getUserByID($row['AuthorID']); |
$post->user = $this->getUserByID($row['AuthorID']); // For some older pages |
$post->user = $this->getUserByID($row['AuthorID']); |
$post->title = $row['Title']; |
$post->content = $row['Content']; |
$post->datePosted = strtotime($row['DatePosted']); |
327,15 → 295,6 |
$this->drawError('Cannot find blog post, #' . $id); |
} |
function delBlogPost($id) |
{ |
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID=' . $id); |
for ($i = 0; $i < count($ids); $i++) |
$this->delBlogPost($ids[$i]); |
$this->query('delete from BlogPosts where ID=' . $id); |
} |
function getGetID() |
{ |
$id = $_GET['id']; |
/styles.css |
---|
63,15 → 63,6 |
background-color: #B5D7FF; |
} |
table { |
border: 1px solid #222222; |
} |
td { |
padding: 3px; |
border: 1px solid #888888; |
} |
.sidebar { |
left: 0px; |
top: 0px; |
111,6 → 102,7 |
left: 200px; |
top: 0px; |
position: absolute; |
width: 720px; |
margin-right: 32px; |
} |
118,7 → 110,6 |
font-weight: bold; |
} |
.indent { |
margin-left: 14px; |
border-left: 1px solid #BBBBBB; |
p.indent { |
margin-left: 5em; |
} |
/index.php |
---|
34,6 → 34,12 |
write('<br />'); |
} |
if ($page->isLoggedIn()) |
{ |
write('<h3>Actions</h3>'); |
write('<h4><a href="admin/account.php?id=' . $page->getLoggedInUser()->ID . '">Manage Account</a></h4>'); |
} |
$page->drawFooter(); |
?> |