diff --git a/imgboard.php b/imgboard.php
index cf233d6..9bef66e 100644
--- a/imgboard.php
+++ b/imgboard.php
@@ -14,7 +14,7 @@ if (get_magic_quotes_gpc()) {
if (get_magic_quotes_runtime()) { set_magic_quotes_runtime(0); }
function fancyDie($message) {
- die('' . $message . '');
+ die('
' . $message . '
- Click here to go back -');
}
if (!file_exists('settings.php')) {
@@ -32,12 +32,8 @@ foreach ($writedirs as $dir) {
}
$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");
}
@@ -153,7 +149,7 @@ if (isset($_POST["message"]) || isset($_POST["file"])) {
$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...
';
diff --git a/inc/functions.php b/inc/functions.php
index cd2ec61..fec3521 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -86,8 +86,7 @@ function nameAndTripcode($name) {
}
$tripcode = "";
- if ($cap != "") {
- /* From Futabally */
+ if ($cap != "") { // Copied from Futabally
$cap = strtr($cap, "&", "&");
$cap = strtr($cap, ",", ", ");
$salt = substr($cap."H.", 1, 2);
@@ -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;
}