mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-25 07:50:23 +01:00
Fix custom stylesheets & fix bug where couldn't post if previously banned
This commit is contained in:
parent
7201c38567
commit
f508db9e4c
@ -198,7 +198,7 @@ class Bans {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($mod['boards'][0] != '*' && !in_array($ban['board'], $mod['boards']))
|
||||
if ($mod && $mod['boards'][0] != '*' && !in_array($ban['board'], $mod['boards']))
|
||||
error($config['error']['noaccess']);
|
||||
|
||||
if ($modlog) {
|
||||
|
@ -64,7 +64,7 @@
|
||||
{% endraw %}
|
||||
{% for name, uri in config.stylesheets %}{% raw %}'{% endraw %}{{ name|addslashes }}{% raw %}' : '{% endraw %}/stylesheets/{{ uri|addslashes }}{% raw %}',
|
||||
{% endraw %}{% endfor %}{% raw %}
|
||||
};
|
||||
}; onready(init);
|
||||
{% endraw %}</script>
|
||||
|
||||
<script type="text/javascript">{% raw %}
|
||||
|
@ -74,9 +74,27 @@ function changeStyle(styleName, link) {
|
||||
|
||||
|
||||
{% endraw %}
|
||||
|
||||
function init_stylechooser() {
|
||||
var newElement = document.createElement('div');
|
||||
newElement.className = 'styles';
|
||||
|
||||
for (styleName in styles) {
|
||||
var style = document.createElement('a');
|
||||
style.innerHTML = '[' + styleName + ']';
|
||||
style.onclick = function() {
|
||||
changeStyle(this.innerHTML.substring(1, this.innerHTML.length - 1), this);
|
||||
};
|
||||
if (styleName == selectedstyle) {
|
||||
style.className = 'selected';
|
||||
}
|
||||
style.href = 'javascript:void(0);';
|
||||
newElement.appendChild(style);
|
||||
}
|
||||
|
||||
document.getElementsByTagName('body')[0].insertBefore(newElement, document.getElementsByTagName('body')[0].lastChild.nextSibling);
|
||||
{% if config.stylesheets_board %}
|
||||
{# This is such an unacceptable mess. There needs to be an easier way. #}
|
||||
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];
|
||||
@ -86,7 +104,6 @@ function changeStyle(styleName, link) {
|
||||
localStorage.board_stylesheets = '{}';
|
||||
}
|
||||
|
||||
var stylesheet_choices = JSON.parse(localStorage.board_stylesheets);
|
||||
if (board_name && stylesheet_choices[board_name]) {
|
||||
for (var styleName in styles) {
|
||||
if (styleName == stylesheet_choices[board_name]) {
|
||||
@ -109,27 +126,13 @@ function changeStyle(styleName, link) {
|
||||
{% endraw %}
|
||||
{% endif %}
|
||||
{% raw %}
|
||||
|
||||
function init_stylechooser() {
|
||||
var newElement = document.createElement('div');
|
||||
newElement.className = 'styles';
|
||||
|
||||
for (styleName in styles) {
|
||||
var style = document.createElement('a');
|
||||
style.innerHTML = '[' + styleName + ']';
|
||||
style.onclick = function() {
|
||||
changeStyle(this.innerHTML.substring(1, this.innerHTML.length - 1), this);
|
||||
};
|
||||
if (styleName == selectedstyle) {
|
||||
style.className = 'selected';
|
||||
}
|
||||
style.href = 'javascript:void(0);';
|
||||
newElement.appendChild(style);
|
||||
}
|
||||
|
||||
document.getElementsByTagName('body')[0].insertBefore(newElement, document.getElementsByTagName('body')[0].lastChild.nextSibling);
|
||||
}
|
||||
|
||||
var stylesheet_choices = JSON.parse(localStorage.board_stylesheets); {% endraw %}
|
||||
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 %}
|
||||
|
||||
function get_cookie(cookie_name) {
|
||||
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
|
||||
if (results)
|
||||
@ -286,8 +289,6 @@ function ready() {
|
||||
}
|
||||
}
|
||||
|
||||
onready(init);
|
||||
|
||||
{% endraw %}{% if config.google_analytics %}{% raw %}
|
||||
|
||||
var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endraw %}{{ config.google_analytics }}{% raw %}']);{% endraw %}{% if config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', '{% endraw %}{{ config.google_analytics_domain }}{% raw %}']){% endraw %}{% endif %}{% if not config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', 'none']){% endraw %}{% endif %}{% raw %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endraw %}{% endif %}
|
||||
|
@ -47,7 +47,7 @@
|
||||
{% endraw %}
|
||||
{% for name, uri in config.stylesheets %}{% raw %}'{% endraw %}{{ name|addslashes }}{% raw %}' : '{% endraw %}/stylesheets/{{ uri|addslashes }}{% raw %}',
|
||||
{% endraw %}{% endfor %}{% raw %}
|
||||
};
|
||||
}; onready(init);
|
||||
{% endraw %}</script>
|
||||
|
||||
<script type="text/javascript">{% raw %}
|
||||
|
Loading…
Reference in New Issue
Block a user