mirror of
https://github.com/openvk/openvk
synced 2024-11-15 03:31:18 +03:00
Blacklists: Make it barely work (xd)
This commit is contained in:
parent
dda86b167e
commit
d25c2ee183
5 changed files with 17 additions and 8 deletions
|
@ -28,4 +28,6 @@ class BlacklistItem extends RowModel
|
||||||
{
|
{
|
||||||
return new DateTime($this->getRecord()->created);
|
return new DateTime($this->getRecord()->created);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,7 +24,11 @@ class Blacklists
|
||||||
|
|
||||||
function getByAuthorAndTarget(int $author, int $target): ?BlacklistItem
|
function getByAuthorAndTarget(int $author, int $target): ?BlacklistItem
|
||||||
{
|
{
|
||||||
return new BlacklistItem($this->blacklists->where(["author" => $author, "target" => $target])->fetch());
|
$fetch = $this->blacklists->where(["author" => $author, "target" => $target])->fetch();
|
||||||
|
if ($fetch)
|
||||||
|
return new BlacklistItem($fetch);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCount(User $user): int
|
function getCount(User $user): int
|
||||||
|
@ -37,6 +41,9 @@ class Blacklists
|
||||||
if (!$author || !$target)
|
if (!$author || !$target)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
bdump($this->getByAuthorAndTarget($author->getId(), $target->getId()), "хуита какая-то вроде для бл*клиста");
|
||||||
|
|
||||||
|
|
||||||
return !is_null($this->getByAuthorAndTarget($author->getId(), $target->getId()));
|
return !is_null($this->getByAuthorAndTarget($author->getId(), $target->getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,14 @@ final class UserPresenter extends OpenVKPresenter
|
||||||
|
|
||||||
if ($this->user->identity)
|
if ($this->user->identity)
|
||||||
if ($this->blacklists->isBanned($user, $this->user->identity)) {
|
if ($this->blacklists->isBanned($user, $this->user->identity)) {
|
||||||
if ($this->user->identity->isAdmin()) {
|
if ($this->user->identity->isAdmin()) {
|
||||||
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"]) {
|
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"]) {
|
||||||
$this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you"));
|
$this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you"));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!$user || $user->isDeleted()) {
|
if(!$user || $user->isDeleted()) {
|
||||||
if(!is_null($user) && $user->isDeactivated()) {
|
if(!is_null($user) && $user->isDeactivated()) {
|
||||||
|
|
|
@ -394,7 +394,7 @@
|
||||||
<div class="right_big_block">
|
<div class="right_big_block">
|
||||||
<div class="page_info">
|
<div class="page_info">
|
||||||
<div n:if="$isBlacklistedByThem AND $thisUser->isAdmin() AND $thisUser->getId() !== $user->getId()" class="user-alert">
|
<div n:if="$isBlacklistedByThem AND $thisUser->isAdmin() AND $thisUser->getId() !== $user->getId()" class="user-alert">
|
||||||
<b>{admin_privacy_warning}:</b>
|
<b>{_admin_privacy_warning}:</b>
|
||||||
<br/>
|
<br/>
|
||||||
{_user_blacklisted_you}
|
{_user_blacklisted_you}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,6 @@ CREATE TABLE `blacklists` (
|
||||||
`index` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
`index` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
`author` BIGINT UNSIGNED NOT NULL,
|
`author` BIGINT UNSIGNED NOT NULL,
|
||||||
`target` BIGINT UNSIGNED NOT NULL,
|
`target` BIGINT UNSIGNED NOT NULL,
|
||||||
`created` DATETIME NOT NULL,
|
`created` BIGINT UNSIGNED NOT NULL,
|
||||||
PRIMARY KEY (`index`)
|
PRIMARY KEY (`index`)
|
||||||
) ENGINE = InnoDB;
|
) ENGINE = InnoDB;
|
||||||
|
|
Loading…
Reference in a new issue