diff options
| author | czaks <marcin@6irc.net> | 2013-05-26 17:53:00 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-05-26 17:53:00 -0400 |
| commit | 258083e5cbcf905d6454866ee8f1ca9e75f247ea (patch) | |
| tree | 010f2a4c0f09d53fc124d08e6c4922e90d5f1be1 /inc/mod/ban.php | |
| parent | 4c45689528a0448b6e6808817104f132880c0ac7 (diff) | |
| parent | b9140f3c079c925092dd7a6d53ed05226888756a (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Diffstat (limited to 'inc/mod/ban.php')
| -rw-r--r-- | inc/mod/ban.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/inc/mod/ban.php b/inc/mod/ban.php index 9c93d70e..30234157 100644 --- a/inc/mod/ban.php +++ b/inc/mod/ban.php @@ -80,16 +80,25 @@ function ban($mask, $reason, $length, $board) { modLog('Created a new ' . ($length > 0 ? preg_replace('/^(\d+) (\w+?)s?$/', '$1-$2', until($length)) : 'permanent') . - ' ban (<small>#' . $pdo->lastInsertId() . '</small>) for ' . + ' ban on ' . + ($board ? '/' . $board . '/' : 'all boards') . + ' for ' . (filter_var($mask, FILTER_VALIDATE_IP) !== false ? "<a href=\"?/IP/$mask\">$mask</a>" : utf8tohtml($mask)) . + ' (<small>#' . $pdo->lastInsertId() . '</small>)' . ' with ' . ($reason ? 'reason: ' . utf8tohtml($reason) . '' : 'no reason')); } -function unban($id) { +function unban($id) { + $query = prepare("SELECT `ip` FROM `bans` WHERE `id` = :id"); + $query->bindValue(':id', $id); + $query->execute() or error(db_error($query)); + $mask = $query->fetchColumn(); + $query = prepare("DELETE FROM `bans` WHERE `id` = :id"); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); - modLog("Removed ban #{$id}"); + if ($mask) + modLog("Removed ban #{$id} for " . (filter_var($mask, FILTER_VALIDATE_IP) !== false ? "<a href=\"?/IP/$mask\">$mask</a>" : utf8tohtml($mask))); } |
