forked from leftypol/leftypol
Public ban messages
This commit is contained in:
parent
e5d9aa67a1
commit
1a378ee6b2
4 changed files with 42 additions and 8 deletions
18
mod.php
18
mod.php
|
@ -1445,7 +1445,7 @@
|
|||
// Record the action
|
||||
modLog('Created a ' . ($expire ? $expire . ' second' : 'permanent') . " ban for {$_POST['ip']} with " . (!empty($_POST['reason']) ? "reason \"{$_POST['reason']}\"" : 'no reason'));
|
||||
|
||||
$query->execute() or error(db_error($query));
|
||||
//$query->execute() or error(db_error($query));
|
||||
|
||||
// Delete too
|
||||
if($mod['type'] >= $config['mod']['delete'] && isset($_POST['delete']) && isset($_POST['board'])) {
|
||||
|
@ -1462,6 +1462,20 @@
|
|||
buildIndex();
|
||||
}
|
||||
|
||||
if($mod['type'] >= $config['mod']['public_ban'] && isset($_POST['post']) && isset($_POST['board']) && isset($_POST['public_message']) && isset($_POST['message'])) {
|
||||
openBoard($_POST['board']);
|
||||
|
||||
$post = round($_POST['post']);
|
||||
|
||||
$query = prepare(sprintf("UPDATE `posts_%s` SET `body` = CONCAT(`body`, :body) WHERE `id` = :id", $board['uri']));
|
||||
$query->bindValue(':id', $post, PDO::PARAM_INT);
|
||||
$query->bindValue(':body', sprintf($config['mod']['ban_message'], htmlentities($_POST['message'])));
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
// Record the action
|
||||
modLog("Attached a public ban message for post #{$post}: " . $_POST['message']);
|
||||
}
|
||||
|
||||
// Redirect
|
||||
if(isset($_POST['continue']))
|
||||
header('Location: ' . $_POST['continue'], true, $config['redirect_http']);
|
||||
|
@ -1493,7 +1507,7 @@
|
|||
|
||||
$post = $query->fetch();
|
||||
|
||||
$body = form_newBan($post['ip'], null, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false, $delete ? $post['id'] : false, $delete ? $boardName : false);
|
||||
$body = form_newBan($post['ip'], null, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false, $post['id'], $boardName, !$delete);
|
||||
|
||||
echo Element('page.html', Array(
|
||||
'config'=>$config,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue