mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-24 07:30:10 +01:00
[#184] Added <body> tag classes. Style selector now adds a <body> class. Moved board list under moderator dashboard.
This commit is contained in:
parent
6850301595
commit
2d6d449bd2
553
d
Normal file
553
d
Normal file
@ -0,0 +1,553 @@
|
||||
[1mdiff --git a/inc/instance-config.php b/inc/instance-config.php[m
|
||||
[1mindex 699d1a1..475f3ed 100644[m
|
||||
[1m--- a/inc/instance-config.php[m
|
||||
[1m+++ b/inc/instance-config.php[m
|
||||
[36m@@ -18,15 +18,15 @@[m
|
||||
$config['db']['user'] = 'root';[m
|
||||
$config['db']['password'] = '';[m
|
||||
$config['timezone'] = 'UTC';[m
|
||||
[31m- $config['cache']['enabled'] = 'apc';[m
|
||||
[31m-[m
|
||||
[31m-[m
|
||||
[32m+[m [32m$config['cache']['enabled'] = false;[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m[41m [m
|
||||
$config['cookies']['mod'] = 'mod';[m
|
||||
$config['cookies']['salt'] = '';[m
|
||||
[31m-[m
|
||||
[32m+[m[41m [m
|
||||
$config['spam']['hidden_inputs_max_pass'] = 128;[m
|
||||
$config['spam']['hidden_inputs_expire'] = 60 * 60 * 4; // three hours[m
|
||||
[31m-[m
|
||||
[32m+[m[41m [m
|
||||
$config['flood_time'] = 5;[m
|
||||
$config['flood_time_ip'] = 30;[m
|
||||
$config['flood_time_same'] = 2;[m
|
||||
[36m@@ -46,10 +46,10 @@[m
|
||||
$config['thread_subject_in_title'] = true;[m
|
||||
$config['spam']['hidden_inputs_max_pass'] = 128;[m
|
||||
$config['ayah_enabled'] = true;[m
|
||||
[31m-[m
|
||||
[32m+[m[41m [m
|
||||
// Load database credentials[m
|
||||
require "secrets.php";[m
|
||||
[31m-[m
|
||||
[32m+[m[41m [m
|
||||
// Image shit[m
|
||||
$config['thumb_method'] = 'gm+gifsicle';[m
|
||||
$config['thumb_ext'] = '';[m
|
||||
[1mdiff --git a/install.php b/install.php[m
|
||||
[1mindex 8b3815a..07e94e7 100644[m
|
||||
[1m--- a/install.php[m
|
||||
[1m+++ b/install.php[m
|
||||
[36m@@ -579,7 +579,8 @@[m [mif ($step == 0) {[m
|
||||
</p>';[m
|
||||
[m
|
||||
echo Element('page.html', $page);[m
|
||||
[31m-} elseif ($step == 1) {[m
|
||||
[32m+[m[32m}[m
|
||||
[32m+[m[32melseif ($step == 1) {[m
|
||||
$page['title'] = 'Pre-installation test';[m
|
||||
[m
|
||||
$can_exec = true;[m
|
||||
[36m@@ -761,7 +762,8 @@[m [mif ($step == 0) {[m
|
||||
'title' => 'Checking environment',[m
|
||||
'config' => $config[m
|
||||
));[m
|
||||
[31m-} elseif ($step == 2) {[m
|
||||
[32m+[m[32m}[m
|
||||
[32m+[m[32melseif ($step == 2) {[m
|
||||
// Basic config[m
|
||||
$page['title'] = 'Configuration';[m
|
||||
[m
|
||||
[36m@@ -775,7 +777,8 @@[m [mif ($step == 0) {[m
|
||||
'title' => 'Configuration',[m
|
||||
'config' => $config[m
|
||||
));[m
|
||||
[31m-} elseif ($step == 3) {[m
|
||||
[32m+[m[32m}[m
|
||||
[32m+[m[32melseif ($step == 3) {[m
|
||||
$instance_config = [m
|
||||
'<?php[m
|
||||
[m
|
||||
[36m@@ -814,7 +817,8 @@[m [mif ($step == 0) {[m
|
||||
[m
|
||||
if (@file_put_contents('inc/instance-config.php', $instance_config)) {[m
|
||||
header('Location: ?step=4', true, $config['redirect_http']);[m
|
||||
[31m- } else {[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32melse {[m
|
||||
$page['title'] = 'Manual installation required';[m
|
||||
$page['body'] = '[m
|
||||
<p>I couldn\'t write to <strong>inc/instance-config.php</strong> with the new configuration, probably due to a permissions error.</p>[m
|
||||
[36m@@ -826,7 +830,8 @@[m [mif ($step == 0) {[m
|
||||
';[m
|
||||
echo Element('page.html', $page);[m
|
||||
}[m
|
||||
[31m-} elseif ($step == 4) {[m
|
||||
[32m+[m[32m}[m
|
||||
[32m+[m[32melseif ($step == 4) {[m
|
||||
// SQL installation[m
|
||||
[m
|
||||
buildJavascript();[m
|
||||
[36m@@ -846,11 +851,15 @@[m [mif ($step == 0) {[m
|
||||
[m
|
||||
$sql_errors = '';[m
|
||||
foreach ($queries as $query) {[m
|
||||
[31m- if ($mysql_version < 50503)[m
|
||||
[32m+[m [32mif ($mysql_version < 50503) {[m
|
||||
$query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query);[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m[41m [m
|
||||
$query = preg_replace('/^([\w\s]*)`([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)`/u', '$1``$2``', $query);[m
|
||||
[31m- if (!query($query))[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mif (!query($query)) {[m
|
||||
$sql_errors .= '<li>' . db_error() . '</li>';[m
|
||||
[32m+[m [32m}[m
|
||||
}[m
|
||||
[m
|
||||
$page['title'] = 'Installation complete';[m
|
||||
[36m@@ -858,7 +867,8 @@[m [mif ($step == 0) {[m
|
||||
[m
|
||||
if (!empty($sql_errors)) {[m
|
||||
$page['body'] .= '<div class="ban"><h2>SQL errors</h2><p>SQL errors were encountered when trying to install the database. This may be the result of using a database which is already occupied with a vichan installation; if so, you can probably ignore this.</p><p>The errors encountered were:</p><ul>' . $sql_errors . '</ul><p><a href="?step=5">Ignore errors and complete installation.</a></p></div>';[m
|
||||
[31m- } else {[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32melse {[m
|
||||
$boards = listBoards();[m
|
||||
foreach ($boards as &$_board) {[m
|
||||
setupBoard($_board);[m
|
||||
[36m@@ -866,13 +876,11 @@[m [mif ($step == 0) {[m
|
||||
}[m
|
||||
[m
|
||||
file_write($config['has_installed'], VERSION);[m
|
||||
[31m- /*if (!file_unlink(__FILE__)) {[m
|
||||
[31m- $page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';[m
|
||||
[31m- }*/[m
|
||||
}[m
|
||||
[m
|
||||
echo Element('page.html', $page);[m
|
||||
[31m-} elseif ($step == 5) {[m
|
||||
[32m+[m[32m}[m
|
||||
[32m+[m[32melseif ($step == 5) {[m
|
||||
$page['title'] = 'Installation complete';[m
|
||||
$page['body'] = '<p style="text-align:center">Thank you for using vichan. Please remember to report any bugs you discover.</p>';[m
|
||||
[m
|
||||
[1mdiff --git a/templates/8chan/index.html b/templates/8chan/index.html[m
|
||||
[1mindex 459e7e8..4f25473 100644[m
|
||||
[1m--- a/templates/8chan/index.html[m
|
||||
[1m+++ b/templates/8chan/index.html[m
|
||||
[36m@@ -223,7 +223,7 @@[m
|
||||
</style>[m
|
||||
</head>[m
|
||||
[m
|
||||
[31m- <body>[m
|
||||
[32m+[m[32m <body class="8chan index">[m
|
||||
[m
|
||||
<div id="main">[m
|
||||
[m
|
||||
[1mdiff --git a/templates/generic_page.html b/templates/generic_page.html[m
|
||||
[1mindex 0fe1f9c..4cd3116 100644[m
|
||||
[1m--- a/templates/generic_page.html[m
|
||||
[1m+++ b/templates/generic_page.html[m
|
||||
[36m@@ -6,7 +6,7 @@[m
|
||||
<title>{{ board.url }} - {{ board.name }}</title>[m
|
||||
{% endblock %}[m
|
||||
</head>[m
|
||||
[31m-<body> [m
|
||||
[32m+[m[32m<body class="8chan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' and not mod %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}">[m
|
||||
{{ boardlist.top }}[m
|
||||
{% 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 %}[m
|
||||
{% 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 %}[m
|
||||
[1mdiff --git a/templates/index.html b/templates/index.html[m
|
||||
[1mindex aae87c1..5638fd6 100644[m
|
||||
[1m--- a/templates/index.html[m
|
||||
[1m+++ b/templates/index.html[m
|
||||
[36m@@ -14,7 +14,7 @@[m
|
||||
{% include 'header.html' %}[m
|
||||
<title>{{ board.url }} - {{ board.title|e }}</title>[m
|
||||
</head>[m
|
||||
[31m-<body> [m
|
||||
[32m+[m[32m<body class="8chan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' and not mod %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}">[m
|
||||
{{ boardlist.top }}[m
|
||||
[m
|
||||
{% 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 %}[m
|
||||
[1mdiff --git a/templates/main.js b/templates/main.js[m
|
||||
[1mindex 1ec4d26..d100f93 100644[m
|
||||
[1m--- a/templates/main.js[m
|
||||
[1m+++ b/templates/main.js[m
|
||||
[36m@@ -73,11 +73,6 @@[m [mvar saved = {};[m
|
||||
[m
|
||||
[m
|
||||
var selectedstyle = '{% endraw %}{{ config.default_stylesheet.0|addslashes }}{% raw %}';[m
|
||||
[31m-/*var styles = {[m
|
||||
[31m- {% endraw %}[m
|
||||
[31m- {% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',[m
|
||||
[31m- {% endraw %}{% endfor %}{% raw %}[m
|
||||
[31m-};*/[m
|
||||
var board_name = false;[m
|
||||
[m
|
||||
function changeStyle(styleName, link) {[m
|
||||
[36m@@ -92,36 +87,78 @@[m [mfunction changeStyle(styleName, link) {[m
|
||||
{% endif %}[m
|
||||
{% raw %}[m
|
||||
[m
|
||||
[31m- if (!document.getElementById('stylesheet')) {[m
|
||||
[31m- var s = document.createElement('link');[m
|
||||
[31m- s.rel = 'stylesheet';[m
|
||||
[31m- s.type = 'text/css';[m
|
||||
[31m- s.id = 'stylesheet';[m
|
||||
[32m+[m [32m// Find the <dom> for the stylesheet. May be nothing.[m
|
||||
[32m+[m [32mvar domStylesheet = document.getElementById('stylesheet');[m
|
||||
[32m+[m [32m// Determine if this stylesheet is the default.[m
|
||||
[32m+[m [32mvar setToDefault = ( styles[styleName] == "" || styles[styleName] == "/stylesheets/" );[m
|
||||
[32m+[m [32m// Turn "Yotsuba B" to "yotsuba_b"[m[41m [m
|
||||
[32m+[m [32mvar attributeName = styleName.replace(/[^a-z0-9_\-]/gi, '_').toLowerCase();[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mif( !domStylesheet && !setToDefault ) {[m
|
||||
[32m+[m [32mdomStylesheet = document.createElement('link');[m
|
||||
[32m+[m [32mdomStylesheet.rel = 'stylesheet';[m
|
||||
[32m+[m [32mdomStylesheet.type = 'text/css';[m
|
||||
[32m+[m [32mdomStylesheet.id = 'stylesheet';[m
|
||||
[32m+[m[41m [m
|
||||
var x = document.getElementsByTagName('head')[0];[m
|
||||
[31m- x.appendChild(s);[m
|
||||
[32m+[m [32mx.appendChild(domStylesheet);[m
|
||||
}[m
|
||||
[31m-[m
|
||||
[31m- {% endraw %}[m
|
||||
[31m- var root = "{{ config.root }}";[m
|
||||
[31m- {% raw %}[m
|
||||
[31m- root = root.replace(/\/$/, "");[m
|
||||
[31m- [m
|
||||
[31m- document.getElementById('stylesheet').href = root + styles[styleName];[m
|
||||
[31m- selectedstyle = styleName;[m
|
||||
[m
|
||||
[31m- if (document.getElementsByClassName('styles').length != 0) {[m
|
||||
[31m- var styleLinks = document.getElementsByClassName('styles')[0].childNodes;[m
|
||||
[31m- for (var i = 0; i < styleLinks.length; i++) {[m
|
||||
[31m- styleLinks[i].className = '';[m
|
||||
[32m+[m [32mif( !setToDefault ) {[m
|
||||
[32m+[m [32m{% endraw %}[m
|
||||
[32m+[m [32mvar root = "{{ config.root }}";[m
|
||||
[32m+[m [32m{% raw %}[m
|
||||
[32m+[m [32mroot = root.replace(/\/$/, "");[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mdomStylesheet.href = root + styles[styleName];[m
|
||||
[32m+[m [32mselectedstyle = styleName;[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mif (document.getElementsByClassName('styles').length != 0) {[m
|
||||
[32m+[m [32mvar styleLinks = document.getElementsByClassName('styles')[0].childNodes;[m
|
||||
[32m+[m [32mfor (var i = 0; i < styleLinks.length; i++) {[m
|
||||
[32m+[m [32mstyleLinks[i].className = '';[m
|
||||
[32m+[m [32m}[m
|
||||
}[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mif (link) {[m
|
||||
[32m+[m [32mlink.className = 'selected';[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32melse if( domStylesheet ) {[m
|
||||
[32m+[m [32mdomStylesheet.parentNode.removeChild( domStylesheet );[m
|
||||
}[m
|
||||
[m
|
||||
[31m- if (link) {[m
|
||||
[31m- link.className = 'selected';[m
|
||||
[32m+[m [32m// Fix the classes on the body tag.[m
|
||||
[32m+[m [32mvar body = document.getElementsByTagName('body')[0];[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mif( body ) {[m
|
||||
[32m+[m [32mvar bodyClasses = document.getElementsByTagName('body')[0].getAttribute('class').split(" ");[m
|
||||
[32m+[m [32mvar bodyClassesNew = [];[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mfor( i = 0; i < bodyClasses.length; ++i ) {[m
|
||||
[32m+[m [32mvar bodyClass = bodyClasses[ i ];[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32m// null class from a double-space.[m
|
||||
[32m+[m [32mif( bodyClass == "" ) {[m
|
||||
[32m+[m [32mcontinue;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mif( bodyClass.indexOf( "stylesheet-" ) == 0 ) {[m
|
||||
[32m+[m [32mcontinue;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mbodyClassesNew.push( bodyClass );[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32m// Add stylesheet-yotsuba_b at the end.[m
|
||||
[32m+[m [32mbodyClassesNew.push( "stylesheet-" + attributeName );[m
|
||||
[32m+[m [32mbody.setAttribute( 'class', bodyClassesNew.join(" ") );[m
|
||||
[32m+[m [32mbody.setAttribute( 'data-stylesheet', attributeName );[m
|
||||
}[m
|
||||
[m
|
||||
[31m- if (typeof $ != 'undefined')[m
|
||||
[32m+[m [32mif (typeof $ != 'undefined') {[m
|
||||
$(window).trigger('stylesheet', styleName);[m
|
||||
[32m+[m [32m}[m
|
||||
}[m
|
||||
[m
|
||||
[m
|
||||
[36m@@ -167,7 +204,7 @@[m [mfunction init_stylechooser() {[m
|
||||
}[m
|
||||
}[m
|
||||
}[m
|
||||
[31m- {% endraw%}[m
|
||||
[32m+[m [32m{% endraw %}[m
|
||||
{% else %}[m
|
||||
{% raw %}[m
|
||||
if (localStorage.stylesheet) {[m
|
||||
[36m@@ -185,10 +222,13 @@[m [mfunction init_stylechooser() {[m
|
||||
[m
|
||||
function get_cookie(cookie_name) {[m
|
||||
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)');[m
|
||||
[31m- if (results)[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32mif (results) {[m
|
||||
return (unescape(results[2]));[m
|
||||
[31m- else[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32melse {[m
|
||||
return null;[m
|
||||
[32m+[m [32m}[m
|
||||
}[m
|
||||
[m
|
||||
function highlightReply(id) {[m
|
||||
[1mdiff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html[m
|
||||
[1mindex 4f76625..87e67c8 100644[m
|
||||
[1m--- a/templates/mod/dashboard.html[m
|
||||
[1m+++ b/templates/mod/dashboard.html[m
|
||||
[36m@@ -1,40 +1,5 @@[m
|
||||
[31m-<fieldset>[m
|
||||
[31m- <legend>{% trans 'Boards' %}</legend>[m
|
||||
[31m- [m
|
||||
[31m- <ul>[m
|
||||
[31m- {% for board in boards %}[m
|
||||
[31m- {% if board.uri in mod.boards or mod.boards[0] == '*' %}[m
|
||||
[31m- <li>[m
|
||||
[31m- <a href="?/{{ config.board_path|sprintf(board.uri) }}{{ config.file_index }}">{{ config.board_abbreviation|sprintf(board.uri) }}</a>[m
|
||||
[31m- - [m
|
||||
[31m- {{ board.title|e }}[m
|
||||
[31m- {% if board.subtitle %}[m
|
||||
[31m- <small>— [m
|
||||
[31m- {% if config.allow_subtitle_html %}[m
|
||||
[31m- {{ board.subtitle }}[m
|
||||
[31m- {% else %}[m
|
||||
[31m- {{ board.subtitle|e }}[m
|
||||
[31m- {% endif %}[m
|
||||
[31m- </small>[m
|
||||
[31m-[m
|
||||
[31m- {% endif %}[m
|
||||
[31m- {% if mod.type == "20" %}[m
|
||||
[31m- <a href="?/settings/{{ board.uri }}"><small>[{% trans 'settings' %}]</small></a>[m
|
||||
[31m- {% endif %}[m
|
||||
[31m- {% if mod|hasPermission(config.mod.manageboards) %}[m
|
||||
[31m- <a href="?/edit/{{ board.uri }}"><small>[{% trans 'edit' %}]</small></a>[m
|
||||
[31m- {% endif %}[m
|
||||
[31m- </li>[m
|
||||
[31m- {% endif %}[m
|
||||
[31m- {% endfor %}[m
|
||||
[31m- [m
|
||||
[31m- {% if mod|hasPermission(config.mod.newboard) %}[m
|
||||
[31m- <li style="margin-top:15px"><a href="?/new-board"><strong>{% trans 'Create new board' %}</strong></a></li>[m
|
||||
[31m- {% endif %}[m
|
||||
[31m- </ul>[m
|
||||
[31m-</fieldset>[m
|
||||
[31m-[m
|
||||
[31m-<fieldset>[m
|
||||
[32m+[m[32m<!-- Messages -->[m
|
||||
[32m+[m[32m<fieldset class="mod-dash mod-dash-set mod-dash-messages">[m
|
||||
<legend>{% trans 'Messages' %}</legend>[m
|
||||
<ul>[m
|
||||
{% if mod|hasPermission(config.mod.noticeboard) %}[m
|
||||
[36m@@ -78,7 +43,8 @@[m
|
||||
</ul>[m
|
||||
</fieldset>[m
|
||||
[m
|
||||
[31m-<fieldset>[m
|
||||
[32m+[m[32m<!-- Administration -->[m
|
||||
[32m+[m[32m<fieldset class="mod-dash mod-dash-set mod-dash-messages">[m
|
||||
<legend>{% trans 'Administration' %}</legend>[m
|
||||
[m
|
||||
<ul>[m
|
||||
[36m@@ -123,57 +89,99 @@[m
|
||||
</ul>[m
|
||||
</fieldset>[m
|
||||
[m
|
||||
[32m+[m[32m<!-- Search -->[m
|
||||
{% if mod|hasPermission(config.mod.search) %}[m
|
||||
[31m- <fieldset>[m
|
||||
[31m- <legend>{% trans 'Search' %}</legend>[m
|
||||
[31m- [m
|
||||
[31m- <ul>[m
|
||||
[32m+[m[32m<fieldset class="mod-dash mod-dash-set mod-dash-search">[m
|
||||
[32m+[m [32m<legend>{% trans 'Search' %}</legend>[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32m<ul>[m
|
||||
[32m+[m [32m<li>[m
|
||||
[32m+[m [32m{% include 'mod/search_form.html' %}[m
|
||||
[32m+[m [32m</li>[m
|
||||
[32m+[m [32m</ul>[m
|
||||
[32m+[m[32m</fieldset>[m
|
||||
[32m+[m[32m{% endif %}[m
|
||||
[32m+[m
|
||||
[32m+[m[32m<!-- Boards -->[m
|
||||
[32m+[m[32m<fieldset class="mod-dash mod-dash-set mod-dash-boards">[m
|
||||
[32m+[m [32m<legend>{% trans 'Boards' %}</legend>[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32m<ul>[m
|
||||
[32m+[m [32m{% for board in boards %}[m
|
||||
[32m+[m [32m{% if board.uri in mod.boards or mod.boards[0] == '*' %}[m
|
||||
<li>[m
|
||||
[31m- {% include 'mod/search_form.html' %}[m
|
||||
[32m+[m [32m<a href="?/{{ config.board_path|sprintf(board.uri) }}{{ config.file_index }}">{{ config.board_abbreviation|sprintf(board.uri) }}</a>[m
|
||||
[32m+[m [32m -[m[41m [m
|
||||
[32m+[m [32m{{ board.title|e }}[m
|
||||
[32m+[m [32m{% if board.subtitle %}[m
|
||||
[32m+[m [32m<small>—[m[41m [m
|
||||
[32m+[m [32m{% if config.allow_subtitle_html %}[m
|
||||
[32m+[m [32m{{ board.subtitle }}[m
|
||||
[32m+[m [32m{% else %}[m
|
||||
[32m+[m [32m{{ board.subtitle|e }}[m
|
||||
[32m+[m [32m{% endif %}[m
|
||||
[32m+[m [32m</small>[m
|
||||
[32m+[m
|
||||
[32m+[m [32m{% endif %}[m
|
||||
[32m+[m [32m{% if mod.type == "20" %}[m
|
||||
[32m+[m [32m<a href="?/settings/{{ board.uri }}"><small>[{% trans 'settings' %}]</small></a>[m
|
||||
[32m+[m [32m{% endif %}[m
|
||||
[32m+[m [32m{% if mod|hasPermission(config.mod.manageboards) %}[m
|
||||
[32m+[m [32m <a href="?/edit/{{ board.uri }}"><small>[{% trans 'edit' %}]</small></a>[m
|
||||
[32m+[m [32m{% endif %}[m
|
||||
</li>[m
|
||||
[31m- </ul>[m
|
||||
[31m- </fieldset>[m
|
||||
[31m-{% endif %}[m
|
||||
[32m+[m [32m{% endif %}[m
|
||||
[32m+[m [32m{% endfor %}[m
|
||||
[32m+[m[41m [m
|
||||
[32m+[m [32m{% if mod|hasPermission(config.mod.newboard) %}[m
|
||||
[32m+[m [32m<li style="margin-top:15px"><a href="?/new-board"><strong>{% trans 'Create new board' %}</strong></a></li>[m
|
||||
[32m+[m [32m{% endif %}[m
|
||||
[32m+[m [32m</ul>[m
|
||||
[32m+[m[32m</fieldset>[m
|
||||
[m
|
||||
[32m+[m[32m<!-- Misc -->[m
|
||||
{% if config.mod.dashboard_links|count %}[m
|
||||
[31m- <fieldset>[m
|
||||
[31m- <legend>{% trans 'Other' %}</legend>[m
|
||||
[31m- [m
|
||||
[31m- <ul>[m
|
||||
[31m- {% for label,link in config.mod.dashboard_links %}[m
|
||||
[31m- <li><a href="{{ link }}">{{ label }}</a></li>[m
|
||||
[31m- {% endfor %}[m
|
||||
[31m- </ul>[m
|
||||
[31m- </fieldset>[m
|
||||
[32m+[m[32m<fieldset class="mod-dash mod-dash-set mod-dash-misc">[m
|
||||
[32m+[m [32m<legend>{% trans 'Other' %}</legend>[m
|
||||
[32m+[m
|
||||
[32m+[m [32m<ul>[m
|
||||
[32m+[m [32m{% for label,link in config.mod.dashboard_links %}[m
|
||||
[32m+[m [32m<li><a href="{{ link }}">{{ label }}</a></li>[m
|
||||
[32m+[m [32m{% endfor %}[m
|
||||
[32m+[m [32m</ul>[m
|
||||
[32m+[m[32m</fieldset>[m
|
||||
{% endif %}[m
|
||||
[m
|
||||
[32m+[m[32m<!-- Debug Information -->[m
|
||||
{% if config.debug %}[m
|
||||
[31m- <fieldset>[m
|
||||
[31m- <legend>{% trans 'Debug' %}</legend>[m
|
||||
[31m- <ul>[m
|
||||
[31m- <li><a href="?/debug/antispam">{% trans 'Anti-spam' %}</a></li>[m
|
||||
[31m- <li><a href="?/debug/recent">{% trans 'Recent posts' %}</a></li>[m
|
||||
[31m- {% if mod|hasPermission(config.mod.debug_sql) %}[m
|
||||
[31m- <li><a href="?/debug/sql">{% trans 'SQL' %}</a></li>[m
|
||||
[31m- {% endif %}[m
|
||||
[31m- </ul>[m
|
||||
[31m- </fieldset>[m
|
||||
[32m+[m[32m<fieldset class="mod-dash mod-dash-set mod-dash-debug">[m
|
||||
[32m+[m [32m<legend>{% trans 'Debug' %}</legend>[m
|
||||
[32m+[m [32m<ul>[m
|
||||
[32m+[m [32m<li><a href="?/debug/antispam">{% trans 'Anti-spam' %}</a></li>[m
|
||||
[32m+[m [32m<li><a href="?/debug/recent">{% trans 'Recent posts' %}</a></li>[m
|
||||
[32m+[m [32m{% if mod|hasPermission(config.mod.debug_sql) %}[m
|
||||
[32m+[m [32m<li><a href="?/debug/sql">{% trans 'SQL' %}</a></li>[m
|
||||
[32m+[m [32m{% endif %}[m
|
||||
[32m+[m [32m</ul>[m
|
||||
[32m+[m[32m</fieldset>[m
|
||||
{% endif %}[m
|
||||
[m
|
||||
[32m+[m[32m<!-- Update -->[m
|
||||
{% if newer_release %}[m
|
||||
[31m- <fieldset>[m
|
||||
[31m- <legend>Update</legend>[m
|
||||
[31m- <ul>[m
|
||||
[31m- <li>[m
|
||||
[31m- A newer version of Tinyboard [m
|
||||
[31m- (<strong>v{{ newer_release.massive }}.{{ newer_release.major }}.{{ newer_release.minor }}</strong>) is available! [m
|
||||
[31m- See <a href="http://tinyboard.org">http://tinyboard.org/</a> for upgrade instructions.[m
|
||||
[31m- </li>[m
|
||||
[31m- </ul>[m
|
||||
[31m- </fieldset>[m
|
||||
[32m+[m[32m<fieldset class="mod-dash mod-dash-set mod-dash-update">[m
|
||||
[32m+[m [32m<legend>Update</legend>[m
|
||||
[32m+[m [32m<ul>[m
|
||||
[32m+[m [32m<li>[m
|
||||
[32m+[m [32mA newer version of Tinyboard[m[41m [m
|
||||
[32m+[m [32m(<strong>v{{ newer_release.massive }}.{{ newer_release.major }}.{{ newer_release.minor }}</strong>) is available![m[41m [m
|
||||
[32m+[m [32mSee <a href="http://tinyboard.org">http://tinyboard.org/</a> for upgrade instructions.[m
|
||||
[32m+[m [32m</li>[m
|
||||
[32m+[m [32m</ul>[m
|
||||
[32m+[m[32m</fieldset>[m
|
||||
{% endif %}[m
|
||||
[m
|
||||
[31m-<fieldset>[m
|
||||
[32m+[m[32m<!-- Account Actions -->[m
|
||||
[32m+[m[32m<fieldset class="mod-dash mod-dash-set mod-dash-account">[m
|
||||
<legend>{% trans 'User account' %}</legend>[m
|
||||
[m
|
||||
<ul>[m
|
||||
[1mdiff --git a/templates/page.html b/templates/page.html[m
|
||||
[1mindex b136566..a3916b6 100644[m
|
||||
[1m--- a/templates/page.html[m
|
||||
[1m+++ b/templates/page.html[m
|
||||
[36m@@ -6,9 +6,10 @@[m
|
||||
active_page = "page";[m
|
||||
</script>[m
|
||||
{% include 'header.html' %}[m
|
||||
[32m+[m [32m{% if mod %}{% include 'mod/header.html' %}{% endif %}[m
|
||||
<title>{{ title }}</title>[m
|
||||
</head>[m
|
||||
[31m-<body>[m
|
||||
[32m+[m[32m<body class="8chan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %} stylesheet-{% if config.default_stylesheet.1 != '' and not mod %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}">[m
|
||||
{% 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 %}[m
|
||||
<header>[m
|
||||
<h1>{{ title }}</h1>[m
|
||||
[1mdiff --git a/templates/themes/basic/index.html b/templates/themes/basic/index.html[m
|
||||
[1mindex 3376a68..0ec18f9 100644[m
|
||||
[1m--- a/templates/themes/basic/index.html[m
|
||||
[1m+++ b/templates/themes/basic/index.html[m
|
||||
[36m@@ -11,7 +11,7 @@[m
|
||||
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %}[m
|
||||
{% if config.font_awesome %}<link rel="stylesheet" href="{{ config.root }}{{ config.font_awesome_css }}">{% endif %}[m
|
||||
</head>[m
|
||||
[31m-<body>[m
|
||||
[32m+[m[32m<body class="8chan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' and not mod %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}">[m
|
||||
{{ boardlist.top }}[m
|
||||
<header>[m
|
||||
<h1>{{ settings.title }}</h1>[m
|
||||
[1mdiff --git a/templates/thread.html b/templates/thread.html[m
|
||||
[1mindex af2a6e0..a3ace9b 100644[m
|
||||
[1m--- a/templates/thread.html[m
|
||||
[1m+++ b/templates/thread.html[m
|
||||
[36m@@ -10,7 +10,7 @@[m
|
||||
{% include 'header.html' %}[m
|
||||
<title>{{ board.url }} - {% if config.thread_subject_in_title and thread.subject %}{{ thread.subject }}{% else %}{{ board.title|e }}{% endif %}</title>[m
|
||||
</head>[m
|
||||
[31m-<body>[m
|
||||
[32m+[m[32m<body class="8chan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' and not mod %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}">[m
|
||||
{{ boardlist.top }}[m
|
||||
{% 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 %}[m
|
||||
{% if config.url_banner %}<img class="board_image" src="{{ config.url_banner }}?board={{ board.uri }}" {% 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 %}[m
|
@ -18,7 +18,7 @@
|
||||
$config['db']['user'] = 'root';
|
||||
$config['db']['password'] = '';
|
||||
$config['timezone'] = 'UTC';
|
||||
$config['cache']['enabled'] = 'apc';
|
||||
$config['cache']['enabled'] = false;
|
||||
|
||||
|
||||
$config['cookies']['mod'] = 'mod';
|
||||
|
@ -2266,6 +2266,7 @@ function mod_reports($global = false) {
|
||||
if ($mod['type'] == '20' and $global)
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
// Get REPORTS.
|
||||
$query = prepare("SELECT * FROM ``reports`` " . ($mod["type"] == "20" ? "WHERE board = :board" : "") . " ORDER BY `time` DESC LIMIT :limit");
|
||||
if ($mod['type'] == '20')
|
||||
$query->bindValue(':board', $mod['boards'][0]);
|
||||
@ -2276,10 +2277,15 @@ function mod_reports($global = false) {
|
||||
|
||||
$query->bindValue(':limit', $config['mod']['recent_reports'], PDO::PARAM_INT);
|
||||
|
||||
|
||||
$query->execute() or error(db_error($query));
|
||||
$reports = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Cut off here if we don't have any reports.
|
||||
$reportCount = 0;
|
||||
$reportHTML = '';
|
||||
if( count( $reports ) > 0 ) {
|
||||
|
||||
// Build queries to fetch content.
|
||||
$report_queries = array();
|
||||
foreach ($reports as $report) {
|
||||
if (!isset($report_queries[$report['board']]))
|
||||
@ -2287,6 +2293,7 @@ function mod_reports($global = false) {
|
||||
$report_queries[$report['board']][] = $report['post'];
|
||||
}
|
||||
|
||||
// Get reported CONTENT.
|
||||
$report_posts = array();
|
||||
foreach ($report_queries as $board => $posts) {
|
||||
$report_posts[$board] = array();
|
||||
@ -2297,11 +2304,13 @@ function mod_reports($global = false) {
|
||||
}
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$body = '';
|
||||
foreach ($reports as $report) {
|
||||
if (!isset($report_posts[$report['board']][$report['post']])) {
|
||||
// // Invalid report (post has since been deleted)
|
||||
// Develop an associative array of posts to reports.
|
||||
$report_index = array();
|
||||
foreach( $reports as &$report ) {
|
||||
|
||||
// Delete reports which are for removed content.
|
||||
if( !isset( $report_posts[ $report['board'] ][ $report['post'] ] ) ) {
|
||||
// Invalid report (post has since been deleted)
|
||||
$query = prepare("DELETE FROM ``reports`` WHERE `post` = :id AND `board` = :board");
|
||||
$query->bindValue(':id', $report['post'], PDO::PARAM_INT);
|
||||
$query->bindValue(':board', $report['board']);
|
||||
@ -2309,19 +2318,68 @@ function mod_reports($global = false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
openBoard($report['board']);
|
||||
// Build a unique ID.
|
||||
$content_key = "{$report['board']}.{$report['post']}";
|
||||
|
||||
$post = &$report_posts[$report['board']][$report['post']];
|
||||
|
||||
if (!$post['thread']) {
|
||||
// Still need to fix this:
|
||||
$po = new Thread($post, '?/', $mod, false);
|
||||
} else {
|
||||
$po = new Post($post, '?/', $mod);
|
||||
// Create a dummy array if it doesn't already exist.
|
||||
if( !isset( $report_index[ $content_key ] ) ) {
|
||||
$report_index[ $content_key ] = array(
|
||||
"board_id" => $report['board'],
|
||||
"post_id" => $report['post'],
|
||||
"content" => &$report_posts[ $report['board'] ][ $report['post'] ],
|
||||
"reports" => array(),
|
||||
);
|
||||
}
|
||||
|
||||
// a little messy and inefficient
|
||||
$append_html = Element('mod/report.html', array(
|
||||
// Add the report to the list of reports.
|
||||
$report_index[ $content_key ]['reports'][ $report['id'] ] = &$report;
|
||||
|
||||
// Increment the total report count.
|
||||
++$reportCount;
|
||||
}
|
||||
|
||||
|
||||
// Only continue if we have something to do.
|
||||
// If there are no valid reports left, we're done.
|
||||
if( $reportCount > 0 ) {
|
||||
|
||||
// Sort this report index by number of reports, desc.
|
||||
usort( $report_index, function( $a, $b ) {
|
||||
$ra = $a['reports'];
|
||||
$rb = $b['reports'];
|
||||
|
||||
if( $ra < $rb ) {
|
||||
return 1;
|
||||
}
|
||||
else if( $rb > $ra ) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
} );
|
||||
|
||||
// Loop through the custom index.
|
||||
foreach( $report_index as &$report_item ) {
|
||||
$content = $report_item['content'];
|
||||
|
||||
// Load board content.
|
||||
openBoard($report_item['board_id']);
|
||||
|
||||
// Load the reported content.
|
||||
if( !$content['thread'] ) {
|
||||
// Still need to fix this:
|
||||
$po = new Thread($content, '?/', $mod, false);
|
||||
}
|
||||
else {
|
||||
$po = new Post($content, '?/', $mod);
|
||||
}
|
||||
|
||||
// Add each report's template to this container.
|
||||
$report_html = "";
|
||||
$content_reports = 0;
|
||||
foreach( $report_item['reports'] as $report ) {
|
||||
$report_html .= Element('mod/report.html', array(
|
||||
'report' => $report,
|
||||
'config' => $config,
|
||||
'mod' => $mod,
|
||||
@ -2329,26 +2387,43 @@ function mod_reports($global = false) {
|
||||
'token_all' => make_secure_link_token('reports/' . $report['id'] . '/dismissall')
|
||||
));
|
||||
|
||||
// Bug fix for https://github.com/savetheinternet/Tinyboard/issues/21
|
||||
$po->body = truncate($po->body, $po->link(), $config['body_truncate'] - substr_count($append_html, '<br>'));
|
||||
|
||||
if (mb_strlen($po->body) + mb_strlen($append_html) > $config['body_truncate_char']) {
|
||||
// still too long; temporarily increase limit in the config
|
||||
$__old_body_truncate_char = $config['body_truncate_char'];
|
||||
$config['body_truncate_char'] = mb_strlen($po->body) + mb_strlen($append_html);
|
||||
++$content_reports;
|
||||
}
|
||||
|
||||
$po->body .= $append_html;
|
||||
// Build the ">>>/b/ thread reported 3 times" title.
|
||||
$report_title = sprintf(
|
||||
_('<a href="%s" title="View content" target="_new">>>>/%s/</a> %s reported %d time(s).'),
|
||||
"?/{$report_item['board_id']}/res/" . ( $content['thread'] ?: $content['id'] ) . ".html#{$content['thread']}",
|
||||
$report_item['board_id'],
|
||||
_( $content['thread'] ? "reply" : "thread" ),
|
||||
$content_reports
|
||||
);
|
||||
|
||||
$body .= $po->build(true) . '<hr>';
|
||||
$content_html = Element('mod/report_content.html', array(
|
||||
'reports_html' => $report_html,
|
||||
'report_count' => $content_reports,
|
||||
|
||||
if (isset($__old_body_truncate_char))
|
||||
$config['body_truncate_char'] = $__old_body_truncate_char;
|
||||
'content_html' => $po->build(true),
|
||||
'content_board' => $report_item['board_id'],
|
||||
'content' => $content,
|
||||
|
||||
$count++;
|
||||
'config' => $config,
|
||||
'mod' => $mod,
|
||||
'report_title' => $report_title,
|
||||
));
|
||||
|
||||
$reportHTML .= $content_html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mod_page(sprintf('%s (%d)', _('Report queue'), $count), 'mod/reports.html', array('reports' => $body, 'count' => $count));
|
||||
$pageArgs = array(
|
||||
'count' => $reportCount,
|
||||
'reports' => $reportHTML,
|
||||
'global' => $global,
|
||||
);
|
||||
|
||||
mod_page( sprintf('%s (%d)', _( ( $global ? 'Global report queue' : 'Report queue' ) ), $reportCount), 'mod/reports.html', $pageArgs );
|
||||
}
|
||||
|
||||
function mod_report_dismiss($id, $all = false) {
|
||||
@ -2361,7 +2436,8 @@ function mod_report_dismiss($id, $all = false) {
|
||||
$ip = $report['ip'];
|
||||
$board = $report['board'];
|
||||
$post = $report['post'];
|
||||
} else
|
||||
}
|
||||
else
|
||||
error($config['error']['404']);
|
||||
|
||||
if (!$all && !hasPermission($config['mod']['report_dismiss'], $board))
|
||||
|
32
install.php
32
install.php
@ -579,7 +579,8 @@ if ($step == 0) {
|
||||
</p>';
|
||||
|
||||
echo Element('page.html', $page);
|
||||
} elseif ($step == 1) {
|
||||
}
|
||||
elseif ($step == 1) {
|
||||
$page['title'] = 'Pre-installation test';
|
||||
|
||||
$can_exec = true;
|
||||
@ -761,7 +762,8 @@ if ($step == 0) {
|
||||
'title' => 'Checking environment',
|
||||
'config' => $config
|
||||
));
|
||||
} elseif ($step == 2) {
|
||||
}
|
||||
elseif ($step == 2) {
|
||||
// Basic config
|
||||
$page['title'] = 'Configuration';
|
||||
|
||||
@ -775,7 +777,8 @@ if ($step == 0) {
|
||||
'title' => 'Configuration',
|
||||
'config' => $config
|
||||
));
|
||||
} elseif ($step == 3) {
|
||||
}
|
||||
elseif ($step == 3) {
|
||||
$instance_config =
|
||||
'<?php
|
||||
|
||||
@ -814,7 +817,8 @@ if ($step == 0) {
|
||||
|
||||
if (@file_put_contents('inc/instance-config.php', $instance_config)) {
|
||||
header('Location: ?step=4', true, $config['redirect_http']);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$page['title'] = 'Manual installation required';
|
||||
$page['body'] = '
|
||||
<p>I couldn\'t write to <strong>inc/instance-config.php</strong> with the new configuration, probably due to a permissions error.</p>
|
||||
@ -826,7 +830,8 @@ if ($step == 0) {
|
||||
';
|
||||
echo Element('page.html', $page);
|
||||
}
|
||||
} elseif ($step == 4) {
|
||||
}
|
||||
elseif ($step == 4) {
|
||||
// SQL installation
|
||||
|
||||
buildJavascript();
|
||||
@ -846,19 +851,24 @@ if ($step == 0) {
|
||||
|
||||
$sql_errors = '';
|
||||
foreach ($queries as $query) {
|
||||
if ($mysql_version < 50503)
|
||||
if ($mysql_version < 50503) {
|
||||
$query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query);
|
||||
}
|
||||
|
||||
$query = preg_replace('/^([\w\s]*)`([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)`/u', '$1``$2``', $query);
|
||||
if (!query($query))
|
||||
|
||||
if (!query($query)) {
|
||||
$sql_errors .= '<li>' . db_error() . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$page['title'] = 'Installation complete';
|
||||
$page['body'] = '<p style="text-align:center">Thank you for using vichan. Please remember to report any bugs you discover. <a href="http://tinyboard.org/docs/?p=Config">How do I edit the config files?</a></p>';
|
||||
|
||||
if (!empty($sql_errors)) {
|
||||
$page['body'] .= '<div class="ban"><h2>SQL errors</h2><p>SQL errors were encountered when trying to install the database. This may be the result of using a database which is already occupied with a vichan installation; if so, you can probably ignore this.</p><p>The errors encountered were:</p><ul>' . $sql_errors . '</ul><p><a href="?step=5">Ignore errors and complete installation.</a></p></div>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$boards = listBoards();
|
||||
foreach ($boards as &$_board) {
|
||||
setupBoard($_board);
|
||||
@ -866,13 +876,11 @@ if ($step == 0) {
|
||||
}
|
||||
|
||||
file_write($config['has_installed'], VERSION);
|
||||
/*if (!file_unlink(__FILE__)) {
|
||||
$page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
|
||||
}*/
|
||||
}
|
||||
|
||||
echo Element('page.html', $page);
|
||||
} elseif ($step == 5) {
|
||||
}
|
||||
elseif ($step == 5) {
|
||||
$page['title'] = 'Installation complete';
|
||||
$page['body'] = '<p style="text-align:center">Thank you for using vichan. Please remember to report any bugs you discover.</p>';
|
||||
|
||||
|
@ -658,7 +658,7 @@ pre {
|
||||
margin-left: -20px;
|
||||
}
|
||||
|
||||
div.thread:hover {
|
||||
.theme-catalog div.thread:hover {
|
||||
background: #D6DAF0;
|
||||
border-color: #B7C5D9;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="8chan index">
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<title>{{ board.url }} - {{ board.name }}</title>
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<body class="8chan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' and not mod %}{{ 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 %}
|
||||
|
@ -14,7 +14,7 @@
|
||||
{% include 'header.html' %}
|
||||
<title>{{ board.url }} - {{ board.title|e }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<body class="8chan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' and not mod %}{{ 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 %}
|
||||
|
@ -73,11 +73,6 @@ var saved = {};
|
||||
|
||||
|
||||
var selectedstyle = '{% endraw %}{{ config.default_stylesheet.0|addslashes }}{% raw %}';
|
||||
/*var styles = {
|
||||
{% endraw %}
|
||||
{% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',
|
||||
{% endraw %}{% endfor %}{% raw %}
|
||||
};*/
|
||||
var board_name = false;
|
||||
|
||||
function changeStyle(styleName, link) {
|
||||
@ -92,21 +87,30 @@ function changeStyle(styleName, link) {
|
||||
{% endif %}
|
||||
{% raw %}
|
||||
|
||||
if (!document.getElementById('stylesheet')) {
|
||||
var s = document.createElement('link');
|
||||
s.rel = 'stylesheet';
|
||||
s.type = 'text/css';
|
||||
s.id = 'stylesheet';
|
||||
// Find the <dom> for the stylesheet. May be nothing.
|
||||
var domStylesheet = document.getElementById('stylesheet');
|
||||
// Determine if this stylesheet is the default.
|
||||
var setToDefault = ( styles[styleName] == "" || styles[styleName] == "/stylesheets/" );
|
||||
// Turn "Yotsuba B" to "yotsuba_b"
|
||||
var attributeName = styleName.replace(/[^a-z0-9_\-]/gi, '_').toLowerCase();
|
||||
|
||||
if( !domStylesheet && !setToDefault ) {
|
||||
domStylesheet = document.createElement('link');
|
||||
domStylesheet.rel = 'stylesheet';
|
||||
domStylesheet.type = 'text/css';
|
||||
domStylesheet.id = 'stylesheet';
|
||||
|
||||
var x = document.getElementsByTagName('head')[0];
|
||||
x.appendChild(s);
|
||||
x.appendChild(domStylesheet);
|
||||
}
|
||||
|
||||
if( !setToDefault ) {
|
||||
{% endraw %}
|
||||
var root = "{{ config.root }}";
|
||||
{% raw %}
|
||||
root = root.replace(/\/$/, "");
|
||||
|
||||
document.getElementById('stylesheet').href = root + styles[styleName];
|
||||
domStylesheet.href = root + styles[styleName];
|
||||
selectedstyle = styleName;
|
||||
|
||||
if (document.getElementsByClassName('styles').length != 0) {
|
||||
@ -119,9 +123,42 @@ function changeStyle(styleName, link) {
|
||||
if (link) {
|
||||
link.className = 'selected';
|
||||
}
|
||||
}
|
||||
else if( domStylesheet ) {
|
||||
domStylesheet.parentNode.removeChild( domStylesheet );
|
||||
}
|
||||
|
||||
if (typeof $ != 'undefined')
|
||||
// Fix the classes on the body tag.
|
||||
var body = document.getElementsByTagName('body')[0];
|
||||
|
||||
if( body ) {
|
||||
var bodyClasses = document.getElementsByTagName('body')[0].getAttribute('class').split(" ");
|
||||
var bodyClassesNew = [];
|
||||
|
||||
for( i = 0; i < bodyClasses.length; ++i ) {
|
||||
var bodyClass = bodyClasses[ i ];
|
||||
|
||||
// null class from a double-space.
|
||||
if( bodyClass == "" ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( bodyClass.indexOf( "stylesheet-" ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bodyClassesNew.push( bodyClass );
|
||||
}
|
||||
|
||||
// Add stylesheet-yotsuba_b at the end.
|
||||
bodyClassesNew.push( "stylesheet-" + attributeName );
|
||||
body.setAttribute( 'class', bodyClassesNew.join(" ") );
|
||||
body.setAttribute( 'data-stylesheet', attributeName );
|
||||
}
|
||||
|
||||
if (typeof $ != 'undefined') {
|
||||
$(window).trigger('stylesheet', styleName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -167,7 +204,7 @@ function init_stylechooser() {
|
||||
}
|
||||
}
|
||||
}
|
||||
{% endraw%}
|
||||
{% endraw %}
|
||||
{% else %}
|
||||
{% raw %}
|
||||
if (localStorage.stylesheet) {
|
||||
@ -185,10 +222,13 @@ function init_stylechooser() {
|
||||
|
||||
function get_cookie(cookie_name) {
|
||||
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
|
||||
if (results)
|
||||
|
||||
if (results) {
|
||||
return (unescape(results[2]));
|
||||
else
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function highlightReply(id) {
|
||||
|
@ -1,40 +1,5 @@
|
||||
<fieldset>
|
||||
<legend>{% trans 'Boards' %}</legend>
|
||||
|
||||
<ul>
|
||||
{% for board in boards %}
|
||||
{% if board.uri in mod.boards or mod.boards[0] == '*' %}
|
||||
<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.type == "20" %}
|
||||
<a href="?/settings/{{ board.uri }}"><small>[{% trans 'settings' %}]</small></a>
|
||||
{% endif %}
|
||||
{% if mod|hasPermission(config.mod.manageboards) %}
|
||||
<a href="?/edit/{{ board.uri }}"><small>[{% trans 'edit' %}]</small></a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% 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>
|
||||
<!-- Messages -->
|
||||
<fieldset class="mod-dash mod-dash-set mod-dash-messages">
|
||||
<legend>{% trans 'Messages' %}</legend>
|
||||
<ul>
|
||||
{% if mod|hasPermission(config.mod.noticeboard) %}
|
||||
@ -78,7 +43,8 @@
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<!-- Administration -->
|
||||
<fieldset class="mod-dash mod-dash-set mod-dash-messages">
|
||||
<legend>{% trans 'Administration' %}</legend>
|
||||
|
||||
<ul>
|
||||
@ -123,8 +89,9 @@
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
<!-- Search -->
|
||||
{% if mod|hasPermission(config.mod.search) %}
|
||||
<fieldset>
|
||||
<fieldset class="mod-dash mod-dash-set mod-dash-search">
|
||||
<legend>{% trans 'Search' %}</legend>
|
||||
|
||||
<ul>
|
||||
@ -132,11 +99,49 @@
|
||||
{% include 'mod/search_form.html' %}
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
|
||||
<!-- Boards -->
|
||||
<fieldset class="mod-dash mod-dash-set mod-dash-boards">
|
||||
<legend>{% trans 'Boards' %}</legend>
|
||||
|
||||
<ul>
|
||||
{% for board in boards %}
|
||||
{% if board.uri in mod.boards or mod.boards[0] == '*' %}
|
||||
<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.type == "20" %}
|
||||
<a href="?/settings/{{ board.uri }}"><small>[{% trans 'settings' %}]</small></a>
|
||||
{% endif %}
|
||||
{% if mod|hasPermission(config.mod.manageboards) %}
|
||||
<a href="?/edit/{{ board.uri }}"><small>[{% trans 'edit' %}]</small></a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% 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>
|
||||
|
||||
<!-- Misc -->
|
||||
{% if config.mod.dashboard_links|count %}
|
||||
<fieldset>
|
||||
<fieldset class="mod-dash mod-dash-set mod-dash-misc">
|
||||
<legend>{% trans 'Other' %}</legend>
|
||||
|
||||
<ul>
|
||||
@ -144,11 +149,12 @@
|
||||
<li><a href="{{ link }}">{{ label }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
|
||||
<!-- Debug Information -->
|
||||
{% if config.debug %}
|
||||
<fieldset>
|
||||
<fieldset class="mod-dash mod-dash-set mod-dash-debug">
|
||||
<legend>{% trans 'Debug' %}</legend>
|
||||
<ul>
|
||||
<li><a href="?/debug/antispam">{% trans 'Anti-spam' %}</a></li>
|
||||
@ -157,11 +163,12 @@
|
||||
<li><a href="?/debug/sql">{% trans 'SQL' %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
|
||||
<!-- Update -->
|
||||
{% if newer_release %}
|
||||
<fieldset>
|
||||
<fieldset class="mod-dash mod-dash-set mod-dash-update">
|
||||
<legend>Update</legend>
|
||||
<ul>
|
||||
<li>
|
||||
@ -170,10 +177,11 @@
|
||||
See <a href="http://tinyboard.org">http://tinyboard.org/</a> for upgrade instructions.
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
{% endif %}
|
||||
|
||||
<fieldset>
|
||||
<!-- Account Actions -->
|
||||
<fieldset class="mod-dash mod-dash-set mod-dash-account">
|
||||
<legend>{% trans 'User account' %}</legend>
|
||||
|
||||
<ul>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="report">
|
||||
<hr>
|
||||
<li class="report-item">
|
||||
<div class="report">
|
||||
{% trans 'Board' %}: <a href="?/{{ report.board }}/{{ config.file_index }}">{{ config.board_abbreviation|sprintf(report.board) }}</a>
|
||||
<br>
|
||||
{% trans 'Reason' %}: {{ report.reason }}
|
||||
@ -22,5 +22,5 @@
|
||||
<a title="{% trans 'Discard all abuse reports by this IP address' %}" href="?/reports/{{ report.id }}/dismissall/{{ token_all }}">Dismiss+</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</li>
|
@ -1,5 +1,7 @@
|
||||
{% if reports %}
|
||||
<ul class="mod-reports reports-global">
|
||||
{{ reports }}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p style="text-align:center" class="unimportant">({% trans 'There are no reports.' %})</p>
|
||||
{% endif %}
|
||||
|
@ -6,9 +6,10 @@
|
||||
active_page = "page";
|
||||
</script>
|
||||
{% include 'header.html' %}
|
||||
{% if mod %}{% include 'mod/header.html' %}{% endif %}
|
||||
<title>{{ title }}</title>
|
||||
</head>
|
||||
<body>
|
||||
<body class="8chan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %} stylesheet-{% if config.default_stylesheet.1 != '' and not mod %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}">
|
||||
{% 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>
|
||||
|
@ -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' %}
|
||||
|
@ -11,7 +11,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 {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' and not mod %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}">
|
||||
{{ boardlist.top }}
|
||||
<header>
|
||||
<h1>{{ settings.title }}</h1>
|
||||
|
@ -10,7 +10,7 @@
|
||||
{% include 'header.html' %}
|
||||
<title>{{ board.url }} - {% if config.thread_subject_in_title and thread.subject %}{{ thread.subject }}{% else %}{{ board.title|e }}{% endif %}</title>
|
||||
</head>
|
||||
<body>
|
||||
<body class="8chan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' and not mod %}{{ 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="board_image" src="{{ config.url_banner }}?board={{ board.uri }}" {% 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 %}
|
||||
|
Loading…
Reference in New Issue
Block a user