/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(); |
?> |
/admin/index.php |
---|
9,16 → 9,16 |
$page->checkLoggedIn(); |
$user = $page->getLoggedInUser(); |
write('<h3><a href="account.php?id=' . $user->ID. '">Manage Account</a></h3>'); |
write('<h4><a href="account.php?id=' . $user->ID. '">Manage Account</a></h4>'); |
if ($page->isUserAdmin($user)) |
{ |
write('<h3><a href="all-accounts.php">Manage All Accounts</a></h3>'); |
write('<h3><a href="all-blog-posts.php">Manage All Blog Posts</a></h3>'); |
write('<h3><a href="all-blog-comments.php">Manage All Blog Comments</a></h3>'); |
write('<h3><a href="all-forum-categories.php">Manage All Forum Categories</a></h3>'); |
write('<h3><a href="all-forum-topics.php">Manage All Forum Topics</a></h3>'); |
write('<h3><a href="all-forum-posts.php">Manage All Forum Posts</a></h3>'); |
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-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>'); |
} |
$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) |
/blog/index.php |
---|
1,30 → 1,39 |
<?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 />'); |
} |
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1'); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$id = $ids[$i]; |
$post = $page->getBlogPost($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>'); |
} |
$page->drawFooter(); |
?> |
<?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($_GET['post'])) |
{ |
} |
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(); |
?> |
/install.sql |
---|
72,4 → 72,4 |
); |
INSERT INTO Users VALUES (1, 0, "admin", SHA1("password"), "admins@tim32.org", "Tim32 Admin", 0); |
INSERT INTO BlogPosts VALUES(1, 1, "Welcome to Tim32!", "Welcome to the new Tim32 website! It has had a complete design re-think to make it simpler and easier to use!", NOW(), "Tim32"); |
INSERT INTO BlogPosts VALUES(1, -1, 1, "Welcome to Tim32!", "Welcome to the new Tim32 website! It has had a complete design re-think to make it simpler and easier to use!", NOW(), "Tim32", FALSE); |