Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 112 → Rev 169

/admin/account-do.php
1,53 → 1,53
<?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);
}
if (!empty($email))
{
$page->query('UPDATE Users SET EmailAddress = "' . $email . '" WHERE ID = ' . $userID);
}
if (!empty($name))
{
$page->query('UPDATE Users SET Name = "' . $name . '" 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=' . $userID);
 
?>
 
<?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);
}
if (!empty($email))
{
$page->query('UPDATE Users SET EmailAddress = "' . $email . '" WHERE ID = ' . $userID);
}
if (!empty($name))
{
$page->query('UPDATE Users SET Name = "' . $name . '" 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=' . $userID);
 
?>
 
/admin/account.php
1,60 → 1,60
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Manage 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 />
 
<form action="account-do.php" method="POST">
<table>
<tr><td class="bold">ID: </td><td><?php echo $user->ID; ?></td></tr>
<?php
if ($page->isUserAdmin($page->getLoggedInUser()))
{
write('<tr><td class="bold">AccessID: </td><td><input type="text" name="accessID" value="' . $user->accessID . '" /></td></tr>');
}
else
{
write('<tr><td class="bold">AccessID: </td><td>' . $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>
<tr><td></td><td><input type="submit" value="Update Account" /></td></tr>
</table>
</form>
 
<?php
}
else
{
if (!$user)
{
drawError('No such user, #' . $userID);
}
else
{
drawError('You do not have permission to access this page.');
}
}
 
$page->drawFooter();
 
?>
 
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Manage 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 />
 
<form action="account-do.php" method="POST">
<table>
<tr><td class="bold">ID: </td><td><?php echo $user->ID; ?></td></tr>
<?php
if ($page->isUserAdmin($page->getLoggedInUser()))
{
write('<tr><td class="bold">AccessID: </td><td><input type="text" name="accessID" value="' . $user->accessID . '" /></td></tr>');
}
else
{
write('<tr><td class="bold">AccessID: </td><td>' . $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>
<tr><td></td><td><input type="submit" value="Update Account" /></td></tr>
</table>
</form>
 
<?php
}
else
{
if (!$user)
{
drawError('No such user, #' . $userID);
}
else
{
drawError('You do not have permission to access this page.');
}
}
 
$page->drawFooter();
 
?>
 
/admin/all-blog-posts.php
1,60 → 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();
 
?>
 
<?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
1,51 → 1,51
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Manage All Accounts', '../');
$page->drawHeader();
$page->drawMiddle();
 
$page->checkLoggedIn();
 
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++)
{
$user = $page->getUserByID($ids[$i]);
write('<tr>');
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->emailAddress . '</td>');
write('<td>' . $user->challengeID . '</td>');
write('</tr>');
}
write('</table>');
}
else
{
drawError('You do not have permission to access this page.');
}
 
$page->drawFooter();
 
?>
 
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Manage All Accounts', '../');
$page->drawHeader();
$page->drawMiddle();
 
$page->checkLoggedIn();
 
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++)
{
$user = $page->getUserByID($ids[$i]);
write('<tr>');
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->emailAddress . '</td>');
write('<td>' . $user->challengeID . '</td>');
write('</tr>');
}
write('</table>');
}
else
{
drawError('You do not have permission to access this page.');
}
 
$page->drawFooter();
 
?>
 
/admin/index.php
1,27 → 1,27
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Administration', '../');
$page->drawHeader();
$page->drawMiddle();
 
$page->checkLoggedIn();
$user = $page->getLoggedInUser();
 
write('<h4><a href="account.php?id=' . $user->ID. '">Manage Account</a></h4>');
 
if ($page->isUserAdmin($user))
{
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-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>');
}
 
$page->drawFooter();
 
?>
 
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Administration', '../');
$page->drawHeader();
$page->drawMiddle();
 
$page->checkLoggedIn();
$user = $page->getLoggedInUser();
 
write('<h4><a href="account.php?id=' . $user->ID. '">Manage Account</a></h4>');
 
if ($page->isUserAdmin($user))
{
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-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>');
}
 
$page->drawFooter();
 
?>