Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 214 → Rev 242

/photos/album.php
0,0 → 1,72
<?php
 
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('<p class="bold"><a href="index.php">Back to Photos</a></p><br />');
 
write('<table>');
write('<tr>');
 
$i = 0;
 
$dir = dir('albums/' . $dirName);
while (($file = $dir->read()) !== false)
{
if ($file[0] != '.')
{
if ($i >= 4)
{
write('</tr><tr>');
}
$filename = 'albums/' . $dirName . '/' . $file;
$size = getImageSizes($filename, 200, 200);
write('<td><a href="' . $filename . '"><img wdith="' . $size[0] . '" height="' . $size[1] . '" src="' . $filename . '" /></a></td>');
$i++;
}
}
 
write('</tr>');
write('<table>');
 
$page->drawFooter();
 
?>
 
/photos/index.php
2,12 → 2,21
 
require '../_taios.php';
 
$page = new Taios_Page('Photos', '../');
$page = new Taios_Page('Photo Albums', '../');
$page->drawHeader();
$page->drawMiddle();
 
write('<br /><p class="bold">This page is currently under construction.</p>');
write('<p>Here we have all sorts of photos from Tim32.</p><br />');
 
$dir = dir('albums/');
while (($file = $dir->read()) !== false)
{
if ($file[0] != '.')
{
write('<p><a href="album.php?dir=' . $file . '">' . $file . '</a></p>');
}
}
 
$page->drawFooter();
 
?>
/photos/albums/ArchLinux Wallpapers/archlinux-firestarter.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/photos/albums/ArchLinux Wallpapers/archlinux-firestarter.jpg
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: photos/albums/ArchLinux Wallpapers/archlinux-berry.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: photos/albums/ArchLinux Wallpapers/archlinux-berry.jpg
===================================================================
--- photos/albums/ArchLinux Wallpapers/archlinux-berry.jpg (nonexistent)
+++ photos/albums/ArchLinux Wallpapers/archlinux-berry.jpg (revision 242)
/photos/albums/ArchLinux Wallpapers/archlinux-berry.jpg
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: wiki/edit.php
===================================================================
--- wiki/edit.php (nonexistent)
+++ wiki/edit.php (revision 242)
@@ -0,0 +1,52 @@
+
+
+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);
+ }
+
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+else
+{
+ $page->drawError('You do not have permission to access this page.');
+}
+
+$page->drawFooter();
+
+?>
+
Index: wiki/edit-do.php
===================================================================
--- wiki/edit-do.php (nonexistent)
+++ wiki/edit-do.php (revision 242)
@@ -0,0 +1,38 @@
+
+
+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();
+
+?>
+
Index: wiki/index.php
===================================================================
--- wiki/index.php (revision 214)
+++ wiki/index.php (revision 242)
@@ -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('

This page is currently under construction.

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

Edit Page


');
+}
+$filename = 'pages/' . $pageName . '.txt';
+
+$fp = @fopen($filename, 'r');
+if ($fp)
+{
+ write('

' . $page->replaceBBCode(fread($fp, filesize($filename))) . '

');
+ fclose($fp);
+}
+else
+{
+ write('

This page is empty.

');
+}
+
$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 242)
@@ -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 242)
@@ -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 (revision 214)
+++ projects/edit-project.php (revision 242)
@@ -2,7 +2,7 @@
require '../_taios.php';
-$page = new Taios_Page('Add Project', '../');
+$page = new Taios_Page('Edit Project', '../');
$page->drawHeader();
$page->drawMiddle();