Skip to content
This repository has been archived by the owner on Jun 8, 2018. It is now read-only.

Commit

Permalink
Better looking error page
Browse files Browse the repository at this point in the history
  • Loading branch information
tslocum committed Jan 8, 2011
1 parent 4dea085 commit 730ddf4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
12 changes: 4 additions & 8 deletions imgboard.php
Expand Up @@ -14,7 +14,7 @@
if (get_magic_quotes_runtime()) { set_magic_quotes_runtime(0); }

function fancyDie($message) {
die('<span style="color: red;font-size: 1.5em;font-family: Helvetica;">' . $message . '</span>');
die('<body text="#800000" bgcolor="#FFFFEE" align="center"><br><span style="background-color: #F0E0D6;font-size: 1.25em;font-family: Tahoma, Geneva, sans-serif;padding: 7px;border: 1px solid #D9BFB7;border-left: none;border-top: none;">' . $message . '</span><br><br>- <a href="javascript:history.go(-1)">Click here to go back</a> -</body>');
}

if (!file_exists('settings.php')) {
Expand All @@ -32,12 +32,8 @@ function fancyDie($message) {
}

$includes = array("inc/functions.php", "inc/html.php");
if (TINYIB_DBMODE == 'flatfile') {
$includes[] = 'inc/database_flatfile.php';
} elseif (TINYIB_DBMODE == 'mysql') {
$includes[] = 'inc/database_mysql.php';
} elseif (TINYIB_DBMODE == 'sqlite') {
$includes[] = 'inc/database_sqlite.php';
if (in_array(TINYIB_DBMODE, array('flatfile', 'mysql', 'sqlite'))) {
$includes[] = 'inc/database_' . TINYIB_DBMODE . '.php';
} else {
fancyDie("Unknown database mode specificed");
}
Expand Down Expand Up @@ -153,7 +149,7 @@ function fancyDie($message) {

$post['id'] = insertPost($post);
if ($noko) {
$redirect = ($post['parent'] != '0') ? 'res/' . $post['parent'] . '.html#' . $post['id'] : 'res/' . $post['id'] . '.html#' . $post['id'];
$redirect = 'res/' . ($post['parent'] == '0' ? $post['id'] : $post['parent']) . '.html#' . $post['id'];
}
trimThreads();
echo 'Updating thread page...<br>';
Expand Down
11 changes: 3 additions & 8 deletions inc/functions.php
Expand Up @@ -86,8 +86,7 @@ function nameAndTripcode($name) {
}

$tripcode = "";
if ($cap != "") {
/* From Futabally */
if ($cap != "") { // Copied from Futabally
$cap = strtr($cap, "&amp;", "&");
$cap = strtr($cap, "&#44;", ", ");
$salt = substr($cap."H.", 1, 2);
Expand Down Expand Up @@ -349,30 +348,26 @@ function createThumbnail($name, $filename, $new_w, $new_h) {
}

function fastImageCopyResampled(&$dst_image, &$src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3) {
//Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable.
// Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable.
if (empty($src_image) || empty($dst_image)) { return false; }

if ($quality <= 1) {
$temp = imagecreatetruecolor ($dst_w + 1, $dst_h + 1);

imagecopyresized ($temp, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w + 1, $dst_h + 1, $src_w, $src_h);
imagecopyresized ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $dst_w, $dst_h);
imagedestroy ($temp);
} elseif ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {

$tmp_w = $dst_w * $quality;
$tmp_h = $dst_h * $quality;
$temp = imagecreatetruecolor ($tmp_w + 1, $tmp_h + 1);

imagecopyresized ($temp, $src_image, $dst_x * $quality, $dst_y * $quality, $src_x, $src_y, $tmp_w + 1, $tmp_h + 1, $src_w, $src_h);

imagecopyresampled ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $tmp_w, $tmp_h);

imagedestroy ($temp);

} else {
imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
}


return true;
}
Expand Down

0 comments on commit 730ddf4

Please sign in to comment.