2014-09-23 23:26:27 +00:00
|
|
|
<?php
|
|
|
|
|
2015-04-14 01:40:45 +10:00
|
|
|
include "inc/functions.php"; // October 23, 2013
|
2014-09-26 10:15:17 +09:00
|
|
|
include "inc/countries.php";
|
|
|
|
|
2014-09-23 23:26:27 +00:00
|
|
|
$admin = isset($mod["type"]) && $mod["type"]<=30;
|
|
|
|
|
|
|
|
if (php_sapi_name() == 'fpm-fcgi' && !$admin) {
|
|
|
|
error('Cannot be run directly.');
|
|
|
|
}
|
|
|
|
|
2015-04-14 01:40:45 +10:00
|
|
|
/* Build parameters for page */
|
|
|
|
$searchJson = include "board-search.php";
|
|
|
|
$boards = array();
|
|
|
|
$tags = array();
|
2014-12-03 00:10:28 -08:00
|
|
|
|
2015-04-14 01:40:45 +10:00
|
|
|
if (count($searchJson)) {
|
|
|
|
if (isset($searchJson['boards'])) {
|
|
|
|
$boards = $searchJson['boards'];
|
|
|
|
}
|
|
|
|
if (isset($searchJson['tags'])) {
|
|
|
|
$tags = $searchJson['tags'];
|
|
|
|
}
|
2015-03-10 16:20:55 -07:00
|
|
|
}
|
2014-09-23 23:26:27 +00:00
|
|
|
|
2015-04-14 01:40:45 +10:00
|
|
|
/* $query = prepare(sprintf("
|
2015-03-10 16:20:55 -07:00
|
|
|
SELECT IFNULL(MAX(id),0) max,
|
2014-09-23 23:26:27 +00:00
|
|
|
(SELECT COUNT(*) FROM ``posts_%s`` WHERE FROM_UNIXTIME(time) > DATE_SUB(NOW(), INTERVAL 1 HOUR)) pph,
|
2014-10-06 18:01:01 -07:00
|
|
|
(SELECT COUNT(DISTINCT ip) FROM ``posts_%s`` WHERE FROM_UNIXTIME(time) > DATE_SUB(NOW(), INTERVAL 3 DAY)) uniq_ip
|
2014-09-29 07:17:00 +00:00
|
|
|
FROM ``posts_%s``
|
|
|
|
", $board['uri'], $board['uri'], $board['uri'], $board['uri'], $board['uri']));
|
2014-09-23 23:26:27 +00:00
|
|
|
$query->execute() or error(db_error($query));
|
2015-04-14 01:40:45 +10:00
|
|
|
$r = $query->fetch(PDO::FETCH_ASSOC); */
|
|
|
|
|
|
|
|
$boardQuery = prepare("SELECT COUNT(1) AS 'boards_total', COUNT(indexed) AS 'boards_public' FROM ``boards``");
|
|
|
|
$boardQuery->execute() or error(db_error($tagQuery));
|
|
|
|
$boardResult = $boardQuery->fetchAll(PDO::FETCH_ASSOC)[0];
|
|
|
|
|
|
|
|
$boards_total = $boardResult['boards_total'];
|
|
|
|
$boards_public = $boardResult['boards_public'];
|
|
|
|
$boards_hidden = $boardResult['boards_total'] - $boardResult['boards_public'];
|
|
|
|
|
|
|
|
$posts_hour = 0;
|
|
|
|
$posts_total = 0;
|
|
|
|
|
|
|
|
/* Create and distribute page */
|
|
|
|
$boardsHTML = Element("8chan/boards-table.html", array(
|
|
|
|
"config" => $config,
|
|
|
|
"boards" => $boards,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$tagsHTML = Element("8chan/boards-tags.html", array(
|
|
|
|
"config" => $config,
|
|
|
|
"tags" => $tags,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$searchHTML = Element("8chan/boards-search.html", array(
|
|
|
|
"config" => $config,
|
|
|
|
|
|
|
|
"boards_total" => $boards_total,
|
|
|
|
"boards_public" => $boards_public,
|
|
|
|
"boards_hidden" => $boards_hidden,
|
|
|
|
|
|
|
|
"posts_hour" => $posts_hour,
|
|
|
|
"posts_total" => $posts_total,
|
|
|
|
|
|
|
|
"page_updated" => date('r'),
|
|
|
|
"uptime" => shell_exec('uptime -p'),
|
|
|
|
|
|
|
|
"html_boards" => $boardsHTML,
|
|
|
|
"html_tags" => $tagsHTML
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$config['additional_javascript'] = array(
|
|
|
|
'js/jquery.min.js',
|
|
|
|
'js/board-directory.js'
|
|
|
|
);
|
|
|
|
|
|
|
|
$pageHTML = Element("page.html", array(
|
|
|
|
"config" => $config,
|
|
|
|
"body" => $searchHTML,
|
|
|
|
"title" => "Boards on ∞chan"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
file_write("boards.html", $pageHTML);
|
|
|
|
echo $pageHTML;
|