Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 75 → Rev 134

/blog/post-add.php
File deleted
/blog/index.php
13,7 → 13,7
write('<br />');
}
 
$query = 'WHERE ParentID = -1';
$query = 'HERE ParentID = -1';
 
if (isset($_GET['cat']))
{
21,17 → 21,20
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);
write('<a href="post.php?id=' . $ids[$i] . '"><h3>' . $post->title. '</h3></a>');
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>' . $post->content . '</p>');
write('<br />');
}
 
 
$page->drawFooter();
 
?>
/blog/add-post.php
0,0 → 1,91
<?php
 
function getParentID()
{
if (isset($_GET['id']))
{
return $_GET['id'];
}
else
{
return -1;
}
}
 
require '../_taios.php';
 
$page = new Taios_Page('Blog Posts', '../');
$page->checkLoggedIn();
 
$error = '';
 
if (isset($_POST['post']))
{
$title = $_POST['title'];
$content = $_POST['content'];
$parentID = $_POST['parentID'];
$category = $_POST['category'];
 
if (empty($title))
{
$error = "No Title Specified";
}
else if (empty($content))
{
$error = "No Content Specified";
}
else if (empty($parentID))
{
$error = "No Parent ID Specified";
}
else
{
$page->query('INSERT INTO BlogPosts VALUES(0, ' . $parentID . ', "' . $page->getLoggedInUser()->ID . '", "' . $title . '", "' . $content . '", NOW(), "' . $category . '", 0)');
$page->redirect('index.php');
}
}
 
$page->drawHeader();
$page->drawBlogCategoriesMenu();
$page->drawMiddle();
 
if (!empty($error))
{
$page->drawError($error, false);
}
 
?>
 
<form action="add-post.php?id=<?php echo getParentID(); ?>" method="post">
<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" style="width: 500px; height: 300px;"></textarea></td>
</tr>
<tr>
<td class="bold">Catagory: </td>
<td><input type="text" name="category" /></td>
</tr>
 
<input type="hidden" name="post" value="yes" />
 
<?php
write('<input type="hidden" name="parentID" value="' . getParentID() . '" />');
?>
 
<tr>
<td class="bold"></td>
<td><input type="submit" value="Post" /></td>
</tr>
</table>
</form>
 
<?php
 
$page->drawFooter();
 
?>
/blog/post.php
4,14 → 4,16
 
$page = new Taios_Page('Blog Posts', '../');
 
if (!isset($_GET['id']))
$page->redirect("index.php");
if (empty($_GET['id']))
{
$page->redirect('index.php');
}
 
$page->drawHeader();
$page->drawBlogCategoriesMenu();
$page->drawMiddle();
 
$page->drawBlogPostTree($_GET['id']);
$page->drawBlogPostTree($page->getGetID(), true);
 
$page->drawFooter();
 
/blog/del-post.php
0,0 → 1,27
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Delete Blog Post', '../');
 
$id = $_GET['id'];
if ($id)
{
if ($page->isUserAdmin($page->getLoggedInUser()) || $page->getLoggedInUser()->ID == $page->getBlogPost($id)->author->ID)
{
$page->delBlogPost($id);
}
else
{
$page->drawError('You do not have permission to access this page.');
}
}
else
{
$page->drawError('No ID Specified');
}
 
$page->redirect('index.php');
 
?>
 
/index.php
22,7 → 22,7
 
