Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 356 → Rev 449

/register.php
42,11 → 42,11
<td><input type="password" name="password2" /></td>
</tr>
<tr>
<td class="bold">Email Address</td>: </td>
<td class="bold">Email Address: </td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td class="bold">Name</td>: </td>
<td class="bold">Name: </td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
54,10 → 54,16
<td><?php echo recaptcha_get_html(RECAPTCHA_PUBLICKEY); ?></td>
</tr>
<tr>
<td class="bold">3 + 9 * 8</td>
<td><input type="text" name="maths" /></td>
</tr>
<tr>
<td class="bold"></td>
<td><input type="submit" value="Register" /></td>
</tr>
</table>
 
<p style="text-align: center; color: #666666">By registering to Tim32, you agree to be reasonable in all your suggestion/accusations and advoid subjectivity. Suvbjective posts/comments are subject to removal by a Subject of the Tim32 Admins.</p>
</form>
 
<?php
/register-do.php
10,6 → 10,7
$password2 = $_POST['password2'];
$email = $_POST['email'];
$name = $_POST['name'];
$maths = $_POST['maths'];
 
if (empty($username))
{
27,6 → 28,10
{
$page->redirect('register.php?error=Passwords do not match');
}
if ($maths != '75')
{
$page->redirect('register.php?error=Incorrect maths answer');
}
 
$resp = recaptcha_check_answer(RECAPTCHA_PRIVATEKEY, $_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
/photos/album.php
28,8 → 28,6
}
 
$page = new Taios_Page('Photo Albums', '../');
$page->drawHeader();
$page->drawMiddle();
 
$dirName = $_GET['dir'];
if (empty($dirName))
37,6 → 35,11
$page->redirect('index.php');
}
 
$page->drawHeader();
write('<br /><h3>RSS</h3>');
$page->drawMenuItem('RSS Feed', 'photos/rss.php?dir=' . $dirName);
$page->drawMiddle();
 
write('<p class="bold"><a href="index.php">Back to Photos</a></p><br />');
 
if (file_exists("albums/" . $dirName . "/description.txt"))
47,33 → 50,64
write('<table>');
write('<tr>');
 
$directory = "albums/" . $dirName . "/";
$sortOrder = "newestFirst";
 
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler))
{
if ($file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess" && getimagesize($directory . $file))
{
$currentModified = filectime($directory . $file);
$file_names[] = $file;
$file_dates[] = $currentModified;
}
}
 
closedir($handler);
 
if ($sortOrder == "newestFirst")
{
arsort($file_dates);
}
else
{
asort($file_dates);
}
$file_names_Array = array_keys($file_dates);
foreach ($file_names_Array as $idx => $name) $name=$file_names[$name];
$file_dates = array_merge($file_dates);
$i = 0;
 
$indexInArray = 0;
$i = 0;
 
$dir = dir('albums/' . $dirName);
while (($file = $dir->read()) !== false)
foreach ($file_dates as $$file_dates)
{
if (getimagesize('albums/' . $dirName . '/' . $file))
$j = $file_names_Array[$indexInArray];
$file = $file_names[$j];
if ($i >= 3)
{
if ($file[0] != '.')
{
if ($i >= 3)
{
write('</tr><tr>');
$i = 0;
}
write('</tr><tr>');
$i = 0;
}
$filename = 'albums/' . $dirName . '/' . $file;
$size = getImageSizes($filename, 300, 300);
write('<td><a href="' . $filename . '"><img width="' . $size[0] . '" height="' . $size[1] . '" src="' . $filename . '" /></a></td>');
$filename = $directory . $file;
$size = getImageSizes($filename, 280, 260);
 
write('<td><a href="' . str_replace(" ", "%20", $filename) . '"><img width="' . $size[0] . '" height="' . $size[1] . '" src="' . str_replace(" ", "%20", $filename) . '" /></a></td>');
$i++;
}
}
$i++;
$indexInArray++;
}
 
write('</tr>');
write('<table>');
write('</table>');
 
$page->drawFooter();
 
/photos/rss.php
0,0 → 1,76
<?php
 
require '../_taios.php';
 
header("Content-type: application/rss+xml");
 
$page = new Taios_Page('Photos RSS Feed', '../');
 
$dirName = $_GET['dir'];
if (empty($dirName))
{
$dirName = "Lassitor";
}
 
