Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 230 → Rev 249

/_taios.php
284,7 → 284,7
$result = mysql_query($query);
if (!$result)
{
$this->drawError('MySQL Error: ' . mysql_error());
$this->drawError('Query Failed: . ' $query . "\n" . 'MySQL Error: ' . mysql_error());
}
return $result;
397,6 → 397,24
return false;
}
function getForumCategory($id)
{
$result = $this->query('SELECT * FROM ForumCategories WHERE ID = ' . $id);
while ($row = mysql_fetch_array($result))
{
$f = new ForumCategory;
$f->ID = $row['ID'];
$f->parentID = $row['ParentID'];
$f->title = $row['Title'];
$f->description = $row['Description'];
return $f;
}
return false;
}
function delBlogPost($id)
{
$ids = $this->findIDs('BlogPosts', 'WHERE ParentID=' . $id);
468,6 → 486,14
public $lastUpdate;
}
 
class ForumCategory
{
public $ID;
public $parentID;
public $title;
public $description;
}
 
function write($str)
{
echo $str;
/forums/index.php
6,8 → 6,20
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
$parentID = $_GET['parentID'];
if (empty($parentID))
{
$parentID = -1;
}
 
$ids = $page->findIDs('ForumCategories', 'WHERE ParentID = ' . $parentID . ' ORDER BY Title ASC');
for ($i = 0; $i < count($ids); $i++)
{
$forumCategory = $page->getForumCategory($ids[$id]);
write('<h4><a href="index.php?parentID=' . $forumCategory->parentID . '">' . $forumCategory->title . '</a></h4>');
write('<p>' . $forumCategory->description . '</p>');
}
 
$page->drawFooter();
 
?>
/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 249)
/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 249)
@@ -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 230)
+++ photos/index.php (revision 249)
@@ -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
28,6 → 28,7
?>
 
<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>
/wiki/edit-do.php
19,6 → 19,8
{
fwrite($fp, $_POST['content']);
fclose($fp);
$page->redirect('index.php?page=' . $pageName);
}
else
{