Compare commits

..

1 commit

Author SHA1 Message Date
Dark-Killer228
1025e65c94
Merge 153206f9ba into ee0dd8c749 2025-02-22 21:44:47 +05:00
2 changed files with 5 additions and 9 deletions

View file

@ -7,7 +7,6 @@ namespace openvk\Web\Models\Repositories;
use Chandler\Database\DatabaseConnection as DB; use Chandler\Database\DatabaseConnection as DB;
use Nette\Database\Table\{ActiveRow, Selection}; use Nette\Database\Table\{ActiveRow, Selection};
use openvk\Web\Models\Entities\BannedLink; use openvk\Web\Models\Entities\BannedLink;
use function Symfony\Component\Translation\t; use function Symfony\Component\Translation\t;
class BannedLinks class BannedLinks
@ -63,11 +62,10 @@ class BannedLinks
public function genEntries($links, $uri): \Traversable public function genEntries($links, $uri): \Traversable
{ {
foreach ($links as $link) { foreach ($links as $link) {
if (preg_match($link->getRegexpRule(), $uri)) { if (preg_match($link->getRegexpRule(), $uri))
yield $link->getId(); yield $link->getId();
} elseif ($this->isDomainBanned($link->getDomain())) { else if ($this->isDomainBanned($link->getDomain()))
yield $link->getId(); yield $link->getId();
}
} }
} }

View file

@ -11,12 +11,10 @@ final class AwayPresenter extends OpenVKPresenter
{ {
public function renderAway(): void public function renderAway(): void
{ {
$checkBanEntries = (new BannedLinks())->check($this->queryParam("to")); $checkBanEntries = (new BannedLinks)->check($this->queryParam("to"));
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["susLinks"]["warnings"]) { if (OPENVK_ROOT_CONF["openvk"]["preferences"]["susLinks"]["warnings"])
if (sizeof($checkBanEntries) > 0) { if (sizeof($checkBanEntries) > 0)
$this->pass("openvk!Away->view", $checkBanEntries[0]); $this->pass("openvk!Away->view", $checkBanEntries[0]);
}
}
header("HTTP/1.0 302 Found"); header("HTTP/1.0 302 Found");
header("X-Robots-Tag: noindex, nofollow, noarchive"); header("X-Robots-Tag: noindex, nofollow, noarchive");