/blog/edit-post.php |
---|
0,0 → 1,87 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Blog Posts', '../'); |
if (!isset($_GET['id'])) |
$id = $_GET['id']; |
else if (!isset($_POST['id'])) |
$id = $_POST['id']; |
else |
$page->redirect("index.php"); |
$page->checkLoggedIn(); |
$post = $page->getBlogPost($id); |
if (!$page->isUserAdmin($page->getLoggedInUser()) && $page->getLoggedInUser()->ID != $post->author->ID) |
{ |
$page->drawError('You do not have permission to access this page.'); |
} |
$error = ''; |
if (isset($_POST['id'])) |
{ |
$title = $_POST['title']; |
$content = $_POST['content']; |
$category = $_POST['category']; |
if (empty($title)) |
{ |
$error = "No Title Specified"; |
} |
else if (empty($content)) |
{ |
$error = "No Content Specified"; |
} |
else |
{ |
$page->query('update BlogPosts set (Content="' . $content . '", Title="' . $title . '", Category="' . $category . '") where ID=' . $id); |
$page->redirect('index.php'); |
} |
} |
$page->drawHeader(); |
$page->drawBlogCategoriesMenu(); |
$page->drawMiddle(); |
if (!empty($error)) |
{ |
$page->drawError($error, false); |
} |
?> |
<form action="add-post.php?id=<?php echo getParentID(); ?>" method="post"> |
<table> |
<tr> |
<td class="bold">Title: </td> |
<td><input type="text" name="title" value="<?php echo post->title; ?>/></td> |
</tr> |
<tr> |
<td class="bold">Content: </td> |
<td><textarea name="content" style="width: 500px; height: 300px;"><?php echo $post->content; ?></textarea></td> |
</tr> |
<tr> |
<td class="bold">Catagory: </td> |
<td><input type="text" name="category" /><?php echo $post->category; ?></td> |
</tr> |
<?php |
write('<input type="hidden" name="is" value="' . $id . '" />'); |
?> |
<tr> |
<td class="bold"></td> |
<td><input type="submit" value="Post" /></td> |
</tr> |
</table> |
</form> |
<?php |
$page->drawFooter(); |
?> |
/blog/index.php |
---|
21,17 → 21,20 |
write('<p>Only showing blog posts from the ' . $_GET['cat'] . ' category. <a href="index.php">Reset Filtering</a></p><br />'); |
} |
$query = $query . " ORDER BY DatePosted DESC"; |
$ids = $page->findIDs('BlogPosts', $query); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$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'); |
?> |
/styles.css |
---|
72,6 → 72,10 |
border: 1px solid #888888; |
} |
img { |
border: 2px solid #333333; |
} |
.sidebar { |
left: 0px; |
top: 0px; |
122,3 → 126,10 |
margin-left: 14px; |
border-left: 1px solid #BBBBBB; |
} |
.code { |
border: 1px solid #333333; |
background-color: #DDDDDD; |
font-family: Droid Sans Mono, Monospace, Fixed; |
} |
/404.php |
---|
0,0 → 1,28 |
<?php |
require '_taios.php'; |
$page = new Taios_Page('404'); |
$page->drawHeader(); |
write('<h3>Pages</h3>'); |
$page->drawMenuItem('Biggles', '/~biggles/'); |
$page->drawMenuItem('Freddie', '/~freddie/'); |
$page->drawMenuItem('Muzer', '/~muzer/'); |
$page->drawMenuItem('Sh4rk', '/~szabot/'); |
$page->drawMenuItem('Tom', '/~tom/'); |
$page->drawMiddle(); |
?> |
<p class="bold">404 - Page not found</p> |
<p>The page you requested could not be found.</p> |
<h4>Useful Links</h4> |
<?php |
$page->drawMenuItem('Tim32 Homepage', 'index.php'); |
$page->drawFooter(); |
?> |
/_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 ' · <a href="del-post.php?id=' . $id . '">Delete Post</a>'; |
write('</p><br />'); |
} |
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID=' . $id); |
157,7 → 159,47 |
$this->drawMenuItem($cats[$i], 'blog/index.php?cat=' . $cats[$i]); |
} |
} |
function replaceBBCode($str) |
{ |
$newstr = str_replace("\n", '</p><p>', $str); |
$newstr = str_replace(' ', ' ', $newstr); |
$newstr = str_replace(' :)', ' <img src="' . $this->url . 'data/smilies/face-smile.png" style="vertical-align: middle;" />', $newstr); |
$newstr = str_replace(' :p', ' <img src="' . $this->url . 'data/smilies/face-raspberry.png" style="vertical-align: middle;" />', $newstr); |
$newstr = str_replace(' :P', ' <img src="' . $this->url . 'data/smilies/face-raspberry.png" style="vertical-align: middle;" />',$newstr); |
$newstr = str_replace(' :|', ' <img src="' . $this->url . 'data/smilies/face-plain.png" style="vertical-align: middle;" />',$newstr); |
$newstr = str_replace(' :D', ' <img src="' . $this->url . 'data/smilies/face-laugh.png" style="vertical-align: middle;" />',$newstr); |
$newstr = str_replace(' =D', ' <img src="' . $this->url . 'data/smilies/face-laugh.png" style="vertical-align: middle;" />',$newstr); |
$newstr = str_replace(' :(', ' <img src="' . $this->url . 'data/smilies/face-sad.png" style="vertical-align: middle;" />',$newstr); |
$newstr = str_replace(' :0', ' <img src="' . $this->url . 'data/smilies/face-surprise.png" style="vertical-align: middle;" />',$newstr); |
$newstr = str_replace(' :o', ' <img src="' . $this->url . 'data/smilies/face-surprise.png" style="vertical-align: middle;" />',$newstr); |
$newstr = str_replace(' :O', ' <img src="' . $this->url . 'data/smilies/face-surprise.png" style="vertical-align: middle;" />',$newstr); |
$newstr = str_replace(' :/', ' <img src="' . $this->url . 'data/smilies/face-uncertain.png" style="vertical-align: middle;" />',$newstr); |
$newstr = str_replace(' ;)', ' <img src="' . $this->url . 'data/smilies/face-wink.png" style="vertical-align: middle;" />',$newstr); |
$bbcode = array( |
'/\[b\](.+?)\[\/b\]/is', |
'/\[i\](.+?)\[\/i\]/is', |
'/\[u\](.+?)\[\/u\]/is', |
'/\[url\](.+?)\[\/url\]/is', |
'/\[code\](.+?)\[\/code\]/is', |
'/\[img\](.+?)\[\/img\]/is' |
); |
$html = array( |
'<b>$1</b>', |
'<i>$1</i>', |
'<u>$1</u>', |
'<a href="$1">$1</a>', |
'<div class="code">$1</div>', |
'<img src="$1" />' |
); |
$newstr = preg_replace($bbcode, $html, $newstr); |
return $newstr; |
} |
function redirect($u) |
{ |
header('Location: ' . $u); |
314,7 → 356,7 |
$post->author = $this->getUserByID($row['AuthorID']); |
$post->user = $this->getUserByID($row['AuthorID']); // For some older pages |
$post->title = $row['Title']; |
$post->content = $row['Content']; |
$post->content = $this->replaceBBCode($row['Content']); |
$post->datePosted = strtotime($row['DatePosted']); |
$post->category = $row['Category']; |
$post->spam = $row['Spam']; |
325,6 → 367,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']; |
/data/smilies/face-laugh.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/data/smilies/face-laugh.png |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: data/smilies/face-plain.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: data/smilies/face-plain.png |
=================================================================== |
--- data/smilies/face-plain.png (nonexistent) |
+++ data/smilies/face-plain.png (revision 161) |
/data/smilies/face-plain.png |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: data/smilies/face-sad.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: data/smilies/face-sad.png |
=================================================================== |
--- data/smilies/face-sad.png (nonexistent) |
+++ data/smilies/face-sad.png (revision 161) |
/data/smilies/face-sad.png |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: data/smilies/face-uncertain.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: data/smilies/face-uncertain.png |
=================================================================== |
--- data/smilies/face-uncertain.png (nonexistent) |
+++ data/smilies/face-uncertain.png (revision 161) |
/data/smilies/face-uncertain.png |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: data/smilies/face-wink.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: data/smilies/face-wink.png |
=================================================================== |
--- data/smilies/face-wink.png (nonexistent) |
+++ data/smilies/face-wink.png (revision 161) |
/data/smilies/face-wink.png |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: data/smilies/face-raspberry.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: data/smilies/face-raspberry.png |
=================================================================== |
--- data/smilies/face-raspberry.png (nonexistent) |
+++ data/smilies/face-raspberry.png (revision 161) |
/data/smilies/face-raspberry.png |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: data/smilies/face-surprise.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: data/smilies/face-surprise.png |
=================================================================== |
--- data/smilies/face-surprise.png (nonexistent) |
+++ data/smilies/face-surprise.png (revision 161) |
/data/smilies/face-surprise.png |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: data/smilies/face-smile.png |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: data/smilies/face-smile.png |
=================================================================== |
--- data/smilies/face-smile.png (nonexistent) |
+++ data/smilies/face-smile.png (revision 161) |
/data/smilies/face-smile.png |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+application/octet-stream |
\ No newline at end of property |
Index: index.php |
=================================================================== |
--- index.php (revision 111) |
+++ index.php (revision 161) |
@@ -22,7 +22,7 @@ |
-$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1'); |
+$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1 ORDER BY DatePosted DESC'); |
for ($i = 0; $i < 5 && $i < count($ids); $i++) |
{ |
$id = $ids[$i]; |
/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>'); |