forked from leftypol/leftypol
Merge remote-tracking branch 'upstream/master' into vichan-merge
This commit is contained in:
commit
4b40f69a4e
223 changed files with 65256 additions and 2969 deletions
|
@ -44,7 +44,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 © 2010-2014 Tinyboard Development Group
|
||||
<br><a href="https://int.vichan.net/devel/">vichan</a> Copyright © 2012-2014 vichan-devel</p>
|
||||
<br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -50,45 +50,53 @@
|
|||
data-bump="{{ post.bump }}"
|
||||
data-time="{{ post.time }}"
|
||||
>
|
||||
<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"
|
||||
{% else %}
|
||||
<img src="{{post.file}}"
|
||||
{% endif %}
|
||||
id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject|e }}{% endif %}" data-name="{{ post.name|e }}" data-muhdifference="{{ post.muhdifference }}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}">
|
||||
</a>
|
||||
<div class="replies">
|
||||
<strong>R: {{ post.reply_count }} / I: {{ post.image_count }}</strong>
|
||||
{% if post.subject %}
|
||||
<p class="intro">
|
||||
<span class="subject">
|
||||
{{ post.subject|e }}
|
||||
</span>
|
||||
</p>
|
||||
{% else %}
|
||||
<br />
|
||||
{% endif %}
|
||||
|
||||
{{ post.body }}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="thread grid-li grid-size-small">
|
||||
<a href="{{post.link}}">
|
||||
{% if post.youtube %}
|
||||
<img src="//img.youtube.com/vi/{{ post.youtube }}/0.jpg"
|
||||
{% else %}
|
||||
<img src="{{post.file}}"
|
||||
{% endif %}
|
||||
id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject|e }}{% endif %}" data-name="{{ post.name|e }}" data-muhdifference="{{ post.muhdifference }}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}">
|
||||
</a>
|
||||
<div class="replies">
|
||||
<strong>R: {{ post.reply_count }} / I: {{ post.image_count }}</strong>
|
||||
{% if post.subject %}
|
||||
<p class="intro">
|
||||
<span class="subject">
|
||||
{{ post.subject|e }}
|
||||
</span>
|
||||
</p>
|
||||
{% else %}
|
||||
<br />
|
||||
{% endif %}
|
||||
|
||||
{{ post.body }}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
<footer>
|
||||
<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 © 2010-2014 Tinyboard Development Group
|
||||
<br><a href="https://int.vichan.net/devel/">vichan</a> Copyright © 2012-2014 vichan-devel</p>
|
||||
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2014 Tinyboard Development Group
|
||||
<br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p>
|
||||
</footer>
|
||||
<script type="text/javascript">
|
||||
<script type="text/javascript">{% raw %}
|
||||
var styles = {
|
||||
{% endraw %}
|
||||
{% for name, uri in config.stylesheets %}{% raw %}'{% endraw %}{{ name|addslashes }}{% raw %}' : '{% endraw %}/stylesheets/{{ uri|addslashes }}{% raw %}',
|
||||
{% endraw %}{% endfor %}{% raw %}
|
||||
}; onready(init);
|
||||
{% endraw %}</script>
|
||||
|
||||
<script type="text/javascript">{% raw %}
|
||||
ready();
|
||||
</script>
|
||||
{% endraw %}</script>
|
||||
</body>
|
||||
</html>
|
||||
{% endfilter %}
|
||||
|
|
|
@ -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,35 +57,37 @@
|
|||
$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'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id']));
|
||||
$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)) {
|
||||
$post['youtube'] = $matches[2];
|
||||
}
|
||||
|
||||
if (isset($post['files'])) {
|
||||
if (isset($post['files']) && $post['files']) {
|
||||
$files = json_decode($post['files']);
|
||||
|
||||
if ($files[0]->file == 'deleted') {
|
||||
if (count($files) > 1) {
|
||||
foreach ($files as $file) {
|
||||
if (($file == $files[0]) || ($file->file == 'deleted')) continue;
|
||||
$post['file'] = $config['uri_thumb'] . $file->thumb;
|
||||
}
|
||||
if ($files[0]) {
|
||||
if ($files[0]->file == 'deleted') {
|
||||
if (count($files) > 1) {
|
||||
foreach ($files as $file) {
|
||||
if (($file == $files[0]) || ($file->file == 'deleted')) continue;
|
||||
$post['file'] = $config['uri_thumb'] . $file->thumb;
|
||||
}
|
||||
|
||||
if (empty($post['file'])) $post['file'] = $config['image_deleted'];
|
||||
if (empty($post['file'])) $post['file'] = $config['image_deleted'];
|
||||
}
|
||||
else {
|
||||
$post['file'] = $config['image_deleted'];
|
||||
}
|
||||
}
|
||||
else if($files[0]->thumb == 'spoiler') {
|
||||
$post['file'] = '/' . $config['spoiler_image'];
|
||||
}
|
||||
else {
|
||||
$post['file'] = $config['image_deleted'];
|
||||
$post['file'] = $config['uri_thumb'] . $files[0]->thumb;
|
||||
}
|
||||
}
|
||||
else if($files[0]->thumb == 'spoiler') {
|
||||
$post['file'] = '/' . $config['spoiler_image'];
|
||||
}
|
||||
else {
|
||||
$post['file'] = $config['uri_thumb'] . $files[0]->thumb;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($post['image_count'])) $post['image_count'] = 0;
|
||||
|
|
|
@ -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 © 2010-2014 Tinyboard Development Group
|
||||
<br><a href="https://int.vichan.net/devel/">vichan</a> Copyright © 2012-2014 vichan-devel</p>
|
||||
<br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p>
|
||||
</footer>
|
||||
</body>
|
||||
</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 © 2010-2014 Tinyboard Development Group
|
||||
<br><a href="https://int.vichan.net/devel/">vichan</a> Copyright © 2012-2014 vichan-devel</p>
|
||||
<br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
33
templates/themes/public_banlist/info.php
Normal file
33
templates/themes/public_banlist/info.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
$theme = Array();
|
||||
|
||||
// Theme name
|
||||
$theme['name'] = 'Public Banlist';
|
||||
// Description (you can use Tinyboard markup here)
|
||||
$theme['description'] =
|
||||
'Shows a public list of bans, that were issued on all boards. Basically, this theme
|
||||
copies the banlist interface from moderation panel.';
|
||||
$theme['version'] = 'v0.1';
|
||||
|
||||
// Theme configuration
|
||||
$theme['config'] = Array();
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'JSON feed file',
|
||||
'name' => 'file_json',
|
||||
'type' => 'text',
|
||||
'default' => 'bans.json',
|
||||
'comment' => '(eg. "bans.json")'
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Main HTML file',
|
||||
'name' => 'file_bans',
|
||||
'type' => 'text',
|
||||
'default' => 'bans.html',
|
||||
'comment' => '(eg. "bans.html")'
|
||||
);
|
||||
|
||||
// Unique function name for building everything
|
||||
$theme['build_function'] = 'pbanlist_build';
|
||||
?>
|
56
templates/themes/public_banlist/theme.php
Normal file
56
templates/themes/public_banlist/theme.php
Normal file
|
@ -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'],
|
||||
))
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
|
@ -61,7 +61,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 © 2010-2014 Tinyboard Development Group
|
||||
<br><a href="https://int.vichan.net/devel/">vichan</a> Copyright © 2012-2014 vichan-devel</p>
|
||||
<br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -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
|
||||
|
@ -62,7 +68,7 @@
|
|||
|
||||
// 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'];
|
||||
. link_for($post) . '#' . $post['id'];
|
||||
|
||||
if ($files) {
|
||||
if ($files[0]->thumb == 'spoiler') {
|
||||
|
@ -92,7 +98,7 @@
|
|||
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['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . link_for($post) . '#' . $post['id'];
|
||||
if ($post['body'] != "")
|
||||
$post['snippet'] = pm_snippet($post['body'], 30);
|
||||
else
|
||||
|
@ -124,15 +130,21 @@
|
|||
$query = query($query) or error(db_error());
|
||||
$stats['unique_posters'] = number_format($query->fetchColumn());
|
||||
|
||||
/*$query = 'SELECT SUM(`filesize`) FROM (';
|
||||
// Active content
|
||||
$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,
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
{% for board, thread_list in threads %}
|
||||
{% for thread in thread_list %}
|
||||
<url>
|
||||
<loc>{{ settings.url ~ (config.board_path | format(board)) ~ config.dir.res ~ (config.file_page | format(thread.thread_id)) }}</loc>
|
||||
<loc>{{ settings.url ~ (config.board_path | format(board)) ~ config.dir.res ~ link_for(thread) }}</loc>
|
||||
<lastmod>{{ thread.lastmod | date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}</lastmod>
|
||||
<changefreq>{{ settings.changefreq }}</changefreq>
|
||||
</url>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</urlset>
|
||||
{% endfilter %}
|
||||
{% endfilter %}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$boards = explode(' ', $settings['boards']);
|
||||
|
||||
$threads = array();
|
||||
|
||||
foreach ($boards as $board) {
|
||||
$query = query(sprintf("SELECT `id` AS `thread_id`, (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);
|
||||
|
||||
if ($config['smart_build']) {
|
||||
file_unlink($settings['path']);
|
||||
}
|
||||
else {
|
||||
$boards = explode(' ', $settings['boards']);
|
||||
|
||||
$threads = array();
|
||||
|
||||
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,
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,21 @@
|
|||
require 'info.php';
|
||||
|
||||
function ukko_build($action, $settings) {
|
||||
global $config;
|
||||
|
||||
$ukko = new ukko();
|
||||
$ukko->settings = $settings;
|
||||
|
||||
file_write($settings['uri'] . '/index.html', $ukko->build());
|
||||
file_write($settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array()));
|
||||
|
||||
if (! ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($config['smart_build']) {
|
||||
file_unlink($settings['uri'] . '/index.html');
|
||||
}
|
||||
else {
|
||||
file_write($settings['uri'] . '/index.html', $ukko->build());
|
||||
}
|
||||
}
|
||||
|
||||
class ukko {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue