1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-01-31 12:23:48 +01:00
Conflicts:
	boards.php
This commit is contained in:
8chan 2015-04-19 06:09:14 -07:00
commit 5cceda9d15
3 changed files with 13 additions and 21 deletions

View File

@ -200,16 +200,14 @@ array_multisort(
);
if (php_sapi_name() == 'cli') {
$boardLimit = $search['index'] ? 50 : 100;
$response['omitted'] = count( $response['boards'] ) - $boardLimit;
$response['omitted'] = $response['omitted'] < 0 ? 0 : $response['omitted'];
$response['boards'] = array_splice( $response['boards'], $search['page'], $boardLimit );
}
else {
$response['omitted'] = 0;
$response['boardsFull'] = $response['boards'];
}
$boardLimit = $search['index'] ? 50 : 100;
$response['omitted'] = count( $response['boards'] ) - $boardLimit;
$response['omitted'] = $response['omitted'] < 0 ? 0 : $response['omitted'];
$response['boards'] = array_splice( $response['boards'], $search['page'], $boardLimit );
$response['order'] = array_keys( $response['boards'] );

View File

@ -94,9 +94,9 @@ $pageHTML = Element("page.html", array(
// We only want to cache if this is not a dynamic form request.
// Otherwise, our information will be skewed by the search criteria.
if (count($_GET) == 0) {
if (php_sapi_name() == 'cli') {
// Preserves the JSON output format of [{board},{board}].
$nonAssociativeBoardList = array_values($boards);
$nonAssociativeBoardList = array_values($response['boardsFull']);
file_write("boards.html", $pageHTML);
file_write("boards.json", json_encode($nonAssociativeBoardList));
@ -109,6 +109,9 @@ if (count($_GET) == 0) {
}
file_write("boards-top20.json", json_encode(array_splice($topbar, 0, 48)));
echo "The board directories have regenerated.";
exit;
}
echo $pageHTML;

View File

@ -875,13 +875,6 @@ function fetchBoardActivity( array $uris = array(), $forTime = false, $detailed
foreach ($bsResult as $bsRow) {
// Do we need to define the arrays for this URI?
if (!isset($boardActivity['active'][$bsRow['stat_uri']])) {
if ($bsRow['stat_hour'] == $forHour) {
$boardActivity['active'][$bsRow['stat_uri']] = unserialize( $bsRow['author_ip_array'] );
}
else {
$boardActivity['active'][$bsRow['stat_uri']] = array();
}
if ($bsRow['stat_hour'] <= $forHour && $bsRow['stat_hour'] >= $yesterHour) {
$boardActivity['today'][$bsRow['stat_uri']] = $bsRow['post_count'];
}
@ -889,17 +882,15 @@ function fetchBoardActivity( array $uris = array(), $forTime = false, $detailed
$boardActivity['today'][$bsRow['stat_uri']] = 0;
}
$boardActivity['active'][$bsRow['stat_uri']] = unserialize( $bsRow['author_ip_array'] );
$boardActivity['average'][$bsRow['stat_uri']] = $bsRow['post_count'];
}
else {
if ($bsRow['stat_hour'] == $forHour) {
$boardActivity['active'][$bsRow['stat_uri']] = array_merge( $boardActivity['active'][$bsRow['stat_uri']], unserialize( $bsRow['author_ip_array'] ) );
}
if ($bsRow['stat_hour'] <= $forHour && $bsRow['stat_hour'] >= $yesterHour) {
$boardActivity['today'][$bsRow['stat_uri']] += $bsRow['post_count'];
}
$boardActivity['active'][$bsRow['stat_uri']] = array_merge( $boardActivity['active'][$bsRow['stat_uri']], unserialize( $bsRow['author_ip_array'] ) );
$boardActivity['average'][$bsRow['stat_uri']] += $bsRow['post_count'];
}
}