forked from leftypol/leftypol
If mod, bypass password on delete
This commit is contained in:
parent
40012ef81c
commit
1bd809b9f0
1 changed files with 17 additions and 4 deletions
21
post.php
21
post.php
|
@ -183,9 +183,18 @@ function handle_nntpchan() {
|
||||||
|
|
||||||
function handle_delete(){
|
function handle_delete(){
|
||||||
// Delete
|
// Delete
|
||||||
global $config,$board;
|
global $config, $board, $mod;
|
||||||
if (!isset($_POST['board'], $_POST['password']))
|
if (!isset($_POST['board'], $_POST['password']))
|
||||||
error($config['error']['bot']);
|
error($config['error']['bot']);
|
||||||
|
|
||||||
|
check_login(false);
|
||||||
|
$is_mod = !!$mod;
|
||||||
|
|
||||||
|
if (isset($_POST['mod']) && $_POST['mod'] && !$mod) {
|
||||||
|
// Mismatched claims. (As stated below "Liar, you are not a mod.")
|
||||||
|
error($config['error']['notamod']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$password = &$_POST['password'];
|
$password = &$_POST['password'];
|
||||||
|
|
||||||
|
@ -234,10 +243,14 @@ function handle_delete(){
|
||||||
error($config['error']['nodeletethread']);
|
error($config['error']['nodeletethread']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($password != '' && $post['password'] != $password && (!$thread || $thread['password'] != $password))
|
if ($password != ''
|
||||||
|
&& $post['password'] != $password
|
||||||
|
&& (!$thread || $thread['password'] != $password)
|
||||||
|
&& !$is_mod) {
|
||||||
error($config['error']['invalidpassword']);
|
error($config['error']['invalidpassword']);
|
||||||
|
}
|
||||||
|
|
||||||
if ($post['time'] > time() - $config['delete_time'] && (!$thread || $thread['password'] != $password)) {
|
if ($post['time'] > time() - $config['delete_time']) {
|
||||||
error(sprintf($config['error']['delete_too_soon'], until($post['time'] + $config['delete_time'])));
|
error(sprintf($config['error']['delete_too_soon'], until($post['time'] + $config['delete_time'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +272,7 @@ function handle_delete(){
|
||||||
|
|
||||||
buildIndex();
|
buildIndex();
|
||||||
|
|
||||||
$is_mod = isset($_POST['mod']) && $_POST['mod'];
|
|
||||||
$root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root'];
|
$root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root'];
|
||||||
|
|
||||||
if (!isset($_POST['json_response'])) {
|
if (!isset($_POST['json_response'])) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue