diff options
| author | Benjamin Southall <applemansigloo@gmail.com> | 2016-09-25 16:34:47 +0900 |
|---|---|---|
| committer | Benjamin Southall <applemansigloo@gmail.com> | 2016-09-25 16:34:47 +0900 |
| commit | a3b9c4405c6d4cca2a70dbb400e3ba3f65e7ea04 (patch) | |
| tree | 5a2ebdb801748586e3fde7c12cbeda169b2c3e31 /templates | |
| parent | 9436524a306c8e3d6d8a6ed195e2a3c56d5cde39 (diff) | |
| parent | a4b619ae5eaab5755dc215a496854dee8f7ce395 (diff) | |
Merged lainchan with vichan master at 25/9/2016 a4b619ae5eaab5755dc215a496854dee8f7ce395 @czaks czaks committed on GitHub 2 days ago
Diffstat (limited to 'templates')
35 files changed, 671 insertions, 117 deletions
diff --git a/templates/generic_page.html b/templates/generic_page.html index 3ff200f9..6d2f28c3 100644 --- a/templates/generic_page.html +++ b/templates/generic_page.html @@ -8,7 +8,7 @@ </head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> -<body> +<body class="8chan vichan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}"> {{ boardlist.top }} {% if pm %}<div class="top_notice">You have <a href="?/PM/{{ pm.id }}">an unread PM</a>{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.</div><hr />{% endif %} {% if config.url_banner %}<img class="banner" src="{{ config.url_banner }}" {% if config.banner_width or config.banner_height %}style="{% if config.banner_width %}width:{{ config.banner_width }}px{% endif %};{% if config.banner_width %}height:{{ config.banner_height }}px{% endif %}" {% endif %}alt="" />{% endif %} @@ -38,10 +38,10 @@ {% endfor %} {{ btn.next }}</div> {{ boardlist.bottom }} <footer> - <p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> + - <a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} - - <br><a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2014 Tinyboard Development Group - <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p> + <p class="unimportant" style="margin-top:20px;text-align:center;">- Tinyboard + + <a href="https://engine.vichan.net/">vichan</a> {{ config.version }} - + <br>Tinyboard Copyright © 2010-2014 Tinyboard Development Group + <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2016 vichan-devel</p> {% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %} </footer> <script type="text/javascript">{% raw %} diff --git a/templates/index.html b/templates/index.html index 2241b13c..52c7419b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,21 +5,23 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <script type="text/javascript"> + var {% if not no_post_form %} - var active_page = "index"; + active_page = "index" + , board_name = "{{ board.uri }}"; {% else %} - var active_page = "ukko"; + active_page = "ukko"; {% endif %} </script> {% include 'header.html' %} <title>{{ board.url }} - {{ board.title|e }}</title> </head> -<body> +<body class="8chan vichan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %} active-{% if not no_post_form %}index{% else %}ukko{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}"> <div class="bar top"> {{ boardlist.top }} </div> - + {% if pm %}<div class="top_notice">You have <a href="?/PM/{{ pm.id }}">an unread PM</a>{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.</div><hr />{% endif %} {% if config.url_banner %}<img class="board_image" src="{{ config.url_banner }}" {% if config.banner_width or config.banner_height %}style="{% if config.banner_width %}width:{{ config.banner_width }}px{% endif %};{% if config.banner_width %}height:{{ config.banner_height }}px{% endif %}" {% endif %}alt="" />{% endif %} @@ -69,6 +71,17 @@ {{ body }} {% include 'report_delete.html' %} </form> + + <div class="pages"> + {{ btn.prev }} {% for page in pages %} + [<a {% if page.selected %}class="selected"{% endif %}{% if not page.selected %}href="{{ page.link }}"{% endif %}>{{ page.num }}</a>]{% if loop.last %} {% endif %} + {% endfor %} {{ btn.next }} + {% if config.catalog_link %} + | <a href="{{ config.root }}{{ board.dir }}{{ config.catalog_link }}">{% trans %}Catalog{% endtrans %}</a> + {% endif %} + </div> + + {{ boardlist.bottom }} {{ config.ad.bottom }} diff --git a/templates/installer/config.html b/templates/installer/config.html index 193bb98b..973328f5 100644 --- a/templates/installer/config.html +++ b/templates/installer/config.html @@ -87,6 +87,9 @@ <legend>Miscellaneous</legend> <label for="secure_trip_salt">Secure trip (##) salt:</label> <input type="text" id="secure_trip_salt" name="secure_trip_salt" value="{{ config.secure_trip_salt }}" size="40"> + + <label for="more">Additional configuration:</label> + <textarea id="more" name="more">{{ more }}</textarea> </fieldset> <p style="text-align:center"> diff --git a/templates/main.js b/templates/main.js index 3e44ed2d..af665987 100755 --- a/templates/main.js +++ b/templates/main.js @@ -70,26 +70,40 @@ var datelocale = }; -function alert(a) { - var handler, div; - var close = function() { - handler.fadeOut(400, function() { handler.remove(); }); - return false; - }; +function alert(a, do_confirm, confirm_ok_action, confirm_cancel_action) { + var handler, div, bg, closebtn, okbtn; + var close = function() { + handler.fadeOut(400, function() { handler.remove(); }); + return false; + }; - handler = $("<div id='alert_handler'></div>").hide().appendTo('body'); + handler = $("<div id='alert_handler'></div>").hide().appendTo('body'); - $("<div id='alert_background'></div>").click(close).appendTo(handler); + bg = $("<div id='alert_background'></div>").appendTo(handler); - div = $("<div id='alert_div'></div>").appendTo(handler); - $("<a id='alert_close' href='javascript:void(0)'><i class='fa fa-times'></i></div>") - .click(close).appendTo(div); + div = $("<div id='alert_div'></div>").appendTo(handler); + closebtn = $("<a id='alert_close' href='javascript:void(0)'><i class='fa fa-times'></i></div>") + .appendTo(div); - $("<div id='alert_message'></div>").html(a).appendTo(div); + $("<div id='alert_message'></div>").html(a).appendTo(div); - $("<button class='button alert_button'>"+_("OK")+"</button>").click(close).appendTo(div); + okbtn = $("<button class='button alert_button'>"+_("OK")+"</button>").appendTo(div); - handler.fadeIn(400); + if (do_confirm) { + confirm_ok_action = (typeof confirm_ok_action !== "function") ? function(){} : confirm_ok_action; + confirm_cancel_action = (typeof confirm_cancel_action !== "function") ? function(){} : confirm_cancel_action; + okbtn.click(confirm_ok_action); + $("<button class='button alert_button'>"+_("Cancel")+"</button>").click(confirm_cancel_action).click(close).appendTo(div); + bg.click(confirm_cancel_action); + okbtn.click(confirm_cancel_action); + closebtn.click(confirm_cancel_action); + } + + bg.click(close); + okbtn.click(close); + closebtn.click(close); + + handler.fadeIn(400); } var saved = {}; @@ -106,7 +120,10 @@ var codestyles = { {% for stylesheet in code_stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}', {% endraw %}{% endfor %}{% raw %} }; -var board_name = false; + +if (typeof board_name === 'undefined') { + var board_name = false; +} function changeStyle(styleName, link) { {% endraw %} @@ -163,13 +180,7 @@ function changeStyle(styleName, link) { {% endraw %} {% if config.stylesheets_board %} - {# This is such an unacceptable mess. There needs to be an easier way. #} - {# Needs fix for slugify #} - var matches = document.URL.match(/\/(\w+)\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }})/); {% raw %} - if (matches) { - board_name = matches[1]; - } if (!localStorage.board_stylesheets) { localStorage.board_stylesheets = '{}'; diff --git a/templates/mod/ban_form.html b/templates/mod/ban_form.html index 911a8dcd..91281359 100644 --- a/templates/mod/ban_form.html +++ b/templates/mod/ban_form.html @@ -24,7 +24,7 @@ </th> <td> {% if not hide_ip %} - <input type="text" name="ip" id="ip" size="30" maxlength="40" value="{{ ip }}"> + <input type="text" name="ip" id="ip" size="30" maxlength="40" value="{{ ip|e }}"> {% else %} <em>{% trans 'hidden' %}</em> {% endif %} diff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html index 9e622c8c..706504ea 100644 --- a/templates/mod/dashboard.html +++ b/templates/mod/dashboard.html @@ -56,6 +56,127 @@ {% if mod|hasPermission(config.mod.edit_config) %} <li><a href="?/config">{% trans 'Configuration' %}</a></li> {% endif %} +======= +<fieldset> + <legend>{% trans 'Boards' %}</legend> + + <ul> + {% for board in boards %} + <li> + <a href="?/{{ config.board_path|sprintf(board.uri) }}{{ config.file_index }}">{{ config.board_abbreviation|sprintf(board.uri) }}</a> + - + {{ board.title|e }} + {% if board.subtitle %} + <small>— + {% if config.allow_subtitle_html %} + {{ board.subtitle }} + {% else %} + {{ board.subtitle|e }} + {% endif %} + </small> + {% endif %} + {% if mod|hasPermission(config.mod.manageboards) %} + <a href="?/edit/{{ board.uri }}"><small>[{% trans 'edit' %}]</small></a> + {% endif %} + {% if mod|hasPermission(config.mod.edit_pages) %} + <a href="?/edit_pages/{{ board.uri }}"><small>[{% trans 'pages' %}]</small></a> + {% endif %} + </li> + {% endfor %} + + {% if mod|hasPermission(config.mod.newboard) %} + <li style="margin-top:15px"><a href="?/new-board"><strong>{% trans 'Create new board' %}</strong></a></li> + {% endif %} + </ul> +</fieldset> + +<fieldset> + <legend>{% trans 'Messages' %}</legend> + <ul> + {% if mod|hasPermission(config.mod.noticeboard) %} + {% if noticeboard|count > 0 %} + <li> + {% trans 'Noticeboard' %}: + <ul> + {% for post in noticeboard %} + <li> + <a href="?/noticeboard#{{ post.id }}"> + {% if post.subject %} + {{ post.subject|e }} + {% else %} + <em>{% trans 'no subject' %}</em> + {% endif %} + </a> + <small class="unimportant"> + — by + {% if post.username %} + {{ post.username|e }} + {% else %} + <em>deleted?</em> + {% endif %} + at + {{ post.time|date(config.post_date) }} + </small> + </li> + {% endfor %} + </ul> + </li> + {% endif %} + <li><a href="?/noticeboard">{% trans 'View all noticeboard entries' %}</a></li> + {% endif %} + <li><a href="?/edit_news">{% trans 'News' %}</a></li> + <li> + <a href="?/inbox"> + {% trans 'PM inbox' %} + {% if unread_pms > 0 %}<strong>{%endif %}({{ unread_pms }} unread){% if unread_pms > 0 %}</strong>{%endif %} + </a> + </li> + </ul> +</fieldset> + +<fieldset> + <legend>{% trans 'Administration' %}</legend> + + <ul> + {% if mod|hasPermission(config.mod.reports) %} + <li> + {% if reports > 0 %}<strong>{% endif %} + <a href="?/reports">{% trans 'Report queue' %} ({{ reports }})</a> + {% if reports > 0 %}</strong>{% endif %} + </li> + {% endif %} + {% if mod|hasPermission(config.mod.view_banlist) %} + <li><a href="?/bans">{% trans 'Ban list' %}</a></li> + {% endif %} + {% if config.ban_appeals and mod|hasPermission(config.mod.view_ban_appeals) %} + <li><a href="?/ban-appeals">{% trans 'Ban appeals' %}</a></li> + {% endif %} + {% if mod|hasPermission(config.mod.manageusers) %} + <li><a href="?/users">{% trans 'Manage users' %}</a></li> + {% elseif mod|hasPermission(config.mod.change_password) %} + <li><a href="?/users/{{ mod.id }}">{% trans 'Change password' %}</a></li> + {% endif %} + {% if mod|hasPermission(config.mod.themes) %} + <li><a href="?/themes">{% trans 'Manage themes' %}</a></li> + {% endif %} + {% if mod|hasPermission(config.mod.modlog) %} + <li><a href="?/log">{% trans 'Moderation log' %}</a></li> + {% endif %} + {% if mod|hasPermission(config.mod.edit_pages) %} + <li><a href="?/edit_pages">{% trans 'Global static pages' %}</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 %} + {% if mod|hasPermission(config.mod.edit_config) %} + <li><a href="?/config">{% trans 'Configuration' %}</a></li> + {% endif %} + + </ul> +</fieldset> {% if mod|hasPermission(config.mod.search) %} diff --git a/templates/mod/edit_page.html b/templates/mod/edit_page.html new file mode 100644 index 00000000..3d132767 --- /dev/null +++ b/templates/mod/edit_page.html @@ -0,0 +1,29 @@ +<div style="text-align:center"> +<form method="POST"> + <input name="token" value="{{ token }}" type="hidden"> + <table> + <tr> + <th>{% trans %}Markup method{% endtrans %} + {% set allowed_html = config.allowed_html %} + {% trans %}<p class="unimportant">"markdown" is provided by <a href="http://parsedown.org/">parsedown</a>. Note: images disabled.</p> + <p class="unimportant">"html" allows the following tags:<br/>{{ allowed_html }}</p> + <p class="unimportant">"infinity" is the same as what is used in posts.</p> + <p class="unimportant">This page will not convert between formats,<br/>choose it once or do the conversion yourself!</p>{% endtrans %} + </th> + <td> + <select name="method"> + {% for markup in ['markdown', 'html', 'infinity'] %} + <option value="{{ markup }}" {% if page.type == markup %}selected{% endif %}>{{ markup }}</option> + {% endfor %} + </select> + </td></tr> + <tr><th>{% trans %}Page content{% endtrans %} + <br/> + <span class="unimportant">{% trans %}Page will appear at:{% endtrans %} + {% if board %} <a href="/{{ board.uri }}/{{ page.name }}.html">{{ config.domain }}/{{ board.uri }}/{{ page.name }}.html</a> + {% else %} <a href="/{{ page.name }}.html">{{ config.site }}/{{ page.name }}.html</a> + {% endif %}</span></th><td><textarea name="content" style="height:500px;width:500px">{{content}}</textarea></td><tr> + </table> + <input type="submit" value="Save page"> +</form> +</div> diff --git a/templates/mod/log.html b/templates/mod/log.html index 0aa3f110..a38b4af5 100644 --- a/templates/mod/log.html +++ b/templates/mod/log.html @@ -10,7 +10,15 @@ <tr> <td class="minimal"> {% if log.username %} - <a href="?/log:{{ log.username|e }}">{{ log.username|e }}</a> + {% if hide_names %} + <em>hidden</em> + {% else %} + {% if not mod|hasPermission(config.mod.modlog) %} + <a href="?/new_PM/{{ log.username|e }}">{{ log.username|e }}</a> + {% else %} + <a href="?/log:{{ log.username|e }}">{{ log.username|e }}</a> + {% endif %} + {% endif %} {% elseif log.mod == -1 %} <em>system</em> {% else %} @@ -44,7 +52,11 @@ {% if count > logs|count %} <p class="unimportant" style="text-align:center;word-wrap:break-word"> {% for i in range(0, (count - 1) / config.mod.modlog_page) %} - <a href="?/log{% if username %}:{{ username }}{% endif %}/{{ i + 1 }}">[{{ i + 1 }}]</a> + {% if public %} + <a href="?page={{ i + 1 }}&board={{ board|url_encode }}">[{{ i + 1 }}]</a> + {% else %} + <a href="?/log{% if username %}:{{ username }}{% elseif board %}:b:{{ board }}{% endif %}/{{ i + 1 }}">[{{ i + 1 }}]</a> + {% endif %} {% endfor %} </p> {% endif %} diff --git a/templates/mod/news.html b/templates/mod/news.html index 510d60ce..57058291 100644 --- a/templates/mod/news.html +++ b/templates/mod/news.html @@ -40,7 +40,7 @@ <div class="ban"> {% if mod|hasPermission(config.mod.news_delete) %} <span style="float:right;padding:2px"> - <a class="unimportant" href="?/news/delete/{{ post.id }}/{{ post.delete_token }}">[{% trans 'delete' %}]</a> + <a class="unimportant" href="?/edit_news/delete/{{ post.id }}/{{ post.delete_token }}">[{% trans 'delete' %}]</a> </span> {% endif %} <h2 id="{{ post.id }}"> diff --git a/templates/mod/pages.html b/templates/mod/pages.html new file mode 100644 index 00000000..c2395c02 --- /dev/null +++ b/templates/mod/pages.html @@ -0,0 +1,34 @@ +<script type="text/javascript" src="js/jquery.min.js"></script> +<div style="text-align:center"> +<p class="unimportant"> +{% if board %} +{% set page_max = config.pages_max %} +{% trans %}This page allows you to create static pages for your board. The limit is {{ page_max }} pages per board. You will still have to link to your pages somewhere in your board, for example in a sticky or in the board's announcement. To make links in the board's announcement, use <a> HTML tags.{% endtrans %} +{% else %} +{% trans %}This page allows you to create static pages for your imageboard.{% endtrans %} +{% endif %} +<h2>{% trans %}Existing pages{% endtrans %}</h2> +{% if pages %} +<form> +<table style="margin:auto"> +<tr><th>{% trans %}URL{% endtrans %}</th><th>{% trans %}Title{% endtrans %}</th><th>{% trans %}Edit{% endtrans %}</th><th>{% trans %}Delete{% endtrans %}</tr> +{% for page in pages %} +<tr><td>{{ page.name }}</td><td>{{ page.title }}</td><td><a href="?/edit_page/{{ page.id }}">{% trans %}Edit{% endtrans %}</a></td><td><a href="?/edit_pages/delete/{{ page.name }}{% if board %}/{{ board }}{% endif %}/{{ page.delete_token }}">{% trans %}Delete{% endtrans %}</a></td> +{% endfor %} +{% else %} +<em>No pages yet!</em> +{% endif %} +</table> +</form> +<hr/> +<h2>{% trans %}Create a new page{% endtrans %}</h2> +<form method="POST"> + <input type="hidden" name="token" value="{{ token }}"> +<table> +<tr><th>{% trans %}URL{% endtrans %}</th><th>{% trans %}Title{% endtrans %}</th></tr> +<tr><td><input type="text" name="page"></td><td><input type="text" name="title"></td> +</table> +<input type="submit" value="{% trans %}Create{% endtrans %}"> +</form> + +</div> diff --git a/templates/mod/rebuilt.html b/templates/mod/rebuilt.html index 57d16fff..f27cdf56 100644 --- a/templates/mod/rebuilt.html +++ b/templates/mod/rebuilt.html @@ -1,12 +1,12 @@ <div class="ban"> <h2>{% trans 'Rebuilt' %}</h2> + <p> + <a href="?/rebuild">{% trans 'Go back and rebuild again' %}</a>. + </p> <ul> {% for log in logs %} <li>{{ log }}</li> {% endfor %} </ul> - <p> - <a href="?/rebuild">{% trans 'Go back and rebuild again' %}</a>. - </p> </div> diff --git a/templates/mod/view_ip.html b/templates/mod/view_ip.html index 1c1c7fa6..4bacc7f6 100644 --- a/templates/mod/view_ip.html +++ b/templates/mod/view_ip.html @@ -45,7 +45,7 @@ </td> {% if mod|hasPermission(config.mod.remove_notes) %} <td class="minimal"> - <a href="?/IP/{{ ip }}/remove_note/{{ note.id }}"> + <a href="?/IP/{{ ip|url_encode(true) }}/remove_note/{{ note.id }}"> <small>[{% trans 'remove' %}]</small> </a> </td> diff --git a/templates/page.html b/templates/page.html index 7c0ccb09..a5327cf8 100644 --- a/templates/page.html +++ b/templates/page.html @@ -5,12 +5,14 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <script type="text/javascript"> - active_page = "page"; + var active_page = "page"; </script> {% include 'header.html' %} <title>{{ title }}</title> </head> -<body> +<body class="8chan vichan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %} active-page" data-stylesheet="{% if config.default_stylesheet.1 != '' %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}"> + {{ boardlist.top }} + {% if pm %}<div class="top_notice">You have <a href="?/PM/{{ pm.id }}">an unread PM</a>{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.</div><hr>{% endif %} <header> <h1>{{ title }}</h1> @@ -24,10 +26,10 @@ {{ body }} <hr> <footer> - <p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> + - <a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} - - <br><a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2014 Tinyboard Development Group - <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p> + <p class="unimportant" style="margin-top:20px;text-align:center;">- Tinyboard + + <a href="https://engine.vichan.net/">vichan</a> {{ config.version }} - + <br>Tinyboard Copyright © 2010-2014 Tinyboard Development Group + <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2016 vichan-devel</p> </footer> </body> </html> diff --git a/templates/post/flag.html b/templates/post/flag.html index 61622368..481e40ae 100644 --- a/templates/post/flag.html +++ b/templates/post/flag.html @@ -1,5 +1,5 @@ {% if config.display_flags and post.modifiers.flag %} - <img + <img {% if config.country_flags_condensed %} class="flag flag-{{ post.modifiers.flag }}" src="{{ config.image_blank }}" {% else %} diff --git a/templates/post/name.html b/templates/post/name.html index 13c676c7..e7f85f8b 100644 --- a/templates/post/name.html +++ b/templates/post/name.html @@ -1,5 +1,5 @@ {% set capcode = post.capcode|capcode %} -{% if post.email|length > 0 and (config.hide_sage!=true or post.email!='sage') %} +{% if post.email|length > 0 and (config.hide_sage!=true or post.email!='sage') and config.hide_email!=true %} {# start email #} <a class="email" href="mailto:{{ post.email }}"> {% endif %} @@ -7,7 +7,7 @@ {% if post.trip|length > 0 %} <span {% if capcode.trip %}style="{{ capcode.trip }}" {% endif %}class="trip">{{ post.trip }}</span> {% endif %} -{% if post.email|length > 0 %} +{% if post.email|length > 0 and (config.hide_sage!=true or post.email!='sage') and config.hide_email!=true %} {# end email #} </a> {% endif %} diff --git a/templates/post/post_controls.html b/templates/post/post_controls.html index 108d80b3..7e56edd3 100644 --- a/templates/post/post_controls.html +++ b/templates/post/post_controls.html @@ -41,7 +41,6 @@ {% 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> @@ -49,6 +48,13 @@ <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.cycle, board.uri) %} + {% if post.cycle %} + <a title="{% trans %}Make thread not cycle{% endtrans %}" href="?/{{ secure_link(board.dir ~ 'uncycle/' ~ post.id) }}">{{ config.mod.link_uncycle }}</a> + {% else %} + <a title="{% trans %}Make thread cycle{% endtrans %}" href="?/{{ secure_link(board.dir ~ 'cycle/' ~ post.id) }}">{{ config.mod.link_cycle }}</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 %} diff --git a/templates/post/poster_id.html b/templates/post/poster_id.html index 4efc56ff..51f0624f 100644 --- a/templates/post/poster_id.html +++ b/templates/post/poster_id.html @@ -1,7 +1,7 @@ {% if config.poster_ids %} {% if post.thread %} - ID: <span class="poster_id">{{ post.ip|poster_id(post.thread) }}</span> + <span class="poster_id">{{ post.ip|poster_id(post.thread) }}</span> {% else %} - ID: <span class="poster_id">{{ post.ip|poster_id(post.id) }}</span> + <span class="poster_id">{{ post.ip|poster_id(post.id) }}</span> {% endif %} {% endif %} diff --git a/templates/post_thread.html b/templates/post_thread.html index 61146491..125d5f78 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -1,7 +1,7 @@ {% filter remove_whitespace %} {# tabs and new lines will be ignored #} -<div id="thread_{{ post.id }}" data-board="{{ board.uri }}"> +<div class="thread" id="thread_{{ post.id }}" data-board="{{ board.uri }}"> {% if not index %}<a id="{{ post.id }}" class="post_anchor"></a>{% endif %} {% include 'post/fileinfo.html' %} @@ -19,25 +19,32 @@ <a class="post_no" onclick="citeReply({{ post.id }})" href="{% if isnoko50 %}{{ post.link('q', '50') }}{% else %}{{ post.link('q') }}{% endif %}">{{ post.id }}</a> {% if post.sticky %} {% if config.font_awesome %} - <i class="fa fa-thumb-tack"></i> + <i class="fa fa-thumb-tack" title="Sticky"></i> {% else %} <img class="icon" title="Sticky" src="{{ config.image_sticky }}" alt="Sticky" /> {% endif %} {% endif %} {% if post.locked %} {% if config.font_awesome %} - <i class="fa fa-lock"></i> + <i class="fa fa-lock" title="Locked"></i> {% else %} <img class="icon" title="Locked" src="{{ config.image_locked }}" alt="Locked" /> {% endif %} {% endif %} {% if post.bumplocked and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %} {% if config.font_awesome %} - <i class="fa fa-anchor"></i> + <i class="fa fa-anchor" title="Bumplocked"></i> {% else %} <img class="icon" title="Bumplocked" src="{{ config.image_bumplocked }}" alt="Bumplocked" /> {% endif %} {% endif %} + {% if post.cycle %} + {% if config.font_awesome %} + <i class="fa fa-refresh" title="Cyclical"></i> + {% else %} + <img class="icon" title="Cyclical" src="{{ config.image_sticky }}" alt="Cyclical" /> + {% endif %} + {% endif %} {% if index %} <a href="{{ post.root }}{{ board.dir }}{{ config.dir.res }}{{ link_for(post) }}">[{% trans %}Reply{% endtrans %}]</a> {% endif %} diff --git a/templates/posts.sql b/templates/posts.sql index 6b2249ef..070e687b 100755 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -17,6 +17,7 @@ CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` ( `ip` varchar(39) CHARACTER SET ascii NOT NULL, `sticky` int(1) NOT NULL, `locked` int(1) NOT NULL, + `cycle` int(1) NOT NULL, `sage` int(1) NOT NULL, `embed` text, `slug` varchar(256) DEFAULT NULL, diff --git a/templates/report.html b/templates/report.html new file mode 100644 index 00000000..b34f7430 --- /dev/null +++ b/templates/report.html @@ -0,0 +1,22 @@ +<form action="{{ config.post_url }}" method="post" id="report_form"> + {% if error %} + <div class="error"> + <strong>{{ error|e }}</strong> + </div> + {% endif %} + <input type="hidden" name="board" value="{{ board.uri }}"> + <input type="hidden" name="{{ post|e }}" value="1"> + {% if global %} + <input type="hidden" name="global" value="1"> + <div><h1>Attention!</h1><p>This form is only for reporting <strong>child pornography</strong>, <strong>bot spam</strong> and <strong>credit card numbers, social security numbers or banking information</strong>. DMCA requests and all other deletion requests <em>MUST</em> be sent via email to admin@8chan.co.</p><p>8chan is unmoderated and allows posts without collecting <em>ANY</em> information from the poster less the details of their post. Furthermore, all boards on 8chan are user created and not actively monitored by anyone but the board creator.</p><p>8chan has a small volunteer staff to handle this queue, please do not waste their time by filling it with nonsense! <em>If you made a report with this tool and the post was not deleted, <strong>do not make the report again!</strong> Email admin@8chan.co instead.</em> Abuse of the global report system could lead to address blocks against your IP from 8chan.</p><p>Again, 8chan's global volunteers <em>do not</em> handle board specific issues. You most likely want to click "Report" instead to reach the creator and volunteers he assigned to this board.</p> + {% endif %} + <p>{% trans %}Enter reason below...{% endtrans %}</p> + <input type="text" id="reason" name="reason" value="{{ reason_prefill|e|addslashes }}"> + {% if config.report_captcha %} + <p>{% trans %}To submit your report, please fill out the CAPTCHA below.{% endtrans %}</p> + {{ captcha['html'] }}<br/> + <input class="captcha_text" name="captcha_text" size="25" maxlength="6" autocomplete="off" type="text" value=""> + <input class="captcha_cookie" name="captcha_cookie" type="hidden" autocomplete="off" value="{{ captcha['cookie']|e }}"><br/> + {% endif %} + <input name="report" value="{% trans %}Submit{% endtrans %}" type="submit"> +</form> diff --git a/templates/report_delete.html b/templates/report_delete.html index 2fcb7259..e246da9e 100644 --- a/templates/report_delete.html +++ b/templates/report_delete.html @@ -1,13 +1,16 @@ -{% 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> +<div id="post-moderation-fields"> + {% if config.allow_delete %} + <div id="delete-fields"> + {% 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> + </div> + {% endif %} + + <div id="report-fields"> + <label for="reason">{% trans %}Reason{% endtrans %}</label> <input id="reason" type="text" name="reason" size="20" maxlength="30" /> <input type="submit" name="report" value="{% trans %}Report{% endtrans %}" /> -</div> + </div> +</div>
\ No newline at end of file diff --git a/templates/themes/basic/index.html b/templates/themes/basic/index.html index 3e83f919..ad5b92ca 100644 --- a/templates/themes/basic/index.html +++ b/templates/themes/basic/index.html @@ -12,7 +12,7 @@ <!--{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %}--> {% if config.font_awesome %}<link rel="stylesheet" href="{{ config.root }}{{ config.font_awesome_css }}">{% endif %} </head> -<body> +<body class="8chan vichan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}"> <div class="bar top"> {{ boardlist.top }} </div> @@ -41,10 +41,10 @@ <hr/> <footer> - <p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> + - <a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} - - <br><a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2014 Tinyboard Development Group - <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p> + <p class="unimportant" style="margin-top:20px;text-align:center;">- Tinyboard + + <a href="https://engine.vichan.net/">vichan</a> {{ config.version }} - + <br>Tinyboard Copyright © 2010-2014 Tinyboard Development Group + <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2016 vichan-devel</p> </footer> </body> </html> diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index f23298bf..e556b4a9 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -4,12 +4,12 @@ <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <script type='text/javascript'> - active_page = "catalog"; + var active_page = "catalog" + , board_name = "{{ board }}"; </script> {% include 'header.html' %} - <title>{{ settings.title }} (/{{ board }}/)</title> </head> -<body class="theme-catalog board-{{ board }}"> +<body class="8chan vichan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %} theme-catalog active-catalog" data-stylesheet="{% if config.default_stylesheet.1 != '' %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}"> <div class="top bar topbar"> {{ boardlist.top }} </div> @@ -42,14 +42,16 @@ </select> </div> - <div class="threads"> - <ul id="Grid"> - {% for post in recent_posts %} - <li class="mix" + <div class="threads"> + <div id="Grid"> + {% for post in recent_posts %} + <div class="mix" data-reply="{{ post.reply_count }}" - data-bump="{{ post.bump }}" - data-time="{{ post.time }}" - data-board="{{ post.board }}" + data-bump="{{ post.bump }}" + data-time="{{ post.time }}" + data-id="{{ post.id }}" + data-sticky="{% if post.sticky %}true{% else %}false{% endif %}" + data-locked="{% if post.locked %}true{% else %}false{% endif %}" > <div class="thread grid-li grid-size-small"> <a href="{{post.link}}"> @@ -61,7 +63,7 @@ id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject|e }}{% endif %}" data-name="{{ post.name|e }}" data-muhdifference="{{ post.muhdifference }}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}"> </a> <div class="replies"> - <strong>R: {{ post.reply_count }} / I: {{ post.image_count }}</strong> + <strong>R: {{ post.reply_count }} / I: {{ post.image_count }}{% if post.sticky %} (sticky){% endif %}</strong> {% if post.subject %} <p class="intro"> <span class="subject"> @@ -75,9 +77,9 @@ {{ post.body }} </div> </div> - </li> + </div> {% endfor %} - </ul> + </div> </div> <hr/> diff --git a/templates/themes/catalog/index.rss b/templates/themes/catalog/index.rss new file mode 100644 index 00000000..e6576ffc --- /dev/null +++ b/templates/themes/catalog/index.rss @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> +<channel> + <title>/{{ board.uri }}/ - {{ board.title|e }}</title> + <link>{{ config.root }}{{ board.uri }}/</link> + <description>Live feed of new threads on the board /{{ board.uri }}/ - {{ board.title|e }}.</description> + <atom:link href="{{ config.root }}{{ board.uri }}/index.rss" rel="self" type="application/rss+xml"/> + {% for post in recent_posts %} + <item> + <title>{% if post.subject %}{{ post.subject|e }}{% else %}{{ post.body_nomarkup[:256]|remove_modifiers|e }}{% endif %}</title> + <link>{{ config.root }}{{ board.uri }}/res/{{ post.id }}.html</link> + <guid>{{ config.root }}{{ board.uri }}/res/{{ post.id }}.html</guid> + <comments>{{ config.root }}{{ board.uri }}/res/{{ post.id }}.html</comments> + <pubDate>{{ post.pubdate }}</pubDate> + <description><![CDATA[ <a href='{{ config.root }}{{ board.uri }}/res/{{ post.id }}.html' target=_blank><img style='float:left;margin:8px' border=0 src='{% if not config.uri_thumb %}{{ config.root }}{% endif %}{{ post.file }}'></a> {{ post.body }} ]]></description> + </item> + {% endfor %} +</channel> +</rss> diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 1199b54a..24cdcbb8 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -15,23 +15,30 @@ // - post-thread (a thread has been made) if ($action === 'all') { foreach ($boards as $board) { - if ($config['smart_build']) { + $b = new Catalog(); + + $action = generation_strategy("sb_catalog", array($board)); + if ($action == 'delete') { file_unlink($config['dir']['home'] . $board . '/catalog.html'); - } else { - $b->build($board); + file_unlink($config['dir']['home'] . $board . '/index.rss'); + } + elseif ($action == 'rebuild') { + $b->build($settings, $board); } } - } elseif (in_array($board, $boards) && - $action == 'post-thread' || - ($settings['update_on_posts'] && $action == 'post') || - ($settings['update_on_posts'] && $action == 'post-delete')) - { - if ($config['smart_build']) { + } elseif ($action == 'post-thread' || ($settings['update_on_posts'] && $action == 'post') || ($settings['update_on_posts'] && $action == 'post-delete') && in_array($board, $boards)) { + $b = new Catalog(); + + $action = generation_strategy("sb_catalog", array($board)); + if ($action == 'delete') { file_unlink($config['dir']['home'] . $board . '/catalog.html'); - } else { - $b->build($board); + file_unlink($config['dir']['home'] . $board . '/index.rss'); } - } + elseif ($action == 'rebuild') { + $b->build($settings, $board); + } + + } // FIXME: Check that Ukko is actually enabled if ($settings['enable_ukko'] && ( @@ -210,10 +217,13 @@ $post['file'] = $config['uri_thumb'] . $files[0]->thumb; } } + } else { + $post['file'] = $config['root'] . $config['image_deleted']; } if (empty($post['image_count'])) $post['image_count'] = 0; + $post['pubdate'] = date('r', $post['time']); $posts[] = $post; } @@ -247,5 +257,11 @@ 'board' => $board_name, 'link' => $board_link ))); + + file_write($config['dir']['home'] . $board_name . '/index.rss', Element('themes/catalog/index.rss', Array( + 'config' => $config, + 'recent_posts' => $recent_posts, + 'board' => $board + ))); } } diff --git a/templates/themes/categories/news.html b/templates/themes/categories/news.html index 95b330b6..4ce65128 100644 --- a/templates/themes/categories/news.html +++ b/templates/themes/categories/news.html @@ -32,10 +32,10 @@ </div> <footer> - <p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> + - <a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} - - <br><a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2014 Tinyboard Development Group - <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p> + <p class="unimportant" style="margin-top:20px;text-align:center;">- Tinyboard + + <a href="https://engine.vichan.net/">vichan</a> {{ config.version }} - + <br>Tinyboard Copyright © 2010-2014 Tinyboard Development Group + <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2016 vichan-devel</p> </footer> </body> </html> diff --git a/templates/themes/frameset/news.html b/templates/themes/frameset/news.html index 9f779b74..320c64d3 100644 --- a/templates/themes/frameset/news.html +++ b/templates/themes/frameset/news.html @@ -31,10 +31,10 @@ </div> <footer> - <p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> + - <a href='https://int.vichan.net/devel/'>vichan</a> {{ config.version }} - - <br><a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2014 Tinyboard Development Group - <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2015 vichan-devel</p> + <p class="unimportant" style="margin-top:20px;text-align:center;">- Tinyboard + + <a href="https://engine.vichan.net/">vichan</a> {{ config.version }} - + <br>Tinyboard Copyright © 2010-2014 Tinyboard Development Group + <br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2016 vichan-devel</p> </footer> </body> </html> diff --git a/templates/themes/recent/recent.html b/templates/themes/recent/recent.html index 763f8bec..f0276ac7 100644 --- a/templates/themes/recent/recent.html +++ b/templates/themes/recent/recent.html @@ -9,6 +9,8 @@ <link rel="stylesheet" media="screen" href="https://lainchan.org/stylesheets/font-awesome/css/font-awesome.min.css"/> {% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}" />{% endif %} + {% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %} + {% if config.font_awesome %}<link rel="stylesheet" href="{{ config.root }}{{ config.font_awesome_css }}">{% endif %} </head> <body> <div class="bar top"> diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php index f44e2529..a826048f 100644 --- a/templates/themes/recent/theme.php +++ b/templates/themes/recent/theme.php @@ -25,10 +25,11 @@ $this->excluded = explode(' ', $settings['exclude']); if ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete') { - if ($config['smart_build']) { + $action = generation_strategy('sb_recent', array()); + if ($action == 'delete') { file_unlink($config['dir']['home'] . $settings['html']); } - else { + elseif ($action == 'rebuild') { file_write($config['dir']['home'] . $settings['html'], $this->homepage($settings)); } } @@ -64,7 +65,7 @@ if (isset($post['files'])) $files = json_decode($post['files']); - if ($files[0]->file == 'deleted') continue; + if ($files[0]->file == 'deleted' || $files[0]->thumb == 'file') continue; // board settings won't be available in the template file, so generate links now $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] diff --git a/templates/themes/rss/info.php b/templates/themes/rss/info.php new file mode 100755 index 00000000..14b39eb9 --- /dev/null +++ b/templates/themes/rss/info.php @@ -0,0 +1,61 @@ +<?php + $theme = Array(); + + // Theme name + $theme['name'] = 'RSS'; + // Description (you can use Tinyboard markup here) + $theme['description'] = 'Show recent posts and images as a RSS'; + $theme['version'] = 'v0.1'; + + // Theme configuration + $theme['config'] = Array(); + + $theme['config'][] = Array( + 'title' => 'Title', + 'name' => 'title', + 'type' => 'text', + 'default' => 'Recent Posts RSS' + ); + + $theme['config'][] = Array( + 'title' => 'Excluded boards', + 'name' => 'exclude', + 'type' => 'text', + 'comment' => '(space seperated)' + ); + + $theme['config'][] = Array( + 'title' => '# of recent posts', + 'name' => 'limit_posts', + 'type' => 'text', + 'default' => '30', + 'comment' => '(maximum posts to display)' + ); + + $theme['config'][] = Array( + 'title' => 'XML file', + 'name' => 'xml', + 'type' => 'text', + 'default' => 'recent.xml', + 'comment' => '(eg. "recent.xml")' + ); + + $theme['config'][] = Array( + 'title' => 'Base URL', + 'name' => 'base_url', + 'type' => 'text', + 'default' => 'http://test.com', + 'comment' => '(eg. "http://test.com")' + ); + + // Unique function name for building everything + $theme['build_function'] = 'rss_recentposts_build'; + $theme['install_callback'] = 'rss_recentposts_install'; + + if (!function_exists('rss_recentposts_install')) { + function rss_recentposts_install($settings) { + if (!is_numeric($settings['limit_posts']) || $settings['limit_posts'] < 0) + return Array(false, '<strong>' . utf8tohtml($settings['limit_posts']) . '</strong> is not a non-negative integer.'); + } + } + diff --git a/templates/themes/rss/rss.xml b/templates/themes/rss/rss.xml new file mode 100644 index 00000000..30fdb473 --- /dev/null +++ b/templates/themes/rss/rss.xml @@ -0,0 +1,28 @@ +{% filter remove_whitespace %} +<?xml version="1.0" encoding="utf-8"?> +<rss xmlns:dc="http://purl.org/dc/elements/1.1/" + version="2.0"> + <channel> + <description> + <![CDATA[{{ settings.subtitle }}]]> + </description> + <title>{{ settings.title }}</title> + <generator>Tinyboard {{ config.version }}</generator> + <link>{{ settings.base_url }}{{ config.root }}{{ settings.html }}</link> + {% for post in recent_posts %} + <item> + <title>{{ post.board_name }}</title> + <description> + <![CDATA[ + <a href="{{ settings.base_url }}{{ post.link }}"> + {{ post.snippet }} + </a> + ]]> + </description> + <link>{{ settings.base_url }}{{ post.link }}</link> + <guid>{{ settings.base_url }}{{ post.link }}</guid> + </item> + {% endfor %} + </channel> +</rss> +{% endfilter %} diff --git a/templates/themes/rss/theme.php b/templates/themes/rss/theme.php new file mode 100755 index 00000000..33c1b210 --- /dev/null +++ b/templates/themes/rss/theme.php @@ -0,0 +1,124 @@ +<?php + require 'info.php'; + + function rss_recentposts_build($action, $settings, $board) { + // Possible values for $action: + // - all (rebuild everything, initialization) + // - news (news has been updated) + // - boards (board list changed) + // - post (a post has been made) + // - post-thread (a thread has been made) + + $b = new RSSRecentPosts(); + $b->build($action, $settings); + } + + // Wrap functions in a class so they don't interfere with normal Tinyboard operations + class RSSRecentPosts { + public function build($action, $settings) { + global $config, $_theme; + + /*if ($action == 'all') { + copy('templates/themes/recent/' . $settings['basecss'], $config['dir']['home'] . $settings['css']); + }*/ + + $this->excluded = explode(' ', $settings['exclude']); + + if ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete') + file_write($config['dir']['home'] . $settings['xml'], $this->homepage($settings)); + } + + // Build news page + public function homepage($settings) { + global $config, $board; + + //$recent_images = Array(); + $recent_posts = Array(); + //$stats = Array(); + + $boards = listBoards(); + + /*$query = ''; + foreach ($boards as &$_board) { + if (in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `file` IS NOT NULL AND `file` != 'deleted' AND `thumb` != 'spoiler' UNION ALL ", $_board['uri'], $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_images'], $query); + $query = query($query) or error(db_error()); + + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { + openBoard($post['board']); + + // board settings won't be available in the template file, so generate links now + $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id']; + $post['src'] = $config['uri_thumb'] . $post['thumb']; + + //$recent_images[] = $post; + }*/ + + + $query = ''; + foreach ($boards as &$_board) { + if (in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` UNION ALL ", $_board['uri'], $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_posts'], $query); + $query = query($query) or error(db_error()); + + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { + openBoard($post['board']); + + $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id']; + $post['snippet'] = pm_snippet($post['body'], 30); + $post['board_name'] = $board['name']; + + $recent_posts[] = $post; + } + + // Total posts + /*$query = 'SELECT SUM(`top`) FROM ('; + foreach ($boards as &$_board) { + if (in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT MAX(`id`) AS `top` FROM ``posts_%s`` UNION ALL ", $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); + $query = query($query) or error(db_error());*/ + //$stats['total_posts'] = number_format($query->fetchColumn()); + + // Unique IPs + /*$query = 'SELECT COUNT(DISTINCT(`ip`)) FROM ('; + foreach ($boards as &$_board) { + if (in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT `ip` FROM ``posts_%s`` UNION ALL ", $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); + $query = query($query) or error(db_error()); + //$stats['unique_posters'] = number_format($query->fetchColumn());*/ + + // Active content + /*$query = 'SELECT SUM(`filesize`) FROM ('; + foreach ($boards as &$_board) { + if (in_array($_board['uri'], $this->excluded)) + continue; + $query .= sprintf("SELECT `filesize` FROM ``posts_%s`` UNION ALL ", $_board['uri']); + } + $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); + $query = query($query) or error(db_error()); + //$stats['active_content'] = $query->fetchColumn();*/ + + return Element('themes/rss/rss.xml', Array( + 'settings' => $settings, + 'config' => $config, + //'boardlist' => createBoardlist(), + //'recent_images' => $recent_images, + 'recent_posts' => $recent_posts, + //'stats' => $stats + )); + } + }; + +?> diff --git a/templates/themes/sitemap/theme.php b/templates/themes/sitemap/theme.php index 52779d53..6bc035bb 100644 --- a/templates/themes/sitemap/theme.php +++ b/templates/themes/sitemap/theme.php @@ -23,10 +23,12 @@ } } - if ($config['smart_build']) { + $action = generation_strategy('sb_sitemap', array()); + + if ($action == 'delete') { file_unlink($settings['path']); } - else { + elseif ($action == 'rebuild') { $boards = explode(' ', $settings['boards']); $threads = array(); diff --git a/templates/themes/ukko/theme.php b/templates/themes/ukko/theme.php index 92dfb317..ee2707bf 100644 --- a/templates/themes/ukko/theme.php +++ b/templates/themes/ukko/theme.php @@ -11,10 +11,12 @@ return; } - if ($config['smart_build']) { + $action = generation_strategy('sb_ukko', array()); + + if ($action == 'delete') { file_unlink($settings['uri'] . '/index.html'); } - else { + elseif ($action == 'rebuild') { file_write($settings['uri'] . '/index.html', $ukko->build()); } } diff --git a/templates/thread.html b/templates/thread.html index 346db449..5ecef649 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -6,16 +6,30 @@ <script type="text/javascript"> - var active_page = "thread"; + var active_page = "thread" + , board_name = "{{ board.uri }}" + , thread_id = "{{ thread.id }}"; </script> {% include 'header.html' %} - <title>{{ board.url }} - {% if config.thread_subject_in_title and thread.subject %}{{ thread.subject }}{% else %}{{ board.title|e }}{% endif %}</title> + + {% set meta_subject %}{% if config.thread_subject_in_title and thread.subject %}{{ thread.subject|e }}{% else %}{{ thread.body_nomarkup[:256]|remove_modifiers|e }}{% endif %}{% endset %} + + <meta name="description" content="{{ board.url }} - {{ board.title|e }} - {{ meta_subject }}" /> + <meta name="twitter:card" value="summary"> + <meta property="og:title" content="{{ meta_subject }}" /> + <meta property="og:type" content="article" /> + <meta property="og:url" content="{{ config.domain }}/{{ board.uri }}/{{ config.dir.res }}{{ thread.id }}.html" /> + {% if thread.files.0.thumb %}<meta property="og:image" content="{{ config.domain }}/{{ board.uri }}/{{ config.dir.thumb }}{{ thread.files.0.thumb }}" />{% endif %} + <meta property="og:description" content="{{ thread.body_nomarkup|e }}" /> + + <title>{{ board.url }} - {{ meta_subject }}</title> </head> -<body id="thread"> +<body id="thread" class="8chan vichan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %} active-thread" data-stylesheet="{% if config.default_stylesheet.1 != '' %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}"> <div class="bar top"> {{ boardlist.top }} </div> + <a name="top"></a> {% if pm %}<div class="top_notice">You have <a href="?/PM/{{ pm.id }}">an unread PM</a>{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.</div><hr />{% endif %} {% if config.url_banner %}<img class="board_image" src="{{ config.url_banner }}" {% if config.banner_width or config.banner_height %}style="{% if config.banner_width %}width:{{ config.banner_width }}px{% endif %};{% if config.banner_width %}height:{{ config.banner_height }}px{% endif %}" {% endif %}alt="" />{% endif %} <header> @@ -34,6 +48,7 @@ {% include 'attention_bar.html' %} + {{ config.ad.top }} {% include 'post_form.html' %} @@ -46,13 +61,31 @@ </div> <hr /> <form name="postcontrols" action="{{ config.post_url }}" method="post"> - <input type="hidden" name="board" value="{{ board.uri }}" /> - {% if mod %}<input type="hidden" name="mod" value="1" />{% endif %} - {{ body }} - {% include 'report_delete.html' %} + <input type="hidden" name="board" value="{{ board.uri }}" /> + {% if mod %}<input type="hidden" name="mod" value="1" />{% endif %} + + {{ body }} + + <div id="thread-interactions"> + <span id="thread-links"> + <a id="thread-return" href="{{ return }}">[{% trans %}Return{% endtrans %}]</a> + <a id="thread-top" href="#top">[{% trans %}Go to top{% endtrans %}]</a> + {% if config.catalog_link %} + <a id="thread-catalog" href="{{ config.root }}{{ board.dir }}{{ config.catalog_link }}">[{% trans %}Catalog{% endtrans %}]</a> + {% endif %} + </span> + + <span id="thread-quick-reply"> + <a id="link-quick-reply" href="#">[{% trans %}Post a Reply{% endtrans %}]</a> + </span> + + {% include 'report_delete.html' %} + </div> + + <div class="clearfix"></div> </form> - - {{ boardlist.bottom }} + + {{ boardlist.bottom }} {{ config.ad.bottom }} |
