/forums/delete-post-do.php |
---|
0,0 → 1,30 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Delete Post', '../'); |
$page->checkLoggedIn(); |
$id = $page->getGetID(); |
$post = $page->getForumPost($id); |
if (($page->isUserAdmin($page->getLoggedInUser()) || $post->author->ID == $page->getLoggedInUser()->ID) && $post) |
{ |
$page->query('DELETE FROM ForumPosts WHERE ID = ' . $id); |
$page->redirect('index.php'); |
} |
else |
{ |
if (!$post) |
{ |
$page->drawError('No such forum post, #' . $id); |
} |
else |
{ |
$page->drawError('You do not have permission to access this page.'); |
} |
} |
?> |
/forums/post.php |
---|
9,17 → 9,33 |
$id = $page->getGetID(); |
$forumPost = $page->getForumPost($id); |
write('<p class="bold"><a href="index.php?parentID=' . $forumPost->category->ID . '">Back to Topics</a></p><br />'); |
write('<h3>' . $forumPost->title . '</h3>'); |
write('<h5 style="color: #666666;">Posted On ' . date('l j F Y', $forumPost->datePosted) . ' by ' . $forumPost->author->name . ' (' . $forumPost->author->username . ')</h5>'); |
write('<p>' . $page->replaceBBCode($forumPost->content) . '</p>'); |
if ($page->isLoggedIn()) |
{ |
write('<p class="bold"><a href="add-post.php?parentID=' . $id . '">Post Reply</a>'); |
if ($page->isUserAdmin($page->getLoggedInUser()) || $forumPost->author->ID == $page->getLoggedInUser()->ID) |
{ |
write(' · <a href="edit-post.php?id=' . $id . '">Edit Post</a>'); |
write(' · <a href="delete-post-do.php?id=' . $id . '">Delete Post</a>'); |
} |
write('</p>'); |
} |
write('<br />'); |
$ids = $page->findIDs('ForumPosts', 'WHERE ParentID = ' . $id . ' ORDER BY DatePosted DESC'); |
$ids = $page->findIDs('ForumPosts', 'WHERE ParentID = ' . $id . ' ORDER BY DatePosted ASC'); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$forumPost = $page->getForumPost($ids[$i]); |
write('<h4>' . $forumPost->title . '</h4>'); |
write('<h5 style="color: #666666;">Posted On ' . date('l j F Y', $forumPost->datePosted) . ' by ' . $forumPost->author->name . ' (' . $forumPost->author->username . ')</h5>'); |
write('<p>' . $page->replaceBBCode($forumPost->content) . '</p>'); |
if ($page->isUserAdmin($page->getLoggedInUser()) || $forumPost->author->ID == $page->getLoggedInUser()->ID) |
{ |
write('<p class="bold"><a href="edit-post.php?id=' . $ids[$i] . '">Edit Post</a>'); |
write(' · <a href="delete-post-do.php?id=' . $ids[$i] . '">Delete Post</a></p>'); |
} |
write('<br />'); |
} |
/forums/add-post-do.php |
---|
0,0 → 1,36 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Add Category', '../'); |
$page->checkLoggedIn(); |
$parentID = $_POST['parentID']; |
if (empty($parentID)) |
{ |
$parentID = -1; |
} |
$categoryID = $_POST['categoryID']; |
if (empty($categoryID)) |
{ |
$parentID = -1; |
} |
$title = $_POST['title']; |
$content = $_POST['content']; |
if (empty($title)) |
{ |
$page->redirect('add-post.php?error=No Title Specified'); |
} |
if (empty($title)) |
{ |
$page->redirect('add-post.php?error=No Content Specified'); |
} |
$page->query('INSERT INTO ForumPosts VALUES (0, ' .$page->getLoggedInUser()->ID . ', ' . $categoryID . ', ' . $parentID . ', "' . $title . '", "' . $content . '", NOW(), FALSE)'); |
$page->redirect('index.php?parentID=' . $categoryID); |
?> |
/forums/add-post.php |
---|
0,0 → 1,62 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Add Post', '../'); |
$page->drawHeader(); |
$page->drawMiddle(); |
$page->checkLoggedIn(); |
$parentID = $_GET['parentID']; |
if (empty($parentID)) |
{ |
$parentID = -1; |
} |
$categoryID = $_GET['categoryID']; |
if (empty($categoryID)) |
{ |
$categoryID = -1; |
} |
if ($page->isLoggedIn()) |
{ |
if (isset($_GET['error'])) |
{ |
$page->drawError($_GET['error'], false); |
} |
?> |
<form action="add-post-do.php" method="POST"> |
<input type="hidden" name="parentID" value="<?php echo $parentID; ?>" /> |
<input type="hidden" name="categoryID" value="<?php echo $categoryID; ?>" /> |
<table> |
<tr> |
<td class="bold">Title: </td> |
<td><input type="text" name="title" /></td> |
</tr> |
<tr> |
<td class="bold">Content: </td> |
<td><textarea name="content"></textarea></td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Add" /></td> |
</tr> |
</table> |
</form> |
<?php |
} |
else |
{ |
$page->drawError('You do not have permission to access this page.'); |
} |
$page->drawFooter(); |
?> |
/forums/index.php |
---|
12,6 → 12,29 |
$parentID = -1; |
} |
write('<p class="bold">'); |
if ($parentID != -1) |
{ |
write('<a href="index.php?parentID=-1">Back to root</a>'); |
} |
if ($page->isLoggedIn()) |
{ |
if ($parentID != -1) |
{ |
write(' · '); |
} |
write('<a href="add-post.php?categoryID=' . $parentID . '">Add Post</a>'); |
} |
if ($page->isUserAdmin($page->getLoggedInUser())) |
{ |
if ($page->isLoggedIn()) |
{ |
write(' · '); |
} |
write('<a href="add-category.php?parentID=' . $parentID . '">Add Category</a>'); |
} |
write('</p><br />'); |
$ids = $page->findIDs('ForumCategories', 'WHERE ParentID = ' . $parentID . ' ORDER BY Title ASC'); |
if (count($ids) >= 1) |
24,6 → 47,10 |
$forumCategory = $page->getForumCategory($ids[$i]); |
write('<h4><a href="index.php?parentID=' . $forumCategory->ID . '">' . $forumCategory->title . '</a></h4>'); |
write('<p>' . $forumCategory->description . '</p>'); |
if ($page->isUserAdmin($page->getLoggedInUser())) |
{ |
write('<p class="bold"><a href="edit-category.php?id=' . $forumCategory->ID . '">Edit Category</a> · <a href="delete-category-do.php?id=' . $forumCategory->ID . '">Delete Category</a></p>'); |
} |
write('<br />'); |
} |
/forums/edit-category.php |
---|
0,0 → 1,59 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Edit Category', '../'); |
$page->drawHeader(); |
$page->drawMiddle(); |
$page->checkLoggedIn(); |
$id = $page->getGetID(); |
$cat = $page->getForumCategory($id); |
if ($page->isUserAdmin($page->getLoggedInUser()) && $cat) |
{ |
if (isset($_GET['error'])) |
{ |
$page->drawError($_GET['error'], false); |
} |
?> |
<form action="edit-category-do.php" method="POST"> |
<input type="hidden" name="id" value="<?php echo $id; ?>" /> |
<table> |
<tr> |
<td class="bold">Title: </td> |
<td><input type="text" name="title" value="<?php echo $cat->title; ?>" /></td> |
</tr> |
<tr> |
<td class="bold">Description: </td> |
<td><input type="text" name="description" value="<?php echo $cat->description; ?>" /></td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Edit" /></td> |
</tr> |
</table> |
</form> |
<?php |
} |
else |
{ |
if (!$cat) |
{ |
$page->drawError('No such Forum Category, #' . $id); |
} |
else |
{ |
$page->drawError('You do not have permission to access this page.'); |
} |
} |
$page->drawFooter(); |
?> |
/forums/edit-category-do.php |
---|
0,0 → 1,30 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Edit Category', '../'); |
$page->checkLoggedIn(); |
$id = $page->getPostID(); |
$title = $_POST['title']; |
$description = $_POST['description']; |
if ($page->isUserAdmin($page->getLoggedInUser())) |
{ |
if (empty($title)) |
{ |
$page->redirect('edit-category.php?error=No Title Specified'); |
} |
$page->query('UPDATE ForumCategories SET Title = "' . $title . '", Description = "' . $description . '" WHERE ID = ' . $id); |
$page->redirect('index.php'); |
} |
else |
{ |
$page->drawError('You do not have permission to access this page.'); |
} |
?> |
/forums/delete-category-do.php |
---|
0,0 → 1,22 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Delete Category', '../'); |
$page->checkLoggedIn(); |
$id = $page->getGetID(); |
if ($page->isUserAdmin($page->getLoggedInUser())) |
{ |
$page->query('DELETE FROM ForumCategories WHERE ID = ' . $id); |
$page->redirect('index.php'); |
} |
else |
{ |
$page->drawError('You do not have permission to access this page.'); |
} |
?> |
/forums/add-category-do.php |
---|
0,0 → 1,34 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Add Category', '../'); |
$page->checkLoggedIn(); |
$parentID = $_POST['parentID']; |
if (empty($parentID)) |
{ |
$parentID = -1; |
} |
$title = $_POST['title']; |
$description = $_POST['description']; |
if ($page->isUserAdmin($page->getLoggedInUser())) |
{ |
if (empty($title)) |
{ |
$page->redirect('add-category.php?error=No Title Specified'); |
} |
$page->query('INSERT INTO ForumCategories VALUES (0, ' . $parentID . ', "' . $title . '", "' . $description . '")'); |
$page->redirect('index.php?parentID=' . $parentID); |
} |
else |
{ |
$page->drawError('You do not have permission to access this page.'); |
} |
?> |
/forums/add-category.php |
---|
0,0 → 1,55 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Add Category', '../'); |
$page->drawHeader(); |
$page->drawMiddle(); |
$page->checkLoggedIn(); |
$parentID = $_GET['parentID']; |
if (empty($parentID)) |
{ |
$parentID = -1; |
} |
if ($page->isUserAdmin($page->getLoggedInUser())) |
{ |
if (isset($_GET['error'])) |
{ |
$page->drawError($_GET['error'], false); |
} |
?> |
<form action="add-category-do.php" method="POST"> |
<input type="hidden" name="parentID" value="<?php echo $parentID; ?>" /> |
<table> |
<tr> |
<td class="bold">Title: </td> |
<td><input type="text" name="title" /></td> |
</tr> |
<tr> |
<td class="bold">Description: </td> |
<td><input type="text" name="description" /></td> |
</tr> |
<tr> |
<td></td> |
<td><input type="submit" value="Add" /></td> |
</tr> |
</table> |
</form> |
<?php |
} |
else |
{ |
$page->drawError('You do not have permission to access this page.'); |
} |
$page->drawFooter(); |
?> |
/wiki/edit-do.php |
---|
10,6 → 10,8 |
$page = new Taios_Page('Edit Page - ' . $pageName, '../'); |
$page->checkLoggedIn(); |
if ($page->isUserGM($page->getLoggedInUser())) |
{ |
$filename = 'pages/' . $pageName . '.txt'; |
/wiki/edit.php |
---|
12,6 → 12,8 |
$page->drawHeader(); |
$page->drawMiddle(); |
$page->checkLoggedIn(); |
if ($page->isUserGM($page->getLoggedInUser())) |
{ |
$filename = 'pages/' . $pageName . '.txt'; |
/projects/edit-project.php |
---|
6,6 → 6,8 |
$page->drawHeader(); |
$page->drawMiddle(); |
$page->checkLoggedIn(); |
$project = $page->getProject($page->getGetID()); |
if (!$project) |
{ |
/projects/index.php |
---|
49,7 → 49,7 |
write('</table>'); |
if ($page->isUserAdmin($page->getLoggedInUser()) || $user->ID == $project->author->ID) |
{ |
write('<p><a href="edit-project.php?id=' . $project->ID . '">Edit Project</a> · <a href="delete-project-do.php?id=' . $project->ID . '">Delete Project</a></p>'); |
write('<p class="bold"><a href="edit-project.php?id=' . $project->ID . '">Edit Project</a> · <a href="delete-project-do.php?id=' . $project->ID . '">Delete Project</a></p>'); |
} |
write('<br />'); |
} |
/_taios.php |
---|
125,7 → 125,7 |
} |
write('<h5 style="color: #666666;">Posted On ' . date('l j F Y', $post->datePosted) . ' by ' . $post->user->name . ' (' . $post->user->username . ')</h5>'); |
write('<p>' . $this->replaceBBCode($post->content) . '</p>'); |
write('<br />'); |
if ($this->isUserNormal($this->getLoggedInUser())) |
{ |
echo '<p class="bold"><a href="add-post.php?id=' . $id . '">Add Comment</a>'; |
/styles.css |
---|
61,6 → 61,7 |
border: 1px solid #000000; |
color: #000000; |
background-color: #B5D7FF; |
width: 500px; |
} |
table { |
/admin/all-forum-posts.php |
---|
0,0 → 1,67 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Manage All Forum Posts', '../'); |
$page->drawHeader(); |
$page->drawMiddle(); |
$page->checkLoggedIn(); |
if ($page->isUserAdmin($page->getLoggedInUser())) |
{ |
write('<p class="bold">Use this to manage all the forum categories on the Tim32 Website.</p><br />'); |
write('<table>'); |
write('<tr>'); |
write('<td class="bold">ID</td>'); |
write('<td class="bold">Author</td>'); |
write('<td class="bold">Category</td>'); |
write('<td class="bold">Parent</td>'); |
write('<td class="bold">Title</td>'); |
write('<td class="bold">Content</td>'); |
write('<td class="bold">Date Posted</td>'); |
write('<td class="bold">Spam</td>'); |
write('</tr>'); |
$ids = $page->findIDs('ForumPosts'); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$post = $page->getForumPost($ids[$i]); |
write('<tr>'); |
write('<td><a href="../forums/post.php?id=' . $post->ID . '">' . $post->ID . '</a></td>'); |
write('<td><a href="account.php?id=' . $post->author->ID . '">' . $post->author->name . '</a></td>'); |
if (!$post->category) |
{ |
write('<td style="color: #444444;">No Category</td>'); |
} |
else |
{ |
write('<td>' . $post->category->title . '</td>'); |
} |
if (!$post->parent) |
{ |
write('<td style="color: #444444;">No Parent</td>'); |
} |
else |
{ |
write('<td>' . $post->parent->title . '</td>'); |
} |
write('<td>' . $post->title . '</td>'); |
write('<td>' . str_replace("\n", ' ', $post->content) . '</td>'); |
write('<td>' . date('j/m/Y H:i', $post->datePosted) . '</td>'); |
write('<td>' . $post->spam . '</td>'); |
write('</tr>'); |
} |
write('</table>'); |
} |
else |
{ |
$page->drawError('You do not have permission to access this page.'); |
} |
$page->drawFooter(); |
?> |
/admin/all-forum-categories.php |
---|
25,8 → 25,8 |
{ |
$cat = $page->getForumCategory($ids[$i]); |
write('<tr>'); |
write('<td><a href="index.php?parentID=' . $cat->ID . '">' . $cat->ID . '</a></td>'); |
if ($cat->parent == -1) |
write('<td><a href="../forums/index.php?parentID=' . $cat->ID . '">' . $cat->ID . '</a></td>'); |
if (!$cat->parent) |
{ |
write('<td style="color: #444444;">No Parent</td>'); |
} |