diff --git a/inc/functions.php b/inc/functions.php
index 561477a4..fdb74b12 100755
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1938,7 +1938,9 @@ function remove_modifiers($body) {
function markup(&$body, $track_cites = false, $op = false) {
global $board, $config, $markup_urls;
-
+
+ print_err("Markup BEGIN");
+
$modifiers = extract_modifiers($body);
$body = preg_replace('@(.+?)@us', '', $body);
@@ -1948,9 +1950,13 @@ function markup(&$body, $track_cites = false, $op = false) {
return array();
}
+ print_err("Markup utf start");
+
$body = str_replace("\r", '', $body);
$body = utf8tohtml($body);
+ print_err("Markup utf OK");
+
if (mysql_version() < 50503)
$body = mb_encode_numericentity($body, array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8');
@@ -1981,8 +1987,10 @@ function markup(&$body, $track_cites = false, $op = false) {
-1,
$num_links);
- if ($num_links > $config['max_links'])
+ if ($num_links > $config['max_links']) {
+ print_err("Error too many links");
error($config['error']['toomanylinks']);
+ }
}
if ($config['markup_repair_tidy'])
@@ -2000,6 +2008,8 @@ function markup(&$body, $track_cites = false, $op = false) {
$tracked_cites = array();
+ print_err("Cites BEGIN");
+
// Cites
if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)([\s,.)?]|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
if (count($cites[0]) > $config['max_cites']) {
@@ -2047,6 +2057,9 @@ function markup(&$body, $track_cites = false, $op = false) {
}
}
+ print_err("Cites END");
+ print_err("Cross board linking BEGIN");
+
// Cross-board linking
if (preg_match_all('/(^|\s)>>>\/(' . $config['board_regex'] . 'f?)\/(\d+)?([\s,.)?]|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
if (count($cites[0]) > $config['max_cites']) {
@@ -2181,6 +2194,8 @@ function markup(&$body, $track_cites = false, $op = false) {
}
}
}
+
+ print_err("Cross board linking End");
$tracked_cites = array_unique($tracked_cites, SORT_REGULAR);
diff --git a/inc/instance-config.php.snapshopt-aug-30 b/inc/instance-config.php.snapshopt-aug-30
new file mode 100644
index 00000000..8d86ff4b
--- /dev/null
+++ b/inc/instance-config.php.snapshopt-aug-30
@@ -0,0 +1,213 @@
+ 'http://status.example.org/')
+ );
+ // Board categories. Only used in the "Categories" theme.
+ $config['categories'] = array(
+ 'Leftypol' => array('leftypol', 'b'),
+ 'GET' => array('GET', 'ref'),
+ 'Meta' => array('gulag')
+ );
+ // Optional for the Categories theme. This is an array of name => (title, url) groups for categories
+ // with non-board links.
+ $config['custom_categories'] = array(
+ 'Links' => array(
+ 'Leftypedia' => 'http://example.org',
+ 'Staff application' => 'staff_applications.html',
+ 'FAQ' => 'faq.html',
+ 'Donate' => 'donate.html'
+ )
+ );
+
+
+ $config['db']['server'] = 'localhost';
+ $config['db']['database'] = 'lainchan';
+ $config['db']['prefix'] = '';
+ $config['db']['user'] = 'lainchan';
+ $config['db']['password'] = 'oijrljqqwjr242kjn';
+
+
+ $config['cookies']['mod'] = 'mod';
+ $config['cookies']['salt'] = 'ZGZkYWU3NGUwZDNiYjU2MDEwZmRkMW';
+
+ $config['flood_time'] = 10;
+ $config['flood_time_ip'] = 120;
+ $config['flood_time_same'] = 30;
+ $config['max_body'] = 1800;
+ $config['reply_limit'] = 250;
+ $config['max_links'] = 20;
+ $config['max_filesize'] = 10485760;
+ $config['thumb_width'] = 255;
+ $config['thumb_height'] = 255;
+ $config['max_width'] = 10000;
+ $config['max_height'] = 10000;
+ $config['max_images'] = 4;
+ $config['threads_per_page'] = 10;
+ $config['max_pages'] = 10;
+ $config['threads_preview'] = 5;
+ $config['root'] = '/';
+ $config['secure_trip_salt'] = 'MzdhNTJiMjNkMTM5Nzc5NDcwOGViMD';
+
+ $config['thumb_method'] = 'gm+gifsicle';
+ $config['gnu_md5'] = '1';
+
+ // < Added by Zero >
+ // Sun Aug 30 17:44:19 UTC 2020
+
+ // Allowed image file extensions.
+ $config['allowed_ext'][] = 'jpg';
+ $config['allowed_ext'][] = 'jpeg';
+ $config['allowed_ext'][] = 'bmp';
+ $config['allowed_ext'][] = 'gif';
+ $config['allowed_ext'][] = 'png';
+
+ // TODO test section, please remove
+ $config['allowed_ext'][] = 'mp4';
+ $config['allowed_ext'][] = 'webm';
+ $config['allowed_ext_files'][] = 'webm';
+ $config['webm']['use_ffmpeg'] = true;
+ $config['additional_javascript'][] = 'js/options.js';
+ $config['additional_javascript'][] = 'js/webm-settings.js';
+ $config['additional_javascript'][] = 'js/expand-video.js';
+ $config['max_filesize'] = 50 * 1024 * 1024; // 50MB
+ $config['webm']['ffmpeg_path'] = '/usr/bin/ffmpeg';
+ $config['webm']['ffprobe_path'] = '/usr/bin/ffprobe';
+ $config['mp4']['ffmpeg_path'] = '/usr/bin/ffmpeg';
+ $config['mp4']['ffprobe_path'] = '/usr/bin/ffprobe';
+ $config['webm']['allow_audio'] = true;
+ $config['webm']['max_length'] = 620;
+ //end test section
+
+
+ $config['allowed_ext_files'][] = 'mp4';
+ $config['allowed_ext_files'][] = 'pdf';
+ $config['allowed_ext_files'][] = 'txt';
+ $config['allowed_ext_files'][] = 'zip';
+ $config['allowed_ext_files'][] = 'epub';
+
+ /*
+ * From Config:
+ // Always regenerate markup. This isn't recommended and should only be used for debugging; by default,
+ // Tinyboard only parses post markup when it needs to, and keeps post-markup HTML in the database. This
+ // will significantly impact performance when enabled.
+ *
+ */
+ $config['markup_repair_tidy'] = false;
+
+
+ $config['image_reject_repost'] = false;
+ $config['flood_time'] = 0;
+ // Minimum time between between each post with the exact same content AND same IP address.
+ $config['flood_time_ip'] = 0;
+
+ $config['filters'] = array();
+ $config['always_noko'] = false; // the migration script now relies on this default behavior, we can turn this on later.
+ // Added by Zero >
+
+// Changes made via web editor by "admin" @ Tue, 02 Jun 2020 23:16:58 -0700:
+$config['debug'] = true;
+
+
+// Changes made via web editor by "admin" @ Tue, 02 Jun 2020 23:24:29 -0700:
+$config['debug'] = false;
+$config['verbose_errors'] = false;
+
+
+/*
+ * ====================
+ * Javascript
+ * ====================
+ */
+
+ // Additional Javascript files to include on board index and thread pages. See js/ for available scripts.
+ $config['additional_javascript'][] = 'js/jquery.min.js';
+ $config['additional_javascript'][] = 'js/inline-expanding.js';
+ $config['additional_javascript'][] = 'js/multi-image.js'; // required when using multi file upload
+ $config['additional_javascript'][] = 'js/local-time.js';
+ $config['additional_javascript'][] = 'js/auto-reload.js';
+ $config['additional_javascript'][] = 'js/post-hover.js';
+ $config['additional_javascript'][] = 'js/style-select.js';
+
+ // Some scripts require jQuery. Check the comments in script files to see what's needed. When enabling
+ // jQuery, you should first empty the array so that "js/query.min.js" can be the first, and then re-add
+ // "js/inline-expanding.js" or else the inline-expanding script might not interact properly with other
+ // scripts.
+ // $config['additional_javascript'] = array();
+ // $config['additional_javascript'][] = 'js/jquery.min.js';
+ // $config['additional_javascript'][] = 'js/inline-expanding.js';
+ // $config['additional_javascript'][] = 'js/auto-reload.js';
+ // $config['additional_javascript'][] = 'js/post-hover.js';
+ // $config['additional_javascript'][] = 'js/style-select.js';
+
+ // Where these script files are located on the web. Defaults to $config['root'].
+ // $config['additional_javascript_url'] = 'http://static.example.org/tinyboard-javascript-stuff/';
+
+ // Compile all additional scripts into one file ($config['file_script']) instead of including them seperately.
+ $config['additional_javascript_compile'] = false;
+
+ // Minify Javascript using http://code.google.com/p/minify/.
+ $config['minify_js'] = false;
+
+ // Dispatch thumbnail loading and image configuration with JavaScript. It will need a certain javascript
+ // code to work.
+ $config['javascript_image_dispatch'] = false;
+
+ $config['multiimage_method'] = 'each';
+
+
+ $config['mod']['show_ip'] = DISABLED;
+ $config['mod']['move'] = MOD;
+
+// Changes made via web editor by "admin" @ Sun, 23 Aug 2020 16:45:14 -0700:
+$config['force_image_op'] = false;
+
+
+// Changes made via web editor by "admin" @ Sun, 23 Aug 2020 16:48:22 -0700:
+$config['force_body_op'] = false;
+
+
+// Changes made via web editor by "admin" @ Sun, 23 Aug 2020 17:38:52 -0700:
+$config['flood_time'] = 0;
+$config['flood_time_ip'] = 0;
+$config['flood_time_same'] = 0;
+
+
+// Changes made via web editor by "admin" @ Wed, 26 Aug 2020 20:15:11 -0700:
+$config['min_body'] = 5;
+
+
+// Changes made via web editor by "admin" @ Wed, 26 Aug 2020 20:15:44 -0700:
+$config['force_image_op'] = true;
+$config['min_body'] = 15;
+
+
+// Changes made via web editor by "admin" @ Sat, 29 Aug 2020 13:26:51 -0700:
+$config['force_image_op'] = false;
+
+
+// Changes made via web editor by "admin" @ Sat, 29 Aug 2020 23:13:46 -0700:
+$config['cookies']['salt'] = 'ZGZkYWU3NGUwZDNiYjU2MDEwZmRkMX';
+
+
+// Changes made via web editor by "admin" @ Sat, 29 Aug 2020 23:21:09 -0700:
+$config['cookies']['salt'] = 'ZGZkYWU3NGUwZDNiYjU2MDEwZmRkMA';
+
+
+// Changes made via web editor by "admin" @ Sun, 30 Aug 2020 10:48:36 -0700:
+$config['max_body'] = 100000;
+
+
+// Changes made via web editor by "admin" @ Sun, 30 Aug 2020 15:25:41 -0700:
+$config['max_links'] = 40;
+
diff --git a/inc/lib/webm/ffmpeg.php b/inc/lib/webm/ffmpeg.php
index db4d01ed..91b6af17 100644
--- a/inc/lib/webm/ffmpeg.php
+++ b/inc/lib/webm/ffmpeg.php
@@ -35,8 +35,9 @@ function is_valid_webm($ffprobe_out) {
}
if ((count($ffprobe_out['streams']) > 1) && (!$config['webm']['allow_audio']))
return array('code' => 3, 'msg' => $config['error']['webmhasaudio']."error 4");
- if (empty($ffprobe_out['streams'][0]['width']) || (empty($ffprobe_out['streams'][0]['height'])))
+ if ((empty($ffprobe_out['streams'][0]['width']) || (empty($ffprobe_out['streams'][0]['height']))) && !$config['webm']['allow_audio']) {
return array('code' => 2, 'msg' => $config['error']['invalidwebm']."error 5");
+ }
if ($ffprobe_out['format']['duration'] > $config['webm']['max_length'])
return array('code' => 4, 'msg' => sprintf($config['error']['webmtoolong'], $config['webm']['max_length'])."error 6");
}
diff --git a/install.php b/install.php
old mode 100644
new mode 100755
diff --git a/post.php b/post.php
index b72a8995..3cdc889e 100644
--- a/post.php
+++ b/post.php
@@ -726,7 +726,7 @@ function handle_post(){
$stripped_whitespace = preg_replace('/[\s]/u', '', $post['body']);
print_err(print_r(preg_last_error(), true));
- if (preg_last_error() != PREG_BAD_UTF8_ERROR) {
+ if (preg_last_error() == PREG_BAD_UTF8_ERROR) {
print_err("Bad unicode preg error");
}
@@ -935,6 +935,8 @@ function handle_post(){
print_err("Process post body");
$post['body'] = escape_markup_modifiers($post['body']);
+
+ print_err("body escaped");
if ($mod && isset($post['raw']) && $post['raw']) {
$post['body'] .= "\n1";
@@ -964,6 +966,8 @@ function handle_post(){
}
}
+ print_err("flag stuff block OK");
+
if ($config['user_flag'] && isset($_POST['user_flag']))
if (!empty($_POST['user_flag']) ){
@@ -978,15 +982,21 @@ function handle_post(){
"\n" . $flag_alt . "";
}
+ print_err("user flag block ok");
+
if ($config['allowed_tags'] && $post['op'] && isset($_POST['tag']) && isset($config['allowed_tags'][$_POST['tag']])) {
$post['body'] .= "\n" . $_POST['tag'] . "";
}
+ print_err("allowed tags block ok");
+
if (!$dropped_post)
if ($config['proxy_save'] && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$proxy = preg_replace("/[^0-9a-fA-F.,: ]/", '', $_SERVER['HTTP_X_FORWARDED_FOR']);
$post['body'] .= "\n".$proxy."";
}
+
+ print_err("proxy save block ok");
if (mysql_version() >= 50503) {
$post['body_nomarkup'] = $post['body']; // Assume we're using the utf8mb4 charset
@@ -1004,6 +1014,8 @@ function handle_post(){
$post['body_nomarkup'] .= $char;
}
}
+
+ print_err("body nomarkup block OK");
$post['tracked_cites'] = markup($post['body'], true);
@@ -1019,11 +1031,14 @@ function handle_post(){
foreach ($post['files'] as $key => &$file) {
if ($post['op'] && $config['allowed_ext_op']) {
- if (!in_array($file['extension'], $config['allowed_ext_op']))
+ if (!in_array($file['extension'], $config['allowed_ext_op'])) {
+ print_err("Unknown extension (1)!");
error($config['error']['unknownext']);
- }
- elseif (!in_array($file['extension'], $config['allowed_ext']) && !in_array($file['extension'], $config['allowed_ext_files']))
+ }
+ } elseif (!in_array($file['extension'], $config['allowed_ext']) && !in_array($file['extension'], $config['allowed_ext_files'])) {
+ print_err("Unknown extension (2)!");
error($config['error']['unknownext']);
+ }
$file['is_an_image'] = !in_array($file['extension'], $config['allowed_ext_files']);
@@ -1158,7 +1173,10 @@ function handle_post(){
$file['width'] = $image->size->width;
$file['height'] = $image->size->height;
+ print_err("image size width and height");
+
if ($config['spoiler_images'] && isset($_POST['spoiler'])) {
+ print_err("spoiler set");
$file['thumb'] = 'spoiler';
$size = @getimagesize($config['spoiler_image']);
@@ -1169,19 +1187,24 @@ function handle_post(){
$image->size->height <= $config['thumb_height'] &&
$file['extension'] == ($config['thumb_ext'] ? $config['thumb_ext'] : $file['extension'])) {
+ print_err("minimum copy resize");
// Copy, because there's nothing to resize
copy($file['tmp_name'], $file['thumb']);
$file['thumbwidth'] = $image->size->width;
$file['thumbheight'] = $image->size->height;
} else {
+ print_err("thumbnail resize");
$thumb = $image->resize(
$config['thumb_ext'] ? $config['thumb_ext'] : $file['extension'],
$post['op'] ? $config['thumb_op_width'] : $config['thumb_width'],
$post['op'] ? $config['thumb_op_height'] : $config['thumb_height']
);
+ print_err("thumbnail resize ok");
$thumb->to($file['thumb']);
+
+ print_err("thumbnail save ok");
$file['thumbwidth'] = $thumb->width;
$file['thumbheight'] = $thumb->height;
diff --git a/templates/themes/calendar/calendarpost.php b/templates/themes/calendar/calendarpost.php
index 5293a881..9587acc3 100644
--- a/templates/themes/calendar/calendarpost.php
+++ b/templates/themes/calendar/calendarpost.php
@@ -1,5 +1,5 @@
'Board name',
- 'name' => 'title',
- 'type' => 'text',
- 'default' => 'Ukko'
- );
- $theme['config'][] = array(
- 'title' => 'Board URI',
- 'name' => 'uri',
- 'type' => 'text',
- 'default' => '*',
- 'comment' => '(ukko for example)'
- );
- $theme['config'][] = array(
- 'title' => 'Subtitle',
- 'name' => 'subtitle',
- 'type' => 'text',
- 'comment' => '(%s = thread limit. for example "%s freshly bumped threads")'
- );
- $theme['config'][] = array(
- 'title' => 'Excluded boards',
- 'name' => 'exclude',
- 'type' => 'text',
- 'comment' => '(space seperated)'
- );
- $theme['config'][] = array(
- 'title' => 'Number of threads',
- 'name' => 'thread_limit',
- 'type' => 'text',
- 'default' => '15',
- );
- // Unique function name for building everything
- $theme['build_function'] = 'ukko_build';
- $theme['install_callback'] = 'ukko_install';
-
- if(!function_exists('ukko_install')) {
- 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
deleted file mode 100644
index d08b6769..00000000
--- a/templates/themes/ukko/theme.php
+++ /dev/null
@@ -1,162 +0,0 @@
-settings = $settings;
-
- if (! ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')) {
- return;
- }
-
- $action = generation_strategy('sb_ukko', array());
-
- if ($action == 'delete') {
- file_unlink($settings['uri'] . '/index.html');
- if ($config['api']['enabled']) {
- $jsonFilename = $settings['uri'] . '/0.json';
- file_unlink($jsonFilename);
- $jsonFilename = $settings['uri'] . '/catalog.json';
- file_unlink($jsonFilename);
- $jsonFilename = $settings['uri'] . '/threads.json';
- file_unlink($jsonFilename);
- }
- }
- elseif ($action == 'rebuild') {
- file_write($settings['uri'] . '/index.html', $ukko->build());
- }
- }
-
- class ukko {
- public $settings;
- public function build($mod = false) {
- global $config;
- $boards = listBoards();
-
- $body = '';
- $overflow = array();
- $board = array(
- 'dir' => $this->settings['uri'] . "/",
- 'url' => $this->settings['uri'],
- 'uri' => $this->settings['uri'],
- 'name' => $this->settings['title'],
- 'title' => sprintf($this->settings['subtitle'], $this->settings['thread_limit'])
- );
-
- $boardsforukko = array();
- $query = '';
- foreach($boards as &$_board) {
- if(in_array($_board['uri'], explode(' ', $this->settings['exclude'])))
- continue;
- $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL UNION ALL ", $_board['uri'], $_board['uri']);
- array_push($boardsforukko,$_board);
- }
- $query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query);
- $query = query($query) or error(db_error());
-
- $count = 0;
- $threads = array();
- if ($config['api']['enabled']) {
- $apithreads = array();
- }
- while($post = $query->fetch()) {
-
- if(!isset($threads[$post['board']])) {
- $threads[$post['board']] = 1;
- } else {
- $threads[$post['board']] += 1;
- }
-
- if($count < $this->settings['thread_limit']) {
- openBoard($post['board']);
- $thread = new Thread($post, $mod ? '?/' : $config['root'], $mod);
-
- $posts = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `thread` = :id ORDER BY `sticky` DESC, `id` DESC LIMIT :limit", $post['board']));
- $posts->bindValue(':id', $post['id']);
- $posts->bindValue(':limit', ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT);
- $posts->execute() or error(db_error($posts));
-
- $num_images = 0;
- while ($po = $posts->fetch()) {
- if ($po['files'])
- $num_images++;
- $post2 = new Post($po, $mod ? '?/' : $config['root'], $mod);
- $thread->add($post2);
-
- }
- if ($posts->rowCount() == ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
- $ct = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM ``posts_%s`` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `files` IS NOT NULL AND `thread` = :thread", $post['board'], $post['board']));
- $ct->bindValue(':thread', $post['id'], PDO::PARAM_INT);
- $ct->execute() or error(db_error($count));
-
- $c = $ct->fetch();
- $thread->omitted = $c['num'] - ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']);
-
- $c = $ct->fetch();
- $thread->omitted_images = $c['num'] - $num_images;
- }
-
-
- $thread->posts = array_reverse($thread->posts);
- $body .= '
';
- $body .= $thread->build(true);
- if ($config['api']['enabled']) {
- array_push($apithreads,$thread);
- }
- } else {
- $page = 'index';
- if(floor($threads[$post['board']] / $config['threads_per_page']) > 0) {
- $page = floor($threads[$post['board']] / $config['threads_per_page']) + 1;
- }
- $overflow[] = array('id' => $post['id'], 'board' => $post['board'], 'page' => $page . '.html');
- }
-
- $count += 1;
- }
-
- $body .= '';
- $body .= '';
-
- // json api
- if ($config['api']['enabled']) {
- require_once __DIR__. '/../../../inc/api.php';
- $api = new Api();
- $jsonFilename = $board['dir'] . '0.json';
- $json = json_encode($api->translatePage($apithreads));
- file_write($jsonFilename, $json);
-
-
- $catalog = array();
- $catalog[0] = $apithreads;
-
- $json = json_encode($api->translateCatalog($catalog));
- $jsonFilename = $board['dir'] . 'catalog.json';
- file_write($jsonFilename, $json);
-
- $json = json_encode($api->translateCatalog($catalog, true));
- $jsonFilename = $board['dir'] . 'threads.json';
- file_write($jsonFilename, $json);
- }
- $antibot = null;
- if (!$antibot) {
- $antibot = create_antibot($board['uri']);
- }
- $antibot->reset();
-
- return Element('index.html', array(
- 'config' => $config,
- 'board' => $board,
- 'no_post_form' => $config['overboard_post_form'] ? false : true,
- 'body' => $body,
- 'mod' => $mod,
- 'boardlist' => createBoardlist($mod),
- 'boards' => $boardsforukko,
- 'antibot' => $antibot )
- );
- }
-
- };
-
-?>
diff --git a/templates/themes/ukko/thumb.png b/templates/themes/ukko/thumb.png
deleted file mode 100644
index eb616ef7..00000000
Binary files a/templates/themes/ukko/thumb.png and /dev/null differ
diff --git a/templates/themes/ukko/ukko.js b/templates/themes/ukko/ukko.js
deleted file mode 100644
index b2668e0b..00000000
--- a/templates/themes/ukko/ukko.js
+++ /dev/null
@@ -1,116 +0,0 @@
-(function(){
-
-var cache = new Array(),
- thread = false,
- loading = false,
- ukkotimer = false;
-
-if (localStorage.hiddenboards === undefined) {
- localStorage.hiddenboards = "{}";
-}
-
-// Load data from HTML5 localStorage
-var hiddenboards = JSON.parse(localStorage.hiddenboards);
-
-var storeboards = function() {
- localStorage.hiddenboards = JSON.stringify(hiddenboards);
-};
-
-$(document).ready(function() {
- var addukkohide = function() {
- var ukkohide = $('');
- var board = $(this).next().data("board");
- var hr = $("
");
-
- $(this).append(ukkohide);
- $(this).append(hr);
-
- if (hiddenboards[board] !== true) {
- ukkohide.html(_("(hide threads from this board)"));
- hr.hide();
- }
- else {
- ukkohide.html(_("(show threads from this board)"));
- $(this).next().hide();
- }
- ukkohide.click(function() {
- hiddenboards[board] = (hiddenboards[board] !== true);
- if (hiddenboards[board] !== true) {
- $('[data-board="'+board+'"]:not([data-cached="yes"])').show().prev().
- find('.ukkohide').html(_("(hide threads from this board)")).
- parent().find('hr').hide();
- }
- else {
- $('[data-board="'+board+'"]:not([data-cached="yes"])').hide().prev().
- find('.ukkohide').html(_("(show threads from this board)"))
- .parent().find('hr').show();
- }
- storeboards();
- return false;
- });
-
- };
- $("h2").each(addukkohide);
-
- $('.pages').hide();
- var loadnext = function() {
- if (overflow.length == 0) {
- $('.pages').show().html(_("No more threads to display"));
- }
- while($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading && overflow.length > 0) {
- var page = modRoot + overflow[0].board + '/' + overflow[0].page;
- thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"]');
- if (thread.length > 0 && thread.attr("data-cached") !== 'yes') { // already present
- overflow.shift();
- continue;
- }
-
- var boardheader = $('');
-
- if($.inArray(page, cache) != -1) {
- if (thread.length > 0) {
- $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).attr("data-cached", "no").css('display', 'block'));
- boardheader.insertBefore(thread);
- addukkohide.call(boardheader);
- $(document).trigger('new_post', thread);
- }
- overflow.shift();
- } else {
- loading = true;
- $('.pages').show().html(_("Loading..."));
- $.get(page, function(data) {
- cache.push(page);
-
- $(data).find('div[id*="thread_"]').each(function() {
- var checkout = $(this).attr('id').replace('thread_', '');
- if ($('div#thread_' + checkout + '[data-board="' + overflow[0].board + '"]').length == 0) {
- $('form[name="postcontrols"]').prepend($(this).css('display', 'none').attr("data-cached", "yes").attr('data-board', overflow[0].board));
- }
- });
-
- thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"][data-cached="yes"]');
-
- if(thread.length > 0) {
- $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).attr("data-cached", "no").css('display', 'block'));
- boardheader.insertBefore(thread);
- addukkohide.call(boardheader);
- $(document).trigger('new_post', thread);
- }
- overflow.shift();
-
- loading = false;
- $('.pages').hide().html("");
- });
- break;
- }
- }
- clearTimeout(ukkotimer);
- ukkotimer = setTimeout(loadnext, 1000);
- };
-
- $(window).on('scroll', loadnext);
-
- ukkotimer = setTimeout(loadnext, 1000);
-});
-
-})();
diff --git a/templates/themes/ukko2/info.php b/templates/themes/ukko2/info.php
deleted file mode 100644
index f7094697..00000000
--- a/templates/themes/ukko2/info.php
+++ /dev/null
@@ -1,55 +0,0 @@
- 'Board name',
- 'name' => 'title',
- 'type' => 'text',
- 'default' => 'Ukko'
- );
- $theme['config'][] = array(
- 'title' => 'Board URI',
- 'name' => 'uri',
- 'type' => 'text',
- 'default' => '*',
- 'comment' => '(ukko for example)'
- );
- $theme['config'][] = array(
- 'title' => 'Subtitle',
- 'name' => 'subtitle',
- 'type' => 'text',
- 'comment' => '(%s = thread limit. for example "%s freshly bumped threads")'
- );
- $theme['config'][] = array(
- 'title' => 'included boards',
- 'name' => 'include',
- 'type' => 'text',
- 'comment' => '(space seperated)'
- );
- $theme['config'][] = array(
- 'title' => 'Number of threads',
- 'name' => 'thread_limit',
- 'type' => 'text',
- 'default' => '15',
- );
- // Unique function name for building everything
- $theme['build_function'] = 'ukko2_build';
- $theme['install_callback'] = 'ukko2_install';
-
- if(!function_exists('ukko2_install')) {
- function ukko2_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/ukko2/theme.php b/templates/themes/ukko2/theme.php
deleted file mode 100644
index bb21caa0..00000000
--- a/templates/themes/ukko2/theme.php
+++ /dev/null
@@ -1,161 +0,0 @@
-settings = $settings;
-
- if (! ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')) {
- return;
- }
-
- $action = generation_strategy('sb_ukko2', array());
-
- if ($action == 'delete') {
- file_unlink($settings['uri'] . '/index.html');
- if ($config['api']['enabled']) {
- $jsonFilename = $settings['uri'] . '/0.json';
- file_unlink($jsonFilename);
- $jsonFilename = $settings['uri'] . '/catalog.json';
- file_unlink($jsonFilename);
- $jsonFilename = $settings['uri'] . '/threads.json';
- file_unlink($jsonFilename);
- }
- }
- elseif ($action == 'rebuild') {
- file_write($settings['uri'] . '/index.html', $ukko2->build());
- }
- }
-
- class ukko2 {
- public $settings;
- public function build($mod = false) {
- global $config;
- $boards = listBoards();
-
- $body = '';
- $overflow = array();
- $board = array(
- 'dir' => $this->settings['uri'] . "/",
- 'url' => $this->settings['uri'],
- 'uri' => $this->settings['uri'],
- 'name' => $this->settings['title'],
- 'title' => sprintf($this->settings['subtitle'], $this->settings['thread_limit'])
- );
- $boardsforukko2 = array();
- $query = '';
- foreach($boards as &$_board) {
- if(in_array($_board['uri'], explode(' ', $this->settings['include']))){
- $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL UNION ALL ", $_board['uri'], $_board['uri']);
- array_push($boardsforukko2,$_board);
- }
- }
- $query = preg_replace('/UNION ALL $/', 'ORDER BY `sticky` DESC ,`bump` DESC', $query);
- $query = query($query) or error(db_error());
-
- $count = 0;
- $threads = array();
- if ($config['api']['enabled']) {
- $apithreads = array();
- }
- while($post = $query->fetch()) {
-
- if(!isset($threads[$post['board']])) {
- $threads[$post['board']] = 1;
- } else {
- $threads[$post['board']] += 1;
- }
-
- if($count < $this->settings['thread_limit']) {
- openBoard($post['board']);
- $thread = new Thread($post, $mod ? '?/' : $config['root'], $mod);
-
- $posts = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `thread` = :id ORDER BY `sticky` DESC, `id` DESC LIMIT :limit", $post['board']));
- $posts->bindValue(':id', $post['id']);
- $posts->bindValue(':limit', ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT);
- $posts->execute() or error(db_error($posts));
-
- $num_images = 0;
- while ($po = $posts->fetch()) {
- if ($po['files'])
- $num_images++;
- $post2 = new Post($po, $mod ? '?/' : $config['root'], $mod);
- $thread->add($post2);
-
- }
- if ($posts->rowCount() == ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
- $ct = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM ``posts_%s`` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `files` IS NOT NULL AND `thread` = :thread", $post['board'], $post['board']));
- $ct->bindValue(':thread', $post['id'], PDO::PARAM_INT);
- $ct->execute() or error(db_error($count));
-
- $c = $ct->fetch();
- $thread->omitted = $c['num'] - ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']);
-
- $c = $ct->fetch();
- $thread->omitted_images = $c['num'] - $num_images;
- }
-
-
- $thread->posts = array_reverse($thread->posts);
- $body .= '';
- $body .= $thread->build(true);
- if ($config['api']['enabled']) {
- array_push($apithreads,$thread);
- }
- } else {
- $page = 'index';
- if(floor($threads[$post['board']] / $config['threads_per_page']) > 0) {
- $page = floor($threads[$post['board']] / $config['threads_per_page']) + 1;
- }
- $overflow[] = array('id' => $post['id'], 'board' => $post['board'], 'page' => $page . '.html');
- }
-
- $count += 1;
- }
-
- $body .= '';
- $body .= '';
-
- // json api
- if ($config['api']['enabled']) {
- require_once __DIR__. '/../../../inc/api.php';
- $api = new Api();
- $jsonFilename = $board['dir'] . '0.json';
- $json = json_encode($api->translatePage($apithreads));
- file_write($jsonFilename, $json);
-
-
- $catalog = array();
- $catalog[0] = $apithreads;
-
- $json = json_encode($api->translateCatalog($catalog));
- $jsonFilename = $board['dir'] . 'catalog.json';
- file_write($jsonFilename, $json);
-
- $json = json_encode($api->translateCatalog($catalog, true));
- $jsonFilename = $board['dir'] . 'threads.json';
- file_write($jsonFilename, $json);
- }
- $antibot = null;
- if (!$antibot) {
- $antibot = create_antibot($board['uri']);
- }
- $antibot->reset();
-
- return Element('index.html', array(
- 'config' => $config,
- 'board' => $board,
- 'no_post_form' => $config['overboard_post_form'] ? false : true,
- 'body' => $body,
- 'mod' => $mod,
- 'boardlist' => createBoardlist($mod),
- 'boards' => $boardsforukko2,
- 'antibot' => $antibot )
- );
- }
-
- };
-
-?>
diff --git a/templates/themes/ukko2/thumb.png b/templates/themes/ukko2/thumb.png
deleted file mode 100644
index eb616ef7..00000000
Binary files a/templates/themes/ukko2/thumb.png and /dev/null differ
diff --git a/templates/themes/ukko2/ukko.js b/templates/themes/ukko2/ukko.js
deleted file mode 100644
index b2668e0b..00000000
--- a/templates/themes/ukko2/ukko.js
+++ /dev/null
@@ -1,116 +0,0 @@
-(function(){
-
-var cache = new Array(),
- thread = false,
- loading = false,
- ukkotimer = false;
-
-if (localStorage.hiddenboards === undefined) {
- localStorage.hiddenboards = "{}";
-}
-
-// Load data from HTML5 localStorage
-var hiddenboards = JSON.parse(localStorage.hiddenboards);
-
-var storeboards = function() {
- localStorage.hiddenboards = JSON.stringify(hiddenboards);
-};
-
-$(document).ready(function() {
- var addukkohide = function() {
- var ukkohide = $('');
- var board = $(this).next().data("board");
- var hr = $("
");
-
- $(this).append(ukkohide);
- $(this).append(hr);
-
- if (hiddenboards[board] !== true) {
- ukkohide.html(_("(hide threads from this board)"));
- hr.hide();
- }
- else {
- ukkohide.html(_("(show threads from this board)"));
- $(this).next().hide();
- }
- ukkohide.click(function() {
- hiddenboards[board] = (hiddenboards[board] !== true);
- if (hiddenboards[board] !== true) {
- $('[data-board="'+board+'"]:not([data-cached="yes"])').show().prev().
- find('.ukkohide').html(_("(hide threads from this board)")).
- parent().find('hr').hide();
- }
- else {
- $('[data-board="'+board+'"]:not([data-cached="yes"])').hide().prev().
- find('.ukkohide').html(_("(show threads from this board)"))
- .parent().find('hr').show();
- }
- storeboards();
- return false;
- });
-
- };
- $("h2").each(addukkohide);
-
- $('.pages').hide();
- var loadnext = function() {
- if (overflow.length == 0) {
- $('.pages').show().html(_("No more threads to display"));
- }
- while($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading && overflow.length > 0) {
- var page = modRoot + overflow[0].board + '/' + overflow[0].page;
- thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"]');
- if (thread.length > 0 && thread.attr("data-cached") !== 'yes') { // already present
- overflow.shift();
- continue;
- }
-
- var boardheader = $('');
-
- if($.inArray(page, cache) != -1) {
- if (thread.length > 0) {
- $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).attr("data-cached", "no").css('display', 'block'));
- boardheader.insertBefore(thread);
- addukkohide.call(boardheader);
- $(document).trigger('new_post', thread);
- }
- overflow.shift();
- } else {
- loading = true;
- $('.pages').show().html(_("Loading..."));
- $.get(page, function(data) {
- cache.push(page);
-
- $(data).find('div[id*="thread_"]').each(function() {
- var checkout = $(this).attr('id').replace('thread_', '');
- if ($('div#thread_' + checkout + '[data-board="' + overflow[0].board + '"]').length == 0) {
- $('form[name="postcontrols"]').prepend($(this).css('display', 'none').attr("data-cached", "yes").attr('data-board', overflow[0].board));
- }
- });
-
- thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"][data-cached="yes"]');
-
- if(thread.length > 0) {
- $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).attr("data-cached", "no").css('display', 'block'));
- boardheader.insertBefore(thread);
- addukkohide.call(boardheader);
- $(document).trigger('new_post', thread);
- }
- overflow.shift();
-
- loading = false;
- $('.pages').hide().html("");
- });
- break;
- }
- }
- clearTimeout(ukkotimer);
- ukkotimer = setTimeout(loadnext, 1000);
- };
-
- $(window).on('scroll', loadnext);
-
- ukkotimer = setTimeout(loadnext, 1000);
-});
-
-})();
diff --git a/templates/themes/ukko3/info.php b/templates/themes/ukko3/info.php
deleted file mode 100644
index 375995f4..00000000
--- a/templates/themes/ukko3/info.php
+++ /dev/null
@@ -1,55 +0,0 @@
- 'Board name',
- 'name' => 'title',
- 'type' => 'text',
- 'default' => 'Ukko'
- );
- $theme['config'][] = array(
- 'title' => 'Board URI',
- 'name' => 'uri',
- 'type' => 'text',
- 'default' => '*',
- 'comment' => '(ukko for example)'
- );
- $theme['config'][] = array(
- 'title' => 'Subtitle',
- 'name' => 'subtitle',
- 'type' => 'text',
- 'comment' => '(%s = thread limit. for example "%s freshly bumped threads")'
- );
- $theme['config'][] = array(
- 'title' => 'included boards',
- 'name' => 'include',
- 'type' => 'text',
- 'comment' => '(space seperated)'
- );
- $theme['config'][] = array(
- 'title' => 'Number of threads',
- 'name' => 'thread_limit',
- 'type' => 'text',
- 'default' => '15',
- );
- // Unique function name for building everything
- $theme['build_function'] = 'ukko3_build';
- $theme['install_callback'] = 'ukko3_install';
-
- if(!function_exists('ukko3_install')) {
- function ukko3_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/ukko3/theme.php b/templates/themes/ukko3/theme.php
deleted file mode 100644
index 53910199..00000000
--- a/templates/themes/ukko3/theme.php
+++ /dev/null
@@ -1,162 +0,0 @@
-settings = $settings;
-
- if (! ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')) {
- return;
- }
-
- $action = generation_strategy('sb_ukko3', array());
-
- if ($action == 'delete') {
- file_unlink($settings['uri'] . '/index.html');
- if ($config['api']['enabled']) {
- $jsonFilename = $settings['uri'] . '/0.json';
- file_unlink($jsonFilename);
- $jsonFilename = $settings['uri'] . '/catalog.json';
- file_unlink($jsonFilename);
- $jsonFilename = $settings['uri'] . '/threads.json';
- file_unlink($jsonFilename);
- }
- }
- elseif ($action == 'rebuild') {
- file_write($settings['uri'] . '/index.html', $ukko3->build());
- }
- }
-
- class ukko3 {
- public $settings;
- public function build($mod = false) {
- global $config;
- $boards = listBoards();
-
- $body = '';
- $overflow = array();
- $board = array(
- 'dir' => $this->settings['uri'] . "/",
- 'url' => $this->settings['uri'],
- 'uri' => $this->settings['uri'],
- 'name' => $this->settings['title'],
- 'title' => sprintf($this->settings['subtitle'], $this->settings['thread_limit'])
- );
-
- $boardsforukko3 = array();
- $query = '';
- foreach($boards as &$_board) {
- if(in_array($_board['uri'], explode(' ', $this->settings['include']))){
- $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL UNION ALL ", $_board['uri'], $_board['uri']);
- array_push($boardsforukko3,$_board);
- }
- }
- $query = preg_replace('/UNION ALL $/', 'ORDER BY `sticky` DESC ,`bump` DESC', $query);
- $query = query($query) or error(db_error());
-
- $count = 0;
- $threads = array();
- if ($config['api']['enabled']) {
- $apithreads = array();
- }
- while($post = $query->fetch()) {
-
- if(!isset($threads[$post['board']])) {
- $threads[$post['board']] = 1;
- } else {
- $threads[$post['board']] += 1;
- }
-
- if($count < $this->settings['thread_limit']) {
- openBoard($post['board']);
- $thread = new Thread($post, $mod ? '?/' : $config['root'], $mod);
-
- $posts = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `thread` = :id ORDER BY `sticky` DESC, `id` DESC LIMIT :limit", $post['board']));
- $posts->bindValue(':id', $post['id']);
- $posts->bindValue(':limit', ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT);
- $posts->execute() or error(db_error($posts));
-
- $num_images = 0;
- while ($po = $posts->fetch()) {
- if ($po['files'])
- $num_images++;
- $post2 = new Post($po, $mod ? '?/' : $config['root'], $mod);
- $thread->add($post2);
-
- }
- if ($posts->rowCount() == ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
- $ct = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM ``posts_%s`` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `files` IS NOT NULL AND `thread` = :thread", $post['board'], $post['board']));
- $ct->bindValue(':thread', $post['id'], PDO::PARAM_INT);
- $ct->execute() or error(db_error($count));
-
- $c = $ct->fetch();
- $thread->omitted = $c['num'] - ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']);
-
- $c = $ct->fetch();
- $thread->omitted_images = $c['num'] - $num_images;
- }
-
-
- $thread->posts = array_reverse($thread->posts);
- $body .= '';
- $body .= $thread->build(true);
- if ($config['api']['enabled']) {
- array_push($apithreads,$thread);
- }
- } else {
- $page = 'index';
- if(floor($threads[$post['board']] / $config['threads_per_page']) > 0) {
- $page = floor($threads[$post['board']] / $config['threads_per_page']) + 1;
- }
- $overflow[] = array('id' => $post['id'], 'board' => $post['board'], 'page' => $page . '.html');
- }
-
- $count += 1;
- }
-
- $body .= '';
- $body .= '';
-
- // json api
- if ($config['api']['enabled']) {
- require_once __DIR__. '/../../../inc/api.php';
- $api = new Api();
- $jsonFilename = $board['dir'] . '0.json';
- $json = json_encode($api->translatePage($apithreads));
- file_write($jsonFilename, $json);
-
-
- $catalog = array();
- $catalog[0] = $apithreads;
-
- $json = json_encode($api->translateCatalog($catalog));
- $jsonFilename = $board['dir'] . 'catalog.json';
- file_write($jsonFilename, $json);
-
- $json = json_encode($api->translateCatalog($catalog, true));
- $jsonFilename = $board['dir'] . 'threads.json';
- file_write($jsonFilename, $json);
- }
- $antibot = null;
- if (!$antibot) {
- $antibot = create_antibot($board['uri']);
- }
- $antibot->reset();
-
- return Element('index.html', array(
- 'config' => $config,
- 'board' => $board,
- 'no_post_form' => $config['overboard_post_form'] ? false : true,
- 'body' => $body,
- 'mod' => $mod,
- 'boardlist' => createBoardlist($mod),
- 'boards' => $boardsforukko3,
- 'antibot' => $antibot )
- );
- }
-
- };
-
-?>
diff --git a/templates/themes/ukko3/thumb.png b/templates/themes/ukko3/thumb.png
deleted file mode 100644
index eb616ef7..00000000
Binary files a/templates/themes/ukko3/thumb.png and /dev/null differ
diff --git a/templates/themes/ukko3/ukko.js b/templates/themes/ukko3/ukko.js
deleted file mode 100644
index b2668e0b..00000000
--- a/templates/themes/ukko3/ukko.js
+++ /dev/null
@@ -1,116 +0,0 @@
-(function(){
-
-var cache = new Array(),
- thread = false,
- loading = false,
- ukkotimer = false;
-
-if (localStorage.hiddenboards === undefined) {
- localStorage.hiddenboards = "{}";
-}
-
-// Load data from HTML5 localStorage
-var hiddenboards = JSON.parse(localStorage.hiddenboards);
-
-var storeboards = function() {
- localStorage.hiddenboards = JSON.stringify(hiddenboards);
-};
-
-$(document).ready(function() {
- var addukkohide = function() {
- var ukkohide = $('');
- var board = $(this).next().data("board");
- var hr = $("
");
-
- $(this).append(ukkohide);
- $(this).append(hr);
-
- if (hiddenboards[board] !== true) {
- ukkohide.html(_("(hide threads from this board)"));
- hr.hide();
- }
- else {
- ukkohide.html(_("(show threads from this board)"));
- $(this).next().hide();
- }
- ukkohide.click(function() {
- hiddenboards[board] = (hiddenboards[board] !== true);
- if (hiddenboards[board] !== true) {
- $('[data-board="'+board+'"]:not([data-cached="yes"])').show().prev().
- find('.ukkohide').html(_("(hide threads from this board)")).
- parent().find('hr').hide();
- }
- else {
- $('[data-board="'+board+'"]:not([data-cached="yes"])').hide().prev().
- find('.ukkohide').html(_("(show threads from this board)"))
- .parent().find('hr').show();
- }
- storeboards();
- return false;
- });
-
- };
- $("h2").each(addukkohide);
-
- $('.pages').hide();
- var loadnext = function() {
- if (overflow.length == 0) {
- $('.pages').show().html(_("No more threads to display"));
- }
- while($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading && overflow.length > 0) {
- var page = modRoot + overflow[0].board + '/' + overflow[0].page;
- thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"]');
- if (thread.length > 0 && thread.attr("data-cached") !== 'yes') { // already present
- overflow.shift();
- continue;
- }
-
- var boardheader = $('');
-
- if($.inArray(page, cache) != -1) {
- if (thread.length > 0) {
- $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).attr("data-cached", "no").css('display', 'block'));
- boardheader.insertBefore(thread);
- addukkohide.call(boardheader);
- $(document).trigger('new_post', thread);
- }
- overflow.shift();
- } else {
- loading = true;
- $('.pages').show().html(_("Loading..."));
- $.get(page, function(data) {
- cache.push(page);
-
- $(data).find('div[id*="thread_"]').each(function() {
- var checkout = $(this).attr('id').replace('thread_', '');
- if ($('div#thread_' + checkout + '[data-board="' + overflow[0].board + '"]').length == 0) {
- $('form[name="postcontrols"]').prepend($(this).css('display', 'none').attr("data-cached", "yes").attr('data-board', overflow[0].board));
- }
- });
-
- thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"][data-cached="yes"]');
-
- if(thread.length > 0) {
- $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).attr("data-cached", "no").css('display', 'block'));
- boardheader.insertBefore(thread);
- addukkohide.call(boardheader);
- $(document).trigger('new_post', thread);
- }
- overflow.shift();
-
- loading = false;
- $('.pages').hide().html("");
- });
- break;
- }
- }
- clearTimeout(ukkotimer);
- ukkotimer = setTimeout(loadnext, 1000);
- };
-
- $(window).on('scroll', loadnext);
-
- ukkotimer = setTimeout(loadnext, 1000);
-});
-
-})();
diff --git a/templates/themes/ukko4/info.php b/templates/themes/ukko4/info.php
deleted file mode 100644
index dbbf6da8..00000000
--- a/templates/themes/ukko4/info.php
+++ /dev/null
@@ -1,55 +0,0 @@
- 'Board name',
- 'name' => 'title',
- 'type' => 'text',
- 'default' => 'Ukko'
- );
- $theme['config'][] = array(
- 'title' => 'Board URI',
- 'name' => 'uri',
- 'type' => 'text',
- 'default' => '*',
- 'comment' => '(ukko for example)'
- );
- $theme['config'][] = array(
- 'title' => 'Subtitle',
- 'name' => 'subtitle',
- 'type' => 'text',
- 'comment' => '(%s = thread limit. for example "%s freshly bumped threads")'
- );
- $theme['config'][] = array(
- 'title' => 'Excluded boards',
- 'name' => 'exclude',
- 'type' => 'text',
- 'comment' => '(space seperated)'
- );
- $theme['config'][] = array(
- 'title' => 'Number of threads',
- 'name' => 'thread_limit',
- 'type' => 'text',
- 'default' => '15',
- );
- // Unique function name for building everything
- $theme['build_function'] = 'ukko4_build';
- $theme['install_callback'] = 'ukko4_install';
-
- if(!function_exists('ukko4_install')) {
- function ukko4_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/ukko4/theme.php b/templates/themes/ukko4/theme.php
deleted file mode 100644
index 4511483e..00000000
--- a/templates/themes/ukko4/theme.php
+++ /dev/null
@@ -1,162 +0,0 @@
-settings = $settings;
-
- if (! ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete')) {
- return;
- }
-
- $action = generation_strategy('sb_ukko', array());
-
- if ($action == 'delete') {
- file_unlink($settings['uri'] . '/index.html');
- if ($config['api']['enabled']) {
- $jsonFilename = $settings['uri'] . '/0.json';
- file_unlink($jsonFilename);
- $jsonFilename = $settings['uri'] . '/catalog.json';
- file_unlink($jsonFilename);
- $jsonFilename = $settings['uri'] . '/threads.json';
- file_unlink($jsonFilename);
- }
- }
- elseif ($action == 'rebuild') {
- file_write($settings['uri'] . '/index.html', $ukko->build());
- }
- }
-
- class ukko4 {
- public $settings;
- public function build($mod = false) {
- global $config;
- $boards = listBoards();
-
- $body = '';
- $overflow = array();
- $board = array(
- 'dir' => $this->settings['uri'] . "/",
- 'url' => $this->settings['uri'],
- 'uri' => $this->settings['uri'],
- 'name' => $this->settings['title'],
- 'title' => sprintf($this->settings['subtitle'], $this->settings['thread_limit'])
- );
-
- $boardsforukko = array();
- $query = '';
- foreach($boards as &$_board) {
- if(in_array($_board['uri'], explode(' ', $this->settings['exclude'])))
- continue;
- $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL UNION ALL ", $_board['uri'], $_board['uri']);
- array_push($boardsforukko,$_board);
- }
- $query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query);
- $query = query($query) or error(db_error());
-
- $count = 0;
- $threads = array();
- if ($config['api']['enabled']) {
- $apithreads = array();
- }
- while($post = $query->fetch()) {
-
- if(!isset($threads[$post['board']])) {
- $threads[$post['board']] = 1;
- } else {
- $threads[$post['board']] += 1;
- }
-
- if($count < $this->settings['thread_limit']) {
- openBoard($post['board']);
- $thread = new Thread($post, $mod ? '?/' : $config['root'], $mod);
-
- $posts = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `thread` = :id ORDER BY `sticky` DESC, `id` DESC LIMIT :limit", $post['board']));
- $posts->bindValue(':id', $post['id']);
- $posts->bindValue(':limit', ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT);
- $posts->execute() or error(db_error($posts));
-
- $num_images = 0;
- while ($po = $posts->fetch()) {
- if ($po['files'])
- $num_images++;
- $post2 = new Post($po, $mod ? '?/' : $config['root'], $mod);
- $thread->add($post2);
-
- }
- if ($posts->rowCount() == ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
- $ct = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM ``posts_%s`` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `files` IS NOT NULL AND `thread` = :thread", $post['board'], $post['board']));
- $ct->bindValue(':thread', $post['id'], PDO::PARAM_INT);
- $ct->execute() or error(db_error($count));
-
- $c = $ct->fetch();
- $thread->omitted = $c['num'] - ($post['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']);
-
- $c = $ct->fetch();
- $thread->omitted_images = $c['num'] - $num_images;
- }
-
-
- $thread->posts = array_reverse($thread->posts);
- $body .= '';
- $body .= $thread->build(true);
- if ($config['api']['enabled']) {
- array_push($apithreads,$thread);
- }
- } else {
- $page = 'index';
- if(floor($threads[$post['board']] / $config['threads_per_page']) > 0) {
- $page = floor($threads[$post['board']] / $config['threads_per_page']) + 1;
- }
- $overflow[] = array('id' => $post['id'], 'board' => $post['board'], 'page' => $page . '.html');
- }
-
- $count += 1;
- }
-
- $body .= '';
- $body .= '';
-
- // json api
- if ($config['api']['enabled']) {
- require_once __DIR__. '/../../../inc/api.php';
- $api = new Api();
- $jsonFilename = $board['dir'] . '0.json';
- $json = json_encode($api->translatePage($apithreads));
- file_write($jsonFilename, $json);
-
-
- $catalog = array();
- $catalog[0] = $apithreads;
-
- $json = json_encode($api->translateCatalog($catalog));
- $jsonFilename = $board['dir'] . 'catalog.json';
- file_write($jsonFilename, $json);
-
- $json = json_encode($api->translateCatalog($catalog, true));
- $jsonFilename = $board['dir'] . 'threads.json';
- file_write($jsonFilename, $json);
- }
- $antibot = null;
- if (!$antibot) {
- $antibot = create_antibot($board['uri']);
- }
- $antibot->reset();
-
- return Element('index.html', array(
- 'config' => $config,
- 'board' => $board,
- 'no_post_form' => $config['overboard_post_form'] ? false : true,
- 'body' => $body,
- 'mod' => $mod,
- 'boardlist' => createBoardlist($mod),
- 'boards' => $boardsforukko,
- 'antibot' => $antibot )
- );
- }
-
- };
-
-?>
diff --git a/templates/themes/ukko4/thumb.png b/templates/themes/ukko4/thumb.png
deleted file mode 100644
index eb616ef7..00000000
Binary files a/templates/themes/ukko4/thumb.png and /dev/null differ
diff --git a/templates/themes/ukko4/ukko.js b/templates/themes/ukko4/ukko.js
deleted file mode 100644
index b2668e0b..00000000
--- a/templates/themes/ukko4/ukko.js
+++ /dev/null
@@ -1,116 +0,0 @@
-(function(){
-
-var cache = new Array(),
- thread = false,
- loading = false,
- ukkotimer = false;
-
-if (localStorage.hiddenboards === undefined) {
- localStorage.hiddenboards = "{}";
-}
-
-// Load data from HTML5 localStorage
-var hiddenboards = JSON.parse(localStorage.hiddenboards);
-
-var storeboards = function() {
- localStorage.hiddenboards = JSON.stringify(hiddenboards);
-};
-
-$(document).ready(function() {
- var addukkohide = function() {
- var ukkohide = $('');
- var board = $(this).next().data("board");
- var hr = $("
");
-
- $(this).append(ukkohide);
- $(this).append(hr);
-
- if (hiddenboards[board] !== true) {
- ukkohide.html(_("(hide threads from this board)"));
- hr.hide();
- }
- else {
- ukkohide.html(_("(show threads from this board)"));
- $(this).next().hide();
- }
- ukkohide.click(function() {
- hiddenboards[board] = (hiddenboards[board] !== true);
- if (hiddenboards[board] !== true) {
- $('[data-board="'+board+'"]:not([data-cached="yes"])').show().prev().
- find('.ukkohide').html(_("(hide threads from this board)")).
- parent().find('hr').hide();
- }
- else {
- $('[data-board="'+board+'"]:not([data-cached="yes"])').hide().prev().
- find('.ukkohide').html(_("(show threads from this board)"))
- .parent().find('hr').show();
- }
- storeboards();
- return false;
- });
-
- };
- $("h2").each(addukkohide);
-
- $('.pages').hide();
- var loadnext = function() {
- if (overflow.length == 0) {
- $('.pages').show().html(_("No more threads to display"));
- }
- while($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading && overflow.length > 0) {
- var page = modRoot + overflow[0].board + '/' + overflow[0].page;
- thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"]');
- if (thread.length > 0 && thread.attr("data-cached") !== 'yes') { // already present
- overflow.shift();
- continue;
- }
-
- var boardheader = $('');
-
- if($.inArray(page, cache) != -1) {
- if (thread.length > 0) {
- $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).attr("data-cached", "no").css('display', 'block'));
- boardheader.insertBefore(thread);
- addukkohide.call(boardheader);
- $(document).trigger('new_post', thread);
- }
- overflow.shift();
- } else {
- loading = true;
- $('.pages').show().html(_("Loading..."));
- $.get(page, function(data) {
- cache.push(page);
-
- $(data).find('div[id*="thread_"]').each(function() {
- var checkout = $(this).attr('id').replace('thread_', '');
- if ($('div#thread_' + checkout + '[data-board="' + overflow[0].board + '"]').length == 0) {
- $('form[name="postcontrols"]').prepend($(this).css('display', 'none').attr("data-cached", "yes").attr('data-board', overflow[0].board));
- }
- });
-
- thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"][data-cached="yes"]');
-
- if(thread.length > 0) {
- $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).attr("data-cached", "no").css('display', 'block'));
- boardheader.insertBefore(thread);
- addukkohide.call(boardheader);
- $(document).trigger('new_post', thread);
- }
- overflow.shift();
-
- loading = false;
- $('.pages').hide().html("");
- });
- break;
- }
- }
- clearTimeout(ukkotimer);
- ukkotimer = setTimeout(loadnext, 1000);
- };
-
- $(window).on('scroll', loadnext);
-
- ukkotimer = setTimeout(loadnext, 1000);
-});
-
-})();