Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 110 → Rev 133

/blog/index.php
13,7 → 13,7
write('<br />');
}
 
$query = 'WHERE ParentID = -1';
$query = 'ORDER BY DatePosted DESC WHERE ParentID = -1';
 
if (isset($_GET['cat']))
{
26,12 → 26,13
{
$id = $ids[$i];
$post = $page->getBlogPost($id);
write('<a href="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 />');
}
 
 
$page->drawFooter();
 
?>
/blog/add-post.php
1,16 → 1,48
<?php
 
function getParentID()
{
if (isset($_GET['id']))
{
return $_GET['id'];
}
else
{
return -1;
}
}
 
require '../_taios.php';
 
$page = new Taios_Page('Blog Posts', '../');
$page->checkLoggedIn();
 
if (!$page->isUserGM($page->getLoggedInUser()))
$page->redirect("index.php");
$error = '';
 
if (isset($_POST['title']) && isset($_POST['content']) && isset($_POST['catagory']) && isset($_POST['parentID']))
if (isset($_POST['post']))
{
$page->query('insert into BlogPosts VALUES(0, ' . $_POST['parentID'] . ', "' . $page->getLoggedInUser()->ID . '", "' . $_POST['title'] . '", "' . $_POST['content'] . '", NOW(), "' . $_POST['catagory'] . '", 0)');
$page->redirect('index.php');
$title = $_POST['title'];
$content = $_POST['content'];
$parentID = $_POST['parentID'];
$category = $_POST['category'];
 
if (empty($title))
{
$error = "No Title Specified";
}
else if (empty($content))
{
$error = "No Content Specified";
}
else if (empty($parentID))
{
$error = "No Parent ID Specified";
}
else
{
$page->query('INSERT INTO BlogPosts VALUES(0, ' . $parentID . ', "' . $page->getLoggedInUser()->ID . '", "' . $title . '", "' . $content . '", NOW(), "' . $category . '", 0)');
$page->redirect('index.php');
}
}
 
$page->drawHeader();
17,15 → 49,14
$page->drawBlogCategoriesMenu();
$page->drawMiddle();
 
if ($page->isUserGM($page->getLoggedInUser()))
if (!empty($error))
{
write('<p class="bold"><a href="add-post.php">Add Post</a></p>');
write('<br />');
$page->drawError($error, false);
}
 
?>
 
<form action="add-post.php" method="post">
<form action="add-post.php?id=<?php echo getParentID(); ?>" method="post">
<table>
<tr>
<td class="bold">Title: </td>
33,15 → 64,17
</tr>
<tr>
<td class="bold">Content: </td>
<td><textarea name="content" style="width: 523px; height: 543px">Content Here</textarea></td>
<td><textarea name="content" style="width: 500px; height: 300px;"></textarea></td>
</tr>
<tr>
<td class="bold">Catagory: </td>
<td><input type="text" name="catagory" /></td>
<td><input type="text" name="category" /></td>
</tr>
 
<input type="hidden" name="post" value="yes" />
 
<?php
write('<input type="hidden" name="parentID" value="' . $_GET['id'] . '"/>');
write('<input type="hidden" name="parentID" value="' . getParentID() . '" />');
?>
 
<tr>
/blog/post.php
4,17 → 4,16
 
$page = new Taios_Page('Blog Posts', '../');
 
if (!isset($_GET['id']) || $_GET['id'] == "" || $_GET['id'] == -1)
if (empty($_GET['id']))
{
$page->redirect('index.php');
}
 
if (!isset($_GET['id']))
$page->redirect("index.php");
 
$page->drawHeader();
$page->drawBlogCategoriesMenu();
$page->drawMiddle();
 
$page->drawBlogPostTree($_GET['id'], true);
$page->drawBlogPostTree($page->getGetID(), true);
 
$page->drawFooter();
 
/blog/del-post.php
0,0 → 1,27
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Delete Blog Post', '../');
 
$id = $_GET['id'];
if ($id)
{
if ($page->isUserAdmin($page->getLoggedInUser()) || $page->getLoggedInUser()->ID == $page->getBlogPost($id)->author->ID)
{
$page->delBlogPost($id);
}
else
{
$page->drawError('You do not have permission to access this page.');
}
}
else
{
$page->drawError('No ID Specified');
}
 
$page->redirect('index.php');
 
?>
 
/_taios.php
124,8 → 124,10
write('<br />');
if ($this->isUserNormal($this->getLoggedInUser()))
{
write('<p class="bold"><a href="add-post.php?id=' . $id . '">Add Comment</a></p>');
write('<br />');
echo '<p class="bold"><a href="add-post.php?id=' . $id . '">Add Comment</a>';
if ($this->isUserAdmin($this->getLoggedInUser()) || $this->getLoggedInUser() == $post->author->ID)
echo ' &middot <a href="del-post.php?id=' . $id . '">Delete Post</a>';
write('</p><br />');
}
 
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID=' . $id);
325,6 → 327,15
$this->drawError('Cannot find blog post, #' . $id);
}
function delBlogPost($id)
{
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID=' . $id);
for ($i = 0; $i < count($ids); $i++)
$this->delBlogPost($ids[$i]);
 
$this->query('delete from BlogPosts where ID=' . $id);
}
 
function getGetID()
{
$id = $_GET['id'];
/projects/index.php
0,0 → 1,14
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Projects', '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
 
$page->drawFooter();
 
?>
 
/wiki/index.php
0,0 → 1,14
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Wiki', '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
 
$page->drawFooter();
 
?>
 
/forums/index.php
0,0 → 1,14
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Forums', '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
 
$page->drawFooter();
 
?>
 
/photos/index.php
0,0 → 1,14
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Photos', '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
 
$page->drawFooter();
 
?>
 
/admin/index.php
15,6 → 15,7
{
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>');
/admin/all-blog-posts.php
32,7 → 32,7
write('<td><a href="../blog/edit-post.php?id=' . $post->ID . '">' . $post->ID . '</a></td>');
if ($post->parent == -1)
{
write('<td>No Parent</td>');
write('<td style="color: #444444;">No Parent</td>');
}
else
{