Beispiel #1
0
    if ($search['tags'] !== false && (!isset($boardTags[$boardUri]) || count(array_intersect($search['tags'], $boardTags[$boardUri])) !== count($search['tags']))) {
        unset($response['boards'][$boardUri]);
        continue;
    } else {
        if (isset($boardTags[$boardUri]) && $boardTags[$boardUri]) {
            $board['tags'] = $boardTags[$boardUri];
        } else {
            $board['tags'] = array();
        }
    }
    // Legacy support for API readers.
    $board['max'] =& $board['posts_total'];
}
unset($boardTags);
/* Activity Fetching */
$boardActivity = fetchBoardActivity(array_keys($response['boards']), $search['time'], true);
// Loop through each board and record activity to it.
// We will also be weighing and building a tag list.
foreach ($response['boards'] as $boardUri => &$board) {
    $board['active'] = 0;
    $board['pph'] = 0;
    $board['ppd'] = 0;
    if (isset($boardActivity['active'][$boardUri])) {
        $board['active'] = (int) $boardActivity['active'][$boardUri];
    }
    if (isset($boardActivity['average'][$boardUri])) {
        $precision = 0;
        if ($boardActivity['average'][$boardUri] > 0 && $boardActivity['average'][$boardUri] < 10) {
            $precision = 1;
        }
        $board['pph_average'] = round($boardActivity['average'][$boardUri], $precision);
Beispiel #2
0
if (count($searchJson)) {
    if (isset($searchJson['boards'])) {
        $boards = $searchJson['boards'];
    }
    if (isset($searchJson['tagWeight'])) {
        $tags = $searchJson['tagWeight'];
    }
}
$boardQuery = prepare("SELECT COUNT(1) AS 'boards_total', SUM(indexed) AS 'boards_public', SUM(posts_total) AS 'posts_total' FROM ``boards``");
$boardQuery->execute() or error(db_error($tagQuery));
$boardResult = $boardQuery->fetchAll(PDO::FETCH_ASSOC)[0];
$boards_total = number_format($boardResult['boards_total'], 0);
$boards_public = number_format($boardResult['boards_public'], 0);
$boards_hidden = number_format($boardResult['boards_total'] - $boardResult['boards_public'], 0);
$boards_omitted = (int) $searchJson['omitted'];
$posts_hour = number_format(fetchBoardActivity(), 0);
$posts_total = number_format($boardResult['posts_total'], 0);
// This incredibly stupid looking chunk of code builds a query string using existing information.
// It's used to make clickable tags for users without JavaScript for graceful degredation.
// Because of how it orders tags, what you end up with is a prefix that always ends in tags=x+
// ?tags= or ?sfw=1&tags= or ?title=foo&tags=bar+ - etc
$tagQueryGet = $_GET;
$tagQueryTags = isset($tagQueryGet['tags']) ? $tagQueryGet['tags'] : "";
unset($tagQueryGet['tags']);
$tagQueryGet['tags'] = $tagQueryTags;
$tag_query = "/boards.php?" . http_build_query($tagQueryGet) . ($tagQueryTags != "" ? "+" : "");
/* Create and distribute page */
// buildJavascript();
$boardsHTML = Element("8chan/boards-table.html", array("config" => $config, "boards" => $boards, "tag_query" => $tag_query));
$tagsHTML = Element("8chan/boards-tags.html", array("config" => $config, "tags" => $tags, "tag_query" => $tag_query));
$query = query('SELECT np.* FROM newsplus np INNER JOIN `posts_n` p ON np.thread=p.id WHERE np.dead IS FALSE ORDER BY p.bump DESC');