Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 393 → Rev 333

/challenge/index.php
File deleted
/challenge/00-do.php
File deleted
/challenge/00.php
File deleted
/challenge/01.php
File deleted
/_recaptchalib.php
File deleted
/index.php
18,7 → 18,7
<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>
<h3>Latest Blog Posts</h3>
 
<?php
 
/_taios.php
88,7 → 88,6
{
if (!$this->drawnFooter)
{
write('<br /><p class="copyright">&copy; 2011 Tim32 &middot; <a href="http://validator.w3.org/check?uri=http%3A%2F%2Ftim32.org%2F">HTML5 Valid</a></p>');
write('</div>');
write('</body>');
write('</html>');
173,8 → 172,6
$newstr = str_replace("<", "[", $str);
$newstr = str_replace(">", "]", $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);
194,7 → 191,6
'/\[i\](.+?)\[\/i\]/is',
'/\[u\](.+?)\[\/u\]/is',
'/\[url\](.+?)\[\/url\]/is',
'/\[url=(.+?)\](.+?)\[\/url\]/is',
'/\[code\](.+?)\[\/code\]/is',
'/\[img\](.+?)\[\/img\]/is'
);
204,7 → 200,6
'<i>$1</i>',
'<u>$1</u>',
'<a href="$1">$1</a>',
'<a href="$1">$2</a>',
'<div class="code">$1</div>',
'<img src="$1" />'
);
278,24 → 273,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())
/photos/album.php
47,64 → 47,33
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 (getimagesize('albums/' . $dirName . '/' . $file))
{
$currentModified = filectime($directory . $file);
$file_names[] = $file;
$file_dates[] = $currentModified;
}
}
 
closedir($handler);
 
if ($sortOrder == "newestFirst")
{
arsort($file_dates);
}
else
{
asort($file_dates);
}
if ($file[0] != '.')
{
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, 300, 300);
 
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>');
/styles.css
4,9 → 4,6
font-family: Droid Sans, Tahoma, sans-serif;
font-size: 11pt;
margin: 0px;
padding: 0px;
}
 
h1 {
91,8 → 88,9
}
 
.sidebar {
float: left;
width: 146px;
left: 0px;
top: 0px;
position: fixed;
padding: 0px;
padding-left: 32px;
border-right: 0px solid #000089;
101,6 → 99,7
}
 
.sidebar-header {
left: 0px;
width: 140px;
padding: 6px;
text-align: right;
127,8 → 126,8
}
 
.content {
left: 194px;
top: 0px;
left: 180px;
position: absolute;
margin-right: 32px;
}
148,26 → 147,3
font-family: Droid Sans Mono, Monospace, Fixed;
}
 
.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
}
 
/404.php
2,7 → 2,7
 
require '_taios.php';
 
$page = new Taios_Page('404 - Pagee not found', '/');
$page = new Taios_Page('404');
$page->drawHeader();
write('<h3>Pages</h3>');
$page->drawMenuItem('Biggles', '/~biggles/');
23,7 → 23,6
<?php
 
$page->drawMenuItem('Tim32 Homepage', 'index.php');
$page->drawMenuItem('Youfail.org', 'http://youfail.org');
 
$page->drawFooter();
 
/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,30 → 9,11
}
 
$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 />');
/register-do.php
1,7 → 1,6
<?php
 
require '_taios.php';
require_once '_recaptchalib.php';
 
$page = new Taios_Page('Login');
 
28,15 → 27,6
$page->redirect('register.php?error=Passwords do not match');
}
 
$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,19 → 35,15
<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"></td>
<td><input type="submit" value="Register" /></td>
</tr>
</table>