From 64ae123739c39567447bfc16fc95deb556786671 Mon Sep 17 00:00:00 2001 From: Michael Save Date: Sat, 16 Mar 2013 18:27:24 +1100 Subject: Mod log in ?/IP (ie. ban history) --- templates/mod/view_ip.html | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'templates') diff --git a/templates/mod/view_ip.html b/templates/mod/view_ip.html index c49880ae..562a0140 100644 --- a/templates/mod/view_ip.html +++ b/templates/mod/view_ip.html @@ -161,3 +161,43 @@ {% include 'mod/ban_form.html' %} {% endif %} + +{% if logs|count > 0 %} +
+ History + + + + + + + + {% for log in logs %} + + + + + + + {% endfor %} +
{% trans 'Staff' %}{% trans 'Time' %}{% trans 'Board' %}{% trans 'Action' %}
+ {% if log.username %} + {{ log.username|e }} + {% elseif log.mod == -1 %} + system + {% else %} + {% trans 'deleted?' %} + {% endif %} + + {{ log.time|ago }} + + {% if log.board %} + {{ config.board_abbreviation|sprintf(log.board) }} + {% else %} + - + {% endif %} + + {{ log.text }} +
+
+{% endif %} -- cgit v1.3 From 9c29cec6598331589a9020e5be627260e659e977 Mon Sep 17 00:00:00 2001 From: czaks Date: Sun, 26 May 2013 18:03:20 -0400 Subject: Moved ukko to a proper location --- info.php | 53 ------------------- templates/themes/ukko/info.php | 53 +++++++++++++++++++ templates/themes/ukko/theme.php | 111 ++++++++++++++++++++++++++++++++++++++++ templates/themes/ukko/thumb.png | Bin 0 -> 15123 bytes templates/themes/ukko/ukko.js | 37 ++++++++++++++ theme.php | 111 ---------------------------------------- thumb.png | Bin 15123 -> 0 bytes ukko.js | 37 -------------- 8 files changed, 201 insertions(+), 201 deletions(-) delete mode 100644 info.php create mode 100644 templates/themes/ukko/info.php create mode 100644 templates/themes/ukko/theme.php create mode 100644 templates/themes/ukko/thumb.png create mode 100644 templates/themes/ukko/ukko.js delete mode 100644 theme.php delete mode 100644 thumb.png delete mode 100644 ukko.js (limited to 'templates') diff --git a/info.php b/info.php deleted file mode 100644 index 34d59d4e..00000000 --- a/info.php +++ /dev/null @@ -1,53 +0,0 @@ - 'Board name', - 'name' => 'title', - 'type' => 'text', - 'default' => 'Ukko' - ); - $theme['config'][] = Array( - 'title' => 'Board URI', - 'name' => 'uri', - 'type' => 'text', - '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); - } - } - diff --git a/templates/themes/ukko/info.php b/templates/themes/ukko/info.php new file mode 100644 index 00000000..34d59d4e --- /dev/null +++ b/templates/themes/ukko/info.php @@ -0,0 +1,53 @@ + 'Board name', + 'name' => 'title', + 'type' => 'text', + 'default' => 'Ukko' + ); + $theme['config'][] = Array( + 'title' => 'Board URI', + 'name' => 'uri', + 'type' => 'text', + '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); + } + } + diff --git a/templates/themes/ukko/theme.php b/templates/themes/ukko/theme.php new file mode 100644 index 00000000..6fa5fa7e --- /dev/null +++ b/templates/themes/ukko/theme.php @@ -0,0 +1,111 @@ +settings = $settings; + $ukko->build(); + } + + class ukko { + public $settings; + public function build($mod = false) { + global $config; + $boards = listBoards(); + + $body = ''; + $overflow = array(); + $board = array( + 'url' => $this->settings['uri'], + 'name' => $this->settings['title'], + 'title' => sprintf($this->settings['subtitle'], $this->settings['thread_limit']) + ); + + $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']); + } + $query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query); + $query = query($query) or error(db_error()); + + $count = 0; + $threads = 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['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], + $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], + $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], $mod ? '?/' : $config['root'], $mod + ); + + $posts = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `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['file']) + $num_images++; + + $thread->add(new Post( + $po['id'], $post['id'], $po['subject'], $po['email'], $po['name'], $po['trip'], $po['capcode'], $po['body'], $po['time'], + $po['thumb'], $po['thumbwidth'], $po['thumbheight'], $po['file'], $po['filewidth'], $po['fileheight'], $po['filesize'], + $po['filename'], $po['ip'], $po['embed'], $mod ? '?/' : $config['root'], $mod) + ); + + } + 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 `file` 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 .= '

/' . $post['board'] . '/

'; + $body .= $thread->build(true); + } 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 .= ''; + + file_write($this->settings['uri'] . '/index.html', Element('index.html', array( + 'config' => $config, + 'board' => $board, + 'no_post_form' => true, + 'body' => $body, + 'boardlist' => createBoardlist($mod) + ))); + + file_write($this->settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array())); + } + + }; + +?> diff --git a/templates/themes/ukko/thumb.png b/templates/themes/ukko/thumb.png new file mode 100644 index 00000000..49c4237b Binary files /dev/null and b/templates/themes/ukko/thumb.png differ diff --git a/templates/themes/ukko/ukko.js b/templates/themes/ukko/ukko.js new file mode 100644 index 00000000..baf0f78d --- /dev/null +++ b/templates/themes/ukko/ukko.js @@ -0,0 +1,37 @@ +var cache = new Array(), + thread = false, + loading = false; +$(document).ready(function() { + $(window).on('scroll', function() { + if($(window).scrollTop() + $(window).height() + 100 > $(document).height() && !loading && overflow.length > 0) { + var page = '../' + overflow[0].board + '/' + overflow[0].page; + if($.inArray(page, cache) != -1) { + thread = $('div#thread_' + overflow[0].id); + if(thread.length > 0) { + thread.prepend('

/' + overflow[0].board + '/

'); + $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).css('display', 'block')); + overflow.shift(); + } + } else { + loading = true; + $.get(page, function(data) { + cache.push(page); + + $(data).find('div[id*="thread_"]').each(function() { + $('body').prepend($(this).css('display', 'none').attr('data-board', overflow[0].board)); + }); + + thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"]'); + if(thread.length > 0) { + thread.prepend('

/' + overflow[0].board + '/

'); + $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).css('display', 'block')); + overflow.shift(); + } + + loading = false; + }); + } + } + }); + +}); \ No newline at end of file diff --git a/theme.php b/theme.php deleted file mode 100644 index 6fa5fa7e..00000000 --- a/theme.php +++ /dev/null @@ -1,111 +0,0 @@ -settings = $settings; - $ukko->build(); - } - - class ukko { - public $settings; - public function build($mod = false) { - global $config; - $boards = listBoards(); - - $body = ''; - $overflow = array(); - $board = array( - 'url' => $this->settings['uri'], - 'name' => $this->settings['title'], - 'title' => sprintf($this->settings['subtitle'], $this->settings['thread_limit']) - ); - - $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']); - } - $query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query); - $query = query($query) or error(db_error()); - - $count = 0; - $threads = 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['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], - $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], - $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], $mod ? '?/' : $config['root'], $mod - ); - - $posts = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `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['file']) - $num_images++; - - $thread->add(new Post( - $po['id'], $post['id'], $po['subject'], $po['email'], $po['name'], $po['trip'], $po['capcode'], $po['body'], $po['time'], - $po['thumb'], $po['thumbwidth'], $po['thumbheight'], $po['file'], $po['filewidth'], $po['fileheight'], $po['filesize'], - $po['filename'], $po['ip'], $po['embed'], $mod ? '?/' : $config['root'], $mod) - ); - - } - 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 `file` 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 .= '

