forked from leftypol/leftypol
public_banlist: format
This commit is contained in:
parent
938bcd2889
commit
68c0b2ae69
1 changed files with 48 additions and 50 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
require 'info.php';
|
||||
require 'info.php';
|
||||
|
||||
function pbanlist_build($action, $settings, $board) {
|
||||
function pbanlist_build($action, $settings, $board) {
|
||||
// Possible values for $action:
|
||||
// - all (rebuild everything, initialization)
|
||||
// - news (news has been updated)
|
||||
|
|
@ -9,25 +9,27 @@
|
|||
// - bans (ban list changed)
|
||||
|
||||
PBanlist::build($action, $settings);
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
|
||||
class PBanlist {
|
||||
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
|
||||
class PBanlist {
|
||||
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'],
|
||||
))
|
||||
));
|
||||
])
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue