fuck you php

This commit is contained in:
8chan 2014-09-26 03:44:34 +00:00
commit 9dc91c1bf4
5 changed files with 108 additions and 7 deletions

View File

@ -657,8 +657,8 @@ function listBoards($just_uri = false) {
$just_uri ? $cache_name = 'all_boards_uri' : $cache_name = 'all_boards';
if ($config['cache']['enabled'] && ($boards = cache::get($cache_name)))
return $boards;
//if ($config['cache']['enabled'] && ($boards = cache::get($cache_name)))
//return $boards;
if (!$just_uri) {
$query = query("SELECT ``boards``.`uri` uri, ``boards``.`title` title, ``boards``.`subtitle` subtitle, ``board_create``.`time` time FROM ``boards`` LEFT JOIN ``board_create`` ON ``boards``.`uri` = ``board_create``.`uri` ORDER BY ``boards``.`uri`") or error(db_error());
@ -666,7 +666,9 @@ function listBoards($just_uri = false) {
} else {
$boards = array();
$query = query("SELECT `uri` FROM ``boards``") or error(db_error());
while ($board = $query->fetchColumn()) {
while (true) {
$board = $query->fetchColumn();
if ($board === FALSE) break;
$boards[] = $board;
}
}

View File

@ -81,6 +81,7 @@
$config['mod']['recent_reports'] = 65535;
// Board shit
$config['ayah_enabled'] = true;
$config['url_banner'] = '/banners.php';
//$config['default_stylesheet'] = array('Notsuba', 'notsuba.css');
$config['additional_javascript'][] = 'js/jquery.min.js';
@ -92,6 +93,7 @@
$config['additional_javascript'][] = 'js/favorites.js';
$config['additional_javascript'][] = 'js/show-op.js';
$config['additional_javascript'][] = 'js/hide-threads.js';
$config['additional_javascript'][] = 'js/mobile-style.js'
$config['additional_javascript'][] = 'js/smartphone-spoiler.js';
$config['additional_javascript'][] = 'js/inline-expanding.js';
$config['additional_javascript'][] = 'js/show-backlinks.js';
@ -117,6 +119,7 @@
$config['additional_javascript'][] = 'js/toggle-locked-threads.js';
$config['additional_javascript'][] = 'js/toggle-images.js';
$config['additional_javascript'][] = 'js/mobile-style.js';
$config['additional_javascript'][] = 'js/threadscroll.js';
$config['font_awesome_css'] = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';
@ -128,7 +131,7 @@
$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="Home"></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.';

98
js/image-hover.js Normal file
View File

@ -0,0 +1,98 @@
/*
Copyright (C) 2014 undido
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
expands images and webm on hover
*/
$(document).ready(function(){
var mouseisOnImage = false;
var mouseexitedImage = false;
var imageHover = (localStorage['imagehover']) ? true:false;
imageHover = !imageHover;
var imageEnter = function(){
if (!imageHover)
return;
mouseexitedImage = false;
mouseisOnImage = false;
isVideo = (($(this).prop("tagName") == "VIDEO") ? true:($(this).parent().attr("href").indexOf("player.php?v=") > -1) ? true:false);
maxWidth = document.body.offsetWidth-(document.body.offsetWidth * 0.25);
maxHeight = document.documentElement.clientHeight;
stylez = "z-index:1000;z-index: 1000;position: fixed;top: 0;right: 0;";
if (!isVideo){
fileInfo = $(this).parent().parent().children(".fileinfo").children(".unimportant").text();
isSpoiler = (fileInfo.indexOf("Spoiler") > -1) ? true:false;
imageD = ((isSpoiler) ? fileInfo.split(",")[2]:fileInfo.split(",")[1]);
imageWidth = parseInt(imageD.split("x")[0]);
imageHeight = parseInt(imageD.split("x")[1]);
widStyle = "max-width:" + maxWidth + "px;";
heiStyle = ((maxHeight < imageHeight) ? "height:"+maxHeight+"px;":"");
$imgH = $("<img/>", {"src":$(this).parent().attr("href"), "style":stylez + ((imageWidth > maxWidth) ? widStyle:"")+heiStyle, "id":"hover-image"});
} else {
fileInfo = $(this).parent().parent().children(".fileinfo").children(".unimportant").text();
isSpoiler = (fileInfo.indexOf("Spoiler") > -1) ? true:false;
imageD = ((isSpoiler) ? fileInfo.split(",")[2]:fileInfo.split(",")[1]);
videoWidth = parseInt(imageD.split("x")[0]);
videoHeight = parseInt(imageD.split("x")[1]);
widStyle = "width:" + ((maxWidth > videoWidth) ? videoWidth:maxWidth) + "px;" + "height:" + ((maxHeight < videoHeight) ? "100%": videoHeight+"px;");
$imgH = $("<iframe/>", {"src":$(this).parent().attr("href"), "style":stylez + widStyle, "id":"hover-image"});
}
$(document.body).append($imgH);
$("#hover-image").hover(function(){
mouseisOnImage = true;
}, function(){
mouseisOnImage = false;
if (mouseexitedImage){
$("#hover-image").remove();
}
});
};
imageLeave = function(){
setTimeout(function(){
mouseexitedImage = true;
if (!mouseisOnImage){
$("#hover-image").remove();
}
},50);
};
$("a .post-image").hover(imageEnter,imageLeave);
$mrCheckie = $('<div><label id=\"toggle-image-hover\"><input id="toggle-hover" type=\"checkbox\"> show image on hover</label></div>');
$(".options_tab").append($mrCheckie);
$("#toggle-hover").prop("checked", imageHover);
$("#toggle-hover").on("click", function(){
if ($(this).prop("checked")){
imageHover = true;
delete localStorage['imagehover'];
} else {
imageHover = false;
localStorage['imagehover'] = true;
}
});
$(".options_tab").append();
$(document).on("new_post", function(e, post) {
$(post).hover(imageEnter(),imageLeave());
});
});

View File

@ -2,9 +2,7 @@
include "inc/functions.php";
$boards = listBoards(true);
$boards = listBoards(TRUE);
$board = array_rand($boards);
header('Location: /'.$boards[$board]);
?>

BIN
static/favicon_au.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B