summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2013-08-11 17:32:57 -0400
committerczaks <marcin@6irc.net>2013-08-11 17:32:57 -0400
commit6e26c76c56fd5ad1e07e71f424d31ec9a27618df (patch)
tree008c6a81f2be8520a85414ec4d96a804354ddb1d
parent9a03b6902dddbe6201af9dc9b90046c098d0c5fc (diff)
parentb9ec342750009037893e1bb06640905c6d88b5dd (diff)
Merge branch 'master' of http://github.com/ctrlcctrlv/Tinyboard
-rw-r--r--inc/config.php2
-rw-r--r--inc/mod/pages.php13
-rw-r--r--js/catalog-link.js7
3 files changed, 20 insertions, 2 deletions
diff --git a/inc/config.php b/inc/config.php
index d35a8d27..f07ee1b2 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -1124,6 +1124,8 @@
$config['mod']['bandelete'] = MOD;
// Remove bans
$config['mod']['unban'] = MOD;
+ // Spoiler file (and keep post)
+ $config['mod']['spoilerfile'] = JANITOR;
// Delete file (and keep post)
$config['mod']['deletefile'] = JANITOR;
// Spoiler image
diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index b087f6db..f8eb64ab 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -1466,6 +1466,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);
@@ -1475,7 +1483,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();
diff --git a/js/catalog-link.js b/js/catalog-link.js
index cc55eb52..124a3e9a 100644
--- a/js/catalog-link.js
+++ b/js/catalog-link.js
@@ -3,8 +3,13 @@
function catalog() {
var board = $("input[name='board']");
-if (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];