openvk/Web/Presenters/AwayPresenter.php
Alexander Minkin 6ec54a379d
feat: add linting of code (#1220)
* feat(lint): add php-cs-fixer for linting

Removing previous CODE_STYLE as it was not enforced anyway and using PER-CS 2.0.

This is not the reformatting commit.

* style: format code according to PER-CS 2.0 with php-cs-fixer

* ci(actions): add lint action

Resolves #1132.
2025-01-31 18:20:13 +03:00

37 lines
1,001 B
PHP

<?php
declare(strict_types=1);
namespace openvk\Web\Presenters;
use openvk\Web\Models\Repositories\BannedLinks;
use openvk\Web\Models\Entities\BannedLink;
final class AwayPresenter extends OpenVKPresenter
{
public function renderAway(): void
{
$checkBanEntries = (new BannedLinks())->check($this->queryParam("to") . "/");
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["susLinks"]["warnings"]) {
if (sizeof($checkBanEntries) > 0) {
$this->pass("openvk!Away->view", $checkBanEntries[0]);
}
}
header("HTTP/1.0 302 Found");
header("X-Robots-Tag: noindex, nofollow, noarchive");
header("Location: " . $this->queryParam("to"));
exit;
}
public function renderView(int $lid)
{
$this->template->link = (new BannedLinks())->get($lid);
if (!$this->template->link) {
$this->notFound();
}
$this->template->to = $this->queryParam("to");
}
}