Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 466 → Rev 306

/challenge/01.php
File deleted
/challenge/index.php
File deleted
/challenge/00-do.php
File deleted
/challenge/00.php
File deleted
/_recaptchalib.php
File deleted
/admin/all-blog-posts.php
27,28 → 27,24
$ids = $page->findIDs('BlogPosts', 'ORDER BY DatePosted DESC');
for ($i = 0; $i < count($ids); $i++)
{
$id_str = $ids[$i];
if (!empty($id_str))
$post = $page->getBlogPost($ids[$i]);
write('<tr>');
write('<td><a href="../blog/edit-post.php?id=' . $post->ID . '">' . $post->ID . '</a></td>');
if ($post->parent == -1)
{
$post = $page->getBlogPost($id_str);
write('<tr>');
write('<td><a href="../blog/edit-post.php?id=' . $post->ID . '">' . $post->ID . '</a></td>');
if ($post->parent == -1)
{
write('<td style="color: #444444;">No Parent</td>');
}
else
{
write('<td>' . $post->parent->title . '</td>');
}
write('<td><a href="account.php?id=' . $post->author->ID . '">' . $post->author->name . '</a></td>');
write('<td>' . $post->title . '</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>');
write('</tr>');
write('<td style="color: #444444;">No Parent</td>');
}
else
{
write('<td>' . $post->parent->title . '</td>');
}
write('<td><a href="account.php?id=' . $post->author->ID . '">' . $post->author->name . '</a></td>');
write('<td>' . $post->title . '</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>');
write('</tr>');
}
write('</table>');
/wiki/index.php
1,12 → 1,5
<?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'];
16,33 → 9,14
}
 
$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 class="bold"><a href="edit.php?page=' . $pageName . '">Edit Page</a></p><br />');
write('<p><a href="edit.php?page=' . $pageName . '">Edit Page</a></p><br />');
}
 
$filename = 'pages/' . $pageName . '.txt';
/photos/rss.php
File deleted
/photos/album.php
28,6 → 28,8
}
 
$page = new Taios_Page('Photo Albums', '../');
$page->drawHeader();
$page->drawMiddle();
 
$dirName = $_GET['dir'];
if (empty($dirName))
35,79 → 37,35
$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"))
{
write('<p>' . $page->replaceBBCode(file_get_contents("albums/" . $dirName . "/description.txt")) . '</p><br />');
}
 
write('<table>');
write('<tr>');
 
$directory = "albums/" . $dirName . "/";
$sortOrder = "newestFirst";
$i = 0;
 
