mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-03-01 16:20:36 +01:00
Fix multiple issues in anti bump flood
- saged posts aren't ignored when finding last bump - bumplocked thread with one reply, delete the reply and no post matches the query - bumplocked threads should be ignored
This commit is contained in:
parent
8512321669
commit
77bab66293
@ -1271,8 +1271,15 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) {
|
|||||||
$query->bindValue(':board', $board['uri']);
|
$query->bindValue(':board', $board['uri']);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
if ($config['anti_bump_flood']) {
|
// No need to run on OPs
|
||||||
$query = prepare(sprintf("SELECT `time` FROM ``posts_%s`` WHERE (`thread` = :thread OR `id` = :thread) AND `sage` = 0 ORDER BY `time` DESC LIMIT 1", $board['uri']));
|
if ($config['anti_bump_flood'] && isset($thread_id)) {
|
||||||
|
$query = prepare(sprintf("SELECT `sage` FROM ``posts_%s`` WHERE `id` = :thread", $board['uri']));
|
||||||
|
$query->bindValue(':thread', $thread_id);
|
||||||
|
$query->execute() or error(db_error($query));
|
||||||
|
$bumplocked = (bool)$query->fetchColumn();
|
||||||
|
|
||||||
|
if (!$bumplocked) {
|
||||||
|
$query = prepare(sprintf("SELECT `time` FROM ``posts_%s`` WHERE (`thread` = :thread AND NOT email <=> 'sage') OR `id` = :thread ORDER BY `time` DESC LIMIT 1", $board['uri']));
|
||||||
$query->bindValue(':thread', $thread_id);
|
$query->bindValue(':thread', $thread_id);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
$bump = $query->fetchColumn();
|
$bump = $query->fetchColumn();
|
||||||
@ -1282,6 +1289,7 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) {
|
|||||||
$query->bindValue(':thread', $thread_id);
|
$query->bindValue(':thread', $thread_id);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($rebuild) && $rebuild_after) {
|
if (isset($rebuild) && $rebuild_after) {
|
||||||
buildThread($rebuild);
|
buildThread($rebuild);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user