Don't allow users to post in locked threads'
This commit is contained in:
parent
567d37c62e
commit
5df6f85854
@ -66,6 +66,7 @@
|
|||||||
define('ERROR_FILEEXT', 'Unsupported image format.', true);
|
define('ERROR_FILEEXT', 'Unsupported image format.', true);
|
||||||
define('ERROR_NOBOARD', 'Invalid board!', true);
|
define('ERROR_NOBOARD', 'Invalid board!', true);
|
||||||
define('ERROR_NONEXISTANT', 'Thread specified does not exist.', true);
|
define('ERROR_NONEXISTANT', 'Thread specified does not exist.', true);
|
||||||
|
define('ERROR_LOCKED', 'Thread locked. You may not reply at this time.', true);
|
||||||
define('ERROR_NOPOST', 'You didn\'t make a post.', true);
|
define('ERROR_NOPOST', 'You didn\'t make a post.', true);
|
||||||
define('ERR_INVALIDIMG','Invalid image.', true);
|
define('ERR_INVALIDIMG','Invalid image.', true);
|
||||||
define('ERR_FILESIZE', 'Maximum file size: %maxsz% bytes<br>Your file\'s size: %filesz% bytes', true);
|
define('ERR_FILESIZE', 'Maximum file size: %maxsz% bytes<br>Your file\'s size: %filesz% bytes', true);
|
||||||
@ -186,6 +187,8 @@
|
|||||||
define('MOD_DELETEBYIP', MOD_BAN, true);
|
define('MOD_DELETEBYIP', MOD_BAN, true);
|
||||||
// Sticky a thread
|
// Sticky a thread
|
||||||
define('MOD_STICKY', MOD_MOD, true);
|
define('MOD_STICKY', MOD_MOD, true);
|
||||||
|
// Lock a thread
|
||||||
|
define('MOD_LOCK', MOD_MOD, true);
|
||||||
|
|
||||||
/* Administration */
|
/* Administration */
|
||||||
// Display the contents of instant-config.php
|
// Display the contents of instant-config.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) {
|
function threadExists($id) {
|
||||||
global $board;
|
global $board;
|
||||||
|
|
||||||
|
3
post.php
3
post.php
@ -70,6 +70,9 @@
|
|||||||
if(!$OP && !threadExists($post['thread']))
|
if(!$OP && !threadExists($post['thread']))
|
||||||
error(ERROR_NONEXISTANT);
|
error(ERROR_NONEXISTANT);
|
||||||
|
|
||||||
|
if(!$OP && threadLocked($post['thread']))
|
||||||
|
error(ERROR_LOCKED);
|
||||||
|
|
||||||
// Check for a file
|
// Check for a file
|
||||||
if($OP) {
|
if($OP) {
|
||||||
if(!isset($_FILES['file']['tmp_name']) || empty($_FILES['file']['tmp_name']))
|
if(!isset($_FILES['file']['tmp_name']) || empty($_FILES['file']['tmp_name']))
|
||||||
|
Loading…
Reference in New Issue
Block a user