$results = array();
$handler = opendir($directory);
while ($file = readdir($handler))
$dir = dir('albums/' . $dirName);
while (($file = $dir->read()) !== false)
{
if ($file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess" && getimagesize($directory . $file))
if ($file[0] != '.')
{
$currentModified = filectime($directory . $file);
$file_names[] = $file;
$file_dates[] = $currentModified;
}
}
 
closedir($handler);
 
if ($sortOrder == "newestFirst")
{
arsort($file_dates);
}
else
{
asort($file_dates);
}
if ($i >= 4)
{
write('</tr><tr>');
$i = 0;
}
$file_names_Array = array_keys($file_dates);
foreach ($file_names_Array as $idx => $name) $name=$file_names[$name];
$file_dates = array_merge($file_dates);
$filename = 'albums/' . $dirName . '/' . $file;
$size = getImageSizes($filename, 200, 200);
$i = 0;
 
$indexInArray = 0;
$i = 0;
 
foreach ($file_dates as $$file_dates)
{
$j = $file_names_Array[$indexInArray];
$file = $file_names[$j];
if ($i >= 3)
{
write('</tr><tr>');
$i = 0;
write('<td><a href="' . $filename . '"><img width="' . $size[0] . '" height="' . $size[1] . '" src="' . $filename . '" /></a></td>');
$i++;
}
$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++;
$indexInArray++;
}
 
write('</tr>');
write('</table>');
write('<table>');
 
$page->drawFooter();
 
/photos/index.php
8,17 → 8,9
 
write('<p>Here we have all sorts of photos from Tim32.</p><br />');
 
$dirs = array();
$dir = dir('albums/');
while (($file = $dir->read()) !== false)
{
array_push($dirs, $file);
}
 
asort($dirs);
 
foreach ($dirs as $file)
{
if ($file[0] != '.')
{
write('<p><a href="album.php?dir=' . $file . '">' . $file . '</a></p>');
/_taios.php
34,8 → 34,7
write('<head>');
write('<meta http-equiv="Content-Type" content="text/html;charset=utf-8">');
write('<title>Tim32 &middot; ' . $this->title . '</title>');
write('<link href="' . $this->url . 'styles.css" rel="stylesheet" type="text/css" media="screen" />');
write('<link rel="shortcut icon" href="' . $this->url . 'data/favicon.png" />');
write('<link href="' . $this->url . 'styles.css" rel="stylesheet" type="text/css" media="screen">');
write('</head>');
write('<body>');
write('<div class="sidebar">');
89,7 → 88,6
{
if (!$this->drawnFooter)
{
write('<br /><p class="copyright">Tim32</p>');
write('</div>');
write('</body>');
write('</html>');
171,24 → 169,7
function replaceBBCode($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("\\'", "'", $newstr);
$newstr = str_replace("\\\"",'"', $newstr);
$newstr = str_replace("\n", '</p><p>', $str);
$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);
208,13 → 189,8
'/\[i\](.+?)\[\/i\]/is',
'/\[u\](.+?)\[\/u\]/is',
'/\[url\](.+?)\[\/url\]/is',
'/\[url=(.+?)\](.+?)\[\/url\]/is',
'/\[code\](.+?)\[\/code\]/is',
'/\[img\](.+?)\[\/img\]/is',
'/\[ul\](.+?)\[\/ul\]/is',
'/\[ol\](.+?)\[\/ol\]/is',
'/\[li\](.+?)\[\/li\]/is',
'/\[mono\](.+?)\[\/mono\]/is'
'/\[img\](.+?)\[\/img\]/is'
);
 
$html = array(
222,13 → 198,8
'<i>$1</i>',
'<u>$1</u>',
'<a href="$1">$1</a>',
'<a href="$1">$2</a>',
'<div class="code">$1</div>',
'<img src="$1" />',
'<ul>$1</ul>',
'<ol>$1</ol>',
'<li>$1</li>',
'<span style="font-family: Droid Sans Mono, monospace, fixed; margin-left: 1em; margin-right: 1em;">$1</span>',
'<img src="$1" />'
);
 
$newstr = preg_replace($bbcode, $html, $newstr);
300,24 → 271,6
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())
527,7 → 480,6
public $password;
public $emailAddress;
public $name;
 
public $challengeID;
}
 
549,8 → 501,6
public $author;
public $title;
public $description;
 
 
public $logoURL;
public $downloadURL;
public $websiteURL;
564,7 → 514,6
public $parent;
public $title;
public $description;
 
}
 
class ForumPost
/styles.css
3,23 → 3,20
color: #000000;
font-family: Droid Sans, Tahoma, sans-serif;
font-size: 10pt;
margin: 0px;
padding: 0px;
font-size: 11pt;
}
 
h1 {
font-size: 28pt;
margin: 8px;
margin: 6px;
margin-top: 0px;
color: #FFFFFF;
border-bottom: 1px solid #FFFFFF;
color: #000089;
border-bottom: 1px solid #000000;
}
 
h2 {
font-size: 20pt;
margin: 8px;
margin: 6px;
margin-left: 8px;
color: #00004B;
}
26,7 → 23,7
 
h3 {
font-size: 16pt;
margin: 8px;
margin: 6px;
margin-left: 10px;
color: #000055;
}
33,7 → 30,7
 
h4 {
font-size: 12pt;
margin: 8px;
margin: 6px;
margin-left: 12px;
color: #00005F;
}
40,14 → 37,14
 
h5 {
font-size: 10pt;
margin: 8px;
margin: 6px;
margin-left: 14px;
color: #000069;
}
 
p, table, span {
font-size: 10pt;
margin: 8px;
font-size: 11pt;
margin: 6px;
margin-left: 16px;
}
 
91,21 → 88,21
}
 
.sidebar {
left: 0px;
top: 0px;
left: 0px;
position: fixed;
float: left;
width: 156px;
padding: 0px;
padding-left: 32px;
border-right: 2px solid #000049;
background-color: #032865;
color: #FFFFFF;
height: 100%;
z-index: 50;
border-right: 1px solid #000089;
background-color: #FFFF73;
background-image: url('data/sidebar-gradient.png');
background-repeat: repeat-x;
background-position: center bottom;
}
 
.sidebar-header {
left: 0px;
width: 140px;
padding: 6px;
text-align: right;
114,12 → 111,10
.sidebar-menu {
text-align: right;
padding: 6px;
color: #FFFFFF;
}
 
.sidebar-menu h3 {
margin: 6px;
color: #FFFFFF;
}
 
.sidebar-menu p {
127,13 → 122,9
margin: 4px;
}
 
.sidebar-menu a {
color: #FFFFFF;
}
 
.content {
left: 200px;
top: 0px;
left: 190px;
position: absolute;
margin-right: 32px;
}
142,10 → 133,6
font-weight: bold;
}
 
.italic {
font-style: italic;
}
 
