style: fixes (#1237)

This commit is contained in:
Alexander Minkin 2025-02-22 23:46:02 +03:00 committed by GitHub
parent ee0dd8c749
commit cb14085cd4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View file

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

View file

@ -11,10 +11,12 @@ 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)
$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");