/admin/account.php |
---|
19,6 → 19,7 |
<p>Only change the password value if you want to change your password.</p> |
<br /> |
<form action="account-do.php" method="POST"> |
<table> |
<tr><td class="bold">ID: </td><td><?php echo $user->ID; ?></td></tr> |
<?php |
37,6 → 38,7 |
<tr><td class="bold">Name: </td><td><input type="text" name="name" value="<?php echo $user->name; ?>" /></td></tr> |
<tr><td></td><td><input type="submit" value="Update Account" /></td></tr> |
</table> |
</form> |
<?php |
} |
/admin/account-do.php |
---|
0,0 → 1,42 |
<?php |
require '_taios.php'; |
$page = new Taios_Page('Update Account'); |
$userID = $page->getPostID(); |
$page->checkLoggedIn(); |
$accessID = $_POST['accessID']; |
$password = $_POST['password']; |
$email = $_POST['email']; |
$name = $_POST['name']; |
$user = $page->getUserByID($userID); |
if (($page->getLoggedInUser()->ID == $userID || $page->isUserAdmin($page->getLoggedInUser())) && $user) |
{ |
if (isset($accessID) && $page->isUserAdmin($page->getLoggedInUser())) |
{ |
$page->query('UPDATE Users SET AccessID=' . $accessID . ' WHERE ID = ' . $userID); |
} |
if (!empty($password)) |
{ |
$page->query('UPDATE Users SET Password=' . sha1($password) . ' WHERE ID = ' . $userID); |
} |
} |
else |
{ |
if (!$user) |
{ |
drawError('No such user, #' . $userID); |
} |
else |
{ |
drawError('You do not have permission to access this page.'); |
} |
} |
$page->redirect('account.php?id=' . $id); |
?> |
/blog/post.php |
---|
2,6 → 2,23 |
require '../_taios.php'; |
function drawPost($id) |
{ |
$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>'); |
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = ' . $id); |
for ($i = 0; $i < count($ids); $i++) |
{ |
write('<p class="indent">'); |
drawPost($i); |
write('</p>'); |
} |
} |
$page = new Taios_Page('Blog Posts', '../'); |
if (!isset($_GET['id'])) |
20,23 → 37,7 |
drawPost($_GET['id']); |
function drawPost($id) |
{ |
$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>'); |
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = ' . $id); |
for ($i = 0; $i < count($ids); $i++) |
{ |
write('<p class="indent">'); |
drawPost($i); |
write('</p>'); |
} |
} |
$page->drawFooter(); |
?> |