summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-04-17 01:28:25 +1000
committerSavetheinternet <savetheinternet@n0v4.com>2011-04-17 01:28:25 +1000
commite47279b3f078b133a1ddb132264c401ed713357e (patch)
tree45ab65aa69f7eb4ce6b673005499ffa8c1e34575 /templates
parent21d97bab29cc09c807bfa08c751aa47a55987539 (diff)
theme update
Diffstat (limited to 'templates')
-rw-r--r--templates/homepage/recent/info.php7
-rw-r--r--templates/homepage/recent/theme.php23
2 files changed, 25 insertions, 5 deletions
diff --git a/templates/homepage/recent/info.php b/templates/homepage/recent/info.php
index 2f5c977a..734908c4 100644
--- a/templates/homepage/recent/info.php
+++ b/templates/homepage/recent/info.php
@@ -16,6 +16,13 @@
'type' => 'text'
);
+ $theme['config'][] = Array(
+ 'title' => 'Excluded boards',
+ 'name' => 'exclude',
+ 'type' => 'text',
+ 'comment' => '(space seperated)'
+ );
+
// Unique function name for building everything
$theme['build_function'] = 'recentposts_build';
?> \ No newline at end of file
diff --git a/templates/homepage/recent/theme.php b/templates/homepage/recent/theme.php
index 963ce235..f7c5da45 100644
--- a/templates/homepage/recent/theme.php
+++ b/templates/homepage/recent/theme.php
@@ -8,25 +8,28 @@
// - boards (board list changed)
// - post (a post has been made)
- Basic::build($action, $settings);
+ $b = new Basic();
+ $b->build($action, $settings);
}
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
class Basic {
- public static function build($action, $settings) {
+ public function build($action, $settings) {
global $config, $_theme;
if($action == 'all') {
copy($config['dir']['homepage'] . '/' . $_theme . '/recent.css', $config['dir']['home'] . 'recent.css');
}
+ $this->excluded = explode(' ', $settings['exclude']);
+
if($action == 'all' || $action == 'post')
- // file_put_contents($config['dir']['home'] . $config['file_index'], Basic::homepage($settings));
- file_put_contents($config['dir']['home'] . 'recent.html', Basic::homepage($settings));
+ // file_put_contents($config['dir']['home'] . $config['file_index'], $this->homepage($settings));
+ file_put_contents($config['dir']['home'] . 'recent.html', $this->homepage($settings));
}
// Build news page
- public static function homepage($settings) {
+ public function homepage($settings) {
global $config, $board;
// HTML5
@@ -52,6 +55,8 @@
$body .= '<div class="box left"><h2>Recent Images</h2><ul>';
$query = '';
foreach($boards as &$_board) {
+ if(in_array($_board['uri'], $this->excluded))
+ continue;
$query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` WHERE `file` IS NOT NULL UNION ALL ", $_board['uri'], $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT 3', $query);
@@ -70,6 +75,8 @@
$body .= '<div class="box right"><h2>Latest Posts</h2><ul>';
$query = '';
foreach($boards as &$_board) {
+ if(in_array($_board['uri'], $this->excluded))
+ continue;
$query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` UNION ALL ", $_board['uri'], $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT 30', $query);
@@ -92,6 +99,8 @@
// Total posts
$query = 'SELECT SUM(`top`) AS `count` FROM (';
foreach($boards as &$_board) {
+ if(in_array($_board['uri'], $this->excluded))
+ continue;
$query .= sprintf("SELECT MAX(`id`) AS `top` FROM `posts_%s` UNION ALL ", $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
@@ -102,6 +111,8 @@
// Unique IPs
$query = 'SELECT COUNT(DISTINCT(`ip`)) AS `count` FROM (';
foreach($boards as &$_board) {
+ if(in_array($_board['uri'], $this->excluded))
+ continue;
$query .= sprintf("SELECT `ip` FROM `posts_%s` UNION ALL ", $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
@@ -112,6 +123,8 @@
// Active content
$query = 'SELECT SUM(`filesize`) AS `count` FROM (';
foreach($boards as &$_board) {
+ if(in_array($_board['uri'], $this->excluded))
+ continue;
$query .= sprintf("SELECT `filesize` FROM `posts_%s` UNION ALL ", $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);