write('<?xml version="1.0" encoding="UTF-8" ?>');
write('<rss version="2.0">');
write('<channel>');
write('<title>Tim32 Photo RSS - ' . $dirName . '</title>');
write('<description>This is the RSS feed for the Tim32 Photos.</description>');
write('<link>http://tim32.org/photos/album.php?dir=' . $dirName . '</link>');
$directory = "albums/" . $dirName . "/";
$sortOrder = "newestFirst";
 
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler))
{
if ($file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess" && getimagesize($directory . $file))
{
$currentModified = filectime($directory . $file);
$file_names[] = $file;
$file_dates[] = $currentModified;
}
}
 
closedir($handler);
 
if ($sortOrder == "newestFirst")
{
arsort($file_dates);
}
else
{
asort($file_dates);
}
$file_names_Array = array_keys($file_dates);
foreach ($file_names_Array as $idx => $name) $name=$file_names[$name];
$file_dates = array_merge($file_dates);
 
$indexInArray = 0;
 
foreach ($file_dates as $date)
{
$j = $file_names_Array[$indexInArray];
$file = $file_names[$j];
$filename = $directory . $file;
write('<item>');
write('<title>' . $file . '</title>');
write('<link>http://tim32.org/photos/' . str_replace(" ", "%20", $filename) . '</link>');
write('<guid>id_' . $file . '</guid>');
write('<pubDate>' . date('D, d M Y H:i:s O', $date). '</pubDate>');
write('<description><![CDATA[<img src="http://tim32.org/photos/' . str_replace(" ", "%20", $filename) . '" />]]></description>');
write('</item>');
$indexInArray++;
}
 
write('</channel>');
write('</rss>');
 
?>
/404.php
1,15 → 1,16
<?php
 
header('Status: 404 Not Found');
 
require '_taios.php';
 
$page = new Taios_Page('404');
$page = new Taios_Page('404 - Page not found', '/');
$page->drawHeader();
write('<h3>Pages</h3>');
$page->drawMenuItem('Biggles', '/~biggles/');
$page->drawMenuItem('Freddie', '/~freddie/');
$page->drawMenuItem('Muzer', '/~muzer/');
$page->drawMenuItem('Sh4rk', '/~szabot/');
$page->drawMenuItem('Tom', '/~tom/');
$page->drawMenuItem('Biggles', '~biggles/');
$page->drawMenuItem('Freddie (FredFace)', '~freddie/');
$page->drawMenuItem('Muzer', '~muzer/');
$page->drawMenuItem('Tom (TomMan)', '~tom/');
$page->drawMiddle();
 
?>
23,6 → 24,7
<?php
 
$page->drawMenuItem('Tim32 Homepage', 'index.php');
$page->drawMenuItem('Youfail.org', 'http://youfail.org');
 
$page->drawFooter();
 
/index.php
8,8 → 8,9
$page->drawMenuItem('Biggles', '/~biggles/');
$page->drawMenuItem('Freddie (FredFace)', '/~freddie/');
$page->drawMenuItem('Muzer', '/~muzer/');
$page->drawMenuItem('Sh4rk', '/~szabot/');
$page->drawMenuItem('Tom (TomMan)', '/~tom/');
write('<br /><h3>Downtime-o-meter</h3>');
write('<p>No planned down.</p>');
$page->drawMiddle();
 
?>
18,12 → 19,13
<p>Tim32 is a 10 year-old laptop running Ubuntu Server Edition 10.04.</p>
<br />
 
<h3>Latest Blog Posts</h3>
<h3 title="Take the Tim32 challenge: http://tim32.org/challenge/">Latest Blog Posts</h3>
<p><a href="blog/rss.php">Rss Feed</a></p>
 
<?php
 
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1 ORDER BY DatePosted DESC');
for ($i = 0; $i < 5 && $i < count($ids); $i++)
for ($i = 0; $i < 4 && $i < count($ids); $i++)
{
$id = $ids[$i];
$post = $page->getBlogPost($id);
/blog/rss.php
0,0 → 1,34
<?php
 
require '../_taios.php';
 
header("Content-type: application/rss+xml");
 
$page = new Taios_Page('Blog RSS Feed', '../');
 
write('<?xml version="1.0" encoding="UTF-8" ?>');
write('<rss version="2.0">');
write('<channel>');
write('<title>Tim32 Blog RSS</title>');
write('<description>This is the RSS feed for the Tim32 Blog.</description>');
write('<link>http://tim32.org/blog/</link>');
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1 ORDER BY DatePosted DESC');
for ($i = 0; $i < count($ids); $i++)
{
$id = $ids[$i];
$post = $page->getBlogPost($id);
write('<item>');
write('<title>' . $post->title . '</title>');
write('<link>http://tim32.org/blog/post.php?id=' . $id . '</link>');
write('<guid>' . $id . '</guid>');
write('<pubDate>' . date('D, d M Y H:i:s O', $post->datePosted). '</pubDate>');
write('<description><![CDATA[' . $page->replaceBBCode($post->content) . ']]></description>');
write('</item>');
}
 
write('</channel>');
write('</rss>');
 
?>
/blog/index.php
5,6 → 5,8
$page = new Taios_Page('Blog Posts', '../');
$page->drawHeader();
$page->drawBlogCategoriesMenu();
write('<br /><h3>RSS</h3>');
$page->drawMenuItem('RSS Feed', 'blog/rss.php');
$page->drawMiddle();
 
if ($page->isUserGM($page->getLoggedInUser()))
/_taios.php
88,6 → 88,7
{
if (!$this->drawnFooter)
{
write('<br /><p class="copyright">&copy; 2011 Tim32 &middot;</p>');
write('</div>');
write('</body>');
write('</html>');
169,9 → 170,24
function replaceBBCode($str)
{
$newstr = str_replace("<", "[", $str);
/*$newstrarray = explode("\n", $str);
$newstr = "";
foreach ($newstrarray as $line)
{
if ($line == "\n" || $line == " \n" || $line == "\n " || $line == "\n\r")
{
$line = "</p><p>";
}
$newstr .= ($line . "\n");
}*/
$newstr = $str;
$newstr = str_replace("<", "[", $newstr);
$newstr = str_replace(">", "]", $newstr);
$newstr = str_replace("\n", '</p><p>', $newstr);
$newstr = str_replace("\n", "</p><p>", $newstr);
$newstr = str_replace("\\'", "'", $newstr);
$newstr = str_replace("\\\"",'"', $newstr);
$newstr = str_replace(' ', '&nbsp;&nbsp;', $newstr);
$newstr = str_replace(' :)', ' <img src="' . $this->url . 'data/smilies/face-smile.png" class="smiley" />', $newstr);
$newstr = str_replace(' :p', ' <img src="' . $this->url . 'data/smilies/face-raspberry.png" class="smiley" />', $newstr);
191,8 → 207,12
'/\[i\](.+?)\[\/i\]/is',
'/\[u\](.+?)\[\/u\]/is',
'/\[url\](.+?)\[\/url\]/is',
'/\[url=(.+?)\](.+?)\[\/url\]/is',
'/\[code\](.+?)\[\/code\]/is',
'/\[img\](.+?)\[\/img\]/is'
'/\[img\](.+?)\[\/img\]/is',
'/\[ul\](.+?)\[\/ul\]/is',
'/\[ol\](.+?)\[\/ol\]/is',
'/\[li\](.+?)\[\/li\]/is'
);
 
$html = array(
200,8 → 220,12
'<i>$1</i>',
'<u>$1</u>',
'<a href="$1">$1</a>',
'<a href="$1">$2</a>',
'<div class="code">$1</div>',
'<img src="$1" />'
'<img src="$1" />',
'<ul>$1</ul>',
'<ol>$1</ol>',
'<li>$1</li>'
);
 
$newstr = preg_replace($bbcode, $html, $newstr);
273,6 → 297,24
return false;
}
function checkChallengeStatus($challengeID, $previous, $next)
{
$currentChallengeID = $this->getLoggedInUser()->challengeID;
if (!$this->isLoggedIn())
{
$this->redirect('index.php');
}
else if ($currentChallengeID > $challengeID)
{
$this->redirect($next . '.php');
}
else if ($currentChallengeID < $challengeID)
{
$this->redirect($previous . '.php');
}
}
function checkLoggedIn()
{
if (!$this->isLoggedIn())
482,6 → 524,7
public $password;
public $emailAddress;
public $name;
 
public $challengeID;
}
 
503,6 → 546,8
public $author;
public $title;
public $description;
 
 
public $logoURL;
public $downloadURL;
public $websiteURL;
516,6 → 561,7
public $parent;
public $title;
public $description;
 
}
 
class ForumPost
/wiki/index.php
1,5 → 1,12
<?php
 
function endswith($string, $test) {
$strlen = strlen($string);
$testlen = strlen($test);
if ($testlen > $strlen) return false;
return substr_compare($string, $test, -$testlen) === 0;
}
 
require '../_taios.php';
 
$pageName = $_GET['page'];
9,14 → 16,33
}
 
$page = new Taios_Page('Wiki - ' . $pageName, '../');
 
if (isset($_GET['random']))
{
$results = array();
$handler = opendir('pages/');
while ($file = readdir($handler))
{
if ($file != '.' && $file != '..' && endswith($file, ".txt"))
{
$results[] = substr($file, 0, count($file) - 5);
}
}
$index = rand() % count($results);
$result = $results[$index];
$page->redirect('index.php?page=' . $result);
}
 
$page->drawHeader();
write('<h3>Wiki</h3>');
$page->drawMenuItem('Index', 'wiki/index.php');
$page->drawMenuItem('Random Page', 'wiki/index.php?random');
$page->drawMiddle();
 
write('<p><i>The wiki is still under construction.</i></p>');
 
if ($page->isUserGM($page->getLoggedInUser()))
{
write('<p><a href="edit.php?page=' . $pageName . '">Edit Page</a></p><br />');
write('<p class="bold"><a href="edit.php?page=' . $pageName . '">Edit Page</a></p><br />');
}
 
$filename = 'pages/' . $pageName . '.txt';
/styles.css
3,7 → 3,7
color: #000000;
font-family: Droid Sans, Tahoma, sans-serif;
font-size: 11pt;
font-size: 10pt;
margin: 0px;
padding: 0px;
46,7 → 46,7
}
 
