summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorMacil Tech <maciltech@gmail.com>2012-11-14 13:33:27 -0700
committerMacil Tech <maciltech@gmail.com>2013-01-19 00:25:24 -0600
commit91e8547b0469e0e046bc15cd9c86f7d7abe86999 (patch)
tree4820be9122ed72f200966dc4dc61e025a8cc4354 /inc
parentced540a66ee223ba2e3e2b8dbaaf50e5b48a13d8 (diff)
Add image_reject_repost_in_thread option
Diffstat (limited to 'inc')
-rw-r--r--inc/config.php5
-rw-r--r--inc/functions.php14
2 files changed, 18 insertions, 1 deletions
diff --git a/inc/config.php b/inc/config.php
index f4951a40..e977f066 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -445,8 +445,10 @@
// Maximum image dimensions
$config['max_width'] = 10000;
$config['max_height'] = $config['max_width']; // 1:1
- // Reject dupliate image uploads
+ // Reject duplicate image uploads
$config['image_reject_repost'] = true;
+ // Reject duplicate image uploads within the same thread. Doesn't change anything if image_reject_repost is true.
+ $config['image_reject_repost_in_thread'] = false;
// Display the aspect ratio in a post's file info
$config['show_ratio'] = false;
@@ -667,6 +669,7 @@
$config['error']['maxsize'] = _('The file was too big.');
$config['error']['invalidzip'] = _('Invalid archive!');
$config['error']['fileexists'] = _('That file <a href="%s">already exists</a>!');
+ $config['error']['fileexistsinthread'] = _('That file <a href="%s">already exists</a> in this thread!');
$config['error']['delete_too_soon'] = _('You\'ll have to wait another %s before deleting that.');
$config['error']['mime_exploit'] = _('MIME type detection XSS exploit (IE) detected; post discarded.');
$config['error']['invalid_embed'] = _('Couldn\'t make sense of the URL of the video you tried to embed.');
diff --git a/inc/functions.php b/inc/functions.php
index a7b6b434..63fd4a27 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1651,6 +1651,20 @@ function getPostByHash($hash) {
return false;
}
+function getPostByHashInThread($hash, $thread) {
+ global $board;
+ $query = prepare(sprintf("SELECT `id`,`thread` FROM `posts_%s` WHERE `filehash` = :hash AND ( `thread` = :thread OR `id` = :thread )", $board['uri']));
+ $query->bindValue(':hash', $hash, PDO::PARAM_STR);
+ $query->bindValue(':thread', $thread, PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
+
+ if ($post = $query->fetch()) {
+ return $post;
+ }
+
+ return false;
+}
+
function undoImage(array $post) {
if (!$post['has_file'])
return;