From 5df6f85854f25581df787241773b8b39e23e8f00 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Mon, 3 Jan 2011 01:23:34 +1100 Subject: Don't allow users to post in locked threads' --- inc/functions.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index e5a8023d..a5ec0093 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -118,6 +118,21 @@ } } + function threadLocked($id) { + global $board; + + $query = prepare(sprintf("SELECT `locked` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri'])); + $query->bindValue(':id', $id, PDO::PARAM_INT); + $query->execute() or error(db_error()); + + if(!$post = $query->fetch()) { + // Non-existant, so it can't be locked... + return false; + } + + return (bool) $post['locked']; + } + function threadExists($id) { global $board; -- cgit v1.3