mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
23 lines
588 B
PHP
23 lines
588 B
PHP
<?php
|
|
/** @phpstan-var \Gazelle\User $Viewer */
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Gazelle;
|
|
|
|
if ($Viewer->disableForums()) {
|
|
json_die('failure');
|
|
}
|
|
|
|
$showUnread = (bool)($_GET['showunread'] ?? true);
|
|
|
|
$forMan = new Manager\Forum();
|
|
$paginator = new Util\Paginator($Viewer->postsPerPage(), (int)($_GET['page'] ?? 1));
|
|
$paginator->setTotal(
|
|
$showUnread ? $forMan->unreadSubscribedForumTotal($Viewer) : $forMan->subscribedForumTotal($Viewer)
|
|
);
|
|
|
|
json_print('success', [
|
|
'threads' => $forMan->latestPostsList($Viewer, $showUnread, $paginator->limit(), $paginator->offset())
|
|
]);
|