Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 169 → Rev 191

/projects/index.php
6,7 → 6,15
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
$ids = $page->findIDs('Projects', 'ORDER BY LastUpdate DESC');
for ($i = 0; $i < count($ids); $i++)
{
$id = $ids[$i];
$project = $page->getProject($id);
write('<h3>' . $project->title . '</h3>');
write('<br />');
}
 
$page->drawFooter();
 
/_taios.php
116,17 → 116,24
{
$post = $this->getBlogPost($id);
if ($first)
{
write('<h3><a href="post.php?id=' . $id . '">' . $post->title. '</a> <a href="post.php?id=' . $post->parent->ID . '">^</a></h3>');
}
else
{
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('<p>' . $this->replaceBBCode($post->content) . '</p>');
write('<br />');
if ($this->isUserNormal($this->getLoggedInUser()))
{
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>';
if ($this->isUserAdmin($this->getLoggedInUser()) || $this->getLoggedInUser()->ID == $post->author->ID)
{
echo ' &middot <a href="edit-post.php?id=' . $id . '">Edit Post</a>';
echo ' &nbsp;&nbsp; &middot &nbsp;&nbsp; <a href="del-post.php?id=' . $id . '">Delete Post</a>';
}
write('</p><br />');
}
 
356,7 → 363,7
$post->author = $this->getUserByID($row['AuthorID']);
$post->user = $this->getUserByID($row['AuthorID']); // For some older pages
$post->title = $row['Title'];
$post->content = $this->replaceBBCode($row['Content']);
$post->content = $row['Content'];
$post->datePosted = strtotime($row['DatePosted']);
$post->category = $row['Category'];
$post->spam = $row['Spam'];
367,13 → 374,38
$this->drawError('Cannot find blog post, #' . $id);
}
function getProject($id)
{
$result = $this->query('SELECT * FROM Projects WHERE ID = ' . $id);
while ($row = mysql_fetch_array($result))
{
$project = new Project;
$project->ID = $row['ID'];
$project->author = $this->getUserByID($row['AuthorID']);
$project->title = $row['Title'];
$project->description = $row['Description'];
$project->logoURL = $row['LogoURL'];
$project->downloadURL = $row['DownloadURL'];
$project->websiteURl = $row['WebsiteURL'];
$project->latestVersion = $row['LatestVersion'];
$project->lastUpdate = strtotime($row['LastUpdate']);
return $project;
}
return false;
}
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);
$this->query('DELETE FROM BlogPosts WHERE ID=' . $id);
}
 
function getGetID()
423,6 → 455,19
public $spam;
}
 
class Project
{
public $ID;
public $author;
public $title;
public $description;
public $logoURL;
public $downloadURL;
public $websiteURL;
public $latestVersion;
public $lastUpdate;
}
 
function write($str)
{
echo $str;
/install.sql
35,8 → 35,10
Title TEXT,
Description TEXT,
LogoURL TEXT,
DownloadURL TEXT,
WebsiteURL TEXT,
LatestVersion TEXT,
LastUpdate DATETIME
PRIMARY KEY(ID)
);
 
73,3 → 75,4
 
INSERT INTO Users VALUES (1, 0, "admin", SHA1("password"), "admins@tim32.org", "Tim32 Admin", 0);
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);
INSERT INTO Projects VALUES (1, 1, "TAIOS", "TAIOS (The All In One System) is a PHP based system to make the Tim32 website very self contained and altogether.", "http://websvn.kde.org/*checkout*/trunk/kdesupport/oxygen-icons/64x64/categories/applications-internet.png", "", "http://tim32.org/~tom/taios/", "SVN", NOW());
/admin/all-blog-posts.php
24,7 → 24,7
write('<td class="bold">Spam</td>');
write('</tr>');
 
$ids = $page->findIDs('BlogPosts');
$ids = $page->findIDs('BlogPosts', 'ORDER BY DatePosted DESC');
for ($i = 0; $i < count($ids); $i++)
{
$post = $page->getBlogPost($ids[$i]);
40,7 → 40,7
}
write('<td><a href="account.php?id=' . $post->author->ID . '">' . $post->author->name . '</a></td>');
write('<td>' . $post->title . '</td>');
write('<td>' . $post->content . '</td>');
write('<td>' . str_replace("\n", '<br />', $post->content) . '</td>');
write('<td>' . date('j/m/Y H:i', $post->datePosted) . '</td>');
write('<td>' . $post->category . '</td>');
write('<td>' . $post->spam . '</td>');
51,7 → 51,7
}
else
{
drawError('You do not have permission to access this page.');
$page->drawError('You do not have permission to access this page.');
}
 
