Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 56 → Rev 75

/_taios.php
51,7 → 51,7
write('<br />');
if ($this->isLoggedIn())
{
$this->drawMenuItem('Manage Account', 'admin/account.php?id=' . $this->getLoggedInUser()->ID);
$this->drawMenuItem('Administration', 'admin/';
$this->drawMenuItem('Logout', 'logout-do.php');
}
else
115,9 → 115,15
function drawBlogPostTree($id)
{
$post = $this->getBlogPost($id);
write('<h3>' . $post->title. '</h3>');
write('<a href="' . $this->url . 'blog/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 />');
}
 
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID=' . $id);
for ($i = 0; $i < count($ids); $i++)
126,12 → 132,32
$this->drawBlogPostTree($ids[$i]);
write('</div>');
}
 
}
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($url)
function redirect($u)
{
header('Location: ' . $url);
header('Location: ' . $u);
die();
}
/admin/all-accounts.php
0,0 → 1,39
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Manage All Accounts', '../');
$page->drawHeader();
$page->drawMiddle();
 
$page->checkLoggedIn();
 
if ($page->isUserAdmin($page->getLoggedInUser())))
{
write('<table>');
 
$ids = $page->findIDs('Users');
for ($i = 0; $i < count($ids); $i++)
{
$user = $page->getUserByID($ids[$i]);
write('<tr>');
write('<td>' . $user->ID . '</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('</tr>');
}
write('</table>');
}
else
{
drawError('You do not have permission to access this page.');
}
 
$page->drawFooter();
 
?>
 
/admin/account-do.php
50,3 → 50,4
$page->redirect('account.php?id=' . $userID);
 
?>
 
/admin/account.php
57,3 → 57,4
$page->drawFooter();
 
?>
 
/admin/index.php
24,3 → 24,4
$page->drawFooter();
 
?>
 
/styles.css
63,6 → 63,10
background-color: #B5D7FF;
}
 
table, td {
border: 1px solid #222222;
}
 
.sidebar {
left: 0px;
top: 0px;
/index.php
34,12 → 34,6
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();
 
?>
/blog/post.php
8,18 → 8,12
$page->redirect("index.php");
 
$page->drawHeader();
write('<h3>Blog</h3>');
$page->drawMenuItem('Computing', 'index.php?cat=Computing');
$page->drawBlogCategoriesMenu();
$page->drawMiddle();
 
if ($page->isUserGM($page->getLoggedInUser()))
{
write('<p class="bold"><a href="add-post.php?id="' . $_GET['id'] . '">Add Comment</a></p>');
write('<br />');
}
 
$page->drawBlogPostTree($_GET['id']);
 
$page->drawFooter();
 
?>
 
/blog/index.php
4,8 → 4,7
 
$page = new Taios_Page('Blog Posts', '../');
$page->drawHeader();
write('<h3>Blog</h3>');
$page->drawMenuItem('Computing', 'index.php?cat=Computing');
$page->drawBlogCategoriesMenu();
$page->drawMiddle();
 
if ($page->isUserGM($page->getLoggedInUser()))
14,7 → 13,15
write('<br />');
}
 
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1');
$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);
for ($i = 0; $i < count($ids); $i++)
{
$id = $ids[$i];
/blog/post-add.php
6,13 → 6,12
 
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->query('insert into BlogPosts VALUES(0, ' . $_POST['parentID'] . ', "' . $page->getLoggedInUser()->ID . '", "' . $_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->drawBlogCategoriesMenu();
$page->drawMiddle();
 
if ($page->isUserGM($page->getLoggedInUser()))