diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/banned.html | 4 | ||||
| -rw-r--r-- | templates/index.html | 3 | ||||
| -rw-r--r-- | templates/main.js | 7 | ||||
| -rw-r--r-- | templates/mod/dashboard.html | 3 | ||||
| -rw-r--r-- | templates/mod/recent_posts.html | 6 | ||||
| -rw-r--r-- | templates/post/file_controls.html | 10 | ||||
| -rw-r--r-- | templates/post/fileinfo.html | 38 | ||||
| -rw-r--r-- | templates/post/image_identification.html | 14 | ||||
| -rw-r--r-- | templates/post/post_controls.html | 57 | ||||
| -rw-r--r-- | templates/post_reply.html | 36 | ||||
| -rw-r--r-- | templates/post_thread.html | 36 | ||||
| -rw-r--r-- | templates/posts.sql | 12 | ||||
| -rw-r--r-- | templates/report_delete.html | 2 | ||||
| -rw-r--r-- | templates/themes/catalog/catalog.html | 71 | ||||
| -rw-r--r-- | templates/themes/catalog/info.php | 11 | ||||
| -rw-r--r-- | templates/themes/catalog/theme.php | 15 | ||||
| -rw-r--r-- | templates/themes/recent/theme.php | 12 | ||||
| -rw-r--r-- | templates/themes/ukko/theme.php | 4 |
18 files changed, 228 insertions, 113 deletions
diff --git a/templates/banned.html b/templates/banned.html index 1a9a3915..33f9d9f8 100644 --- a/templates/banned.html +++ b/templates/banned.html @@ -83,7 +83,7 @@ {% if post and config.ban_show_post %} <hr> - <p>{% trans %}You were banned for the following post on {% endtrans %}{{ board.url }}:</p> + <p>{% trans %}You were banned for the following post on{% endtrans %} {{ board.url }}:</p> {{ post }} <br> {% endif %} @@ -133,4 +133,4 @@ {% endif %} {% endif %} </div> -{% endfilter %}
\ No newline at end of file +{% endfilter %} diff --git a/templates/index.html b/templates/index.html index 530247f7..52328675 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,9 +4,6 @@ <meta charset="utf-8"> <script type="text/javascript"> - {% if config.quick_reply %} - var new_reply_string = "{{ config.button_reply }}"; - {% endif %} {% if not no_post_form %} var active_page = "index"; {% else %} diff --git a/templates/main.js b/templates/main.js index 7796565c..231b8043 100644 --- a/templates/main.js +++ b/templates/main.js @@ -264,10 +264,14 @@ var script_settings = function(script_name) { function init() { init_stylechooser(); - + + {% endraw %} + {% if config.allow_delete %} if (document.forms.postcontrols) { document.forms.postcontrols.password.value = localStorage.password; } + {% endif %} + {% raw %} if (window.location.hash.indexOf('q') != 1 && window.location.hash.substring(1)) highlightReply(window.location.hash.substring(1)); @@ -291,6 +295,7 @@ function ready() { {% endraw %} var post_date = "{{ config.post_date }}"; +var max_images = {{ config.max_images }}; onready(init); diff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html index 7b907533..2c370a11 100644 --- a/templates/mod/dashboard.html +++ b/templates/mod/dashboard.html @@ -100,6 +100,9 @@ {% if mod|hasPermission(config.mod.modlog) %} <li><a href="?/log">{% trans 'Moderation log' %}</a></li> {% endif %} + {% if mod|hasPermission(config.mod.recent) %} + <li><a href="?/recent/25">{% trans 'Recent posts' %}</a></li> + {% endif %} {% if mod|hasPermission(config.mod.rebuild) %} <li><a href="?/rebuild">{% trans 'Rebuild' %}</a></li> {% endif %} diff --git a/templates/mod/recent_posts.html b/templates/mod/recent_posts.html new file mode 100644 index 00000000..4a2f9baa --- /dev/null +++ b/templates/mod/recent_posts.html @@ -0,0 +1,6 @@ +<script src="{{ config.additional_javascript_url }}js/mod/recent_posts.js"></script>
+{% if posts|count %}
+ <p style="text-align:center" class="unimportant">({% trans 'There are no active posts.' %})</p>
+{% else %}
+
+{% endif %}
diff --git a/templates/post/file_controls.html b/templates/post/file_controls.html new file mode 100644 index 00000000..6855a293 --- /dev/null +++ b/templates/post/file_controls.html @@ -0,0 +1,10 @@ +{% if post.files and mod %} +<span class="controls"> +{% if file.file != 'deleted' and mod|hasPermission(config.mod.deletefile, board.uri) %} +{{ secure_link_confirm(config.mod.link_deletefile, 'Delete file'|trans, 'Are you sure you want to delete this file?'|trans, board.dir ~ 'deletefile/' ~ post.id ~ '/' ~ loop.index0 ) }} +{% endif %} +{% if file.file and file.file != 'deleted' and file.thumb != 'spoiler' and mod|hasPermission(config.mod.spoilerimage, board.uri) %} +{{ secure_link_confirm(config.mod.link_spoilerimage, 'Spoiler file'|trans, 'Are you sure you want to spoiler this file?'|trans, board.dir ~ 'spoiler/' ~ post.id ~ '/' ~ loop.index0 ) }} +{% endif %} +</span> +{% endif %} diff --git a/templates/post/fileinfo.html b/templates/post/fileinfo.html new file mode 100644 index 00000000..f862f59d --- /dev/null +++ b/templates/post/fileinfo.html @@ -0,0 +1,38 @@ + {% if post.embed %} + {{ post.embed }} + {% else %} + <div class="files"> + {% for file in post.files %} + <div class="file{% if post.num_files > 1 %} multifile" style="width:{{ file.thumbwidth + 40 }}px"{% else %}"{% endif %}> + {% if file.file == 'deleted' %} + <img class="post-image deleted" src="{{ config.image_deleted }}" alt="" /> + {% else %} + <p class="fileinfo">File: <a href="{{ config.uri_img }}{{ file.file }}">{{ file.file }}</a> <span class="unimportant"> + ( + {% if file.thumb == 'spoiler' %} + {% trans %}Spoiler Image{% endtrans %}, + {% endif %} + {{ file.size|filesize }} + {% if file.width and file.height %} + , {{ file.width}}x{{ file.height }} + {% if config.show_ratio %} + , {{ ratio(file.width, file.height) }} + {% endif %} + {% endif %} + {% if config.show_filename and file.filename %} + , + {% if file.filename|length > config.max_filename_display %} + <span class="postfilename" title="{{ file.filename|e }}">{{ file.filename|truncate_filename(config.max_filename_display)|bidi_cleanup }}</span> + {% else %} + <span class="postfilename">{{ file.filename|e|bidi_cleanup }}</span> + {% endif %} + {% endif %} + {% include "post/image_identification.html" %} + ) + </span> {% include "post/file_controls.html" %}</p> + {% include "post/image.html" with {'post':file} %} + {% endif %} +</div> + {% endfor %} +</div> + {% endif %} diff --git a/templates/post/image_identification.html b/templates/post/image_identification.html index 3d3bd655..4f3f593a 100644 --- a/templates/post/image_identification.html +++ b/templates/post/image_identification.html @@ -1,10 +1,14 @@ -{% if post.thumb != 'file' and config.image_identification %} +{% if file.thumb != 'file' and config.image_identification %} , <span class='image_id'> - <a href="http://imgops.com/{{ config.domain }}{{ config.uri_img }}{{ post.file }}">io</a> - {% if post.file|extension == 'jpg' %} - <a href="http://regex.info/exif.cgi?url={{ config.domain }}{{ config.uri_img }}{{ post.file }}">e</a> + {% if config.image_identification_imgops %} + <a href="http://imgops.com/{{ config.domain }}{{ config.uri_img }}{{ file.file }}">io</a> + {% endif %} + {% if config.image_identification_exif and file.file|extension == 'jpg' %} + <a href="http://regex.info/exif.cgi?url={{ config.domain }}{{ config.uri_img }}{{ file.file }}">e</a> + {% endif %} + {% if config.image_identification_google %} + <a href="http://www.google.com/searchbyimage?image_url={{ config.domain }}{{ config.uri_img }}{{ file.file }}">g</a> {% endif %} - <a href="http://www.google.com/searchbyimage?image_url={{ config.domain }}{{ config.uri_img }}{{ post.file }}">g</a> </span> {% endif %} diff --git a/templates/post/post_controls.html b/templates/post/post_controls.html new file mode 100644 index 00000000..99a8484c --- /dev/null +++ b/templates/post/post_controls.html @@ -0,0 +1,57 @@ +{% if mod %} + +<span class="controls {% if not post.thread %}op{% endif %}"> +{% if mod|hasPermission(config.mod.delete, board.uri) %} + {{ secure_link_confirm(config.mod.link_delete, 'Delete'|trans, 'Are you sure you want to delete this?'|trans, board.dir ~ 'delete/' ~ post.id) }} +{% endif %} +{% if mod|hasPermission(config.mod.deletebyip, board.uri) %} + {{ secure_link_confirm(config.mod.link_deletebyip, 'Delete all posts by IP'|trans, 'Are you sure you want to delete all posts by this IP address?'|trans, board.dir ~ 'deletebyip/' ~ post.id) }} +{% endif %} +{% if mod|hasPermission(config.mod.deletebyip_global, board.uri) %} + {{ secure_link_confirm(config.mod.link_deletebyip_global, 'Delete all posts by IP across all boards'|trans, 'Are you sure you want to delete all posts by this IP address, across all boards?'|trans, board.dir ~ 'deletebyip/' ~ post.id ~ '/global') }} +{% endif %} +{% if mod|hasPermission(config.mod.ban, board.uri) %} + <a title="{% trans %}Ban{% endtrans %}" href="?/{{ board.dir }}ban/{{ post.id }}">{{ config.mod.link_ban }}</a> +{% endif %} +{% if mod|hasPermission(config.mod.bandelete, board.uri) %} + <a title="{% trans %}Ban & Delete{% endtrans %}" href="?/{{ board.dir }}ban&delete/{{ post.id }}">{{ config.mod.link_bandelete }}</a> +{% endif %} + +{% if not post.thread %} +{% if mod|hasPermission(config.mod.sticky, board.uri) %} + {% if post.sticky %} + <a title="{% trans %}Make thread not sticky{% endtrans %}" href="?/{{ secure_link(board.dir ~ 'unsticky/' ~ post.id) }}">{{ config.mod.link_desticky }}</a> + {% else %} + <a title="{% trans %}Make thread sticky{% endtrans %}" href="?/{{ secure_link(board.dir ~ 'sticky/' ~ post.id) }}">{{ config.mod.link_sticky }}</a> + {% endif %} +{% endif %} +{% if mod|hasPermission(config.mod.bumplock, board.uri) %} + {% if post.sage %} + <a title="{% trans %}Allow thread to be bumped{% endtrans %}" href="?/{{ secure_link(board.dir ~ 'bumpunlock/' ~ post.id) }}">{{ config.mod.link_bumpunlock }}</a> + {% else %} + <a title="{% trans %}Prevent thread from being bumped{% endtrans %}" href="?/{{ secure_link(board.dir ~ 'bumplock/' ~ post.id) }}">{{ config.mod.link_bumplock }}</a> + {% endif %} +{% endif %} +{% if mod|hasPermission(config.mod.lock, board.uri) %} + {% if post.locked %} + <a title="{% trans %}Unlock thread{% endtrans %}" href="?/{{ secure_link(board.dir ~ 'unlock/' ~ post.id) }}">{{ config.mod.link_unlock }}</a> + {% else %} + <a title="{% trans %}Lock thread{% endtrans %}" href="?/{{ secure_link(board.dir ~ 'lock/' ~ post.id) }}">{{ config.mod.link_lock }}</a> + {% endif %} +{% endif %} + +{% endif %} + +{% if mod|hasPermission(config.mod.move, board.uri) %} + {% if not post.thread %} + <a title="{% trans %}Move thread to another board{% endtrans %}" href="?/{{ board.dir }}move/{{ post.id }}">{{ config.mod.link_move }}</a> + {% else %} + <a title="{% trans %}Move reply to another board{% endtrans %}" href="?/{{ board.dir }}move_reply/{{ post.id }}">{{ config.mod.link_move }}</a> + {% endif %} +{% endif %} +{% if mod|hasPermission(config.mod.editpost, board.uri) %} + <a title="{% trans %}Edit post{% endtrans %}" href="?/{{ board.dir }}edit{% if config.mod.raw_html_default %}_raw{% endif %}/{{ post.id }}">{{ config.mod.link_editpost }}</a> +{% endif %} +</span> + +{% endif %} diff --git a/templates/post_reply.html b/templates/post_reply.html index 90ac5065..8ef3c1e8 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -1,7 +1,6 @@ {% filter remove_whitespace %} {# tabs and new lines will be ignored #} <div class="post reply" id="reply_{{ post.id }}"> - <p class="intro"{% if not index %} id="{{ post.id }}"{% endif %}> <input type="checkbox" class="delete" name="delete_{{ post.id }}" id="delete_{{ post.id }}" /> <label for="delete_{{ post.id }}"> @@ -18,38 +17,9 @@ {{ post.id }} </a> </p> - {% if post.embed %} - {{ post.embed }} - {% elseif post.file == 'deleted' %} - <img class="post-image deleted" src="{{ config.image_deleted }}" alt="" /> - {% elseif post.file and post.file %} - <p class="fileinfo">File: <a href="{{ config.uri_img }}{{ post.file }}">{{ post.file }}</a> <span class="unimportant"> - ( - {% if post.thumb == 'spoiler' %} - {% trans %}Spoiler Image{% endtrans %}, - {% endif %} - {{ post.filesize|filesize }} - {% if post.filewidth and post.fileheight %} - , {{ post.filewidth}}x{{ post.fileheight }} - {% if config.show_ratio %} - , {{ post.ratio }} - {% endif %} - {% endif %} - {% if config.show_filename and post.filename %} - , - {% if post.filename|length > config.max_filename_display %} - <span class="postfilename" title="{{ post.filename|e }}">{{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }}</span> - {% else %} - <span class="postfilename">{{ post.filename|e|bidi_cleanup }}</span> - {% endif %} - {% endif %} - {% include "post/image_identification.html" %} - ) - </span></p> - {% include "post/image.html" %} - {% endif %} - {{ post.postControls }} - <div class="body"> + {% include 'post/fileinfo.html' %} + {% include 'post/post_controls.html' %} + <div class="body" {% if post.files|length > 1 %}style="clear:both"{% endif %}> {% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %} {% if post.modifiers['ban message'] %} {{ config.mod.ban_message|sprintf(post.modifiers['ban message']) }} diff --git a/templates/post_thread.html b/templates/post_thread.html index f74427e4..335c1713 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -2,38 +2,8 @@ {# tabs and new lines will be ignored #} <div id="thread_{{ post.id }}" data-board="{{ board.uri }}"> - -{% if post.embed %} - {{ post.embed }} -{% elseif post.file == 'deleted' %} - <img class="post-image deleted" src="{{ config.image_deleted }}" alt="" /> -{% elseif post.file and post.file %} - <p class="fileinfo">{% trans %}File:{% endtrans %} <a href="{{ config.uri_img }}{{ post.file }}">{{ post.file }}</a> <span class="unimportant"> - ( - {% if post.thumb == 'spoiler' %} - {% trans %}Spoiler Image{% endtrans %}, - {% endif %} - {{ post.filesize|filesize }} - {% if post.filewidth and post.fileheight %} - , {{ post.filewidth}}x{{ post.fileheight }} - {% if config.show_ratio %} - , {{ post.ratio }} - {% endif %} - {% endif %} - {% if config.show_filename and post.filename %} - , - {% if post.filename|length > config.max_filename_display %} - <span class="postfilename" title="{{ post.filename|e }}">{{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }}</span> - {% else %} - <span class="postfilename">{{ post.filename|e|bidi_cleanup }}</span> - {% endif %} - {% endif %} - {% include "post/image_identification.html" %} - ) - </span></p> - {% include "post/image.html" %} -{% endif %} -<div class="post op"><p class="intro"{% if not index %} id="{{ post.id }}"{% endif %}> +{% include 'post/fileinfo.html' %} +<div class="post op" {%if post.num_files > 1%}style='clear:both'{%endif%}><p class="intro"{% if not index %} id="{{ post.id }}"{% endif %}> <input type="checkbox" class="delete" name="delete_{{ post.id }}" id="delete_{{ post.id }}" /> <label for="delete_{{ post.id }}"> {% include 'post/subject.html' %} @@ -78,7 +48,7 @@ {% set lastcount = config.noko50_count %} <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ config.file_page50|sprintf(post.id) }}">[{% trans %}Last 1 Post{% plural lastcount %}Last {{ count }} Posts{% endtrans %}]</a> {% endif %} - {{ post.postControls }} + {% include 'post/post_controls.html' %} </p> <div class="body"> {% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %} diff --git a/templates/posts.sql b/templates/posts.sql index c1f491f2..9a47c6ad 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -10,14 +10,8 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` ( `body_nomarkup` text, `time` int(11) NOT NULL, `bump` int(11) DEFAULT NULL, - `thumb` varchar(255) DEFAULT NULL, - `thumbwidth` int(11) DEFAULT NULL, - `thumbheight` int(11) DEFAULT NULL, - `file` varchar(255) DEFAULT NULL, - `filewidth` int(11) DEFAULT NULL, - `fileheight` int(11) DEFAULT NULL, - `filesize` int(11) DEFAULT NULL, - `filename` text, + `files` text DEFAULT NULL, + `num_files` int(11) DEFAULT 0, `filehash` text CHARACTER SET ascii, `password` varchar(20) DEFAULT NULL, `ip` varchar(39) CHARACTER SET ascii NOT NULL, @@ -32,4 +26,4 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` ( KEY `ip` (`ip`), KEY `list_threads` (`thread`, `sticky`, `bump`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; -
\ No newline at end of file + diff --git a/templates/report_delete.html b/templates/report_delete.html index 07221120..2fcb7259 100644 --- a/templates/report_delete.html +++ b/templates/report_delete.html @@ -1,9 +1,11 @@ +{% if config.allow_delete %} <div class="delete"> {% trans %}Delete Post{% endtrans %} [<input title="Delete file only" type="checkbox" name="file" id="delete_file" /> <label for="delete_file">{% trans %}File{% endtrans %}</label>] <label for="password">{% trans %}Password{% endtrans %}</label> <input id="password" type="password" name="password" size="12" maxlength="18" /> <input type="submit" name="delete" value="{% trans %}Delete{% endtrans %}" /> </div> +{% endif %} <div class="delete" style="clear:both"> <label for="reason">{% trans %}Reason{% endtrans %}</label> <input id="reason" type="text" name="reason" size="20" maxlength="30" /> diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index c69eb7f7..2b8649e4 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -5,6 +5,12 @@ <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <script type='text/javascript'> active_page = "catalog"; + + {% if settings.use_tooltipster %} + var use_tooltipster = true; + {% else %} + var use_tooltipster = false; + {% endif %} </script> {% include 'header.html' %} <title>{{ settings.title }}</title> @@ -15,24 +21,53 @@ <h1>{{ settings.title }} (<a href="{{link}}">/{{ board }}/</a>)</h1> <div class="subtitle">{{ settings.subtitle }}</div> </header> - <hr/> - <ul> - {% for post in recent_posts %} - <div class="thread"> - <a href="{{post.link}}"> - {% if post.youtube %} - <img src="http://img.youtube.com/vi/{{ post.youtube }}/0.jpg" class="{{post.board}}" title="{{post.bump|date('%b %d %H:%M')}}"> - {% elseif post.file %} - <img src="{{post.file}}" class="{{post.board}}" title="{{post.bump|date('%b %d %H:%M')}}"> - {% endif %} - <span class="replies"> - <strong>{% trans %}1 reply{% plural post.reply_count %}{{ count }} replies{% endtrans %}</strong><br/> - {{ post.body }} - </span> - </a> - </div> - {% endfor %} - </ul> + + <ul style="display: none"> + <li id="sort-bump-order" class="sort" data-sort="data-bump" data-order="asc">{% trans 'Bump order' %}</li> + <li id="sort-last-reply" class="sort" data-sort="data-lastreply" data-order="asc">{% trans 'Last reply' %}</li> + <li id="sort-creation-date" class="sort" data-sort="data-time" data-order="asc">{% trans 'Creation date' %}</li> + <li id="sort-reply-count" class="sort" data-sort="data-reply" data-order="asc">{% trans 'Reply count' %}</li> + <li id="sort-random" class="sort" data-sort="random">{% trans 'Random' %}</li> + </ul> + + <span>{% trans 'Sort by' %}: </span> + <select id="selectorzilla" style="display: inline-block"> + <option selected value="bump-order">{% trans 'Bump order' %}</option> + <option value="last-reply">{% trans 'Last reply' %}</option> + <option value="creation-date">{% trans 'Creation date' %}</option> + <option value="reply-count">{% trans 'Reply count' %}</option> + <option value="random">{% trans 'Random' %}</option> + </select> + + <span>{% trans 'Image size' %}: </span> + <select id="imgurzilla" style="display: inline-block"> + <option selected value="small">{% trans 'Small' %}</option> + <option value="large">{% trans 'Large' %}</option> + </select> + <div class="threads"> + <ul id="Grid"> + {% for post in recent_posts %} + <li class="mix" data-reply="{{ post.reply_count }}" data-bump="{{ post.bump }}" data-lastreply="{{ post.last_reply }}" 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 }}{% endif %}" data-name="{{ post.name }}" data-muhdifference="{{ post.muhdifference }}" data-last-reply="{% if post.last_reply %}{{ post.last_reply }}{% endif %}" data-last-subject="{% if post.last_reply_subject %}{{ post.last_reply_subject }}{% endif %}" data-last-name="{% if post.last_reply %}{{ post.last_reply_name }}{% endif %}" data-last-difference="{% if post.last_reply %}{{ post.last_reply_difference }}{% endif %}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}"> + </a> + <p> + <span class="replies"> + <strong>R: {{ post.reply_count }} / I: {{ post.image_count }}</strong><br/> + {{ post.body }} + </span> + </p> + </div> + </li> + {% endfor %} + </ul> + </div> <hr/> <footer> diff --git a/templates/themes/catalog/info.php b/templates/themes/catalog/info.php index 32695b4d..c20a0ca3 100644 --- a/templates/themes/catalog/info.php +++ b/templates/themes/catalog/info.php @@ -5,7 +5,7 @@ $theme['name'] = 'Catalog'; // Description (you can use Tinyboard markup here) $theme['description'] = 'Show a post catalog.'; - $theme['version'] = 'v0.1'; + $theme['version'] = 'v0.2'; // Theme configuration $theme['config'] = Array(); @@ -38,5 +38,14 @@ 'comment' => 'Without this checked, the catalog only updates on new threads.' ); + $theme['config'][] = Array( + 'title' => 'Use tooltipster', + 'name' => 'use_tooltipster', + 'type' => 'checkbox', + 'default' => true, + 'comment' => 'Check this if you wish to show a nice tooltip with info about the thread on mouse over.' + ); + + // Unique function name for building everything $theme['build_function'] = 'catalog_build'; diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 5d391536..cf2095d0 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -35,17 +35,28 @@ $recent_posts = array(); $stats = array(); - $query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error()); + $query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id` AND `filehash` IS NOT NULL) AS `image_count`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply`, (SELECT `name` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply_name`, (SELECT `subject` FROM ``posts_%s`` WHERE `thread` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `last_reply_subject`, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $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['board_name'] = $board['name']; - $post['file'] = $config['uri_thumb'] . $post['thumb']; 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'])) + $files = json_decode($post['files']); + if ($files[0]->file == 'deleted') continue; + $post['file'] = $config['uri_thumb'] . $files[0]->thumb; + + if ($settings['use_tooltipster']) { + $post['muhdifference'] = ago(time() - $post['time']); + + if ($post['last_reply']) + $post['last_reply_difference'] = ago(time() - $post['last_reply']); + } + $recent_posts[] = $post; } diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php index 26a9a69b..842ab9ac 100644 --- a/templates/themes/recent/theme.php +++ b/templates/themes/recent/theme.php @@ -42,7 +42,7 @@ foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; - $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `file` IS NOT NULL AND `file` != 'deleted' AND `thumb` != 'spoiler' UNION ALL ", $_board['uri'], $_board['uri']); + $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `files` IS NOT NULL UNION ALL ", $_board['uri'], $_board['uri']); } $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_images'], $query); @@ -54,10 +54,14 @@ while ($post = $query->fetch(PDO::FETCH_ASSOC)) { openBoard($post['board']); + if (isset($post['files'])) + $files = json_decode($post['files']); + + if ($files[0]->file == 'deleted') continue; // board settings won't be available in the template file, so generate links now $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id']; - $post['src'] = $config['uri_thumb'] . $post['thumb']; + if ($files) $post['src'] = $config['uri_thumb'] . $files[0]->thumb; $recent_images[] = $post; } @@ -105,7 +109,7 @@ $stats['unique_posters'] = number_format($query->fetchColumn()); // Active content - $query = 'SELECT SUM(`filesize`) FROM ('; + /*$query = 'SELECT SUM(`filesize`) FROM ('; foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; @@ -113,7 +117,7 @@ } $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); $query = query($query) or error(db_error()); - $stats['active_content'] = $query->fetchColumn(); + $stats['active_content'] = $query->fetchColumn();*/ return Element('themes/recent/recent.html', Array( 'settings' => $settings, diff --git a/templates/themes/ukko/theme.php b/templates/themes/ukko/theme.php index 37ecf208..b2624ed7 100644 --- a/templates/themes/ukko/theme.php +++ b/templates/themes/ukko/theme.php @@ -53,14 +53,14 @@ $num_images = 0; while ($po = $posts->fetch()) { - if ($po['file']) + if ($po['files']) $num_images++; $thread->add(new Post($po, $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 = 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)); |
