summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/fileboard.html15
-rw-r--r--templates/generic_page.html2
-rw-r--r--templates/index.html2
-rw-r--r--templates/main.js2
-rw-r--r--templates/mod/dashboard.html4
-rw-r--r--templates/mod/recent_posts.html2
-rw-r--r--templates/page.html2
-rw-r--r--templates/post/image.html6
-rw-r--r--templates/post/image_identification.html2
-rw-r--r--templates/post/name.html4
-rw-r--r--templates/post_form.html22
-rw-r--r--templates/post_thread_fileboard.html42
-rw-r--r--templates/themes/basic/index.html2
-rw-r--r--templates/themes/catalog/catalog.html4
-rw-r--r--templates/themes/catalog/theme.php25
-rw-r--r--templates/themes/categories/news.html2
-rw-r--r--templates/themes/frameset/news.html2
-rw-r--r--templates/themes/recent/recent.html2
-rw-r--r--templates/themes/recent/theme.php23
-rwxr-xr-xtemplates/themes/rss/info.php61
-rw-r--r--templates/themes/rss/rss.xml28
-rwxr-xr-xtemplates/themes/rss/theme.php124
-rw-r--r--templates/themes/sitemap/theme.php47
-rw-r--r--templates/themes/ukko/info.php1
-rw-r--r--templates/themes/ukko/theme.php10
-rw-r--r--templates/thread.html7
26 files changed, 383 insertions, 60 deletions
diff --git a/templates/fileboard.html b/templates/fileboard.html
new file mode 100644
index 00000000..a970cecb
--- /dev/null
+++ b/templates/fileboard.html
@@ -0,0 +1,15 @@
+<table class='fileboard'>
+ <tr>
+ <th>&nbsp; <!-- checkbox -->
+ <th>{% trans %}No.{% endtrans %}
+ <th>{% trans %}Name{% endtrans %}
+ <th>{% trans %}File{% endtrans %}
+ <th>{% trans %}Tag{% endtrans %}
+ <th>{% trans %}Subject{% endtrans %}
+ <th>{% trans %}Size{% endtrans %}
+ <th>{% trans %}Date{% endtrans %}
+ <th>{% trans %}Replies{% endtrans %}
+ <th>&nbsp; <!-- reply -->
+ </tr>
+ {{ body }}
+</table>
diff --git a/templates/generic_page.html b/templates/generic_page.html
index 0fe1f9c5..965cbc2c 100644
--- a/templates/generic_page.html
+++ b/templates/generic_page.html
@@ -39,7 +39,7 @@
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
<a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} -
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
- <br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
+ <br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2015 vichan-devel</p>
{% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
</footer>
<script type="text/javascript">{% raw %}
diff --git a/templates/index.html b/templates/index.html
index 8c4c278d..fc3ded76 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -79,7 +79,7 @@
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
<a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} -
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
- <br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
+ <br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2015 vichan-devel</p>
{% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
</footer>
diff --git a/templates/main.js b/templates/main.js
index e948fd82..59a632d7 100644
--- a/templates/main.js
+++ b/templates/main.js
@@ -254,7 +254,7 @@ function dopost(form) {
saved[document.location] = form.elements['body'].value;
sessionStorage.body = JSON.stringify(saved);
- return form.elements['body'].value != "" || form.elements['file'].value != "" || (form.elements.file_url && form.elements['file_url'].value != "");
+ return form.elements['body'].value != "" || (form.elements['file'] && form.elements['file'].value != "") || (form.elements.file_url && form.elements['file_url'].value != "");
}
function citeReply(id, with_link) {
diff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html
index 2c370a11..7e25555b 100644
--- a/templates/mod/dashboard.html
+++ b/templates/mod/dashboard.html
@@ -155,9 +155,9 @@
<legend>Update</legend>
<ul>
<li>
- A newer version of Tinyboard
+ A newer version of vichan
(<strong>v{{ newer_release.massive }}.{{ newer_release.major }}.{{ newer_release.minor }}</strong>) is available!
- See <a href="http://tinyboard.org">http://tinyboard.org/</a> for upgrade instructions.
+ See <a href="https://engine.vichan.net">https://engine.vichan.net/</a> for upgrade instructions.
</li>
</ul>
</fieldset>
diff --git a/templates/mod/recent_posts.html b/templates/mod/recent_posts.html
index b9c2c0cc..cb4f1726 100644
--- a/templates/mod/recent_posts.html
+++ b/templates/mod/recent_posts.html
@@ -11,7 +11,7 @@
{% else %}
{% set thread = post.thread %}
{% endif %}
- <div class="post-wrapper" data-board="{{ post.board }}"><hr/><a class="eita-link" id="eita-{{ post.board }}-{{ thread }}" href="?/{{ post.board }}/res/{{ thread }}.html#{{ post.id }}">/{{ post.board }}/{{ post.id }}</a><br>
+ <div class="post-wrapper" data-board="{{ post.board }}"><hr/><a class="eita-link" id="eita-{{ post.board }}-{{ thread }}" href="?/{{ post.board }}/{{ config.dir.res }}{{ thread }}.html#{{ post.id }}">/{{ post.board }}/{{ post.id }}</a><br>
{{ post.built }}
</div>
{% endfor %}
diff --git a/templates/page.html b/templates/page.html
index eb2501e1..cb35d76a 100644
--- a/templates/page.html
+++ b/templates/page.html
@@ -25,7 +25,7 @@
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
<a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} -
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
- <br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
+ <br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2015 vichan-devel</p>
</footer>
</body>
</html>
diff --git a/templates/post/image.html b/templates/post/image.html
index 818ccb57..16fe20b6 100644
--- a/templates/post/image.html
+++ b/templates/post/image.html
@@ -1,16 +1,16 @@
<a href="
- {% if post.file|extension == 'webm' %}
+ {% if post.file|extension == 'webm' or post.file|extension == 'mp4' %}
{{ config.root }}player.php?v={{ config.uri_img }}{{ post.file }}&amp;t={{ post.filename|e('url') }}&amp;loop=1
{% else %}
{{ config.uri_img }}{{ post.file }}
{% endif %}
"
target="_blank"
- {% if post.thumb == 'file' or post.modifiers['is_file'] == '1' or post.filename|extension == 'webm' %}
+ {% if post.thumb == 'file' or post.modifiers['is_file'] == '1' or post.filename|extension == 'webm' or post.file|extension == 'mp4' %}
class="file"
{% endif %}
>
- {% if post.thumb|extension == 'webm' %}
+ {% if post.thumb|extension == 'webm' or post.thumb|extension == 'mp4' %}
<video autoplay class="post-image" src="{{ config.uri_thumb }}{{ post.thumb }}"
poster="
{{ config.root }}
diff --git a/templates/post/image_identification.html b/templates/post/image_identification.html
index fa2f30b3..e6e14abc 100644
--- a/templates/post/image_identification.html
+++ b/templates/post/image_identification.html
@@ -8,7 +8,7 @@
<a href="http://regex.info/exif.cgi?url={{ config.domain }}{{ config.uri_img }}{{ file.file }}" target="_blank">Exif</a>
{% endif %}
{% if config.image_identification_google %}
- <a href="https://www.google.com/searchbyimage?image_url={{ config.domain }}{{ config.uri_img }}{{ file.file }}" target="_blank">Google</a>
+ <a href="https://www.google.com/searchbyimage?image_url={{ config.domain|url_encode }}{{ config.uri_img|url_encode }}{{ file.file|url_encode }}" target="_blank">Google</a>
{% endif %}
{% if config.image_identification_iqdb %}
<a href="http://iqdb.org/?url={{ config.domain }}{{ config.uri_img }}{{ file.file }}" target="_blank">iqdb</a>
diff --git a/templates/post/name.html b/templates/post/name.html
index 13c676c7..e7f85f8b 100644
--- a/templates/post/name.html
+++ b/templates/post/name.html
@@ -1,5 +1,5 @@
{% set capcode = post.capcode|capcode %}
-{% if post.email|length > 0 and (config.hide_sage!=true or post.email!='sage') %}
+{% if post.email|length > 0 and (config.hide_sage!=true or post.email!='sage') and config.hide_email!=true %}
{# start email #}
<a class="email" href="mailto:{{ post.email }}">
{% endif %}
@@ -7,7 +7,7 @@
{% if post.trip|length > 0 %}
<span {% if capcode.trip %}style="{{ capcode.trip }}" {% endif %}class="trip">{{ post.trip }}</span>
{% endif %}
-{% if post.email|length > 0 %}
+{% if post.email|length > 0 and (config.hide_sage!=true or post.email!='sage') and config.hide_email!=true %}
{# end email #}
</a>
{% endif %}
diff --git a/templates/post_form.html b/templates/post_form.html
index 1846adb5..0e0d3fed 100644
--- a/templates/post_form.html
+++ b/templates/post_form.html
@@ -92,12 +92,27 @@
</td>
</tr>
{% endif %}
+ {% if config.allowed_tags and not id %}
+ <tr>
+ <th>{% trans %}Tag{% endtrans %}</th>
+ <td>
+ <select name="tag">
+ {% for id, tag in config.allowed_tags %}
+ <option value="{{ id|e }}">{{ tag|e }}</option>
+ {% endfor %}
+ </select>
+ </td>
+ </tr>
+ {% endif %}
<tr id="upload">
<th>
{% trans %}File{% endtrans %}
</th>
<td>
<input type="file" name="file" id="upload_file">
+
+ <script type="text/javascript">if (typeof init_file_selector !== 'undefined') init_file_selector({{ config.max_images }});</script>
+
{% if config.allow_upload_by_url %}
<div style="float:none;text-align:left" id="upload_url">
<label for="file_url">{% trans %}Or URL{% endtrans %}</label>:
@@ -143,14 +158,9 @@
<th>
{% trans %}Password{% endtrans %}
{{ antibot.html() }}
- <!-- Chrome, you suck so hard with your autofill mechanism -->
- <!-- I tried N different tricks, this sucks most, but only this one -->
- <!-- disables autofill successfully -->
- <input type='text' style='display: none'>
- <input type='password' style='display: none'>
</th>
<td>
- <input type="password" name="password" value="" size="12" maxlength="18" autocomplete="off">
+ <input type="text" name="password" value="" size="12" maxlength="18" autocomplete="off">
<span class="unimportant">{% trans %}(For file deletion.){% endtrans %}</span>
{{ antibot.html() }}
</td>
diff --git a/templates/post_thread_fileboard.html b/templates/post_thread_fileboard.html
new file mode 100644
index 00000000..1a11ff79
--- /dev/null
+++ b/templates/post_thread_fileboard.html
@@ -0,0 +1,42 @@
+{% filter remove_whitespace %}
+{# tabs and new lines will be ignored #}
+
+{# we are intentionally breaking the thread_ID convention: the jses need to handle this case differently #}
+<tr id="filethread_{{ post.id }}" class="intro" data-board="{{ board.uri }}">
+
+<td><input type="checkbox" class="delete" name="delete_{{ post.id }}" id="delete_{{ post.id }}" />
+<td><a class="post_no" onclick="citeReply({{ post.id }})" href="{{ post.link('q') }}">{{ post.id }}</a>
+<td>{% include 'post/name.html' %}
+ {% include 'post/flag.html' %}
+<td>[<a href="{{ config.uri_img }}{{ post.files[0].file }}">{{ post.files[0].filename|e|bidi_cleanup }}</a>]
+<td>{% if post.modifiers['tag'] %}[{{ post.modifiers['tag']|e }}]{% endif %}
+<td>{% include 'post/subject.html' %}
+ {% if post.sticky %}
+ {% if config.font_awesome %}
+ <i class="fa fa-thumb-tack"></i>
+ {% else %}
+ <img class="icon" title="Sticky" src="{{ config.image_sticky }}" alt="Sticky" />
+ {% endif %}
+ {% endif %}
+ {% if post.locked %}
+ {% if config.font_awesome %}
+ <i class="fa fa-lock"></i>
+ {% else %}
+ <img class="icon" title="Locked" src="{{ config.image_locked }}" alt="Locked" />
+ {% endif %}
+ {% endif %}
+ {% if post.bumplocked and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %}
+ {% if config.font_awesome %}
+ <i class="fa fa-anchor"></i>
+ {% else %}
+ <img class="icon" title="Bumplocked" src="{{ config.image_bumplocked }}" alt="Bumplocked" />
+ {% endif %}
+ {% endif %}
+<td>{{ post.files[0].size|filesize }}
+<td>{% include 'post/time.html' %}
+<td>{{ post.omitted }}
+<td>{% include 'post/post_controls.html' %}
+ <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post) }}">[{% trans %}Reply{% endtrans %}]</a>
+
+</tr>
+{% endfilter %}
diff --git a/templates/themes/basic/index.html b/templates/themes/basic/index.html
index 3376a68f..0804faf7 100644
--- a/templates/themes/basic/index.html
+++ b/templates/themes/basic/index.html
@@ -41,7 +41,7 @@
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
<a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} -
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
- <br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
+ <br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2015 vichan-devel</p>
</footer>
</body>
</html>
diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html
index aef6c139..381b1924 100644
--- a/templates/themes/catalog/catalog.html
+++ b/templates/themes/catalog/catalog.html
@@ -48,7 +48,7 @@
<div class="thread grid-li grid-size-small">
<a href="{{post.link}}">
{% if post.youtube %}
- <img src="http://img.youtube.com/vi/{{ post.youtube }}/0.jpg"
+ <img src="//img.youtube.com/vi/{{ post.youtube }}/0.jpg"
{% else %}
<img src="{{post.file}}"
{% endif %}
@@ -79,7 +79,7 @@
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
<a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} -
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
- <br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
+ <br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2015 vichan-devel</p>
</footer>
<script type="text/javascript">{% raw %}
var styles = {
diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php
index b3b7caf7..34b28e48 100644
--- a/templates/themes/catalog/theme.php
+++ b/templates/themes/catalog/theme.php
@@ -16,11 +16,22 @@
if ($action == 'all') {
foreach ($boards as $board) {
$b = new Catalog();
- $b->build($settings, $board);
+ if ($config['smart_build']) {
+ file_unlink($config['dir']['home'] . $board . '/catalog.html');
+ }
+ else {
+ $b->build($settings, $board);
+ }
}
} elseif ($action == 'post-thread' || ($settings['update_on_posts'] && $action == 'post') || ($settings['update_on_posts'] && $action == 'post-delete') && in_array($board, $boards)) {
$b = new Catalog();
- $b->build($settings, $board);
+
+ if ($config['smart_build']) {
+ file_unlink($config['dir']['home'] . $board . '/catalog.html');
+ }
+ else {
+ $b->build($settings, $board);
+ }
}
}
@@ -28,8 +39,12 @@
class Catalog {
public function build($settings, $board_name) {
global $config, $board;
-
- openBoard($board_name);
+
+ if ($board['uri'] != $board_name) {
+ if (!openBoard($board_name)) {
+ error(sprintf(_("Board %s doesn't exist"), $board_name));
+ }
+ }
$recent_images = array();
$recent_posts = array();
@@ -42,7 +57,7 @@
$board_name, $board_name, $board_name, $board_name, $board_name)) or error(db_error());
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
- $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . link_for($post));
+ $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . link_for($post);
$post['board_name'] = $board['name'];
if ($post['embed'] && preg_match('/^https?:\/\/(\w+\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9\-_]{10,11})(&.+)?$/i', $post['embed'], $matches)) {
diff --git a/templates/themes/categories/news.html b/templates/themes/categories/news.html
index e75f9dea..95b330b6 100644
--- a/templates/themes/categories/news.html
+++ b/templates/themes/categories/news.html
@@ -35,7 +35,7 @@
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
<a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} -
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
- <br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
+ <br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2015 vichan-devel</p>
</footer>
</body>
</html>
diff --git a/templates/themes/frameset/news.html b/templates/themes/frameset/news.html
index 17290305..9f779b74 100644
--- a/templates/themes/frameset/news.html
+++ b/templates/themes/frameset/news.html
@@ -34,7 +34,7 @@
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
<a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} -
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
- <br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
+ <br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2015 vichan-devel</p>
</footer>
</body>
</html>
diff --git a/templates/themes/recent/recent.html b/templates/themes/recent/recent.html
index b807515b..31c839e7 100644
--- a/templates/themes/recent/recent.html
+++ b/templates/themes/recent/recent.html
@@ -56,7 +56,7 @@
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
<a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} -
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
- <br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
+ <br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2015 vichan-devel</p>
</footer>
</body>
</html>
diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php
index 2ea6a7b9..f44e2529 100644
--- a/templates/themes/recent/theme.php
+++ b/templates/themes/recent/theme.php
@@ -24,8 +24,14 @@
$this->excluded = explode(' ', $settings['exclude']);
- if ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')
- file_write($config['dir']['home'] . $settings['html'], $this->homepage($settings));
+ if ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete') {
+ if ($config['smart_build']) {
+ file_unlink($config['dir']['home'] . $settings['html']);
+ }
+ else {
+ file_write($config['dir']['home'] . $settings['html'], $this->homepage($settings));
+ }
+ }
}
// Build news page
@@ -125,15 +131,20 @@
$stats['unique_posters'] = number_format($query->fetchColumn());
// Active content
- /*$query = 'SELECT SUM(`filesize`) FROM (';
+ $query = 'SELECT DISTINCT(`files`) 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 .= sprintf("SELECT `files` FROM ``posts_%s`` UNION ALL ", $_board['uri']);
}
- $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
+ $query = preg_replace('/UNION ALL $/', ' WHERE `num_files` > 0) AS `posts_all`', $query);
$query = query($query) or error(db_error());
- $stats['active_content'] = $query->fetchColumn();*/
+ $files = $query->fetchAll();
+ $stats['active_content'] = 0;
+ foreach ($files as &$file) {
+ preg_match_all('/"size":([0-9]*)/', $file[0], $matches);
+ $stats['active_content'] += array_sum($matches[1]);
+ }
return Element('themes/recent/recent.html', Array(
'settings' => $settings,
diff --git a/templates/themes/rss/info.php b/templates/themes/rss/info.php
new file mode 100755
index 00000000..14b39eb9
--- /dev/null
+++ b/templates/themes/rss/info.php
@@ -0,0 +1,61 @@
+<?php
+ $theme = Array();
+
+ // Theme name
+ $theme['name'] = 'RSS';
+ // Description (you can use Tinyboard markup here)
+ $theme['description'] = 'Show recent posts and images as a RSS';
+ $theme['version'] = 'v0.1';
+
+ // Theme configuration
+ $theme['config'] = Array();
+
+ $theme['config'][] = Array(
+ 'title' => 'Title',
+ 'name' => 'title',
+ 'type' => 'text',
+ 'default' => 'Recent Posts RSS'
+ );
+
+ $theme['config'][] = Array(
+ 'title' => 'Excluded boards',
+ 'name' => 'exclude',
+ 'type' => 'text',
+ 'comment' => '(space seperated)'
+ );
+
+ $theme['config'][] = Array(
+ 'title' => '# of recent posts',
+ 'name' => 'limit_posts',
+ 'type' => 'text',
+ 'default' => '30',
+ 'comment' => '(maximum posts to display)'
+ );
+
+ $theme['config'][] = Array(
+ 'title' => 'XML file',
+ 'name' => 'xml',
+ 'type' => 'text',
+ 'default' => 'recent.xml',
+ 'comment' => '(eg. "recent.xml")'
+ );
+
+ $theme['config'][] = Array(
+ 'title' => 'Base URL',
+ 'name' => 'base_url',
+ 'type' => 'text',
+ 'default' => 'http://test.com',
+ 'comment' => '(eg. "http://test.com")'
+ );
+
+ // Unique function name for building everything
+ $theme['build_function'] = 'rss_recentposts_build';
+ $theme['install_callback'] = 'rss_recentposts_install';
+
+ if (!function_exists('rss_recentposts_install')) {
+ function rss_recentposts_install($settings) {
+ if (!is_numeric($settings['limit_posts']) || $settings['limit_posts'] < 0)
+ return Array(false, '<strong>' . utf8tohtml($settings['limit_posts']) . '</strong> is not a non-negative integer.');
+ }
+ }
+
diff --git a/templates/themes/rss/rss.xml b/templates/themes/rss/rss.xml
new file mode 100644
index 00000000..30fdb473
--- /dev/null
+++ b/templates/themes/rss/rss.xml
@@ -0,0 +1,28 @@
+{% filter remove_whitespace %}
+<?xml version="1.0" encoding="utf-8"?>
+<rss xmlns:dc="http://purl.org/dc/elements/1.1/"
+ version="2.0">
+ <channel>
+ <description>
+ <![CDATA[{{ settings.subtitle }}]]>
+ </description>
+ <title>{{ settings.title }}</title>
+ <generator>Tinyboard {{ config.version }}</generator>
+ <link>{{ settings.base_url }}{{ config.root }}{{ settings.html }}</link>
+ {% for post in recent_posts %}
+ <item>
+ <title>{{ post.board_name }}</title>
+ <description>
+ <![CDATA[
+ <a href="{{ settings.base_url }}{{ post.link }}">
+ {{ post.snippet }}
+ </a>
+ ]]>
+ </description>
+ <link>{{ settings.base_url }}{{ post.link }}</link>
+ <guid>{{ settings.base_url }}{{ post.link }}</guid>
+ </item>
+ {% endfor %}
+ </channel>
+</rss>
+{% endfilter %}
diff --git a/templates/themes/rss/theme.php b/templates/themes/rss/theme.php
new file mode 100755
index 00000000..33c1b210
--- /dev/null
+++ b/templates/themes/rss/theme.php
@@ -0,0 +1,124 @@
+<?php
+ require 'info.php';
+
+ function rss_recentposts_build($action, $settings, $board) {
+ // Possible values for $action:
+ // - all (rebuild everything, initialization)
+ // - news (news has been updated)
+ // - boards (board list changed)
+ // - post (a post has been made)
+ // - post-thread (a thread has been made)
+
+ $b = new RSSRecentPosts();
+ $b->build($action, $settings);
+ }
+
+ // Wrap functions in a class so they don't interfere with normal Tinyboard operations
+ class RSSRecentPosts {
+ public function build($action, $settings) {
+ global $config, $_theme;
+
+ /*if ($action == 'all') {
+ copy('templates/themes/recent/' . $settings['basecss'], $config['dir']['home'] . $settings['css']);
+ }*/
+
+ $this->excluded = explode(' ', $settings['exclude']);
+
+ if ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')
+ file_write($config['dir']['home'] . $settings['xml'], $this->homepage($settings));
+ }
+
+ // Build news page
+ public function homepage($settings) {
+ global $config, $board;
+
+ //$recent_images = Array();
+ $recent_posts = Array();
+ //$stats = Array();
+
+ $boards = listBoards();
+
+ /*$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 AND `file` != 'deleted' AND `thumb` != 'spoiler' UNION ALL ", $_board['uri'], $_board['uri']);
+ }
+ $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_images'], $query);
+ $query = query($query) or error(db_error());
+
+ while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
+ openBoard($post['board']);
+
+ // board settings won't be available in the template file, so generate links now
+ $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id'];
+ $post['src'] = $config['uri_thumb'] . $post['thumb'];
+
+ //$recent_images[] = $post;
+ }*/
+
+
+ $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 ' . (int)$settings['limit_posts'], $query);
+ $query = query($query) or error(db_error());
+
+ while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
+ openBoard($post['board']);
+
+ $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id'];
+ $post['snippet'] = pm_snippet($post['body'], 30);
+ $post['board_name'] = $board['name'];
+
+ $recent_posts[] = $post;
+ }
+
+ // Total posts
+ /*$query = 'SELECT SUM(`top`) 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);
+ $query = query($query) or error(db_error());*/
+ //$stats['total_posts'] = number_format($query->fetchColumn());
+
+ // Unique IPs
+ /*$query = 'SELECT COUNT(DISTINCT(`ip`)) 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);
+ $query = query($query) or error(db_error());
+ //$stats['unique_posters'] = number_format($query->fetchColumn());*/
+
+ // Active content
+ /*$query = 'SELECT SUM(`filesize`) 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);
+ $query = query($query) or error(db_error());
+ //$stats['active_content'] = $query->fetchColumn();*/
+
+ return Element('themes/rss/rss.xml', Array(
+ 'settings' => $settings,
+ 'config' => $config,
+ //'boardlist' => createBoardlist(),
+ //'recent_images' => $recent_images,
+ 'recent_posts' => $recent_posts,
+ //'stats' => $stats
+ ));
+ }
+ };
+
+?>
diff --git a/templates/themes/sitemap/theme.php b/templates/themes/sitemap/theme.php
index 1cebcdb6..52779d53 100644
--- a/templates/themes/sitemap/theme.php
+++ b/templates/themes/sitemap/theme.php
@@ -10,30 +10,37 @@
// - boards (board list changed)
// - post (a post has been made)
// - thread (a thread has been made)
+
+ if ($action != 'all') {
+ if ($action != 'post-thread' && $action != 'post-delete')
+ return;
- if ($action != 'post-thread' && $action != 'post-delete')
- return;
-
- if (isset($settings['regen_time']) && $settings['regen_time'] > 0) {
- if ($last_gen = @filemtime($settings['path'])) {
- if (time() - $last_gen < (int)$settings['regen_time'])
- return; // Too soon
+ if (isset($settings['regen_time']) && $settings['regen_time'] > 0) {
+ if ($last_gen = @filemtime($settings['path'])) {
+ if (time() - $last_gen < (int)$settings['regen_time'])
+ return; // Too soon
+ }
}
}
+
+ if ($config['smart_build']) {
+ file_unlink($settings['path']);
+ }
+ else {
+ $boards = explode(' ', $settings['boards']);
- $boards = explode(' ', $settings['boards']);
-
- $threads = array();
+ $threads = array();
- foreach ($boards as $board) {
- $query = query(sprintf("SELECT `id`, `slug`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` OR `id` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `lastmod` FROM ``posts_%s`` WHERE `thread` IS NULL", $board, $board)) or error(db_error());
- $threads[$board] = $query->fetchAll(PDO::FETCH_ASSOC);
- }
+ foreach ($boards as $board) {
+ $query = query(sprintf("SELECT `id`, `id` AS `thread_id`, `slug`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` OR `id` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `lastmod` FROM ``posts_%s`` WHERE `thread` IS NULL", $board, $board)) or error(db_error());
+ $threads[$board] = $query->fetchAll(PDO::FETCH_ASSOC);
+ }
- file_write($settings['path'], Element('themes/sitemap/sitemap.xml', Array(
- 'settings' => $settings,
- 'config' => $config,
- 'threads' => $threads,
- 'boards' => $boards,
- )));
+ file_write($settings['path'], Element('themes/sitemap/sitemap.xml', Array(
+ 'settings' => $settings,
+ 'config' => $config,
+ 'threads' => $threads,
+ 'boards' => $boards,
+ )));
+ }
}
diff --git a/templates/themes/ukko/info.php b/templates/themes/ukko/info.php
index 45a687fc..9a0a53e6 100644
--- a/templates/themes/ukko/info.php
+++ b/templates/themes/ukko/info.php
@@ -49,6 +49,7 @@
function ukko_install($settings) {
if (!file_exists($settings['uri']))
@mkdir($settings['uri'], 0777) or error("Couldn't create " . $settings['uri'] . ". Check permissions.", true);
+ file_write($settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array()));
}
}
diff --git a/templates/themes/ukko/theme.php b/templates/themes/ukko/theme.php
index 058fc77b..d6fc303c 100644
--- a/templates/themes/ukko/theme.php
+++ b/templates/themes/ukko/theme.php
@@ -2,6 +2,8 @@
require 'info.php';
function ukko_build($action, $settings) {
+ global $config;
+
$ukko = new ukko();
$ukko->settings = $settings;
@@ -9,8 +11,12 @@
return;
}
- file_write($settings['uri'] . '/index.html', $ukko->build());
- file_write($settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array()));
+ if ($config['smart_build']) {
+ file_unlink($settings['uri'] . '/index.html');
+ }
+ else {
+ file_write($settings['uri'] . '/index.html', $ukko->build());
+ }
}
class ukko {
diff --git a/templates/thread.html b/templates/thread.html
index 5a2bbfd5..de0bf5e7 100644
--- a/templates/thread.html
+++ b/templates/thread.html
@@ -38,6 +38,9 @@
{% if config.global_message %}<hr /><div class="blotter">{{ config.global_message }}</div>{% endif %}
<hr />
+ <a href="{{ return }}">[{% trans %}Return{% endtrans %}]</a>
+ <a href="#bottom" style="padding-left: 10px">[{% trans %}Go to bottom{% endtrans %}]</a>
+ <hr />
<form name="postcontrols" action="{{ config.post_url }}" method="post">
<input type="hidden" name="board" value="{{ board.uri }}" />
{% if mod %}<input type="hidden" name="mod" value="1" />{% endif %}
@@ -45,7 +48,7 @@
{% include 'report_delete.html' %}
</form>
<a href="{{ return }}">[{% trans %}Return{% endtrans %}]</a>
- <a href="#" style="padding-left: 10px">[{% trans %}Go to top{% endtrans %}]</a>
+ <a href="#" id="bottom" style="padding-left: 10px">[{% trans %}Go to top{% endtrans %}]</a>
{{ boardlist.bottom }}
@@ -55,7 +58,7 @@
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
<a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} -
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2014 Tinyboard Development Group
- <br><a href="https://int.vichan.net/devel/">vichan</a> Copyright &copy; 2012-2014 vichan-devel</p>
+ <br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2015 vichan-devel</p>
{% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
</footer>
<script type="text/javascript">{% raw %}