2025-01-31 18:20:13 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
namespace openvk\Web\Presenters;
|
2025-01-31 18:20:13 +03:00
|
|
|
|
2022-09-05 18:57:41 +03:00
|
|
|
use openvk\Web\Models\Repositories\BannedLinks;
|
|
|
|
use openvk\Web\Models\Entities\BannedLink;
|
2020-06-07 19:04:43 +03:00
|
|
|
|
|
|
|
final class AwayPresenter extends OpenVKPresenter
|
|
|
|
{
|
2025-01-31 18:20:13 +03:00
|
|
|
public function renderAway(): void
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2025-01-31 18:20:13 +03:00
|
|
|
$checkBanEntries = (new BannedLinks())->check($this->queryParam("to") . "/");
|
|
|
|
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["susLinks"]["warnings"]) {
|
|
|
|
if (sizeof($checkBanEntries) > 0) {
|
2022-09-05 18:57:41 +03:00
|
|
|
$this->pass("openvk!Away->view", $checkBanEntries[0]);
|
2025-01-31 18:20:13 +03:00
|
|
|
}
|
|
|
|
}
|
2022-09-05 18:57:41 +03:00
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
header("HTTP/1.0 302 Found");
|
|
|
|
header("X-Robots-Tag: noindex, nofollow, noarchive");
|
|
|
|
header("Location: " . $this->queryParam("to"));
|
|
|
|
exit;
|
|
|
|
}
|
2022-09-05 18:57:41 +03:00
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function renderView(int $lid)
|
|
|
|
{
|
|
|
|
$this->template->link = (new BannedLinks())->get($lid);
|
2022-09-05 18:57:41 +03:00
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
if (!$this->template->link) {
|
2022-09-05 18:57:41 +03:00
|
|
|
$this->notFound();
|
2025-01-31 18:20:13 +03:00
|
|
|
}
|
2022-09-05 18:57:41 +03:00
|
|
|
|
|
|
|
$this->template->to = $this->queryParam("to");
|
|
|
|
}
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|