Revert "Display banned post contents if reason does not contain cp"

This reverts commit 9f00630b40.
This commit is contained in:
Zankaria 2025-07-23 19:40:20 +02:00
parent 0eb075705c
commit 938bcd2889
2 changed files with 2 additions and 10 deletions

View file

@ -285,7 +285,7 @@ class Bans {
} }
} }
static public function stream_json($out = false, $filter_ips = false, $filter_staff = false, $board_access = false, $hide_regexes = []) { static public function stream_json($out = false, $filter_ips = false, $filter_staff = false, $board_access = false, $hide_message = false) {
$query = query("SELECT ``bans``.*, `username` FROM ``bans`` $query = query("SELECT ``bans``.*, `username` FROM ``bans``
LEFT JOIN ``mods`` ON ``mods``.`id` = `creator` LEFT JOIN ``mods`` ON ``mods``.`id` = `creator`
ORDER BY `created` DESC") or error(db_error()); ORDER BY `created` DESC") or error(db_error());
@ -302,14 +302,6 @@ class Bans {
foreach ($bans as &$ban) { foreach ($bans as &$ban) {
$ban['mask'] = self::range_to_string([$ban['ipstart'], $ban['ipend']]); $ban['mask'] = self::range_to_string([$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) { if ($ban['post'] && !$hide_message) {
$post = json_decode($ban['post']); $post = json_decode($ban['post']);
$ban['message'] = isset($post->body) ? $post->body : 0; $ban['message'] = isset($post->body) ? $post->body : 0;

View file

@ -25,7 +25,7 @@
public static function gen_json($settings) { public static function gen_json($settings) {
ob_start(); ob_start();
Bans::stream_json(false, true, true, array(), array("/\bcp\b/i")); Bans::stream_json(false, true, true, array(), true);
$out = ob_get_contents(); $out = ob_get_contents();
ob_end_clean(); ob_end_clean();
return $out; return $out;