From 80804b9df603a3bfeb3d2255351fffbaa29ce329 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sun, 18 Aug 2013 20:53:01 +1000 Subject: Bugfix: $config['file_thumb'] being used incorrectly --- post.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'post.php') diff --git a/post.php b/post.php index 3f8656df..572536de 100644 --- a/post.php +++ b/post.php @@ -593,8 +593,10 @@ if (isset($_POST['delete'])) { // not an image //copy($config['file_thumb'], $post['thumb']); $post['thumb'] = 'file'; - - $size = @getimagesize($config['file_thumb']); + + $size = @getimagesize(sprintf($config['file_thumb'], + isset($config['file_icons'][$post['extension']]) ? + $config['file_icons'][$post['extension']] : $config['file_icons']['default'])); $post['thumbwidth'] = $size[0]; $post['thumbheight'] = $size[1]; } -- cgit v1.3 From 154fbf50701652194d40cfdbfaa9eb4751678afb Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 19 Aug 2013 01:07:04 +1000 Subject: Huge bug: undoImage() was not working at all. This means lots of Tinyboard users probably have lone/permanent images. Working on Tinyboard-Tools script to remove all images/thumbs that don't belong. --- inc/functions.php | 8 ++++---- post.php | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'post.php') diff --git a/inc/functions.php b/inc/functions.php index 259245f3..d5348f0d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1859,10 +1859,10 @@ function undoImage(array $post) { if (!$post['has_file']) return; - if (isset($post['file'])) - file_unlink($post['file']); - if (isset($post['thumb'])) - file_unlink($post['thumb']); + if (isset($post['file_path'])) + file_unlink($post['file_path']); + if (isset($post['thumb_path'])) + file_unlink($post['thumb_path']); } function rDNS($ip_addr) { diff --git a/post.php b/post.php index 572536de..d5e1c500 100644 --- a/post.php +++ b/post.php @@ -653,6 +653,7 @@ if (isset($_POST['delete'])) { // Remove board directories before inserting them into the database. if ($post['has_file']) { $post['file_path'] = $post['file']; + $post['thumb_path'] = $post['thumb']; $post['file'] = mb_substr($post['file'], mb_strlen($board['dir'] . $config['dir']['img'])); if ($is_an_image && $post['thumb'] != 'spoiler') $post['thumb'] = mb_substr($post['thumb'], mb_strlen($board['dir'] . $config['dir']['thumb'])); -- cgit v1.3 From 740b710dd445b8ce988825fb649a3e03704833e5 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 19 Aug 2013 01:54:14 +1000 Subject: chmod(): images don't need +x lol --- post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'post.php') diff --git a/post.php b/post.php index d5e1c500..02d97e24 100644 --- a/post.php +++ b/post.php @@ -605,7 +605,7 @@ if (isset($_POST['delete'])) { if (isset($post['file_tmp'])) { if (!@rename($upload, $post['file'])) error($config['error']['nomove']); - chmod($post['file'], 0755); + chmod($post['file'], 0644); } elseif (!@move_uploaded_file($upload, $post['file'])) error($config['error']['nomove']); } -- cgit v1.3