/blog/post-add.php |
---|
0,0 → 1,56 |
<?php |
require '../_taios.php'; |
$page = new Taios_Page('Blog Posts', '../'); |
if (isset($_POST['title']) && isset($_POST['content']) && isset($_POST['catagory']) && isset($_POST['parentID'])) |
{ |
$page->query("insert into BlogPosts VALUES(0, "' . $page->getLoggedInUser. '", "' . $_POST['title'] . '", "' . $_POST['content'] . '", NOW(), "' . $_POST['catagory'] . '", ' . $_POST['parentID'] . ', 0)'); |
$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 />'); |
} |
?> |
<form action="post-add.php" method="post"> |
<table> |
<tr> |
<td class="bold">Title: </td> |
<td><input type="text" name="title" /></td> |
</tr> |
<tr> |
<td class="bold">Content: </td> |
<td><input type="text" name="content" /></td> |
</tr> |
<tr> |
<td class="bold">Catagory: </td> |
<td><input type="text" name="catagory" /></td> |
</tr> |
<?php |
write('<input type="hidden" name="parentID" value="' . $_GET['id'] . '"/>'); |
?> |
<tr> |
<td class="bold"></td> |
<td><input type="submit" value="Post" /></td> |
</tr> |
</table> |
</form> |
<?php |
$page->drawFooter(); |
?> |
/blog/post.php |
---|
0,0 → 1,25 |
<?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 />'); |
} |
$page->drawBlogPostTree($_GET['id']); |
$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'); |
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(); |
?> |
/_taios.php |
---|
1,290 → 1,351 |
<?php |
class Taios_Page |
{ |
function __construct($title, $url = "") |
{ |
$this->title = $title; |
$this->url = $url; |
$this->drawnHeader = false; |
$this->drawnMiddle = false; |
$this->drawnFooter = false; |
$this->db = mysql_connect('localhost', 'root', 'puppylinux'); |
if (!$this->db) |
{ |
$this->drawError('Failed to connect to database: ' . mysql_error()); |
} |
if (!mysql_select_db('Tim32')) |
{ |
$this->drawError('Failed to select database: ' . mysql_error()); |
} |
} |
function drawHeader() |
{ |
if (!$this->drawnHeader) |
{ |
write('<!DOCTYPE html>'); |
write('<html>'); |
write('<head>'); |
write('<meta http-equiv="Content-Type" content="text/html;charset=utf-8">'); |
write('<title>Tim32 · ' . $this->title . '</title>'); |
write('<link href="' . $this->url . 'styles.css" rel="stylesheet" type="text/css" media="screen">'); |
write('</head>'); |
write('<body>'); |
write('<div class="sidebar">'); |
write('<div class="sidebar-header">'); |
write('<h1>Tim32</h1>'); |
write('</div>'); |
write('<div class="sidebar-menu">'); |
$this->drawMenuItem('Home', 'index.php'); |
$this->drawMenuItem('Blog', 'blog/'); |
$this->drawMenuItem('Projects', 'projects/'); |
$this->drawMenuItem('Forums', 'forums/'); |
$this->drawMenuItem('Wiki', 'wiki/'); |
$this->drawMenuItem('Photos', 'photos/'); |
write('<br />'); |
if ($this->isLoggedIn()) |
{ |
$this->drawMenuItem('Manage Account', 'admim/?id=' . $this->getLoggedInUser()->ID); |
$this->drawMenuItem('Logout', 'logout-do.php'); |
} |
else |
{ |
$this->drawMenuItem('Login', 'login.php'); |
$this->drawMenuItem('Register', 'register.php'); |
} |
write('<br />'); |
$this->drawnHeader = true; |
} |
} |
function drawMenuItem($t, $u) |
{ |
write('<p><a href="' . $this->url . $u . '"</a>' . $t . '</a></p>'); |
} |
function drawMiddle() |
{ |
if (!$this->drawnMiddle) |
{ |
write('<br />'); |
write('</div>'); |
write('</div>'); |
write('<div class="content">'); |
write('<h2>' . $this->title . '</h2>'); |
$this->drawnMiddle = true; |
} |
} |
function drawFooter() |
{ |
if (!$this->drawnFooter) |
{ |
write('</div>'); |
write('</body>'); |
write('</html>'); |
$this->drawnFooter = true; |
} |
die(); |
} |
function drawError($text, $die = true) |
{ |
$this->drawHeader(); |
$this->drawMiddle(); |
write('<h4 style="color: red;">Error: ' . $text . '</h4>'); |
if ($die) |
{ |
$this->drawFooter(); |
die(); |
} |
} |
function redirect($url) |
{ |
header('Location: ' . $url); |
die(); |
} |
function isLoggedIn() |
{ |
$cookie = $_COOKIE['Tim32_Login']; |
if (!empty($cookie)) |
{ |
$clist = explode('|~|', $cookie); |
$user = $this->getUserByUsername($clist[0]); |
if ($user) |
{ |
if ($user->password == $clist[1]) |
{ |
return true; |
} |
} |
} |
return false; |
} |
function isUserAdmin() |
{ |
if ($this->isLoggedIn()) |
{ |
if ($this->getLoggedInUser()->accessID <= 0) |
{ |
return true; |
} |
} |
return false; |
} |
function isUserGM() |
{ |
if ($this->isLoggedIn()) |
{ |
if ($this->getLoggedInUser()->accessID <= 1) |
{ |
return true; |
} |
} |
return false; |
} |
function isUserNormal() |
{ |
if ($this->isLoggedIn()) |
{ |
if ($this->getLoggedInUser()->accessID <= 2) |
{ |
return true; |
} |
} |
return false; |
} |
function query($query) |
{ |
$result = mysql_query($query); |
if (!$result) |
{ |
$this->drawError('MySQL Error: ' . mysql_error()); |
} |
return $result; |
} |
function findIDs($table, $query = '') |
{ |
$array = array(); |
$result = $this->query('SELECT ID FROM ' . $table . ' ' . $query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($array, $row['ID']); |
} |
return $array; |
} |
function getUserByID($id) |
{ |
$result = $this->query('SELECT * FROM Users WHERE ID = ' . $id); |
while ($row = mysql_fetch_array($result)) |
{ |
$user = new User; |
$user->ID = $row['ID']; |
$user->accessID = $row['AccessID']; |
$user->username = $row['Username']; |
$user->password = $row['Password']; |
$user->emailAddress = $row['EmailAddress']; |
$user->name = $row['Name']; |
$user->challengeID = $row['ChallengeID']; |
return $user; |
} |
return false; |
} |
function getUserByUsername($username) |
{ |
$result = $this->query('SELECT * FROM Users WHERE Username = "' . $username . '"'); |
while ($row = mysql_fetch_array($result)) |
{ |
return $this->getUserByID($row['ID']); |
} |
return false; |
} |
function getLoggedInUser() |
{ |
if ($this->isLoggedIn()) |
{ |
$clist = explode('|~|', $_COOKIE['Tim32_Login']); |
return $this->getUserByUsername($clist[0]); |
} |
return false; |
} |
function getBlogPost($id) |
{ |
$result = $this->query('SELECT * FROM BlogPosts WHERE ID = ' . $id); |
while ($row = mysql_fetch_array($result)) |
{ |
$post = new BlogPost; |
$post->ID = $row['ID']; |
$post->user = $this->getUserByID($row['AuthorID']); |
$post->title = $row['Title']; |
$post->content = $row['Content']; |
$post->datePosted = strtotime($row['DatePosted']); |
$post->category = $row['Category']; |
return $post; |
} |
$this->drawError('Cannot find blog post, #' . $id); |
} |
} |
class User |
{ |
public $ID; |
public $accessID; |
public $username; |
public $password; |
public $emailAddress; |
public $name; |
public $challengeID; |
} |
class BlogPost |
{ |
public $ID; |
public $author; |
public $title; |
public $content; |
public $datePosted; |
public $category; |
} |
function write($str) |
{ |
echo $str; |
echo "\n"; |
} |
?> |
<?php |
require '_config.php'; |
class Taios_Page |
{ |
function __construct($title, $url = "") |
{ |
$this->title = $title; |
$this->url = $url; |
$this->drawnHeader = false; |
$this->drawnMiddle = false; |
$this->drawnFooter = false; |
$this->db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD); |
if (!$this->db) |
{ |
$this->drawError('Failed to connect to database: ' . mysql_error()); |
} |
if (!mysql_select_db('Tim32')) |
{ |
$this->drawError('Failed to select database: ' . mysql_error()); |
} |
} |
function drawHeader() |
{ |
if (!$this->drawnHeader) |
{ |
write('<!DOCTYPE html>'); |
write('<html>'); |
write('<head>'); |
write('<meta http-equiv="Content-Type" content="text/html;charset=utf-8">'); |
write('<title>Tim32 · ' . $this->title . '</title>'); |
write('<link href="' . $this->url . 'styles.css" rel="stylesheet" type="text/css" media="screen">'); |
write('</head>'); |
write('<body>'); |
write('<div class="sidebar">'); |
write('<div class="sidebar-header">'); |
write('<h1>Tim32</h1>'); |
write('</div>'); |
write('<div class="sidebar-menu">'); |
$this->drawMenuItem('Home', 'index.php'); |
$this->drawMenuItem('Blog', 'blog/'); |
$this->drawMenuItem('Projects', 'projects/'); |
$this->drawMenuItem('Forums', 'forums/'); |
$this->drawMenuItem('Wiki', 'wiki/'); |
$this->drawMenuItem('Photos', 'photos/'); |
write('<br />'); |
if ($this->isLoggedIn()) |
{ |
$this->drawMenuItem('Manage Account', 'admin/account.php?id=' . $this->getLoggedInUser()->ID); |
$this->drawMenuItem('Logout', 'logout-do.php'); |
} |
else |
{ |
$this->drawMenuItem('Login', 'login.php'); |
$this->drawMenuItem('Register', 'register.php'); |
} |
write('<br />'); |
$this->drawnHeader = true; |
} |
} |
function drawMenuItem($t, $u) |
{ |
write('<p><a href="' . $this->url . $u . '"</a>' . $t . '</a></p>'); |
} |
function drawMiddle() |
{ |
if (!$this->drawnMiddle) |
{ |
write('<br />'); |
write('</div>'); |
write('</div>'); |
write('<div class="content">'); |
write('<h2>' . $this->title . '</h2>'); |
$this->drawnMiddle = true; |
} |
} |
function drawFooter() |
{ |
if (!$this->drawnFooter) |
{ |
write('</div>'); |
write('</body>'); |
write('</html>'); |
$this->drawnFooter = true; |
} |
// die(); |
} |
function drawError($text, $die = true) |
{ |
$this->drawHeader(); |
$this->drawMiddle(); |
write('<h4 style="color: red;">Error: ' . $text . '</h4>'); |
if ($die) |
{ |
$this->drawFooter(); |
die(); |
} |
} |
function drawBlogPostTree($id) |
{ |
$post = $this->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 = $this->findIDs('BlogPosts', 'WHERE ParentID = ' . $id); |
for ($i = 0; $i < count($ids); $i++) |
{ |
write('<p class="indent">'); |
$this->drawBlogPostTree($i); |
write('</p>'); |
} |
} |
function redirect($url) |
{ |
header('Location: ' . $url); |
die(); |
} |
function isLoggedIn() |
{ |
$cookie = $_COOKIE['Tim32_Login']; |
if (!empty($cookie)) |
{ |
$clist = explode('|~|', $cookie); |
$user = $this->getUserByUsername($clist[0]); |
if ($user) |
{ |
if ($user->password == $clist[1]) |
{ |
return true; |
} |
} |
} |
return false; |
} |
function isUserAdmin() |
{ |
if ($this->isLoggedIn()) |
{ |
if ($this->getLoggedInUser()->accessID <= 0) |
{ |
return true; |
} |
} |
return false; |
} |
function isUserGM() |
{ |
if ($this->isLoggedIn()) |
{ |
if ($this->getLoggedInUser()->accessID <= 1) |
{ |
return true; |
} |
} |
return false; |
} |
function isUserNormal() |
{ |
if ($this->isLoggedIn()) |
{ |
if ($this->getLoggedInUser()->accessID <= 2) |
{ |
return true; |
} |
} |
return false; |
} |
function checkLoggedIn() |
{ |
if (!$this->isLoggedIn()) |
{ |
$this->drawError('You need to be logged in.'); |
} |
} |
function query($query) |
{ |
$result = mysql_query($query); |
if (!$result) |
{ |
$this->drawError('MySQL Error: ' . mysql_error()); |
} |
return $result; |
} |
function findIDs($table, $query = '') |
{ |
$array = array(); |
$result = $this->query('SELECT ID FROM ' . $table . ' ' . $query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($array, $row['ID']); |
} |
return $array; |
} |
function getUserByID($id) |
{ |
$result = $this->query('SELECT * FROM Users WHERE ID = ' . $id); |
while ($row = mysql_fetch_array($result)) |
{ |
$user = new User; |
$user->ID = $row['ID']; |
$user->accessID = $row['AccessID']; |
$user->username = $row['Username']; |
$user->password = $row['Password']; |
$user->emailAddress = $row['EmailAddress']; |
$user->name = $row['Name']; |
$user->challengeID = $row['ChallengeID']; |
return $user; |
} |
return false; |
} |
function getUserByUsername($username) |
{ |
$result = $this->query('SELECT * FROM Users WHERE Username = "' . $username . '"'); |
while ($row = mysql_fetch_array($result)) |
{ |
return $this->getUserByID($row['ID']); |
} |
return false; |
} |
function getLoggedInUser() |
{ |
if ($this->isLoggedIn()) |
{ |
$clist = explode('|~|', $_COOKIE['Tim32_Login']); |
return $this->getUserByUsername($clist[0]); |
} |
return false; |
} |
function getBlogPost($id) |
{ |
$result = $this->query('SELECT * FROM BlogPosts WHERE ID = ' . $id); |
while ($row = mysql_fetch_array($result)) |
{ |
$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); |
} |
function getGetID() |
{ |
$id = $_GET['id']; |
if (empty($id)) |
{ |
$id = 1; |
} |
return $id; |
} |
function getPostID() |
{ |
$id = $_POSt['id']; |
if (empty($id)) |
{ |
$id = 1; |
} |
return $id; |
} |
} |
class User |
{ |
public $ID; |
public $accessID; |
public $username; |
public $password; |
public $emailAddress; |
public $name; |
public $challengeID; |
} |
class BlogPost |
{ |
public $ID; |
public $parent; |
public $author; |
public $title; |
public $content; |
public $datePosted; |
public $category; |
public $spam; |
} |
function write($str) |
{ |
echo $str; |
echo "\n"; |
} |
?> |
/admin/account.php |
---|
0,0 → 1,59 |
<?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/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); |
?> |
/admin/index.php |
---|
0,0 → 1,26 |
<?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-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(); |
?> |
/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; |
} |
/install.sql |
---|
18,13 → 18,58 |
CREATE TABLE BlogPosts |
( |
ID INT NOT NUll AUTO_INCREMENT, |
ParentID INT, |
AuthorID INT, |
Title TEXT, |
Content TEXT, |
DatePosted DATETIME, |
Category TEXT, |
Spam BOOLEAN, |
PRIMARY KEY(ID) |
); |
CREATE TABLE Projects |
( |
ID INT NOT NUll AUTO_INCREMENT, |
AuthorID INT, |
Title TEXT, |
Description TEXT, |
LogoURL TEXT, |
WebsiteURL TEXT, |
LatestVersion TEXT, |
PRIMARY KEY(ID) |
); |
CREATE TABLE ForumCategories |
( |
ID INT NOT NUll AUTO_INCREMENT, |
ParentID INT, |
Title TEXT, |
Description TEXT, |
PRIMARY KEY(ID) |
); |
CREATE TABLE ForumTopics |
( |
ID INT NOT NUll AUTO_INCREMENT, |
AuthorID INT, |
CategoryID INT, |
Title TEXT, |
DatePosted DATETIME, |
PRIMARY KEY(ID) |
); |
CREATE TABLE ForumPosts |
( |
ID INT NOT NUll AUTO_INCREMENT, |
AuthorID INT, |
TopicID INT, |
Title TEXT, |
Content TEXT, |
DatePosted DATETIME, |
Spam BOOLEAN, |
PRIMARY KEY(ID) |
); |
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); |
/index.php |
---|
22,7 → 22,7 |
<?php |
$ids = $page->findIDs('BlogPosts'); |
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1'); |
for ($i = 0; $i < 5 && $i < count($ids); $i++) |
{ |
$id = $ids[$i]; |