diff options
Diffstat (limited to 'inc/functions.php')
| -rw-r--r-- | inc/functions.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/inc/functions.php b/inc/functions.php index 8ce81e25..7437bde9 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; |
