/blog/post.php |
---|
0,0 → 1,42 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Blog Posts', '../'); |
if (!isset($_GET['id'])) |
$page->redirect("index.php"); |
$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 />'); |
} |
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(); |
?> |
/blog/index.php |
---|
1,30 → 1,30 |
<?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 />'); |
} |
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1'); |
for ($i = 0; $i < count($ids); $i++) |
{ |
$id = $ids[$i]; |
$post = $page->getBlogPost($id); |
write('<a href="post.php?id=' . $i . '"><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>'); |
} |
$page->drawFooter(); |
?> |
/styles.css |
---|
1,111 → 1,115 |
body { |
background-color: #FFFFFF; |
color: #000000; |
font-family: Droid Sans, Tahoma, sans-serif; |
font-size: 11pt; |
} |
h1 { |
font-size: 28pt; |
margin: 6px; |
margin-top: 0px; |
color: #000089; |
border-bottom: 1px solid #000000; |
} |
h2 { |
font-size: 20pt; |
margin: 6px; |
margin-left: 8px; |
color: #00004B; |
} |
h3 { |
font-size: 16pt; |
margin: 6px; |
margin-left: 10px; |
color: #000055; |
} |
h4 { |
font-size: 12pt; |
margin: 6px; |
margin-left: 12px; |
color: #00005F; |
} |
h5 { |
font-size: 10pt; |
margin: 6px; |
margin-left: 14px; |
color: #000069; |
} |
p, table, span { |
font-size: 11pt; |
margin: 6px; |
margin-left: 16px; |
} |
a { |
text-decoration: none; |
color: #000050; |
} |
a:hover { |
text-decoration: underline; |
} |
input { |
border: 1px solid #000000; |
color: #000000; |
background-color: #B5D7FF; |
} |
.sidebar { |
left: 0px; |
top: 0px; |
position: fixed; |
padding: 0px; |
padding-left: 32px; |
border-right: 1px solid #000089; |
background-color: #FFFF73; |
background-image: url('data/sidebar-gradient.png'); |
background-repeat: repeat-x; |
background-position: center bottom; |
} |
.sidebar-header { |
left: 0px; |
width: 140px; |
padding: 6px; |
text-align: right; |
} |
.sidebar-menu { |
text-align: right; |
padding: 6px; |
} |
.sidebar-menu h3 { |
margin: 6px; |
} |
.sidebar-menu p { |
font-size: 12pt; |
margin: 4px; |
} |
.content { |
left: 200px; |
top: 0px; |
position: absolute; |
width: 720px; |
margin-right: 32px; |
} |
.bold { |
font-weight: bold; |
} |
body { |
background-color: #FFFFFF; |
color: #000000; |
font-family: Droid Sans, Tahoma, sans-serif; |
font-size: 11pt; |
} |
h1 { |
font-size: 28pt; |
margin: 6px; |
margin-top: 0px; |
color: #000089; |
border-bottom: 1px solid #000000; |
} |
h2 { |
font-size: 20pt; |
margin: 6px; |
margin-left: 8px; |
color: #00004B; |
} |
h3 { |
font-size: 16pt; |
margin: 6px; |
margin-left: 10px; |
color: #000055; |
} |
h4 { |
font-size: 12pt; |
margin: 6px; |
margin-left: 12px; |
color: #00005F; |
} |
h5 { |
font-size: 10pt; |
margin: 6px; |
margin-left: 14px; |
color: #000069; |
} |
p, table, span { |
font-size: 11pt; |
margin: 6px; |
margin-left: 16px; |
} |
a { |
text-decoration: none; |
color: #000050; |
} |
a:hover { |
text-decoration: underline; |
} |
input { |
border: 1px solid #000000; |
color: #000000; |
background-color: #B5D7FF; |
} |
.sidebar { |
left: 0px; |
top: 0px; |
position: fixed; |
padding: 0px; |
padding-left: 32px; |
border-right: 1px solid #000089; |
background-color: #FFFF73; |
background-image: url('data/sidebar-gradient.png'); |
background-repeat: repeat-x; |
background-position: center bottom; |
} |
.sidebar-header { |
left: 0px; |
width: 140px; |
padding: 6px; |
text-align: right; |
} |
.sidebar-menu { |
text-align: right; |
padding: 6px; |
} |
.sidebar-menu h3 { |
margin: 6px; |
} |
.sidebar-menu p { |
font-size: 12pt; |
margin: 4px; |
} |
.content { |
left: 200px; |
top: 0px; |
position: absolute; |
width: 720px; |
margin-right: 32px; |
} |
.bold { |
font-weight: bold; |
} |
p.indent { |
margin-left: 5em; |
} |
/_taios.php |
---|
257,16 → 257,26 |
{ |
$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; |
} |
$this->drawError('Cannot find blog post, #' . $id); |
return false; |
} |
function getGetID() |
306,11 → 316,13 |
class BlogPost |
{ |
public $ID; |
public $parent; |
public $author; |
public $title; |
public $content; |
public $datePosted; |
public $category; |
public $spam; |
} |
function write($str) |
/admin/account.php |
---|
0,0 → 1,57 |
<?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 /> |
<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> |
<?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(); |
/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); |