.indent {
margin-left: 14px;
border-left: 1px solid #BBBBBB;
152,35 → 139,8
}
 
.code {
border-top: 2px solid #999999;
border-bottom: 2px solid #999999;
margin: 14px;
border: 1px solid #333333;
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
}
#recaptcha_table {
border-color: #3874A4 !important; //reCaptcha widget border color
}
#recaptcha_response_field {
border-color: #000000 !important; //Text input field border color
background-color:#FFFFFF !important; //Text input field background color
}
 
/blog/rss.php
File deleted
/blog/index.php
5,8 → 5,6
$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()))
/index.php
6,9 → 6,10
$page->drawHeader();
write('<h3>Pages</h3>');
$page->drawMenuItem('Biggles', '/~biggles/');
$page->drawMenuItem('FredFace', '/~freddie/');
$page->drawMenuItem('Freddie', '/~freddie/');
$page->drawMenuItem('Muzer', '/~muzer/');
$page->drawMenuItem('TomMan', '/~tom/');
$page->drawMenuItem('Sh4rk', '/~szabot/');
$page->drawMenuItem('Tom', '/~tom/');
$page->drawMiddle();
 
?>
17,13 → 18,12
<p>Tim32 is a 10 year-old laptop running Ubuntu Server Edition 10.04.</p>
<br />
 
<h3 title="Take the Tim32 challenge: http://tim32.org/challenge/">Latest Blog Posts</h3>
<p><a href="blog/rss.php">Rss Feed</a></p>
<h3>Latest Blog Posts</h3>
 
<?php
 
$ids = $page->findIDs('BlogPosts', 'WHERE ParentID = -1 ORDER BY DatePosted DESC');
for ($i = 0; $i < 4 && $i < count($ids); $i++)
for ($i = 0; $i < 5 && $i < count($ids); $i++)
{
$id = $ids[$i];
$post = $page->getBlogPost($id);
/data/favicon.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/data/favicon.png
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: 404.php
===================================================================
--- 404.php (revision 466)
+++ 404.php (revision 306)
@@ -1,16 +1,15 @@
-header('Status: 404 Not Found');
-
require '_taios.php';
-$page = new Taios_Page('404 - Page not found', '/');
+$page = new Taios_Page('404');
$page->drawHeader();
write('

Pages

');
-$page->drawMenuItem('Biggles', '~biggles/');
-$page->drawMenuItem('Freddie (FredFace)', '~freddie/');
-$page->drawMenuItem('Muzer', '~muzer/');
-$page->drawMenuItem('Tom (TomMan)', '~tom/');
+$page->drawMenuItem('Biggles', '/~biggles/');
+$page->drawMenuItem('Freddie', '/~freddie/');
+$page->drawMenuItem('Muzer', '/~muzer/');
+$page->drawMenuItem('Sh4rk', '/~szabot/');
+$page->drawMenuItem('Tom', '/~tom/');
$page->drawMiddle();
?>
@@ -17,7 +16,6 @@

404 - Page not found

The page you requested could not be found.

-

Useful Links

@@ -24,7 +22,6 @@
$page->drawMenuItem('Tim32 Homepage', 'index.php');
-$page->drawMenuItem('Youfail.org', 'http://youfail.org');
$page->drawFooter();
/register-do.php
1,7 → 1,6
<?php
 
require '_taios.php';
require_once '_recaptchalib.php';
 
$page = new Taios_Page('Login');
 
10,7 → 9,6
$password2 = $_POST['password2'];
$email = $_POST['email'];
$name = $_POST['name'];
$maths = $_POST['maths'];
 
if (empty($username))
{
28,20 → 26,7
{
$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"],
$_POST["recaptcha_response_field"]);
 
if (!$resp->is_valid)
{
$page->redirect('register.php?error=Incorrect reCAPTCHA response');
}
 
$page->query('INSERT INTO Users (AccessID, Username, Password, EmailAddress, Name, ChallengeID) VALUES (2, "' . $username . '", "' . sha1($password) . '", "' . $email . '", "' . $name . '", 0)');
 
$page->redirect('login.php');
/register.php
1,7 → 1,6
<?php
 
require '_taios.php';
require_once '_recaptchalib.php';
 
$page = new Taios_Page('Register');
$page->drawHeader();
21,12 → 20,6
 
?>
 
<script type="text/javascript">
var RecaptchaOptions = {
theme : 'clean'
};
</script>
 
<form action="register-do.php" method="POST">
<table>
<tr>
42,28 → 35,18
<td><input type="password" name="password2" /></td>
</tr>
<tr>
<td class="bold">Email Address: </td>
<td class="bold">Email Address</td>: </td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td class="bold">Name: </td>
<td class="bold">Name</td>: </td>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td class="bold"></td>
<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