/' . $post['board'] . '/

'; - $body .= $thread->build(true); - } 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 .= ''; - - file_write($this->settings['uri'] . '/index.html', Element('index.html', array( - 'config' => $config, - 'board' => $board, - 'no_post_form' => true, - 'body' => $body, - 'boardlist' => createBoardlist($mod) - ))); - - file_write($this->settings['uri'] . '/ukko.js', Element('themes/ukko/ukko.js', array())); - } - - }; - -?> diff --git a/thumb.png b/thumb.png deleted file mode 100644 index 49c4237b..00000000 Binary files a/thumb.png and /dev/null differ diff --git a/ukko.js b/ukko.js deleted file mode 100644 index baf0f78d..00000000 --- a/ukko.js +++ /dev/null @@ -1,37 +0,0 @@ -var cache = new Array(), - thread = false, - loading = false; -$(document).ready(function() { - $(window).on('scroll', function() { - if($(window).scrollTop() + $(window).height() + 100 > $(document).height() && !loading && overflow.length > 0) { - var page = '../' + overflow[0].board + '/' + overflow[0].page; - if($.inArray(page, cache) != -1) { - thread = $('div#thread_' + overflow[0].id); - if(thread.length > 0) { - thread.prepend('

/' + overflow[0].board + '/

'); - $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).css('display', 'block')); - overflow.shift(); - } - } else { - loading = true; - $.get(page, function(data) { - cache.push(page); - - $(data).find('div[id*="thread_"]').each(function() { - $('body').prepend($(this).css('display', 'none').attr('data-board', overflow[0].board)); - }); - - thread = $('div#thread_' + overflow[0].id + '[data-board="' + overflow[0].board + '"]'); - if(thread.length > 0) { - thread.prepend('

