Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 18 → Rev 22

/blog/post.php
0,0 → 1,32
<?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($_POST['id']))
{
$post = $page->getBlogPost($_POST['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>');
}
else
{
write('<h3>Fail</h3>');
write('<p>No Post ID Given</p>');
}
 
$page->drawFooter();
 
?>
/blog/index.php
14,26 → 14,17
write('<br />');
}
 
if (isset($_GET['post']))
$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=' . $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>');
}
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/account.php
0,0 → 1,47
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Manager Account', '../');
$page->drawHeader();
$page->drawMiddle();
 
$page->checkLoggedIn();
 
$userID = $page->getGetID();
$user = $page->getUserByID($userID);
 
if (($page->getLoggedInUser()->ID == $userID || $page->isUserAdmin($page->getLoggedInUser())) && $user)
{
?>
 
<p class="bold">Here you can edit your account.</p>
<p>Only change the password value if you want to change your password.</p>
<br />
 
<table>
<tr><td class="bold">ID: </td><td><?php echo $user->ID; ?></td></tr>
<tr><td class="bold">AccessID: </td><td><?php echo $user->accessID; ?></td></tr>
<tr><td class="bold">Username: </td><td><?php echo $user->username; ?></td></tr>
<tr><td class="bold">Password: </td><td><input type="password" name="password" /></td></tr>
<tr><td class="bold">Email Address: </td><td><input type="text" name="email" value="<?php echo $user->emailAddress; ?>" /></td></tr>
<tr><td class="bold">Name: </td><td><input type="text" name="name" value="<?php echo $user->name; ?>" /></td></tr>
</table>
 
<?php
}
else
{
if (!$user)
{
drawError('No such user, #' . $userID);
}
else
{
drawError('You do not have permission to access this page.');
}
}
 
$page->drawFooter();
 
?>
/_taios.php
257,11 → 257,20
{
$post = new BlogPost;
$post->ID = $row['ID'];
if ($row['ParentID'] == -1)
{
$post->parent = -1;
}
else
{
$post->parent = $this->getBlogPost($row['ParentID']);
}
$post->user = $this->getUserByID($row['AuthorID']);
$post->title = $row['Title'];
$post->content = $row['Content'];
$post->datePosted = strtotime($row['DatePosted']);
$post->category = $row['Category'];
$post->spam = $row['Spam'];
return $post;
}
306,11 → 315,13
class BlogPost
{
public $ID;
public $parent;
public $author;
public $title;
public $content;
public $datePosted;
public $category;
public $spam;
}
 
function write($str)