diff options
| author | czaks <marcin@6irc.net> | 2014-05-06 21:53:05 +0200 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2014-05-06 21:53:05 +0200 |
| commit | f7278e5a61f2617ae4d99d83529c82df048cc0b1 (patch) | |
| tree | aa721dcb5204490ea16e7b1c91fc4d02020479d2 | |
| parent | 81b0612d5699f504440eb477fd9952bf4cb49525 (diff) | |
user moderation support
| -rw-r--r-- | inc/config.php | 3 | ||||
| -rw-r--r-- | post.php | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/inc/config.php b/inc/config.php index 275291b9..a86ae756 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1433,6 +1433,9 @@ // 'db', // ); + // Allow OP to remove arbitrary posts in his thread + $config['user_moderation'] = false; + /* * ==================== * Public post search @@ -52,10 +52,19 @@ if (isset($_POST['delete'])) { $query->execute() or error(db_error($query)); if ($post = $query->fetch(PDO::FETCH_ASSOC)) { - if ($password != '' && $post['password'] != $password) + $thread = false; + if ($config['user_moderation'] && $post['thread']) { + $thread_query = prepare(sprintf("SELECT `time`,`password` FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); + $thread_query->bindValue(':id', $post['thread'], PDO::PARAM_INT); + $thread_query->execute() or error(db_error($query)); + + $thread = $thread_query->fetch(PDO::FETCH_ASSOC); + } + + if ($password != '' && $post['password'] != $password && (!$thread || $thread['password'] != $password)) error($config['error']['invalidpassword']); - if ($post['time'] > time() - $config['delete_time']) { + if ($post['time'] > time() - $config['delete_time'] && (!$thread || $thread['password'] != $password)) { error(sprintf($config['error']['delete_too_soon'], until($post['time'] + $config['delete_time']))); } |
