Merge branch 'master' of github.com:vichan-devel/Tinyboard
This commit is contained in:
commit
7e8bf0ec49
@ -123,12 +123,12 @@ class Bans {
|
||||
$query = prepare('SELECT ``bans``.*' . ($get_mod_info ? ', `username`' : '') . ' FROM ``bans``
|
||||
' . ($get_mod_info ? 'LEFT JOIN ``mods`` ON ``mods``.`id` = `creator`' : '') . '
|
||||
WHERE
|
||||
(' . ($board ? '(`board` IS NULL OR `board` = :board) AND' : '') . '
|
||||
(' . ($board !== false ? '(`board` IS NULL OR `board` = :board) AND' : '') . '
|
||||
(`ipstart` = :ip OR (:ip >= `ipstart` AND :ip <= `ipend`)))
|
||||
ORDER BY `expires` IS NULL, `expires` DESC');
|
||||
|
||||
if ($board)
|
||||
$query->bindValue(':board', $board);
|
||||
if ($board !== false)
|
||||
$query->bindValue(':board', $board, PDO::PARAM_STR);
|
||||
|
||||
$query->bindValue(':ip', inet_pton($ip));
|
||||
$query->execute() or error(db_error($query));
|
||||
|
@ -274,6 +274,7 @@
|
||||
'file_url',
|
||||
'json_response',
|
||||
'user_flag',
|
||||
'no_country'
|
||||
);
|
||||
|
||||
// Enable reCaptcha to make spam even harder. Rarely necessary.
|
||||
@ -531,6 +532,9 @@
|
||||
// Attach country flags to posts.
|
||||
$config['country_flags'] = false;
|
||||
|
||||
// Allow the user to decide whether or not he wants to display his country
|
||||
$config['allow_no_country'] = false;
|
||||
|
||||
// Load all country flags from one file
|
||||
$config['country_flags_condensed'] = true;
|
||||
$config['country_flags_condensed_css'] = 'static/flags/flags.css';
|
||||
|
75
js/favorites.js
Normal file
75
js/favorites.js
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* favorites.js - Allow user to favorite boards and put them in the bar
|
||||
*
|
||||
* Copyright (c) 2014 Fredrick Brennan <admin@8chan.co>
|
||||
*
|
||||
* Usage:
|
||||
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
||||
* $config['additional_javascript'][] = 'js/favorites.js';
|
||||
*/
|
||||
|
||||
if (!localStorage.favorites) {
|
||||
localStorage.favorites = '[]';
|
||||
}
|
||||
|
||||
function favorite(board) {
|
||||
var favorites = JSON.parse(localStorage.favorites);
|
||||
favorites.push(board);
|
||||
localStorage.favorites = JSON.stringify(favorites);
|
||||
};
|
||||
|
||||
function unfavorite(board) {
|
||||
var favorites = JSON.parse(localStorage.favorites);
|
||||
var index = $.inArray(board, favorites);
|
||||
if (~index) {
|
||||
favorites.splice(index, 1);
|
||||
}
|
||||
localStorage.favorites = JSON.stringify(favorites);
|
||||
};
|
||||
|
||||
function handle_boards(data) {
|
||||
var boards = new Array();
|
||||
data = JSON.parse(data);
|
||||
|
||||
$.each(data, function(k, v) {
|
||||
boards.push('<a href="/'+v+'">'+v+'</a>');
|
||||
})
|
||||
|
||||
if (boards[0]) {
|
||||
return $('<span class="favorite-boards"></span>').append(' [ '+boards.slice(0,10).join(" / ")+' ] ');
|
||||
}
|
||||
}
|
||||
|
||||
function add_favorites() {
|
||||
$('.favorite-boards').remove();
|
||||
|
||||
var boards = handle_boards(localStorage.favorites);
|
||||
|
||||
$('.boardlist').append(boards);
|
||||
};
|
||||
|
||||
if (active_page == 'thread' || active_page == 'index') {
|
||||
$(document).ready(function(){
|
||||
var favorites = JSON.parse(localStorage.favorites);
|
||||
var is_board_favorite = ~$.inArray(board_name, favorites);
|
||||
console.log(is_board_favorite);
|
||||
|
||||
$('header>h1').append('<a id="favorite-star" href="#" data-active="'+(is_board_favorite ? 'true' : 'false')+'" style="color: '+(is_board_favorite ? 'yellow' : 'grey')+'; text-decoration:none">\u2605</span>');
|
||||
add_favorites();
|
||||
|
||||
$('#favorite-star').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
if (!$(this).data('active')) {
|
||||
favorite(board_name);
|
||||
add_favorites();
|
||||
$(this).css('color', 'yellow');
|
||||
$(this).data('active', true);
|
||||
} else {
|
||||
unfavorite(board_name);
|
||||
add_favorites();
|
||||
$(this).css('color', 'grey');
|
||||
$(this).data('active', false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
@ -266,6 +266,8 @@
|
||||
$postForm.find('input[type="file"]').parent()
|
||||
.removeAttr('colspan')
|
||||
.after($('<td class="spoiler"></td>').append(this, ' ', $('<label for="q-spoiler-image">').text(_('Spoiler Image'))));
|
||||
} else if ($(this).attr('name') == 'no_country') {
|
||||
$td.find('label,input[type="checkbox"]').remove();
|
||||
} else {
|
||||
$(tr).remove();
|
||||
}
|
||||
|
2
post.php
2
post.php
@ -487,7 +487,7 @@ if (isset($_POST['delete'])) {
|
||||
$post['body'] .= "\n<tinyboard raw html>1</tinyboard>";
|
||||
}
|
||||
|
||||
if ($config['country_flags']) {
|
||||
if (($config['country_flags'] && !$config['allow_no_country']) || ($config['country_flags'] && $config['allow_no_country'] && !isset($_POST['no_country']))) {
|
||||
require 'inc/lib/geoip/geoip.inc';
|
||||
$gi=geoip\geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD);
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
{{ antibot.html() }}
|
||||
</th>
|
||||
<td>
|
||||
<input type="text" name="name" size="25" maxlength="35" autocomplete="off">
|
||||
<input type="text" name="name" size="25" maxlength="35" autocomplete="off"> {% if config.allow_no_country and config.country_flags %}<input id="no_country" name="no_country" type="checkbox"> <label for="no_country">{% trans %}Don't show my flag{% endtrans %}</label>{% endif %}
|
||||
{{ antibot.html() }}
|
||||
</td>
|
||||
</tr>{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user