p, table, span {
font-size: 11pt;
font-size: 10pt;
margin: 8px;
margin-left: 16px;
}
92,7 → 92,7
 
.sidebar {
float: left;
width: 146px;
width: 156px;
padding: 0px;
padding-left: 32px;
border-right: 0px solid #000089;
128,7 → 128,7
 
.content {
top: 0px;
left: 180px;
left: 190px;
position: absolute;
margin-right: 32px;
}
137,6 → 137,10
font-weight: bold;
}
 
.italic {
font-style: italic;
}
 
.indent {
margin-left: 14px;
border-left: 1px solid #BBBBBB;
143,11 → 147,25
}
 
.code {
border: 1px solid #333333;
border-top: 2px solid #999999;
border-bottom: 2px solid #999999;
margin: 14px;
background-color: #DDDDDD;
font-family: Droid Sans Mono, Monospace, Fixed;
font-size: 9px;
line-height: 80%;
}
 
.copyright {
color: #BBBBBB;
text-align: left;
font-size: 9pt;
}
 
.copyright a {
color: #BBBBBB;
}
 
.recaptchatable .recaptcha_image_cell, #recaptcha_table {
background-color: #4B9DE0 !important; //reCaptcha widget background color
}
/challenge/index.php
0,0 → 1,23
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Tim32 Challenge', '../');
$page->drawHeader();
$page->drawMiddle();
 
