diff options
| author | Michael Walker <mike@barrucadu.co.uk> | 2016-02-11 15:21:54 +0000 |
|---|---|---|
| committer | Michael Walker <mike@barrucadu.co.uk> | 2016-02-11 15:21:54 +0000 |
| commit | 9f00630b408d4ce032637c5488aeedde90f5e693 (patch) | |
| tree | 74a9deddd85df67a10ad449efe2c18bf093f9165 /inc | |
| parent | cc62a579bc59ed3366948a622e81f5f9c6cafdc3 (diff) | |
Display banned post contents if reason does not contain cp
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/bans.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/inc/bans.php b/inc/bans.php index dcca1366..e28aec0a 100644 --- a/inc/bans.php +++ b/inc/bans.php @@ -149,7 +149,7 @@ class Bans { return $ban_list; } - static public function stream_json($out = false, $filter_ips = false, $filter_staff = false, $board_access = false, $hide_message = false) { + static public function stream_json($out = false, $filter_ips = false, $filter_staff = false, $board_access = false, $hide_regexes = []) { $query = query("SELECT ``bans``.*, `username` FROM ``bans`` LEFT JOIN ``mods`` ON ``mods``.`id` = `creator` ORDER BY `created` DESC") or error(db_error()); @@ -164,6 +164,14 @@ class Bans { foreach ($bans as &$ban) { $ban['mask'] = self::range_to_string(array($ban['ipstart'], $ban['ipend'])); + $hide_message = false; + foreach ($hide_regexes as $regex) { + if(preg_match($regex, $ban['reason'])) { + $hide_message = true; + break; + } + } + if ($ban['post'] && !$hide_message) { $post = json_decode($ban['post']); $ban['message'] = $post->body; |