/' + overflow[0].board + '/

'); - $('div[id*="thread_"]').last().after(thread.attr('data-board', overflow[0].board).css('display', 'block')); - overflow.shift(); - } - - loading = false; - }); - } - } - }); - -}); \ No newline at end of file -- cgit v1.3 From 0e490407e18679de2458647b891edaeb664a2f8f Mon Sep 17 00:00:00 2001 From: lanc33 Date: Wed, 29 May 2013 19:16:37 -0300 Subject: Fixes #59 by making quick-reply.js agnostic to the value of $config['button_reply']. --- js/quick-reply.js | 2 +- templates/index.html | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'templates') diff --git a/js/quick-reply.js b/js/quick-reply.js index dc48a743..bc36ca48 100644 --- a/js/quick-reply.js +++ b/js/quick-reply.js @@ -17,7 +17,7 @@ $(document).ready(function(){ return; // not index txt_new_topic = $('form[name=post] input[type=submit]').val(); - txt_new_reply = txt_new_topic == 'Submit' ? txt_new_topic : 'New Reply'; + txt_new_reply = txt_new_topic == 'Submit' ? txt_new_topic : new_reply_string; undo_quick_reply = function() { $('div.banner').remove(); diff --git a/templates/index.html b/templates/index.html index 761227ed..112756d1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,6 +10,11 @@ {% if config.default_stylesheet.1 != '' %}{% endif %} {% if not nojavascript %} + {% if config.quick_reply %} + + {% endif %} {% if not config.additional_javascript_compile %} {% for javascript in config.additional_javascript %}{% endfor %} {% endif %} -- cgit v1.3 From b85fc7d102bc17797f53858457b019f4934a03bc Mon Sep 17 00:00:00 2001 From: czaks Date: Fri, 14 Jun 2013 23:57:04 -0400 Subject: generic boardlist for overboard --- templates/boardlist.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 templates/boardlist.html (limited to 'templates') diff --git a/templates/boardlist.html b/templates/boardlist.html new file mode 100644 index 00000000..62646845 --- /dev/null +++ b/templates/boardlist.html @@ -0,0 +1 @@ +I'm your overboard boardlist. You can put here anything and I reside in templates/boardlist.html -- cgit v1.3 From 8b952fe97fc0ead62eb944e8aa62b71852d9adf5 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 15 Jun 2013 00:04:08 -0400 Subject: overboard: missed templates/index.html --- templates/index.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/index.html b/templates/index.html index eaed3666..059abc5e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -20,7 +20,11 @@ {% include 'attention_bar.html' %} - {% include 'post_form.html' %} + {% if not no_post_form %} + {% include 'post_form.html' %} + {% else %} + {% include 'boardlist.html' %} + {% endif %} {% if config.blotter %}
{{ config.blotter }}
{% endif %}
-- cgit v1.3 From ba424698e0f9e79da93b6c54573a67e12fa363e5 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 15 Jun 2013 00:22:13 -0400 Subject: header abstraction: abstracted also in thread.html --- templates/page.html | 2 +- templates/thread.html | 28 +--------------------------- 2 files changed, 2 insertions(+), 28 deletions(-) (limited to 'templates') diff --git a/templates/page.html b/templates/page.html index 6e7a8a18..07eea62e 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,8 +1,8 @@ - {% include 'header.html' %} + {% include 'header.html' %} {{ title }} diff --git a/templates/thread.html b/templates/thread.html index 0997f668..4e2a95a1 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -2,34 +2,8 @@ - - {% if config.url_favicon %}{% endif %} + {% include 'header.html' %} {{ board.url }} - {{ board.name }} - - {% if config.meta_keywords %}{% endif %} - {% if config.default_stylesheet.1 != '' %}{% endif %} - - {% if not nojavascript %} - - {% if not config.additional_javascript_compile %} - {% for javascript in config.additional_javascript %}{% endfor %} - {% endif %} - {% endif %} - {% if config.recaptcha %}{% endif %} {{ boardlist.top }} -- cgit v1.3 From a92bb182d91ae98b2a2bc7787d5650050868f1f1 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Tue, 2 Apr 2013 17:28:04 +0800 Subject: Fix display issues with RTL control characters in post names, subjects, and filenames. --- inc/display.php | 33 +++++++++++++++++++++++++ inc/lib/Twig/Extensions/Extension/Tinyboard.php | 1 + templates/post_reply.html | 8 +++--- templates/post_thread.html | 14 +++++------ 4 files changed, 45 insertions(+), 11 deletions(-) (limited to 'templates') diff --git a/inc/display.php b/inc/display.php index 57110224..ab96eb26 100644 --- a/inc/display.php +++ b/inc/display.php @@ -213,6 +213,39 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) { return $body; } +function bidi_cleanup($str){ + # Closes all embedded RTL and LTR unicode formatting blocks in a string so that + # it can be used inside another without controlling its direction. + # More info: http://www.iamcal.com/understanding-bidirectional-text/ + # + # LRE - U+202A - 0xE2 0x80 0xAA + # RLE - U+202B - 0xE2 0x80 0xAB + # LRO - U+202D - 0xE2 0x80 0xAD + # RLO - U+202E - 0xE2 0x80 0xAE + # + # PDF - U+202C - 0xE2 0x80 0xAC + # + $explicits = '\xE2\x80\xAA|\xE2\x80\xAB|\xE2\x80\xAD|\xE2\x80\xAE'; + $pdf = '\xE2\x80\xAC'; + + $stack = 0; + $str = preg_replace_callback("!(?$explicits)|(?$pdf)!", function($match) use (&$stack) { + if (isset($match['explicits']) && $match['explicits']) { + $stack++; + } else { + if ($stack) + $stack--; + else + return ''; + } + return $match[0]; + }, $str); + for ($i=0; $i<$stack; $i++){ + $str .= "\xE2\x80\xAC"; + } + return $str; +} + function secure_link_confirm($text, $title, $confirm_message, $href) { global $config; diff --git a/inc/lib/Twig/Extensions/Extension/Tinyboard.php b/inc/lib/Twig/Extensions/Extension/Tinyboard.php index 0a128e7b..7592d1b4 100644 --- a/inc/lib/Twig/Extensions/Extension/Tinyboard.php +++ b/inc/lib/Twig/Extensions/Extension/Tinyboard.php @@ -25,6 +25,7 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension 'until' => new Twig_Filter_Function('until'), 'split' => new Twig_Filter_Function('twig_split_filter'), 'push' => new Twig_Filter_Function('twig_push_filter'), + 'bidi_cleanup' => new Twig_Filter_Function('bidi_cleanup'), 'addslashes' => new Twig_Filter_Function('addslashes') ); } diff --git a/templates/post_reply.html b/templates/post_reply.html index ddd0afd4..c5735a0e 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -7,14 +7,14 @@