$page->drawFooter();
/admin/all-accounts.php
42,7 → 42,7
}
else
{
drawError('You do not have permission to access this page.');
$page->drawError('You do not have permission to access this page.');
}
 
$page->drawFooter();
/admin/account.php
21,7 → 21,7
 
<form action="account-do.php" method="POST">
<table>
<tr><td class="bold">ID: </td><td><?php echo $user->ID; ?></td></tr>
<tr><td class="bold">ID: </td><td><input type="hidden" name="id" value="<?php echo $user->ID; ?>" /><?php echo $user->ID; ?></td></tr>
<?php
if ($page->isUserAdmin($page->getLoggedInUser()))
{
46,11 → 46,11
{
if (!$user)
{
drawError('No such user, #' . $userID);
$page->drawError('No such user, #' . $userID);
}
else
{
drawError('You do not have permission to access this page.');
$page->drawError('You do not have permission to access this page.');
}
}
 
/admin/account-do.php
39,11 → 39,11
{
if (!$user)
{
drawError('No such user, #' . $userID);
$page->drawError('No such user, #' . $userID);
}
else
{
drawError('You do not have permission to access this page.');
$page->drawError('You do not have permission to access this page.');
}
}
 
/index.php
28,9 → 28,9
$id = $ids[$i];
$post = $page->getBlogPost($id);
write('<h4>' . $post->title. '</h4>');
write('<h4><a href="blog/post.php?id=' . $post->ID . '">' . $post->title. '</a></h4>');
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('<p>' . $page->replaceBBCode($post->content) . '</p>');
write('<br />');
}
 
/blog/post.php
4,7 → 4,7
 
$page = new Taios_Page('Blog Posts', '../');
 
if (empty($_GET['id']))
if (empty($_GET['id']) || $_GET['id'] == -1)
{
$page->redirect('index.php');
}
/blog/add-post.php
14,7 → 14,7
 
require '../_taios.php';
 
$page = new Taios_Page('Blog Posts', '../');
$page = new Taios_Page('Add Post', '../');
$page->checkLoggedIn();
 
$error = '';
40,7 → 40,7
}
else
{
if ($page->isUserNormal($page->getLoggedInUser()) && $parentID == -1)
if ($page->getLoggedInUser()->accessID >= 2 && $parentID == -1)
{
$page->drawError('You do not have permission to access this page.');
}
/blog/edit-post.php
2,7 → 2,7
 
require '../_taios.php';
 
$page = new Taios_Page('Blog Posts', '../');
$page = new Taios_Page('Edit Post', '../');
 
if (isset($_GET['id']))
{
44,7 → 44,7
else
{
$page->query('UPDATE BlogPosts SET Content = "' . $content . '", Title = "' . $title . '", Category = "' . $category . '" WHERE ID = ' . $id);
$page->redirect('index.php');
$page->redirect('post.php?id=' . $id);
}
}
 
63,7 → 63,7
<table>
<tr>
<td class="bold">Title: </td>
<td><input type="text" name="title" value="<?php echo $post->title; ?>/></td>
<td><input type="text" name="title" value="<?php echo $post->title; ?>"/></td>
</tr>
<tr>
<td class="bold">Content: </td>
71,7 → 71,7
</tr>
<tr>
<td class="bold">Catagory: </td>
<td><input type="text" name="category" /><?php echo $post->category; ?></td>
<td><input type="text" name="category" value="<?php echo $post->category; ?>" /></td>
</tr>
 
<?php
80,7 → 80,7
 
<tr>
<td class="bold"></td>
<td><input type="submit" value="Post" /></td>
<td><input type="submit" value="Edit" /></td>
</tr>
</table>
</form>
/blog/index.php
31,7 → 31,7
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('<p>' . $page->replaceBBCode($post->content) . '</p>');
write('<br />');
}
 
/data/sidebar-gradient.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream