summaryrefslogtreecommitdiff
path: root/templates/themes/public_banlist/theme.php
diff options
context:
space:
mode:
authorSimon McFarlane <simon@piston.pw>2015-05-26 23:31:47 -0700
committerSimon McFarlane <simon@piston.pw>2015-05-29 01:34:53 -0700
commit4b40f69a4e6d190f6d342875bd084c2a6c9d8b0f (patch)
treefcc5dc9efa24afcb0bda3740b59f0c4e81c42f62 /templates/themes/public_banlist/theme.php
parent2ac451ecb7aaae1ed1402425b8df6a5cb9831f2b (diff)
parentd20149b57929c27da87a7d9603d85717da15c5bc (diff)
Merge remote-tracking branch 'upstream/master' into vichan-merge
Diffstat (limited to 'templates/themes/public_banlist/theme.php')
-rw-r--r--templates/themes/public_banlist/theme.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/templates/themes/public_banlist/theme.php b/templates/themes/public_banlist/theme.php
new file mode 100644
index 00000000..f2b65839
--- /dev/null
+++ b/templates/themes/public_banlist/theme.php
@@ -0,0 +1,56 @@
+<?php
+ require 'info.php';
+
+ function pbanlist_build($action, $settings, $board) {
+ // Possible values for $action:
+ // - all (rebuild everything, initialization)
+ // - news (news has been updated)
+ // - boards (board list changed)
+ // - bans (ban list changed)
+
+ PBanlist::build($action, $settings);
+ }
+
+ // 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')
+ file_write($config['dir']['home'] . $settings['file_bans'], PBanlist::homepage($settings));
+
+ 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());
+ $out = ob_get_contents();
+ ob_end_clean();
+ return $out;
+ }
+
+ // Build homepage
+ public static function homepage($settings) {
+ global $config;
+
+ return Element('page.html', array(
+ 'config' => $config,
+ 'mod' => false,
+ 'hide_dashboard_link' => true,
+ 'title' => _("Ban list"),
+ 'subtitle' => "",
+ 'nojavascript' => true,
+ 'body' => Element('mod/ban_list.html', array(
+ 'mod' => false,
+ 'boards' => "[]",
+ 'token' => false,
+ 'token_json' => false,
+ 'uri_json' => $config['dir']['home'] . $settings['file_json'],
+ ))
+ ));
+ }
+ };
+
+?>