diff --git a/Web/Presenters/OpenVKPresenter.php b/Web/Presenters/OpenVKPresenter.php index 1d03a1c2..8b33b5a7 100644 --- a/Web/Presenters/OpenVKPresenter.php +++ b/Web/Presenters/OpenVKPresenter.php @@ -7,7 +7,7 @@ use Chandler\Security\Authenticator; use Latte\Engine as TemplatingEngine; use openvk\Web\Models\Entities\IP; use openvk\Web\Themes\Themepacks; -use openvk\Web\Models\Repositories\{IPs, Users, APITokens, Tickets, Reports, CurrentUser}; +use openvk\Web\Models\Repositories\{IPs, Users, APITokens, Tickets, Reports, CurrentUser, Posts}; use WhichBrowser; abstract class OpenVKPresenter extends SimplePresenter @@ -207,6 +207,17 @@ abstract class OpenVKPresenter extends SimplePresenter $userValidated = 0; $cacheTime = OPENVK_ROOT_CONF["openvk"]["preferences"]["nginxCacheTime"] ?? 0; + if(OPENVK_ROOT_CONF['openvk']['preferences']['news']['show']) { + $post = (new Posts)->getPostsFromUsersWall(-OPENVK_ROOT_CONF['openvk']['preferences']['news']['groupId'], 1, 1); + $post = iterator_to_array($post)[0]; + + $text = wordwrap($post->getText(false), 150, '\n', false); + $text = explode('\n', $text)[0]; + + $this->template->newsText = $text; + $this->template->newsLink = '/wall' . $post->getPrettyId(); + } + if(!is_null($user)) { $this->user = (object) []; $this->user->raw = $user; diff --git a/Web/Presenters/templates/@layout.xml b/Web/Presenters/templates/@layout.xml index 811548cd..34e033dc 100644 --- a/Web/Presenters/templates/@layout.xml +++ b/Web/Presenters/templates/@layout.xml @@ -239,6 +239,14 @@ + +