summaryrefslogtreecommitdiff
path: root/templates/themes/public_banlist/theme.php
diff options
context:
space:
mode:
authorSimon McFarlane <simon@piston.pw>2015-06-01 16:08:19 -0700
committerSimon McFarlane <simon@piston.pw>2015-06-01 16:08:19 -0700
commit209bc5400144e448e95a68e01d842c6fab53ae71 (patch)
treeab4cc6ad241e8daccb546514330d3a5f2906e846 /templates/themes/public_banlist/theme.php
parentd1c1e5a589f30d640f5eb6303e7059105a6297f8 (diff)
parent7ab9cc43d101ed002bce392beefe1c435ab2d5b1 (diff)
Merge pull request #18 from lainchan/vichan-merge
Merge with the latest upstream vichan
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'],
+ ))
+ ));
+ }
+ };
+
+?>