<?php
 
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1');
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1 ORDER BY DatePosted DESC');
for ($i = 0; $i < 5 && $i < count($ids); $i++)
{
$id = $ids[$i];
/_taios.php
51,7 → 51,7
write('<br />');
if ($this->isLoggedIn())
{
$this->drawMenuItem('Administration', 'admin/';
$this->drawMenuItem('Administration', 'admin/');
$this->drawMenuItem('Logout', 'logout-do.php');
}
else
112,17 → 112,22
}
}
function drawBlogPostTree($id)
function drawBlogPostTree($id, $first = false)
{
$post = $this->getBlogPost($id);
write('<a href="' . $this->url . 'blog/post.php?id=' . $id . '"><h3>' . $post->title. '</h3></a>');
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('<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()))
{
write('<p class="bold"><a href="add-commend.php?id="' . $id . '">Add Comment</a></p>');
write('<br />');
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 ' &middot <a href="del-post.php?id=' . $id . '">Delete Post</a>';
write('</p><br />');
}
 
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID=' . $id);
308,7 → 313,8
{
$post->parent = $this->getBlogPost($row['ParentID']);
}
$post->user = $this->getUserByID($row['AuthorID']);
$post->author = $this->getUserByID($row['AuthorID']);
$post->user = $this->getUserByID($row['AuthorID']); // For some older pages
$post->title = $row['Title'];
$post->content = $row['Content'];
$post->datePosted = strtotime($row['DatePosted']);
321,6 → 327,15
$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'];
/projects/index.php
0,0 → 1,14
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Projects', '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
 
$page->drawFooter();
 
?>
 
/wiki/index.php
0,0 → 1,14
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Wiki', '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
 
$page->drawFooter();
 
?>
 
/forums/index.php
0,0 → 1,14
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Forums', '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
 
$page->drawFooter();
 
?>
 
/photos/index.php
0,0 → 1,14
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Photos', '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
 
$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-blog-comments.php">Manage All Blog Comments</a></h4>');
write('<h4><a href="all-projects.php">Manage All Projects</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>');
/admin/all-blog-posts.php
0,0 → 1,60
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Manage All Blog Posts', '../');
$page->drawHeader();
$page->drawMiddle();
 
$page->checkLoggedIn();
 
if ($page->isUserAdmin($page->getLoggedInUser()))
{
write('<p class="bold">Use this to manage all the blog posts on the Tim32 Website.</p><br />');
write('<table>');
write('<tr>');
write('<td class="bold">ID</td>');
write('<td class="bold">Parent</td>');
write('<td class="bold">Author</td>');
write('<td class="bold">Title</td>');
write('<td class="bold">Content</td>');
write('<td class="bold">Date Posted</td>');
write('<td class="bold">Category</td>');
write('<td class="bold">Spam</td>');
write('</tr>');
 
$ids = $page->findIDs('BlogPosts');
for ($i = 0; $i < count($ids); $i++)
{
$post = $page->getBlogPost($ids[$i]);
write('<tr>');
write('<td><a href="../blog/edit-post.php?id=' . $post->ID . '">' . $post->ID . '</a></td>');
if ($post->parent == -1)
{
write('<td style="color: #444444;">No Parent</td>');
}
else
{
write('<td>' . $post->parent->title . '</td>');
}
write('<td><a href="account.php?id=' . $post->author->ID . '">' . $post->author->name . '</a></td>');
write('<td>' . $post->title . '</td>');
write('<td>' . $post->content . '</td>');
write('<td>' . date('j/m/Y H:i', $post->datePosted) . '</td>');
write('<td>' . $post->category . '</td>');
write('<td>' . $post->spam . '</td>');
write('</tr>');
}
write('</table>');
}
else
{
drawError('You do not have permission to access this page.');
}
 
$page->drawFooter();
 
?>
 
/admin/all-accounts.php
8,9 → 8,20
 
$page->checkLoggedIn();
 
if ($page->isUserAdmin($page->getLoggedInUser())))
if ($page->isUserAdmin($page->getLoggedInUser()))
{
write('<p class="bold">Use this to manage all the accounts on the Tim32 Website.</p><br />');
 
write('<table>');
write('<tr>');
write('<td class="bold">ID</td>');
write('<td class="bold">AccessID</td>');
write('<td class="bold">Username</td>');
write('<td class="bold">Password</td>');
write('<td class="bold">Name</td>');
write('<td class="bold">Email Address</td>');
write('<td class="bold">Challenge ID</td>');
write('</tr>');
 
$ids = $page->findIDs('Users');
for ($i = 0; $i < count($ids); $i++)
17,12 → 28,13
{
$user = $page->getUserByID($ids[$i]);
write('<tr>');
write('<td>' . $user->ID . '</td>');
write('<td><a href="account.php?id=' . $user->ID . '">' . $user->ID . '</a></td>');
write('<td>' . $user->accessID . '</td>');
write('<td>' . $user->username . '</td>');
write('<td>' . $user->password . '</td>');
write('<td>' . $user->name . '</td>');
write('<td>' . $user->email . '</td>');
write('<td>' . $user->emailAddress . '</td>');
write('<td>' . $user->challengeID . '</td>');
write('</tr>');
}
/styles.css
63,10 → 63,15
background-color: #B5D7FF;
}
 
table, td {
table {
border: 1px solid #222222;
}
 
td {
padding: 3px;
border: 1px solid #888888;
}
 
.sidebar {
left: 0px;
top: 0px;
106,7 → 111,6
left: 200px;
top: 0px;
position: absolute;
width: 720px;
margin-right: 32px;
}