forked from GithubBackups/vichan
Featured boards now based on uniques
This commit is contained in:
parent
6d19be38e3
commit
345e5aa3a4
@ -22,7 +22,7 @@ foreach ($boards as $i => $board) {
|
||||
SELECT MAX(id) max, (SELECT COUNT(*) FROM ``posts_%s`` WHERE FROM_UNIXTIME(time) > DATE_SUB(NOW(), INTERVAL 1 DAY)) ppd,
|
||||
(SELECT COUNT(*) FROM ``posts_%s`` WHERE FROM_UNIXTIME(time) > DATE_SUB(NOW(), INTERVAL 1 HOUR)) pph,
|
||||
(SELECT count(id) FROM ``posts_%s``) count,
|
||||
(SELECT COUNT(DISTINCT ip) FROM ``posts_%s``) uniq_ip
|
||||
(SELECT COUNT(DISTINCT ip) FROM ``posts_%s`` WHERE FROM_UNIXTIME(time) > DATE_SUB(NOW(), INTERVAL 3 DAY)) uniq_ip
|
||||
FROM ``posts_%s``
|
||||
", $board['uri'], $board['uri'], $board['uri'], $board['uri'], $board['uri']));
|
||||
$query->execute() or error(db_error($query));
|
||||
@ -42,7 +42,7 @@ SELECT MAX(id) max, (SELECT COUNT(*) FROM ``posts_%s`` WHERE FROM_UNIXTIME(time)
|
||||
|
||||
usort($boards,
|
||||
function ($a, $b) {
|
||||
$x = $b['ppd'] - $a['ppd'];
|
||||
$x = $b['uniq_ip'] - $a['uniq_ip'];
|
||||
if ($x) { return $x;
|
||||
//} else { return strcmp($a['uri'], $b['uri']); }
|
||||
} else { return $b['max'] - $a['max']; }
|
||||
|
@ -97,6 +97,7 @@
|
||||
$config['additional_javascript'][] = 'js/style-select.js';
|
||||
$config['additional_javascript'][] = 'js/options/general.js';
|
||||
$config['additional_javascript'][] = 'js/post-hover.js';
|
||||
$config['additional_javascript'][] = 'js/update_boards.js';
|
||||
$config['additional_javascript'][] = 'js/favorites.js';
|
||||
$config['additional_javascript'][] = 'js/show-op.js';
|
||||
$config['additional_javascript'][] = 'js/hide-threads.js';
|
||||
@ -137,7 +138,8 @@
|
||||
$config['markup'][] = array("/\[spoiler\](.+?)\[\/spoiler\]/", "<span class=\"spoiler\">\$1</span>");
|
||||
$config['markup'][] = array("/~~(.+?)~~/", "<s>\$1</s>");
|
||||
|
||||
$config['boards'] = array(array('<i class="fa fa-home" title="Home"></i>' => '/', '<i class="fa fa-tags" title="Boards"></i>' => '/boards.html', '<i class="fa fa-question" title="FAQ"></i>' => '/faq.html', '<i class="fa fa-random" title="Random"></i>' => '/random.php', '<i class="fa fa-plus" title="New board"></i>' => '/create.php', '<i class="fa fa-search" title="Search"></i>' => '/search.php', '<i class="fa fa-cog" title="Manage board"></i>' => '/mod.php', '<i class="fa fa-quote-right" title="Chat"></i>' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta', 'int'), array('v', 'a', 'tg', 'fit', 'pol', 'tech', 'mu', 'co', 'sp', 'boards'), array('<i class="fa fa-twitter" title="Twitter"></i>'=>'https://twitter.com/infinitechan'));
|
||||
$config['boards'] = array(array('<i class="fa fa-home" title="Home"></i>' => '/', '<i class="fa fa-tags" title="Boards"></i>' => '/boards.html', '<i class="fa fa-question" title="FAQ"></i>' => '/faq.html', '<i class="fa fa-random" title="Random"></i>' => '/random.php', '<i class="fa fa-plus" title="New board"></i>' => '/create.php', '<i class="fa fa-search" title="Search"></i>' => '/search.php', '<i class="fa fa-cog" title="Manage board"></i>' => '/mod.php', '<i class="fa fa-quote-right" title="Chat"></i>' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta', 'int'), array('<i class="fa fa-twitter" title="Twitter"></i>'=>'https://twitter.com/infinitechan'));
|
||||
//$config['boards'] = array(array('<i class="fa fa-home" title="Home"></i>' => '/', '<i class="fa fa-tags" title="Boards"></i>' => '/boards.html', '<i class="fa fa-question" title="FAQ"></i>' => '/faq.html', '<i class="fa fa-random" title="Random"></i>' => '/random.php', '<i class="fa fa-plus" title="New board"></i>' => '/create.php', '<i class="fa fa-search" title="Search"></i>' => '/search.php', '<i class="fa fa-cog" title="Manage board"></i>' => '/mod.php', '<i class="fa fa-quote-right" title="Chat"></i>' => 'https://qchat.rizon.net/?channels=#8chan'), array('b', 'meta', 'int'), array('v', 'a', 'tg', 'fit', 'pol', 'tech', 'mu', 'co', 'sp', 'boards'), array('<i class="fa fa-twitter" title="Twitter"></i>'=>'https://twitter.com/infinitechan'));
|
||||
|
||||
$config['footer'][] = 'Contribute to 8chan.co development at <a href="https://github.com/ctrlcctrlv/8chan">github</a>';
|
||||
$config['footer'][] = 'To make a DMCA request or report illegal content, please email <a href="mailto:admin@8chan.co">admin@8chan.co</a> or use the "Global Report" functionality on every page.';
|
||||
|
20
js/update_boards.js
Normal file
20
js/update_boards.js
Normal file
@ -0,0 +1,20 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
window.boards = new Array();
|
||||
function handle_boards(data) {
|
||||
$.each(data, function(k, v) {
|
||||
if (v.uri != 'meta' && v.uri != 'b' && v.uri != 'int') {
|
||||
boards.push('<a href="/'+v.uri+'">'+v.uri+'</a>');
|
||||
}
|
||||
})
|
||||
|
||||
if (boards[0]) {
|
||||
$('.favorite-boards').before(' [ '+boards.slice(0,15).join(" / ")+' ] ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$.getJSON("/boards.json", handle_boards)
|
||||
|
||||
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user