Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 1 → Rev 9

/_taios.php
1,5 → 1,7
<?php
 
require '_config.php';
 
class Taios_Page
{
function __construct($title, $url = "")
11,7 → 13,7
$this->drawnMiddle = false;
$this->drawnFooter = false;
$this->db = mysql_connect('localhost', 'root', 'puppylinux');
$this->db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD);
if (!$this->db)
{
$this->drawError('Failed to connect to database: ' . mysql_error());
49,7 → 51,7
write('<br />');
if ($this->isLoggedIn())
{
$this->drawMenuItem('Manage Account', 'admim/?id=' . $this->getLoggedInUser()->ID);
$this->drawMenuItem('Manage Account', 'admin/account.php?id=' . $this->getLoggedInUser()->ID);
$this->drawMenuItem('Logout', 'logout-do.php');
}
else
93,7 → 95,7
$this->drawnFooter = true;
}
die();
// die();
}
function drawError($text, $die = true)
174,6 → 176,14
return false;
}
function checkLoggedIn()
{
if (!$this->isLoggedIn())
{
$this->drawError('You need to be logged in.');
}
}
function query($query)
{
$result = mysql_query($query);
/admin/index.php
0,0 → 1,16
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Administration', '../');
$page->drawHeader();
$page->drawMiddle();
 
$page->checkLoggedIn();
$user = $page->getLoggedInUser();
 
write('<h3><a href="account.php?id=' . $user->ID. '">Manage Account</a></h3>');
 
$page->drawFooter();
 
?>
/install.sql
26,5 → 26,60
PRIMARY KEY(ID)
);
 
CREATE TABLE BlogComments
(
ID INT NOT NUll AUTO_INCREMENT,
AuthorID INT,
PostID INT,
Title TEXT,
Content TEXT,
DatePosted DATETIME,
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");