Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 192 → Rev 245

/install.sql
51,22 → 51,13
PRIMARY KEY(ID)
);
 
CREATE TABLE ForumTopics
CREATE TABLE ForumPosts
(
ID INT NOT NUll AUTO_INCREMENT,
AuthorID INT,
CategoryID INT,
ParentID 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,
76,3 → 67,6
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());
INSERT INTO ForumCategories VALUES (1, -1, "Tim32", "Talk about Tim32 in here");
INSERT INTO ForumCategories VALUES (2, 1, "TAIOS", "Talk about TAIOS in here");
INSERT INTO ForumPosts VALUES (1, 1, 2, -1, "TAIOS Almost Finished", "As I speak we are currently in the process of finilising TAIOS so it works perfectly! I'm pleased to accounce that TAIOS should be ready within the next week or so! :D", NOW(), FALSE);
/photos/albums/Lassitor/Lassitor.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/photos/albums/Lassitor/Lassitor.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: photos/albums/Lassitor/Lassitor-3d.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: photos/albums/Lassitor/Lassitor-3d.png
===================================================================
--- photos/albums/Lassitor/Lassitor-3d.png (nonexistent)
+++ photos/albums/Lassitor/Lassitor-3d.png (revision 245)
/photos/albums/Lassitor/Lassitor-3d.png
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: photos/album.php
===================================================================
--- photos/album.php (nonexistent)
+++ photos/album.php (revision 245)
@@ -0,0 +1,72 @@
+
+
+require '../_taios.php';
+
+function getImageSizes($sourceImageFilePath, $maxResizeWidth, $maxResizeHeight) {
+
+ $size = getimagesize($sourceImageFilePath);
+ $origWidth = $size[0];
+ $origHeight = $size[1];
+
+ $resizedWidth = $origWidth;
+ $resizedHeight = $origHeight;
+
+ if ($resizedWidth > $maxResizeWidth)
+ {
+ $aspectRatio = $maxResizeWidth / $resizedWidth;
+ $resizedWidth = round($aspectRatio * $resizedWidth);
+ $resizedHeight = round($aspectRatio * $resizedHeight);
+ }
+ if ($resizedHeight > $maxResizeHeight)
+ {
+ $aspectRatio = $maxResizeHeight / $resizedHeight;
+ $resizedWidth = round($aspectRatio * $resizedWidth);
+ $resizedHeight = round($aspectRatio * $resizedHeight);
+ }
+
+ return array($resizedWidth, $resizedHeight);
+}
+
+$page = new Taios_Page('Photo Albums', '../');
+$page->drawHeader();
+$page->drawMiddle();
+
+$dirName = $_GET['dir'];
+if (empty($dirName))
+{
+ $page->redirect('index.php');
+}
+
+write('

Back to Photos


');
+
+write('');');');');');
+write('
+
+$i = 0;
+
+$dir = dir('albums/' . $dirName);
+while (($file = $dir->read()) !== false)
+{
+ if ($file[0] != '.')
+ {
+ if ($i >= 4)
+ {
+ write('
+ }
+
+ $filename = 'albums/' . $dirName . '/' . $file;
+ $size = getImageSizes($filename, 200, 200);
+
+ write('
+
+ $i++;
+ }
+}
+
+write('
+write('');
+
+$page->drawFooter();
+
+?>
+
Index: photos/index.php
===================================================================
--- photos/index.php (revision 192)
+++ photos/index.php (revision 245)
@@ -2,12 +2,21 @@
require '../_taios.php';
-$page = new Taios_Page('Photos', '../');
+$page = new Taios_Page('Photo Albums', '../');
$page->drawHeader();
$page->drawMiddle();
-write('

This page is currently under construction.

');
+write('

Here we have all sorts of photos from Tim32.


');
+$dir = dir('albums/');
+while (($file = $dir->read()) !== false)
+{
+ if ($file[0] != '.')
+ {
+ write('

' . $file . '

');
+ }
+}
+
$page->drawFooter();
?>
/wiki/edit.php
0,0 → 1,52
<?php
 
require '../_taios.php';
 
$pageName = $_GET['page'];
if (empty($pageName))
{
$pageName = 'Index';
}
 
$page = new Taios_Page('Edit Page - ' . $pageName, '../');
$page->drawHeader();
$page->drawMiddle();
 
if ($page->isUserGM($page->getLoggedInUser()))
{
$filename = 'pages/' . $pageName . '.txt';
$content = "";
 
$fp = @fopen($filename, 'r');
if ($fp)
{
$content = fread($fp, filesize($filename));
fclose($fp);
}
?>
 
<form action="edit-do.php" method="POST">
<input type="hidden" name="page" value="<?php echo $pageName; ?>" />
<table>
<tr>
<td><textarea name="content"><?php echo $content; ?></textarea></td>
</tr>
<tr>
<td><input type="submit" value="Edit" /></td>
</tr>
</table>
</form>
 
<?php
}
else
{
$page->drawError('You do not have permission to access this page.');
}
 
$page->drawFooter();
 
?>
 
/wiki/edit-do.php
0,0 → 1,38
<?php
 
require '../_taios.php';
 
$pageName = $_POST['page'];
if (empty($pageName))
{
$pageName = 'Index';
}
 
$page = new Taios_Page('Edit Page - ' . $pageName, '../');
 
if ($page->isUserGM($page->getLoggedInUser()))
{
$filename = 'pages/' . $pageName . '.txt';
$fp = @fopen($filename, 'w');
if ($fp)
{
fwrite($fp, $_POST['content']);
fclose($fp);
$page->redirect('index.php?page=' . $pageName);
}
else
{
$page->drawError('Failed to write file.');
}
}
else
{
$page->drawError('You do not have permission to access this page.');
}
 
$page->drawFooter();
 
?>
 
/wiki/index.php
2,12 → 2,34
 
require '../_taios.php';
 
$page = new Taios_Page('Wiki', '../');
$pageName = $_GET['page'];
if (empty($pageName))
{
$pageName = 'Index';
}
 
$page = new Taios_Page('Wiki - ' . $pageName, '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
if ($page->isUserGM($page->getLoggedInUser()))
{
write('<p><a href="edit.php?page=' . $pageName . '">Edit Page</a></p><br />');
}
 
$filename = 'pages/' . $pageName . '.txt';
 
$fp = @fopen($filename, 'r');
if ($fp)
{
write('<p>' . $page->replaceBBCode(fread($fp, filesize($filename))) . '</p>');
fclose($fp);
}
else
{
write('<p>This page is empty.</p>');
}
 
$page->drawFooter();
 
?>
/wiki/pages/Index.txt
0,0 → 1,4
[b]Welcome to the Tim32 Wiki![/b]
 
Here you can talk about pretty much anything!
 
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: admin/all-projects.php
===================================================================
--- admin/all-projects.php (nonexistent)
+++ admin/all-projects.php (revision 245)
@@ -0,0 +1,55 @@
+
+
+require '../_taios.php';
+
+$page = new Taios_Page('Manage All Projects', '../');
+$page->drawHeader();
+$page->drawMiddle();
+
+$page->checkLoggedIn();
+
+if ($page->isUserAdmin($page->getLoggedInUser()))
+{
+ write('

Use this to manage all the projects on the Tim32 Website.


');
+
+ write('');');');');');');');');');');');');');');');');');');');');');');');
+ write('
+ write('ID
+ write('Author
+ write('Title
+ write('Description
+ write('Logo
+ write('Download
+ write('Website
+ write('Latest Version
+ write('Last Update
+ write('
+
+ $ids = $page->findIDs('Projects');
+ for ($i = 0; $i < count($ids); $i++)
+ {
+ $project = $page->getProject($ids[$i]);
+ write('
+ write('' . $project->ID . '
+ write('' . $project->author->name . '
+ write('' . $project->title . '
+ write('' . str_replace("\n", '
', $project->description) . '
+ write('
+ write('Link
+ write('Link
+ write('' . $project->latestVersion . '
+ write('' . date('j/m/Y H:i', $project->lastUpdate) . '
+ write('
+ }
+
+ write('
');
+}
+else
+{
+ $page->drawError('You do not have permission to access this page.');
+}
+
+$page->drawFooter();
+
+?>
+
Index: projects/edit-project-do.php
===================================================================
--- projects/edit-project-do.php (nonexistent)
+++ projects/edit-project-do.php (revision 245)
@@ -0,0 +1,59 @@
+
+
+require '../_taios.php';
+
+$page = new Taios_Page('Edit Project', '../');
+
+$project = $page->getProject($page->getPostID());
+if (!$project)
+{
+ $page->drawError('No such project, #' . $page->getPostID());
+}
+
+$title = $_POST['title'];
+$description = $_POST['description'];
+$logoURL = $_POST['logourl'];
+$websiteURL = $_POST['websiteurl'];
+$downloadURL = $_POST['downloadurl'];
+$latestVersion = $_POST['latestversion'];
+
+$page->checkLoggedIn();
+$user = $page->getLoggedInUser();
+
+if ($page->isUserAdmin($page->getLoggedInUser()) || $page->getLoggedInUser()->ID == $project->author->ID)
+{
+ if (!empty($title))
+ {
+ $page->query('UPDATE Projects SET Title = "' . $title . '" WHERE ID = ' . $project->ID);
+ }
+ if (!empty($description))
+ {
+ $page->query('UPDATE Projects SET Description = "' . $description . '" WHERE ID = ' . $project->ID);
+ }
+ if (!empty($logoURL))
+ {
+ $page->query('UPDATE Projects SET LogoURL = "' . $logoURL . '" WHERE ID = ' . $project->ID);
+ }
+ if (!empty($websiteURL))
+ {
+ $page->query('UPDATE Projects SET WebsiteURL = "' . $websiteURL . '" WHERE ID = ' . $project->ID);
+ }
+ if (!empty($downloadURL))
+ {
+ $page->query('UPDATE Projects SET DownloadURL = "' . $downloadURL . '" WHERE ID = ' . $project->ID);
+ }
+ if (!empty($latestVersion))
+ {
+ $page->query('UPDATE Projects SET LatestVersion = "' . $latestVersion . '" WHERE ID = ' . $project->ID);
+ }
+
+ $page->query('UPDATE Projects SET LastUpdate = NOW() WHERE ID = ' . $project->ID);
+
+ $page->redirect('index.php');
+}
+else
+{
+ $page->drawError('You do not have permission to access this page.');
+}
+
+?>
Index: projects/edit-project.php
===================================================================
--- projects/edit-project.php (nonexistent)
+++ projects/edit-project.php (revision 245)
@@ -0,0 +1,75 @@
+
+
+require '../_taios.php';
+
+$page = new Taios_Page('Edit Project', '../');
+$page->drawHeader();
+$page->drawMiddle();
+
+$project = $page->getProject($page->getGetID());
+if (!$project)
+{
+ $page->drawError('No such project, #' . $page->getGetID());
+}
+
+?>
+
+

Here you can edit a project from the Tim32 database.

+

Leave an input blank to keep it as it is.

+
+
+
+
+if (isset($_GET['error']))
+{
+ $page->drawError($_GET['error'], false);
+}
+
+if ($page->isUserAdmin($page->getLoggedInUser()) || $page->getLoggedInUser()->ID == $project->author->ID)
+{
+?>
+
+
+
+
+
+Title:
+
+
+
+Description:
+
+
+
+Logo URL:
+
+
+
+Website URL:
+
+
+
+DownloadURL:
+
+
+
+Latest Version:
+
+
+
+
+
+
+
+
+
+
+}
+else
+{
+ $page->drawError('You do not have permission to access this page.');
+}
+
+$page->drawFooter();
+
+?>
Index: projects/delete-project-do.php
===================================================================
--- projects/delete-project-do.php (nonexistent)
+++ projects/delete-project-do.php (revision 245)
@@ -0,0 +1,28 @@
+
+
+require '../_taios.php';
+
+$page = new Taios_Page('Delete Project', '../');
+
+$page->checkLoggedIn();
+$id = $page->getGetID();
+$project = $page->getProject($id);
+
+if (($page->isUserAdmin($page->getLoggedInUser()) || $page->getLoggedInUser()->ID == $project->author->ID) && $project)
+{
+ $page->query('DELETE FROM Projects WHERE ID = ' . $id);
+ $page->redirect('index.php');
+}
+else
+{
+ if (!$project)
+ {
+ $page->drawError('No such project, #' . $id);
+ }
+ else
+ {
+ $page->drawError('You do not have permission to access this page.');
+ }
+}
+
+?>
Index: projects/index.php
===================================================================
--- projects/index.php (revision 192)
+++ projects/index.php (revision 245)
@@ -6,6 +6,13 @@
$page->drawHeader();
$page->drawMiddle();
+write('

Here you can find all the projects that are created by members of Tim32!


');
+if ($page->isUserGM($page->getLoggedInUser()))
+{
+ write('

Add Project

');
+ write('
');
+}
+
$ids = $page->findIDs('Projects', 'ORDER BY LastUpdate DESC');
for ($i = 0; $i < count($ids); $i++)
{
@@ -13,6 +20,37 @@
$project = $page->getProject($id);
write('

' . $project->title . '

');
+ write('');');');');
+ write('
+ write('
+ write('');
+ if (empty($project->latestVersion))
+ {
+ write('

No Releases

');
+ }
+ else
+ {
+ write('

Latest Version: ' . $project->latestVersion . '

');
+ }
+ write('

Project Author: ' . $project->author->name . '

');
+ write('

' . $page->replaceBBCode($project->description) . '

');
+ write('

');

+ if (!empty($project->websiteURL))
+ {
+ write('Website');
+ }
+ if (!empty($project->downloadURL))
+ {
+ write(' · Download');
+ }
+ write('

');
+ write('');
+ write('
+ write('
');
+ if ($page->isUserAdmin($page->getLoggedInUser()) || $user->ID == $project->author->ID)
+ {
+ write('

Edit Project    ·    Delete Project

');
+ }
write('
');
}
/projects/add-project-do.php
0,0 → 1,36
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Add Project', '../');
 
$title = $_POST['title'];
$description = $_POST['description'];
$logoURL = $_POST['logourl'];
$websiteURL = $_POST['websiteurl'];
$downloadURL = $_POST['downloadurl'];
$latestVersion = $_POST['latestversion'];
 
$page->checkLoggedIn();
$user = $page->getLoggedInUser();
 
if (empty($title))
{
$page->redirect('add-project.php?error=No Title Specified');
}
if (empty($description))
{
$page->redirect('add-project.php?error=No Title Specified');
}
 
if ($page->isUserGM($user))
{
$page->query('INSERT INTO Projects VALUES (0, ' . $user->ID . ', "' . $title . '", "' . $description . '", "' . $logoURL . '", "' . $downloadURL . '", "' . $websiteURL . '", "' . $latestVersion . '", NOW())');
$page->redirect('index.php');
}
else
{
$page->drawError('You do not have permission to access this page.');
}
 
?>
/projects/add-project.php
0,0 → 1,69
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Add Project', '../');
$page->drawHeader();
$page->drawMiddle();
 
?>
 
<p class="bold">Here you can add a project to the Tim32 database.</p>
<br />
 
<?php
 
if (isset($_GET['error']))
{
$page->drawError($_GET['error'], false);
}
 
$page->checkLoggedIn();
 
if ($page->isUserGM($page->getLoggedInUser()))
{
?>
 
<form action="add-project-do.php" method="POST">
<table>
<tr>
<td class="bold">Title: </td>
<td><input type="text" name="title" /></td>
</tr>
<tr>
<td class="bold">Description: </td>
<td><textarea name="description"></textarea></td>
</tr>
<tr>
<td class="bold">Logo URL: </td>
<td><input type="text" name="logourl" /></td>
</tr>
<tr>
<td class="bold">Website URL: </td>
<td><input type="text" name="websiteurl" /></td>
</tr>
<tr>
<td class="bold">DownloadURL: </td>
<td><input type="text" name="downloadurl" /></td>
</tr>
<tr>
<td class="bold">Latest Version: </td>
<td><input type="text" name="latestversion" /></td>
</tr>
<tr>
<td class="bold"></td>
<td><input type="submit" value="Add Project" /></td>
</tr>
</table>
</form>
 
<?php
}
else
{
$page->drawError('You do not have permission to access this page.');
}
 
$page->drawFooter();
 
?>
/blog/edit-post.php
67,7 → 67,7
</tr>
<tr>
<td class="bold">Content: </td>
<td><textarea name="content" style="width: 500px; height: 300px;"><?php echo $post->content; ?></textarea></td>
<td><textarea name="content"><?php echo $post->content; ?></textarea></td>
</tr>
<tr>
<td class="bold">Catagory: </td>
/styles.css
76,6 → 76,11
border: 2px solid #333333;
}
 
textarea {
width: 500px;
height: 300px;
}
 
.smiley {
border: 0px;
vertical-align: middle;
/_taios.php
387,7 → 387,7
$project->description = $row['Description'];
$project->logoURL = $row['LogoURL'];
$project->downloadURL = $row['DownloadURL'];
$project->websiteURl = $row['WebsiteURL'];
$project->websiteURL = $row['WebsiteURL'];
$project->latestVersion = $row['LatestVersion'];
$project->lastUpdate = strtotime($row['LastUpdate']);