Date: Tue, 16 Jul 2013 06:33:37 -0400
Subject: $config['require_ban_view']: Force users to view the "You are banned"
page at least once before letting a ban disappear naturally.
---
inc/config.php | 3 +++
inc/functions.php | 18 ++++++++++++++----
inc/mod/ban.php | 2 +-
install.php | 4 +++-
install.sql | 1 +
templates/banned.html | 16 +++++++++++++---
6 files changed, 35 insertions(+), 9 deletions(-)
(limited to 'templates')
diff --git a/inc/config.php b/inc/config.php
index ed4a31f1..b7f6d220 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -366,6 +366,9 @@
// When true, a blank password will be used for files (not usable for deletion).
$config['field_disable_password'] = false;
+ // Require users to see the ban page at least once for a ban even if it has since expired?
+ $config['require_ban_view'] = false;
+
/*
* ====================
* Markup settings
diff --git a/inc/functions.php b/inc/functions.php
index 4b0e56d8..8d6e0a2d 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -579,6 +579,12 @@ function ago($timestamp) {
function displayBan($ban) {
global $config;
+ if (!$ban['seen']) {
+ $query = prepare("UPDATE `bans` SET `seen` = 1 WHERE `id` = :id");
+ $query->bindValue(':id', $ban['id'], PDO::PARAM_INT);
+ $query->execute() or error(db_error($query));
+ }
+
$ban['ip'] = $_SERVER['REMOTE_ADDR'];
// Show banned page and exit
@@ -605,12 +611,12 @@ function checkBan($board = 0) {
if (event('check-ban', $board))
return true;
- $query = prepare("SELECT `set`, `expires`, `reason`, `board`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board) AND `ip` = :ip ORDER BY `expires` IS NULL DESC, `expires` DESC, `expires` DESC LIMIT 1");
+ $query = prepare("SELECT `set`, `expires`, `reason`, `board`, `seen`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board) AND `ip` = :ip ORDER BY `expires` IS NULL DESC, `expires` DESC, `expires` DESC LIMIT 1");
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':board', $board);
$query->execute() or error(db_error($query));
if ($query->rowCount() < 1 && $config['ban_range']) {
- $query = prepare("SELECT `set`, `expires`, `reason`, `board`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board) AND :ip LIKE REPLACE(REPLACE(`ip`, '%', '!%'), '*', '%') ESCAPE '!' ORDER BY `expires` IS NULL DESC, `expires` DESC LIMIT 1");
+ $query = prepare("SELECT `set`, `expires`, `reason`, `board`, `seen`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board) AND :ip LIKE REPLACE(REPLACE(`ip`, '%', '!%'), '*', '%') ESCAPE '!' ORDER BY `expires` IS NULL DESC, `expires` DESC LIMIT 1");
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':board', $board);
$query->execute() or error(db_error($query));
@@ -618,7 +624,7 @@ function checkBan($board = 0) {
if ($query->rowCount() < 1 && $config['ban_cidr'] && !isIPv6()) {
// my most insane SQL query yet
- $query = prepare("SELECT `set`, `expires`, `reason`, `board`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board)
+ $query = prepare("SELECT `set`, `expires`, `reason`, `board`, `seen`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board)
AND (
`ip` REGEXP '^(\[0-9]+\.\[0-9]+\.\[0-9]+\.\[0-9]+\)\/(\[0-9]+)$'
AND
@@ -635,10 +641,14 @@ function checkBan($board = 0) {
if ($ban = $query->fetch()) {
if ($ban['expires'] && $ban['expires'] < time()) {
// Ban expired
- $query = prepare("DELETE FROM `bans` WHERE `id` = :id LIMIT 1");
+ $query = prepare("DELETE FROM `bans` WHERE `id` = :id");
$query->bindValue(':id', $ban['id'], PDO::PARAM_INT);
$query->execute() or error(db_error($query));
+ if ($config['require_ban_view'] && !$ban['seen']) {
+ displayBan($ban);
+ }
+
return;
}
diff --git a/inc/mod/ban.php b/inc/mod/ban.php
index 30234157..cfc2636f 100644
--- a/inc/mod/ban.php
+++ b/inc/mod/ban.php
@@ -56,7 +56,7 @@ function parse_time($str) {
function ban($mask, $reason, $length, $board) {
global $mod, $pdo;
- $query = prepare("INSERT INTO `bans` VALUES (NULL, :ip, :mod, :time, :expires, :reason, :board)");
+ $query = prepare("INSERT INTO `bans` VALUES (NULL, :ip, :mod, :time, :expires, :reason, :board, 0)");
$query->bindValue(':ip', $mask);
$query->bindValue(':mod', $mod['id']);
$query->bindValue(':time', time());
diff --git a/install.php b/install.php
index 1447c723..71d1c910 100644
--- a/install.php
+++ b/install.php
@@ -1,7 +1,7 @@
- {% trans %}You are banned! ;_;{% endtrans %}
+ {% if ban.expires and time() >= ban.expires %}
+ {% trans %}You were banned! ;_;{% endtrans %}
+ {% else %}
+ {% trans %}You are banned! ;_;{% endtrans %}
+ {% endif %}
- {% trans %}You have been banned from{% endtrans %}
+ {% if ban.expires and time() >= ban.expires %}
+ {% trans %}You were banned from{% endtrans %}
+ {% else %}
+ {% trans %}You have been banned from{% endtrans %}
+ {% endif %}
{% if ban.board %}
{{ config.board_abbreviation|sprintf(ban.board) }}
{% else %}
@@ -23,7 +31,9 @@
{% trans %}Your ban was filed on{% endtrans %}
{{ ban.set|date(config.ban_date) }} {% trans %}and{% endtrans %}
- {% if ban.expires %}
+ {% if ban.expires and time() >= ban.expires %}
+ {% trans %} has since expired. Refresh the page to continue.{% endtrans %}
+ {% elseif ban.expires %}
{% trans %}expires{% endtrans %} {{ ban.expires|until }} {% trans %}from now, which is on{% endtrans %}
{{ ban.expires|date(config.ban_date) }}
--
cgit v1.3
From aadb57f2a2db9210468f25d7dcd45d561ef6ad54 Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Tue, 16 Jul 2013 08:50:39 -0400
Subject: More ban stuff: Show whether or not user has "seen" a ban yet in the
ban list and on IP address pages. Purge useless expired ban records.
---
inc/functions.php | 10 ++++++++++
templates/mod/ban_list.html | 8 ++++++++
templates/mod/view_ip.html | 10 ++++++++++
3 files changed, 28 insertions(+)
(limited to 'templates')
diff --git a/inc/functions.php b/inc/functions.php
index 8d6e0a2d..40a2c1fe 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -654,6 +654,16 @@ function checkBan($board = 0) {
displayBan($ban);
}
+
+ // I'm not sure where else to put this. It doesn't really matter where; it just needs to be called every now and then to keep the ban list tidy.
+ purge_bans();
+}
+
+// No reason to keep expired bans in the database (except those that haven't been viewed yet)
+function purge_bans() {
+ $query = prepare("DELETE FROM `bans` WHERE `expires` IS NOT NULL AND `expires` < :time AND `seen` = 1");
+ $query->bindValue(':time', time());
+ $query->execute() or error(db_error($query));
}
function threadLocked($id) {
diff --git a/templates/mod/ban_list.html b/templates/mod/ban_list.html
index 2edb9cdf..f8826ade 100644
--- a/templates/mod/ban_list.html
+++ b/templates/mod/ban_list.html
@@ -10,6 +10,7 @@
| {% trans 'Set' %} |
{% trans 'Duration' %} |
{% trans 'Expires' %} |
+ {% trans 'Seen' %} |
{% trans 'Staff' %} |
{% for ban in bans %}
@@ -58,6 +59,13 @@
{% endif %}
{% endif %}
+
+ {% if ban.seen %}
+ {% trans 'Yes' %}
+ {% else %}
+ {% trans 'No' %}
+ {% endif %}
+ |
{% if ban.username %}
{% if mod|hasPermission(config.mod.view_banstaff) %}
diff --git a/templates/mod/view_ip.html b/templates/mod/view_ip.html
index 562a0140..e2dad7af 100644
--- a/templates/mod/view_ip.html
+++ b/templates/mod/view_ip.html
@@ -136,6 +136,16 @@
{% endif %}
|
+
+ | {% trans 'Seen' %} |
+
+ {% if ban.seen %}
+ {% trans 'Yes' %}
+ {% else %}
+ {% trans 'No' %}
+ {% endif %}
+ |
+
| {% trans 'Staff' %} |
--
cgit v1.3
From 786ac5c55cf151ffcb942d78554c5ae06471eda0 Mon Sep 17 00:00:00 2001
From: czaks
Date: Tue, 16 Jul 2013 13:18:55 -0400
Subject: recaptcha: fix for https
---
templates/post_form.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'templates')
diff --git a/templates/post_form.html b/templates/post_form.html
index e5cb423c..07b53a9f 100644
--- a/templates/post_form.html
+++ b/templates/post_form.html
@@ -62,7 +62,7 @@
{{ antibot.html() }}
|
-
+
{{ antibot.html() }}
|
|
--
cgit v1.3
From 7e95e80c25e2f35b8a49ebd73f95671b0233be6f Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Wed, 17 Jul 2013 10:17:28 -0400
Subject: New theme: XML sitemap generator
---
templates/themes/sitemap/info.php | 53 ++++++++++++++++++++++++++++++++++++
templates/themes/sitemap/sitemap.xml | 19 +++++++++++++
templates/themes/sitemap/theme.php | 28 +++++++++++++++++++
3 files changed, 100 insertions(+)
create mode 100644 templates/themes/sitemap/info.php
create mode 100644 templates/themes/sitemap/sitemap.xml
create mode 100644 templates/themes/sitemap/theme.php
(limited to 'templates')
diff --git a/templates/themes/sitemap/info.php b/templates/themes/sitemap/info.php
new file mode 100644
index 00000000..e16448ee
--- /dev/null
+++ b/templates/themes/sitemap/info.php
@@ -0,0 +1,53 @@
+ 'Sitemap Path',
+ 'name' => 'path',
+ 'type' => 'text',
+ 'default' => 'sitemap.xml',
+ 'size' => '20'
+ );
+
+ $theme['config'][] = Array(
+ 'title' => 'URL prefix',
+ 'name' => 'url',
+ 'type' => 'text',
+ 'comment' => '(with trailing slash)',
+ 'default' => 'http://' . $_SERVER['HTTP_HOST'] . $config['root'],
+ 'size' => '20'
+ );
+
+ $theme['config'][] = Array(
+ 'title' => 'Thread change frequency',
+ 'name' => 'changefreq',
+ 'type' => 'text',
+ 'comment' => '(eg. "hourly", "daily", etc.)',
+ 'default' => 'hourly',
+ 'size' => '20'
+ );
+
+ $__boards = listBoards();
+ $__default_boards = Array();
+ foreach ($__boards as $__board)
+ $__default_boards[] = $__board['uri'];
+
+ $theme['config'][] = Array(
+ 'title' => 'Boards',
+ 'name' => 'boards',
+ 'type' => 'text',
+ 'comment' => '(boards to include; space seperated)',
+ 'size' => 24,
+ 'default' => implode(' ', $__default_boards)
+ );
+
+ $theme['build_function'] = 'sitemap_build';
diff --git a/templates/themes/sitemap/sitemap.xml b/templates/themes/sitemap/sitemap.xml
new file mode 100644
index 00000000..733da607
--- /dev/null
+++ b/templates/themes/sitemap/sitemap.xml
@@ -0,0 +1,19 @@
+{% filter remove_whitespace %}
+
+
+ {% for board in boards %}
+
+ {{ settings.url ~ (config.board_path | format(board)) ~ config.file_index }}
+
+ {% endfor %}
+ {% for board, thread_list in threads %}
+ {% for thread in thread_list %}
+
+ {{ settings.url ~ (config.board_path | format(board)) ~ config.dir.res ~ (config.file_page | format(thread.thread_id)) }}
+ {{ thread.lastmod | date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}
+ {{ settings.changefreq }}
+
+ {% endfor %}
+ {% endfor %}
+
+{% endfilter %}
\ No newline at end of file
diff --git a/templates/themes/sitemap/theme.php b/templates/themes/sitemap/theme.php
new file mode 100644
index 00000000..372d292d
--- /dev/null
+++ b/templates/themes/sitemap/theme.php
@@ -0,0 +1,28 @@
+fetchAll(PDO::FETCH_ASSOC);
+ }
+
+ file_write($settings['path'], Element('themes/sitemap/sitemap.xml', Array(
+ 'settings' => $settings,
+ 'config' => $config,
+ 'threads' => $threads,
+ 'boards' => $boards,
+ )));
+ }
--
cgit v1.3
From f5d378fab5eca1147923bbc268cc7ea1e864041c Mon Sep 17 00:00:00 2001
From: copypaste
Date: Thu, 18 Jul 2013 11:30:00 -0400
Subject: Catalog theme
---
templates/themes/catalog/catalog.css | 38 +++++++++++++++++++++
templates/themes/catalog/info.php | 42 +++++++++++++++++++++++
templates/themes/catalog/theme.php | 64 ++++++++++++++++++++++++++++++++++++
3 files changed, 144 insertions(+)
create mode 100644 templates/themes/catalog/catalog.css
create mode 100644 templates/themes/catalog/info.php
create mode 100644 templates/themes/catalog/theme.php
(limited to 'templates')
diff --git a/templates/themes/catalog/catalog.css b/templates/themes/catalog/catalog.css
new file mode 100644
index 00000000..048dd656
--- /dev/null
+++ b/templates/themes/catalog/catalog.css
@@ -0,0 +1,38 @@
+img {
+ float:none!important;
+ margin: auto;
+ margin-bottom: 12px;
+ max-height: 150px;
+ max-width: 200px;
+ box-shadow: 0 0 4px rgba(0, 0, 0, 0.55);
+ border: 2px solid rgba(153, 153, 153, 0);
+}
+
+/*
+img:hover {
+ border: 2px solid rgba(153, 153, 153, 0.27);
+}
+*/
+
+div.thread {
+ display: inline-block;
+ vertical-align: top;
+ margin-bottom:25px;
+ margin-left: 20px;
+ margin-right: 15px;
+ text-align:center;
+ font-weight:normal;
+ width:205px;
+ overflow:hidden;
+ position: relative;
+ font-size:11px;
+ padding: 15px;
+ background: rgba(182, 182, 182, 0.12);
+ border: 2px solid rgba(111, 111, 111, 0.34);
+ max-height:300px;
+}
+
+div.thread:hover {
+ background: #D6DAF0;
+ border-color: #B7C5D9;
+}
\ No newline at end of file
diff --git a/templates/themes/catalog/info.php b/templates/themes/catalog/info.php
new file mode 100644
index 00000000..1b9831ae
--- /dev/null
+++ b/templates/themes/catalog/info.php
@@ -0,0 +1,42 @@
+ 'Title',
+ 'name' => 'title',
+ 'type' => 'text',
+ 'default' => 'Catalog'
+ );
+
+ $__boards = listBoards();
+ $__default_boards = Array();
+ foreach ($__boards as $__board)
+ $__default_boards[] = $__board['uri'];
+
+ $theme['config'][] = Array(
+ 'title' => 'Included boards',
+ 'name' => 'boards',
+ 'type' => 'text',
+ 'comment' => '(space seperated)',
+ 'default' => implode(' ', $__default_boards)
+ );
+
+ $theme['config'][] = Array(
+ 'title' => 'CSS file',
+ 'name' => 'css',
+ 'type' => 'text',
+ 'default' => 'catalog.css',
+ 'comment' => '(eg. "catalog.css")'
+ );
+
+ // Unique function name for building everything
+ $theme['build_function'] = 'catalog_build';
diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php
new file mode 100644
index 00000000..356933ba
--- /dev/null
+++ b/templates/themes/catalog/theme.php
@@ -0,0 +1,64 @@
+build($action, $settings);
+ }
+
+ // Wrap functions in a class so they don't interfere with normal Tinyboard operations
+ class Catalog {
+ public function build($action, $settings) {
+ global $config, $_theme;
+
+ if ($action == 'all') {
+ copy('templates/themes/catalog/catalog.css', $config['dir']['home'] . $settings['css']);
+ }
+
+ $boards = explode(' ', $settings['boards']);
+ foreach ($boards as $board) {
+ if ($action == 'all' || $action == 'post')
+ file_write($config['dir']['home'] . $board . '/catalog.html', $this->homepage($settings, $board));
+ }
+
+ }
+
+ public function homepage($settings, $board_name) {
+ global $config, $board;
+
+ $recent_images = array();
+ $recent_posts = array();
+ $stats = array();
+
+ $query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM `posts_%s` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error());
+
+ while ($post = $query->fetch()) {
+ openBoard($post['board']);
+
+ $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id']));
+ $post['board_name'] = $board['name'];
+ $post['file'] = $config['uri_thumb'] . $post['thumb'];
+ $recent_posts[] = $post;
+ }
+
+
+ return Element('themes/catalog/catalog.html', Array(
+ 'settings' => $settings,
+ 'config' => $config,
+ 'boardlist' => createBoardlist(),
+ 'recent_images' => $recent_images,
+ 'recent_posts' => $recent_posts,
+ 'stats' => $stats,
+ 'board' => $board_name,
+ 'link' => $config['root'] . $board['dir']
+ ));
+ }
+ };
+
+?>
--
cgit v1.3
From 461d98b9457f90a6ff87534081f760572301e6f9 Mon Sep 17 00:00:00 2001
From: copypaste
Date: Thu, 18 Jul 2013 11:34:04 -0400
Subject: Catalog theme
---
templates/themes/catalog/catalog.html | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 templates/themes/catalog/catalog.html
(limited to 'templates')
diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html
new file mode 100644
index 00000000..501117a8
--- /dev/null
+++ b/templates/themes/catalog/catalog.html
@@ -0,0 +1,35 @@
+{% filter remove_whitespace %}
+
+
+
+
+ {{ settings.title }}
+
+
+ {% if config.url_favicon %}{% endif %}
+
+
+ {{ boardlist.top }}
+
+
+ {{ settings.subtitle }}
+
+
+
+
+
+ Powered by Tinyboard {{ config.version }} | Tinyboard Copyright © 2010-2013 Tinyboard Development Group
+
+
+{% endfilter %}
--
cgit v1.3
From de4b5b396246ee5c3cb8687cfef3647c844a3b54 Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Thu, 18 Jul 2013 11:40:21 -0400
Subject: Quick catalog theme bugfix
---
templates/themes/catalog/catalog.html | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
(limited to 'templates')
diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html
index 501117a8..7fcae04e 100644
--- a/templates/themes/catalog/catalog.html
+++ b/templates/themes/catalog/catalog.html
@@ -16,16 +16,17 @@
--
cgit v1.3
From e4bd9a6886af2a812ccc909d8ad957df1bdc5d2b Mon Sep 17 00:00:00 2001
From: Michael Foster
Date: Thu, 18 Jul 2013 12:06:26 -0400
Subject: Themes edit: Split "post" into two seperate actions: "post" (replies)
and "post-thread". And add a $board variable.
---
inc/functions.php | 8 +++---
post.php | 6 ++++-
templates/themes/basic/theme.php | 2 +-
templates/themes/catalog/theme.php | 50 ++++++++++++++++-------------------
templates/themes/categories/theme.php | 2 +-
templates/themes/frameset/theme.php | 2 +-
templates/themes/recent/theme.php | 5 ++--
templates/themes/rrdtool/theme.php | 2 +-
templates/themes/sitemap/theme.php | 6 ++++-
9 files changed, 44 insertions(+), 39 deletions(-)
(limited to 'templates')
diff --git a/inc/functions.php b/inc/functions.php
index 40a2c1fe..af810f31 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -239,12 +239,12 @@ function create_antibot($board, $thread = null) {
return _create_antibot($board, $thread);
}
-function rebuildThemes($action) {
+function rebuildThemes($action, $board = false) {
// List themes
$query = query("SELECT `theme` FROM `theme_settings` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error());
while ($theme = $query->fetch()) {
- rebuildTheme($theme['theme'], $action);
+ rebuildTheme($theme['theme'], $action, $board);
}
}
@@ -261,7 +261,7 @@ function loadThemeConfig($_theme) {
return $theme;
}
-function rebuildTheme($theme, $action) {
+function rebuildTheme($theme, $action, $board = false) {
global $config, $_theme;
$_theme = $theme;
@@ -270,7 +270,7 @@ function rebuildTheme($theme, $action) {
if (file_exists($config['dir']['themes'] . '/' . $_theme . '/theme.php')) {
require_once $config['dir']['themes'] . '/' . $_theme . '/theme.php';
- $theme['build_function']($action, themeSettings($_theme));
+ $theme['build_function']($action, themeSettings($_theme), $board);
}
}
diff --git a/post.php b/post.php
index 3d718786..97fb263d 100644
--- a/post.php
+++ b/post.php
@@ -677,7 +677,11 @@ if (isset($_POST['delete'])) {
_syslog(LOG_INFO, 'New post: /' . $board['dir'] . $config['dir']['res'] .
sprintf($config['file_page'], $post['op'] ? $id : $post['thread']) . (!$post['op'] ? '#' . $id : ''));
- rebuildThemes('post');
+ if ($post['op'])
+ rebuildThemes('post-thread', $board['uri']);
+ else
+ rebuildThemes('post', $board['uri']);
+
header('Location: ' . $redirect, true, $config['redirect_http']);
} else {
if (!file_exists($config['has_installed'])) {
diff --git a/templates/themes/basic/theme.php b/templates/themes/basic/theme.php
index 806a331a..7ba0d1e7 100644
--- a/templates/themes/basic/theme.php
+++ b/templates/themes/basic/theme.php
@@ -1,7 +1,7 @@
build($action, $settings);
- }
-
- // Wrap functions in a class so they don't interfere with normal Tinyboard operations
- class Catalog {
- public function build($action, $settings) {
- global $config, $_theme;
-
- if ($action == 'all') {
- copy('templates/themes/catalog/catalog.css', $config['dir']['home'] . $settings['css']);
- }
+ $boards = explode(' ', $settings['boards']);
+
+ if ($action == 'all') {
+ copy('templates/themes/catalog/catalog.css', $config['dir']['home'] . $settings['css']);
- $boards = explode(' ', $settings['boards']);
foreach ($boards as $board) {
- if ($action == 'all' || $action == 'post')
- file_write($config['dir']['home'] . $board . '/catalog.html', $this->homepage($settings, $board));
+ $b = new Catalog();
+ $b->build($settings, $board);
}
-
+ } elseif ($action == 'post-thread' && in_array($board, $boards)) {
+ $b = new Catalog();
+ $b->build($settings, $board);
}
-
- public function homepage($settings, $board_name) {
+ }
+
+ // Wrap functions in a class so they don't interfere with normal Tinyboard operations
+ class Catalog {
+ public function build($settings, $board_name) {
global $config, $board;
+ openBoard($board_name);
+
$recent_images = array();
$recent_posts = array();
$stats = array();
@@ -39,16 +40,13 @@
$query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM `posts_%s` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error());
while ($post = $query->fetch()) {
- openBoard($post['board']);
-
$post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id']));
$post['board_name'] = $board['name'];
$post['file'] = $config['uri_thumb'] . $post['thumb'];
$recent_posts[] = $post;
}
-
- return Element('themes/catalog/catalog.html', Array(
+ file_write($config['dir']['home'] . $board_name . '/catalog.html', Element('themes/catalog/catalog.html', Array(
'settings' => $settings,
'config' => $config,
'boardlist' => createBoardlist(),
@@ -57,8 +55,6 @@
'stats' => $stats,
'board' => $board_name,
'link' => $config['root'] . $board['dir']
- ));
+ )));
}
};
-
-?>
diff --git a/templates/themes/categories/theme.php b/templates/themes/categories/theme.php
index 11fcbbaf..7d468d0d 100644
--- a/templates/themes/categories/theme.php
+++ b/templates/themes/categories/theme.php
@@ -1,7 +1,7 @@
build($action, $settings);
@@ -23,7 +24,7 @@
$this->excluded = explode(' ', $settings['exclude']);
- if ($action == 'all' || $action == 'post')
+ if ($action == 'all' || $action == 'post' || $action == 'post-thread')
file_write($config['dir']['home'] . $settings['html'], $this->homepage($settings));
}
diff --git a/templates/themes/rrdtool/theme.php b/templates/themes/rrdtool/theme.php
index eed2ac9a..68fc1850 100644
--- a/templates/themes/rrdtool/theme.php
+++ b/templates/themes/rrdtool/theme.php
@@ -1,7 +1,7 @@
Date: Thu, 18 Jul 2013 15:31:22 -0400
Subject: sitemap theme: fix notice when rebuilding using tools/rebuild.php
from CLI
---
templates/themes/sitemap/info.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'templates')
diff --git a/templates/themes/sitemap/info.php b/templates/themes/sitemap/info.php
index e16448ee..1198c2e3 100644
--- a/templates/themes/sitemap/info.php
+++ b/templates/themes/sitemap/info.php
@@ -23,7 +23,7 @@
'name' => 'url',
'type' => 'text',
'comment' => '(with trailing slash)',
- 'default' => 'http://' . $_SERVER['HTTP_HOST'] . $config['root'],
+ 'default' => 'http://' . (isset ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : "localhost") . $config['root'],
'size' => '20'
);
--
cgit v1.3
From a5a1f00223ea59658b09a0a503a368bf03425ee9 Mon Sep 17 00:00:00 2001
From: czaks
Date: Thu, 18 Jul 2013 16:13:48 -0400
Subject: catalog: translation fix
---
templates/themes/catalog/catalog.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'templates')
diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html
index 7fcae04e..986db846 100644
--- a/templates/themes/catalog/catalog.html
+++ b/templates/themes/catalog/catalog.html
@@ -22,7 +22,7 @@
- {{ post.reply_count }} {% if post.reply_count == 1 %}{% trans 'reply' %}{% else %}{% trans 'replies' %}{% endif %}
+ {% trans %}1 reply{% plural post.omitted %}{{ count }} replies{% endtrans %}
{{ post.body }}