diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index 61be11eb..4f1e8ceb 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -105,6 +105,30 @@ final class WallPresenter extends OpenVKPresenter $this->template->posts[] = $this->posts->get($post->id); } + function renderGlobalFeed(): void + { + $this->assertUserLoggedIn(); + + $page = (int) ($_GET["p"] ?? 1); + $pPage = (int) ($_GET["posts"] ?? OPENVK_DEFAULT_PER_PAGE); + $posts = DatabaseConnection::i() + ->getContext() + ->table("posts") + ->where("deleted", 0) + ->order("created DESC"); + + $this->template->_template = "Wall/Feed.xml"; + $this->template->globalFeed = true; + $this->template->paginatorConf = (object) [ + "count" => sizeof($posts), + "page" => (int) ($_GET["p"] ?? 1), + "amount" => sizeof($posts->page($page, $pPage)), + "perPage" => $pPage, + ]; + foreach($posts->page($page, $pPage) as $post) + $this->template->posts[] = $this->posts->get($post->id); + } + function renderHashtagFeed(string $hashtag): void { $hashtag = rawurldecode($hashtag); diff --git a/Web/Presenters/templates/Wall/Feed.xml b/Web/Presenters/templates/Wall/Feed.xml index b0f097c3..455484a7 100644 --- a/Web/Presenters/templates/Wall/Feed.xml +++ b/Web/Presenters/templates/Wall/Feed.xml @@ -3,6 +3,14 @@ {block header} {_"feed"} + +