public_banlist: format

This commit is contained in:
Zankaria 2025-07-23 19:56:47 +02:00
parent 938bcd2889
commit 68c0b2ae69

View file

@ -16,18 +16,20 @@
public static function build($action, $settings) {
global $config;
if ($action == 'all')
if ($action == 'all') {
file_write($config['dir']['home'] . $settings['file_bans'], PBanlist::homepage($settings));
}
if ($action == 'all' || $action == 'bans')
if ($action == 'all' || $action == 'bans') {
file_write($config['dir']['home'] . $settings['file_json'], PBanlist::gen_json($settings));
}
}
public static function gen_json($settings) {
ob_start();
Bans::stream_json(false, true, true, array(), true);
$out = ob_get_contents();
ob_end_clean();
\ob_start();
Bans::stream_json(false, true, true, [], true);
$out = \ob_get_contents();
\ob_end_clean();
return $out;
}
@ -35,23 +37,19 @@
public static function homepage($settings) {
global $config;
return Element('page.html', array(
return Element('page.html', [
'config' => $config,
'mod' => false,
#'hide_dashboard_link' => true,
'title' => _("Ban list"),
'subtitle' => "",
'boardlist' => createBoardlist(),
#'nojavascript' => true,
'body' => Element('mod/ban_list.html', array(
'body' => Element('mod/ban_list.html', [
'mod' => false,
'boards' => "[]",
'token' => false,
'token_json' => false,
'uri_json' => $config['dir']['home'] . $settings['file_json'],
))
));
])
]);
}
};
?>