if ($page->isLoggedIn())
{
write('<p class="bold">Take the Tim32 challenge here!</p>');
write('<p class="italic">Once you\'ve passed a challenge, your progress will automatically be saved.</p>');
write('<br /><br /><a href="00.php"><h2 style="text-align: center">Enter!</h2></a>');
}
else
{
write('<p class="bold">You need to be logged in to take the Tim32 challenge.</p>');
}
 
$page->drawFooter();
 
?>
 
/challenge/00.php
0,0 → 1,37
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Challenge - 00', '../');
$page->checkChallengeStatus(0, "index", "01");
 
$page->drawHeader();
write('<h3>Challenge</h3>');
$page->drawMenuItem('Index', 'challenge/index.php');
$page->drawMiddle();
 
?>
 
<form action="00-do.php" method="POST">
<table>
<tr>
<td class="bold">Morse: </td>
<td style="color: #FFFFFF">.. .-.. .. -.- . -- --- --- ... . </td>
</tr>
<tr>
<td class="bold">Moose: </td>
<td><input type="text" name="moose" /></td>
</tr>
<tr>
<td class="bold"></td>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>
</form>
 
<?php
 
$page->drawFooter();
 
?>
 
/challenge/01.php
0,0 → 1,18
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Challenge - 01', '../');
$page->checkChallengeStatus(1, "index", "02");
 
$page->drawHeader();
write('<h3>Challenge</h3>');
$page->drawMenuItem('Index', 'challenge/index.php');
$page->drawMiddle();
 
 
 
$page->drawFooter();
 
?>
 
/challenge/00-do.php
0,0 → 1,19
<?php
 
require '../_taios.php';
 
$page = new Taios_Page('Challenge - 00', '../');
$page->checkChallengeStatus(0, "index", "01");
 
if ($_POST['moose'] == 'i like moose')
{
$page->query('UPDATE Users SET ChallengeID = 1 WHERE ID = ' . $page->getLoggedInUser()->ID);
$page->redirect('01.php');
}
else
{
$page->redirect('index.php');
}
 
?>