From 9244cafe9c8c125bac75da404bdcb097176dcde7 Mon Sep 17 00:00:00 2001 From: ctrlcctrlv Date: Sun, 11 Aug 2013 13:17:21 +0000 Subject: [PATCH 1/3] Fix catalog image not working inside threads --- js/catalog-link.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/catalog-link.js b/js/catalog-link.js index a8b8a0a8..124a3e9a 100644 --- a/js/catalog-link.js +++ b/js/catalog-link.js @@ -4,7 +4,12 @@ function catalog() { var board = $("input[name='board']"); if (board.length>0) { +if (window.location.href.indexOf("/res/")==-1){ //if we are inside a thread var catalog_url = 'catalog.html'; +} +else { +var catalog_url = '../catalog.html'; +} var pages = document.getElementsByClassName('pages')[0]; var bottom = document.getElementsByClassName('boardlist bottom')[0] var subtitle = document.getElementsByClassName('subtitle')[0]; From fd54de712631869069a74d2e54e03ed1136a7d06 Mon Sep 17 00:00:00 2001 From: ctrlcctrlv Date: Sun, 11 Aug 2013 13:54:11 +0000 Subject: [PATCH 2/3] Improve spoiler action --- inc/config.php | 2 ++ inc/mod/pages.php | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 440ce9aa..501646bd 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1120,6 +1120,8 @@ $config['mod']['bandelete'] = MOD; // Remove bans $config['mod']['unban'] = MOD; + // Spoiler file (and keep post) + $config['mod']['deletefile'] = JANITOR; // Delete file (and keep post) $config['mod']['deletefile'] = JANITOR; // Delete all posts by IP diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 9c26e0c4..84891e3b 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1467,6 +1467,14 @@ function mod_spoiler_image($board, $post) { error($config['error']['noaccess']); // Delete file + $query = prepare(sprintf("SELECT `thumb`, `thread` FROM ``posts_%s`` WHERE id = :id", $board)); + $query->bindValue(':id', $post, PDO::PARAM_INT); + $query->execute() or error(db_error($query)); + $result = $query->fetch(PDO::FETCH_ASSOC); + + file_unlink($board . '/' . $config['dir']['thumb'] . $result['thumb']); + + // Make thumbnail spoiler $query = prepare(sprintf("UPDATE ``posts_%s`` SET `thumb` = :thumb, `thumbwidth` = :thumbwidth, `thumbheight` = :thumbheight WHERE `id` = :id", $board)); $query->bindValue(':thumb', "spoiler"); $query->bindValue(':thumbwidth', 128, PDO::PARAM_INT); @@ -1476,7 +1484,10 @@ function mod_spoiler_image($board, $post) { // Record the action modLog("Spoilered file from post #{$post}"); - + + // Rebuild thread + buildThread($result['thread'] ? $result['thread'] : $post); + // Rebuild board buildIndex(); From efebd3022198995395859ddc07b1a48828ef1f89 Mon Sep 17 00:00:00 2001 From: ctrlcctrlv Date: Sun, 11 Aug 2013 13:55:15 +0000 Subject: [PATCH 3/3] forgot to rename config option --- inc/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 501646bd..bf966235 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1121,7 +1121,7 @@ // Remove bans $config['mod']['unban'] = MOD; // Spoiler file (and keep post) - $config['mod']['deletefile'] = JANITOR; + $config['mod']['spoilerfile'] = JANITOR; // Delete file (and keep post) $config['mod']['deletefile'] = JANITOR; // Delete all posts by IP