mirror of
https://github.com/openvk/openvk
synced 2024-12-23 09:01:15 +03:00
Compare commits
No commits in common. "c714cc403889dd05e816b45295097e19c68171a3" and "75ef7eaec6d3b50359816f81da8b01494809b18b" have entirely different histories.
c714cc4038
...
75ef7eaec6
24 changed files with 221 additions and 385 deletions
|
@ -228,72 +228,4 @@ final class Account extends VKAPIRequestHandler
|
|||
|
||||
return (object) ['votes' => $this->getUser()->getCoins()];
|
||||
}
|
||||
|
||||
function ban(int $owner_id): int
|
||||
{
|
||||
$this->requireUser();
|
||||
$this->willExecuteWriteAction();
|
||||
|
||||
if($owner_id < 0)
|
||||
return 1;
|
||||
|
||||
if($owner_id == $this->getUser()->getId())
|
||||
$this->fail(15, "Access denied: cannot blacklist yourself");
|
||||
|
||||
$config_limit = OPENVK_ROOT_CONF['openvk']['preferences']['blacklists']['limit'] ?? 100;
|
||||
$user_blocks = $this->getUser()->getBlacklistSize();
|
||||
if(($user_blocks + 1) > $config_limit)
|
||||
$this->fail(-7856, "Blacklist limit exceeded");
|
||||
|
||||
$entity = get_entity_by_id($owner_id);
|
||||
if(!$entity || $entity->isDeleted())
|
||||
return 0;
|
||||
|
||||
if($entity->isBlacklistedBy($this->getUser()))
|
||||
return 1;
|
||||
|
||||
$this->getUser()->addToBlacklist($entity);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
function unban(int $owner_id): int
|
||||
{
|
||||
$this->requireUser();
|
||||
$this->willExecuteWriteAction();
|
||||
|
||||
if($owner_id < 0)
|
||||
return 1;
|
||||
|
||||
if($owner_id == $this->getUser()->getId())
|
||||
return 1;
|
||||
|
||||
$entity = get_entity_by_id($owner_id);
|
||||
if(!$entity || $entity->isDeleted())
|
||||
return 0;
|
||||
|
||||
if(!$entity->isBlacklistedBy($this->getUser()))
|
||||
return 1;
|
||||
|
||||
$this->getUser()->removeFromBlacklist($entity);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
function getBanned(int $offset = 0, int $count = 100, string $fields = ""): object
|
||||
{
|
||||
$this->requireUser();
|
||||
|
||||
$result = (object)[
|
||||
'count' => $this->getUser()->getBlacklistSize(),
|
||||
'items' => [],
|
||||
];
|
||||
$banned = $this->getUser()->getBlacklist($offset, $count);
|
||||
foreach($banned as $ban) {
|
||||
if(!$ban) continue;
|
||||
$result->items[] = $ban->toVkApiStruct($this->getUser(), $fields);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace openvk\VKAPI\Handlers;
|
||||
use openvk\Web\Models\Entities\{User, Report};
|
||||
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
||||
use openvk\Web\Models\Repositories\{Photos, Clubs, Albums, Videos, Notes, Audios};
|
||||
use openvk\Web\Models\Repositories\{Photos, Clubs, Albums, Videos, Notes, Audios, Blacklists};
|
||||
use openvk\Web\Models\Repositories\Reports;
|
||||
|
||||
final class Users extends VKAPIRequestHandler
|
||||
|
@ -52,6 +52,8 @@ final class Users extends VKAPIRequestHandler
|
|||
"last_name" => $usr->getLastName(true),
|
||||
"is_closed" => $usr->isClosed(),
|
||||
"can_access_closed" => (bool)$usr->canBeViewedBy($this->getUser()),
|
||||
"blacklisted" => (new Blacklists)->isBanned($usr, $authuser),
|
||||
"blacklisted_by_me" => (new Blacklists)->isBanned($authuser, $usr)
|
||||
];
|
||||
|
||||
$flds = explode(',', $fields);
|
||||
|
@ -266,27 +268,14 @@ final class Users extends VKAPIRequestHandler
|
|||
case 'nickname':
|
||||
$response[$i]->nickname = $usr->getPseudo();
|
||||
break;
|
||||
case 'blacklisted_by_me':
|
||||
if(!$authuser) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$response[$i]->blacklisted_by_me = (int)$usr->isBlacklistedBy($this->getUser());
|
||||
break;
|
||||
case 'blacklisted':
|
||||
if(!$authuser) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$response[$i]->blacklisted = (int)$this->getUser()->isBlacklistedBy($usr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($usr->getOnline()->timestamp() + 300 > time())
|
||||
$response[$i]->online = 1;
|
||||
else
|
||||
$response[$i]->online = 0;
|
||||
if (!(new Blacklists)->isBanned($usr, $authuser))
|
||||
if($usr->getOnline()->timestamp() + 300 > time())
|
||||
$response[$i]->online = 1;
|
||||
else
|
||||
$response[$i]->online = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,7 +309,7 @@ final class Users extends VKAPIRequestHandler
|
|||
$response = $this->get(implode(',', $followers), $fields, 0, $count);
|
||||
|
||||
return (object) [
|
||||
"count" => $users->get($user_id)->getFollowersCount(),
|
||||
"count" => $target->getFollowersCount(),
|
||||
"items" => $response
|
||||
];
|
||||
}
|
||||
|
|
31
Web/Models/Entities/BlacklistItem.php
Normal file
31
Web/Models/Entities/BlacklistItem.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\Web\Models\Entities;
|
||||
use openvk\Web\Models\RowModel;
|
||||
use openvk\Web\Util\DateTime;
|
||||
use openvk\Web\Models\Entities\{User, Manager};
|
||||
use openvk\Web\Models\Repositories\{Users, Clubs};
|
||||
|
||||
class BlacklistItem extends RowModel
|
||||
{
|
||||
protected $tableName = "blacklists";
|
||||
|
||||
function getId(): int
|
||||
{
|
||||
return $this->getRecord()->index;
|
||||
}
|
||||
|
||||
function getAuthor(): ?User
|
||||
{
|
||||
return (new Users)->get($this->getRecord()->author);
|
||||
}
|
||||
|
||||
function getTarget(): ?User
|
||||
{
|
||||
return (new Users)->get($this->getRecord()->target);
|
||||
}
|
||||
|
||||
function getCreationDate(): DateTime
|
||||
{
|
||||
return new DateTime($this->getRecord()->created);
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ use openvk\Web\Themes\{Themepack, Themepacks};
|
|||
use openvk\Web\Util\DateTime;
|
||||
use openvk\Web\Models\RowModel;
|
||||
use openvk\Web\Models\Entities\{Photo, Message, Correspondence, Gift, Audio};
|
||||
use openvk\Web\Models\Repositories\{Applications, Bans, Comments, Notes, Posts, Users, Clubs, Albums, Gifts, Notifications, Videos, Photos};
|
||||
use openvk\Web\Models\Repositories\{Applications, Bans, Comments, Notes, Posts, Users, Clubs, Albums, Gifts, Notifications, Videos, Photos, Blacklists};
|
||||
use openvk\Web\Models\Exceptions\InvalidUserNameException;
|
||||
use Nette\Database\Table\ActiveRow;
|
||||
use Chandler\Database\DatabaseConnection;
|
||||
|
@ -510,8 +510,11 @@ class User extends RowModel
|
|||
return $permStatus === User::PRIVACY_EVERYONE;
|
||||
else if($user->getId() === $this->getId())
|
||||
return true;
|
||||
else if ((new Blacklists)->isBanned($this, $user)) {
|
||||
return $user->isAdmin() && !OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"];
|
||||
}
|
||||
|
||||
if(/*$permission != "messages.write" && */!$this->canBeViewedBy($user, true))
|
||||
if($permission != "messages.write" && !$this->canBeViewedBy($user))
|
||||
return false;
|
||||
|
||||
switch($permStatus) {
|
||||
|
@ -1294,21 +1297,17 @@ class User extends RowModel
|
|||
return $this->getRecord()->profile_type;
|
||||
}
|
||||
|
||||
function canBeViewedBy(?User $user = NULL, bool $blacklist_check = true): bool
|
||||
function canBeViewedBy(?User $user = NULL): bool
|
||||
{
|
||||
if(!is_null($user)) {
|
||||
if($this->getId() == $user->getId()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($user->isAdmin() && !(OPENVK_ROOT_CONF['openvk']['preferences']['blacklists']['applyToAdmins'] ?? true)) {
|
||||
if($user->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if($blacklist_check && ($this->isBlacklistedBy($user) || $user->isBlacklistedBy($this))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->getProfileType() == 0) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1495,76 +1494,6 @@ class User extends RowModel
|
|||
return DatabaseConnection::i()->getContext()->table("ignored_sources")->where("owner", $this->getId())->count();
|
||||
}
|
||||
|
||||
function isBlacklistedBy(?User $user = NULL): bool
|
||||
{
|
||||
if(!$user)
|
||||
return false;
|
||||
|
||||
$ctx = DatabaseConnection::i()->getContext();
|
||||
$data = [
|
||||
"author" => $user->getId(),
|
||||
"target" => $this->getRealId(),
|
||||
];
|
||||
|
||||
$sub = $ctx->table("blacklist_relations")->where($data);
|
||||
return $sub->count() > 0;
|
||||
}
|
||||
|
||||
function addToBlacklist(?User $user)
|
||||
{
|
||||
DatabaseConnection::i()->getContext()->table("blacklist_relations")->insert([
|
||||
"author" => $this->getRealId(),
|
||||
"target" => $user->getRealId(),
|
||||
"created" => time(),
|
||||
]);
|
||||
|
||||
DatabaseConnection::i()->getContext()->table("subscriptions")->where([
|
||||
"follower" => $user->getId(),
|
||||
"model" => static::class,
|
||||
"target" => $this->getId(),
|
||||
])->delete();
|
||||
|
||||
DatabaseConnection::i()->getContext()->table("subscriptions")->where([
|
||||
"follower" => $this->getId(),
|
||||
"model" => static::class,
|
||||
"target" => $user->getId(),
|
||||
])->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function removeFromBlacklist(?User $user): bool
|
||||
{
|
||||
DatabaseConnection::i()->getContext()->table("blacklist_relations")->where([
|
||||
"author" => $this->getRealId(),
|
||||
"target" => $user->getRealId(),
|
||||
])->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getBlacklist(int $offset = 0, int $limit = 10)
|
||||
{
|
||||
$sources = DatabaseConnection::i()->getContext()->table("blacklist_relations")->where("author", $this->getId())->limit($limit, $offset)->order('created ASC');
|
||||
$output_array = [];
|
||||
|
||||
foreach($sources as $source) {
|
||||
$entity_id = (int)$source->target ;
|
||||
$entity = (new Users)->get($entity_id);
|
||||
if(!$entity)
|
||||
continue;
|
||||
|
||||
$output_array[] = $entity;
|
||||
}
|
||||
|
||||
return $output_array;
|
||||
}
|
||||
|
||||
function getBlacklistSize()
|
||||
{
|
||||
return DatabaseConnection::i()->getContext()->table("blacklist_relations")->where("author", $this->getId())->count();
|
||||
}
|
||||
|
||||
use Traits\TBackDrops;
|
||||
use Traits\TSubscribable;
|
||||
use Traits\TAudioStatuses;
|
||||
|
|
46
Web/Models/Repositories/Blacklists.php
Normal file
46
Web/Models/Repositories/Blacklists.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\Web\Models\Repositories;
|
||||
use openvk\Web\Models\Entities\{User, BlacklistItem};
|
||||
use openvk\Web\Models\Repositories\{Clubs, Users};
|
||||
use Nette\Database\Table\ActiveRow;
|
||||
use Chandler\Database\DatabaseConnection as DB;
|
||||
|
||||
class Blacklists
|
||||
{
|
||||
private $context;
|
||||
private $blacklists;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->context = DB::i()->getContext();
|
||||
$this->blacklists = $this->context->table("blacklists");
|
||||
}
|
||||
|
||||
function getList(User $user, $page = 1): \Traversable
|
||||
{
|
||||
foreach($this->blacklists->where("author", $user->getId())->order("created DESC")->page($page, 10) as $blacklistItem)
|
||||
yield new BlacklistItem($blacklistItem);
|
||||
}
|
||||
|
||||
function getByAuthorAndTarget(int $author, int $target): ?BlacklistItem
|
||||
{
|
||||
$fetch = $this->blacklists->where(["author" => $author, "target" => $target])->fetch();
|
||||
if ($fetch)
|
||||
return new BlacklistItem($fetch);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
function getCount(User $user): int
|
||||
{
|
||||
return sizeof($this->blacklists->where("author", $user->getId())->fetch());
|
||||
}
|
||||
|
||||
function isBanned(User $author, User $target): bool
|
||||
{
|
||||
if (!$author || !$target)
|
||||
return FALSE;
|
||||
|
||||
return !is_null($this->getByAuthorAndTarget($author->getId(), $target->getId()));
|
||||
}
|
||||
}
|
43
Web/Presenters/BlacklistPresenter.php
Normal file
43
Web/Presenters/BlacklistPresenter.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\Web\Presenters;
|
||||
use openvk\Web\Models\Entities\{BlacklistItem};
|
||||
use openvk\Web\Models\Repositories\{Blacklists, Users};
|
||||
use Chandler\Database\DatabaseConnection as DB;
|
||||
|
||||
final class BlacklistPresenter extends OpenVKPresenter
|
||||
{
|
||||
private $blacklists;
|
||||
|
||||
function __construct(Blacklists $blacklists)
|
||||
{
|
||||
$this->blacklists = $blacklists;
|
||||
}
|
||||
|
||||
function renderAddToBlacklist(): void
|
||||
{
|
||||
$this->willExecuteWriteAction();
|
||||
$this->assertUserLoggedIn();
|
||||
|
||||
$record = new BlacklistItem;
|
||||
$target = (new Users)->get((int) $this->postParam("id"));
|
||||
|
||||
$record->setAuthor($this->user->identity->getId());
|
||||
$record->setTarget($this->postParam("id"));
|
||||
$record->setCreated(time());
|
||||
$record->save();
|
||||
|
||||
$this->flashFail("succ", tr("success"), tr("user_blacklisted", $target->getCanonicalName()));
|
||||
}
|
||||
|
||||
function renderRemoveFromBlacklist(): void
|
||||
{
|
||||
$this->willExecuteWriteAction();
|
||||
$this->assertUserLoggedIn();
|
||||
|
||||
$record = $this->blacklists->getByAuthorAndTarget($this->user->identity->getId(), $this->postParam("id"));
|
||||
$name = $record->getTarget()->getCanonicalName();
|
||||
$record->delete(false);
|
||||
|
||||
$this->flashFail("succ", tr("success"), tr("user_removed_from_the_blacklist", $name));
|
||||
}
|
||||
}
|
|
@ -119,7 +119,7 @@ final class GroupPresenter extends OpenVKPresenter
|
|||
$this->template->paginatorConf = (object) [
|
||||
"count" => $this->template->count,
|
||||
"page" => $this->queryParam("p") ?? 1,
|
||||
"amount" => 10,
|
||||
"amount" => NULL,
|
||||
"perPage" => OPENVK_DEFAULT_PER_PAGE,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\Web\Presenters;
|
||||
use openvk\Web\Models\Entities\{Club, Photo, Album, User};
|
||||
use openvk\Web\Models\Repositories\{Photos, Albums, Users, Clubs};
|
||||
use openvk\Web\Models\Repositories\{Photos, Albums, Users, Clubs, Blacklists};
|
||||
use Nette\InvalidStateException as ISE;
|
||||
|
||||
final class PhotosPresenter extends OpenVKPresenter
|
||||
|
|
|
@ -5,7 +5,7 @@ use openvk\Web\Util\Sms;
|
|||
use openvk\Web\Themes\Themepacks;
|
||||
use openvk\Web\Models\Entities\{Photo, Post, EmailChangeVerification};
|
||||
use openvk\Web\Models\Entities\Notifications\{CoinsTransferNotification, RatingUpNotification};
|
||||
use openvk\Web\Models\Repositories\{Users, Clubs, Albums, Videos, Notes, Vouchers, EmailChangeVerifications, Audios};
|
||||
use openvk\Web\Models\Repositories\{Users, Clubs, Albums, Videos, Notes, Vouchers, EmailChangeVerifications, Audios, Blacklists};
|
||||
use openvk\Web\Models\Exceptions\InvalidUserNameException;
|
||||
use openvk\Web\Util\Validator;
|
||||
use Chandler\Security\Authenticator;
|
||||
|
@ -15,13 +15,15 @@ use Nette\Database\UniqueConstraintViolationException;
|
|||
|
||||
final class UserPresenter extends OpenVKPresenter
|
||||
{
|
||||
private $users;
|
||||
public $deactivationTolerant = false;
|
||||
protected $presenterName = "user";
|
||||
private $users;
|
||||
private $blacklists;
|
||||
|
||||
function __construct(Users $users)
|
||||
function __construct(Users $users, Blacklists $blacklists)
|
||||
{
|
||||
$this->users = $users;
|
||||
$this->blacklists = $blacklists;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
@ -34,12 +36,6 @@ final class UserPresenter extends OpenVKPresenter
|
|||
if(!is_null($user) && $user->isDeactivated()) {
|
||||
$this->template->_template = "User/deactivated.xml";
|
||||
|
||||
$this->template->user = $user;
|
||||
} else if($user->isBlacklistedBy($this->user->identity)) {
|
||||
$this->template->_template = "User/blacklisted_pov.xml";
|
||||
$this->template->user = $user;
|
||||
} else if($this->user->identity->isBlacklistedBy($user)) {
|
||||
$this->template->_template = "User/blacklisted.xml";
|
||||
$this->template->user = $user;
|
||||
} else if(!is_null($user) && !$user->canBeViewedBy($this->user->identity)) {
|
||||
$this->template->_template = "User/private.xml";
|
||||
|
@ -64,7 +60,6 @@ final class UserPresenter extends OpenVKPresenter
|
|||
|
||||
if($id !== $this->user->id) {
|
||||
$this->template->ignore_status = $user->isIgnoredBy($this->user->identity);
|
||||
$this->template->blacklist_status = $user->isBlacklistedBy($this->user->identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -599,19 +594,11 @@ final class UserPresenter extends OpenVKPresenter
|
|||
|
||||
$this->template->qrCodeType = substr($qrCode[0], 5);
|
||||
$this->template->qrCodeData = $qrCode[1];
|
||||
} else if($this->template->mode === "blacklist") {
|
||||
$page = (int)($this->queryParam('p') ?? 1);
|
||||
$count = 10;
|
||||
$offset = ($page - 1) * $count;
|
||||
}
|
||||
|
||||
$this->template->blSize = $this->user->identity->getBlacklistSize();
|
||||
$this->template->blItems = $this->user->identity->getBlacklist($offset, $count);
|
||||
$this->template->paginatorConf = (object) [
|
||||
"count" => $this->template->blSize,
|
||||
"page" => $page,
|
||||
"amount" => sizeof($this->template->blItems),
|
||||
"perPage" => OPENVK_DEFAULT_PER_PAGE,
|
||||
];
|
||||
if($this->template->mode == "blacklist") {
|
||||
$this->template->items = $this->blacklists->getList($user);
|
||||
$this->template->count = $this->blacklists->getCount($user);
|
||||
}
|
||||
|
||||
$this->template->user = $user;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\Web\Presenters;
|
||||
use openvk\Web\Models\Entities\Video;
|
||||
use openvk\Web\Models\Repositories\{Users, Videos};
|
||||
use openvk\Web\Models\Repositories\{Users, Videos, Blacklists};
|
||||
use Nette\InvalidStateException as ISE;
|
||||
|
||||
final class VideosPresenter extends OpenVKPresenter
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
{var $isFinance = $mode === 'finance'}
|
||||
{var $isFinanceTU = $mode === 'finance.top-up'}
|
||||
{var $isInterface = $mode === 'interface'}
|
||||
{var $isBl = $mode === 'blacklist'}
|
||||
{var $isBlackList = $mode === 'blacklist'}
|
||||
|
||||
<div class="tabs">
|
||||
<div n:attr="id => ($isMain ? 'activetabs' : 'ki')" class="tab">
|
||||
|
@ -25,15 +25,15 @@
|
|||
<div n:attr="id => ($isPrivacy ? 'activetabs' : 'ki')" class="tab">
|
||||
<a n:attr="id => ($isPrivacy ? 'act_tab_a' : 'ki')" href="/settings?act=privacy">{_privacy}</a>
|
||||
</div>
|
||||
<div n:attr="id => ($isBl ? 'activetabs' : 'ki')" class="tab">
|
||||
<a n:attr="id => ($isBl ? 'act_tab_a' : 'ki')" href="/settings?act=blacklist">{_blacklist}</a>
|
||||
</div>
|
||||
<div n:if="OPENVK_ROOT_CONF['openvk']['preferences']['commerce']" n:attr="id => (($isFinance || $isFinanceTU) ? 'activetabs' : 'ki')" class="tab">
|
||||
<a n:attr="id => (($isFinance || $isFinanceTU) ? 'act_tab_a' : 'ki')" href="/settings?act=finance">{_points}</a>
|
||||
</div>
|
||||
<div n:attr="id => ($isInterface ? 'activetabs' : 'ki')" class="tab">
|
||||
<a n:attr="id => ($isInterface ? 'act_tab_a' : 'ki')" href="/settings?act=interface">{_interface}</a>
|
||||
</div>
|
||||
<div n:attr="id => ($isBlackList ? 'activetabs' : 'ki')" class="tab">
|
||||
<a n:attr="id => ($isBlackList ? 'act_tab_a' : 'ki')" href="/settings?act=blacklist">{_blacklist}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container_gray">
|
||||
|
@ -717,29 +717,49 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
{elseif $isBl}
|
||||
{if $blSize < 1}
|
||||
{include "../components/error.xml", description => tr("bl_count_zero_desc")}
|
||||
{else}
|
||||
<h4 style="margin-bottom: 10px;">{tr("bl_count", $blSize)}.</h4>
|
||||
<div class='entity_vertical_list mini m_mini scroll_container'>
|
||||
<div n:foreach="$blItems as $item" class="entity_vertical_list_item scroll_node">
|
||||
<div class="first_column">
|
||||
<a href="{$item->getURL()}" class="avatar">
|
||||
<img src='{$item->getAvatarURL()}'>
|
||||
</a>
|
||||
<div class="info">
|
||||
<b class="noOverflow">
|
||||
<a href="{$item->getURL()}">
|
||||
{$item->getCanonicalName()}
|
||||
</a>
|
||||
</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{include "../components/paginator.xml", conf => $paginatorConf}
|
||||
|
||||
{elseif $isBlackList}
|
||||
{if $count < 1}
|
||||
{include "../components/nothing.xml"}
|
||||
{/if}
|
||||
<div n:foreach="$items as $item" class="content">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<a href="/id2">
|
||||
<img src="{$item->getTarget()->getAvatarURL()}" width="75" alt="Фотография пользователя">
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="width: 100%">
|
||||
<a href="/id2">
|
||||
<b>
|
||||
{$item->getTarget()->getCanonicalName()}
|
||||
<img n:if="$item->getTarget()->isVerified()" class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png">
|
||||
</b>
|
||||
</a>
|
||||
<br>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="120" valign="top"><span class="nobold">Дата добавления:</span></td>
|
||||
<td>{$item->getCreationDate()}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td valign="top" class="action_links" style="width: 150px;">
|
||||
<form action="/removeFromBl" method="post" class="profile_link_form">
|
||||
<input type="hidden" name="act" value="rem">
|
||||
<input type="hidden" name="id" value="{$item->getTarget()->getId()}">
|
||||
<input type="hidden" name="hash" value="{$csrfToken}">
|
||||
<input type="submit" class="profile_link" value="удалить из чёрного списка">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -166,12 +166,24 @@
|
|||
{/if}
|
||||
|
||||
<a class="profile_link" style="display:block;width:96%;" href="javascript:reportUser({$user->getId()})">{_report}</a>
|
||||
<a n:if="!$blacklist_status" id="_bl_toggler" data-name="{$user->getMorphedName('genitive', false)}" data-val="1" data-id="{$user->getRealId()}" class="profile_link" style="display:block;width:96%;">{_bl_add}</a>
|
||||
<a n:if="!$user->isHideFromGlobalFeedEnabled()" class="profile_link" style="display:block;width:96%;" id="__ignoreSomeone" data-val='{!$ignore_status ? 1 : 0}' data-id="{$user->getId()}">
|
||||
{if !$ignore_status}{_ignore_user}{else}{_unignore_user}{/if}
|
||||
</a>
|
||||
{/if}
|
||||
<a style="width: 194px;" n:if="$user->getFollowersCount() > 0" href="/friends{$user->getId()}?act=incoming" class="profile_link">{tr("followers", $user->getFollowersCount())}</a>
|
||||
{if $isBlacklistedThem}
|
||||
<form n:if="$thisUser->getId() != $user->getId()" action="/removeFromBl" method="post" class="profile_link_form">
|
||||
<input type="hidden" name="id" value="{$user->getId()}" />
|
||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||
<input type="submit" class="profile_link" value="Удалить из чёрного списка" />
|
||||
</form>
|
||||
{else}
|
||||
<form n:if="$thisUser->getId() != $user->getId()" action="/addToBl" method="post" class="profile_link_form">
|
||||
<input type="hidden" name="id" value="{$user->getId()}" />
|
||||
<input type="hidden" name="hash" value="{$csrfToken}" />
|
||||
<input type="submit" class="profile_link" value="Добавить в чёрный список" />
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
<div n:if="isset($thisUser) && !$thisUser->prefersNotToSeeRating()" class="profile-hints">
|
||||
{var $completeness = $user->getProfileCompletenessReport()}
|
||||
|
@ -387,6 +399,11 @@
|
|||
|
||||
<div class="right_big_block">
|
||||
<div class="page_info">
|
||||
<div n:if="$isBlacklistedByThem AND $thisUser->isAdmin() AND $thisUser->getId() !== $user->getId()" class="user-alert">
|
||||
<b>{_admin_privacy_warning}:</b>
|
||||
<br/>
|
||||
{_user_blacklisted_you}
|
||||
</div>
|
||||
<div n:if="!is_null($alert = $user->getAlert())" class="user-alert">{strpos($alert, "@") === 0 ? tr(substr($alert, 1)) : $alert}</div>
|
||||
{var $thatIsThisUser = isset($thisUser) && $user->getId() == $thisUser->getId()}
|
||||
<div n:if="$thatIsThisUser" class="page_status_popup" id="status_editor" style="display: none;">
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
{extends "../@layout.xml"}
|
||||
{block title}{$user->getCanonicalName()}{/block}
|
||||
|
||||
{block header}
|
||||
{$user->getCanonicalName()}
|
||||
<img n:if="$user->isVerified()"
|
||||
class="name-checkmark"
|
||||
src="/assets/packages/static/openvk/img/checkmark.png"
|
||||
/>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
<div class="left_small_block">
|
||||
<div>
|
||||
<img src="{$user->getAvatarUrl('normal')}"
|
||||
alt="{$user->getCanonicalName()}"
|
||||
style="width: 100%; image-rendering: -webkit-optimize-contrast;" />
|
||||
</div>
|
||||
<div id="profile_links" n:if="isset($thisUser)">
|
||||
<a class="profile_link" style="display:block;width:96%;" href="javascript:reportUser({$user->getId()})">{_report}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right_big_block">
|
||||
<div class="page_info">
|
||||
<div class="accountInfo clearFix">
|
||||
<div class="profileName">
|
||||
<h2>{$user->getFullName()}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="msg msg_yellow" style="width: 93%;margin-top: 10px;">
|
||||
{var $m = $user->isFemale() ? "f" : "m"}
|
||||
{tr("limited_access_to_page_$m", $user->getFirstName())}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
|
@ -1,37 +0,0 @@
|
|||
{extends "../@layout.xml"}
|
||||
{block title}{$user->getCanonicalName()}{/block}
|
||||
|
||||
{block header}
|
||||
{$user->getCanonicalName()}
|
||||
<img n:if="$user->isVerified()"
|
||||
class="name-checkmark"
|
||||
src="/assets/packages/static/openvk/img/checkmark.png"
|
||||
/>
|
||||
{/block}
|
||||
|
||||
{block content}
|
||||
<div class="left_small_block">
|
||||
<div>
|
||||
<img src="{$user->getAvatarUrl('normal')}"
|
||||
alt="{$user->getCanonicalName()}"
|
||||
style="width: 100%; image-rendering: -webkit-optimize-contrast;" />
|
||||
</div>
|
||||
<div id="profile_links" n:if="isset($thisUser)">
|
||||
<a n:if="!$blacklist_status" id="_bl_toggler" data-val="0" data-id="{$user->getRealId()}" class="profile_link" style="display:block;width:96%;">{_bl_remove}</a>
|
||||
<a class="profile_link" style="display:block;width:96%;" href="javascript:reportUser({$user->getId()})">{_report}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="right_big_block">
|
||||
<div class="page_info">
|
||||
<div class="accountInfo clearFix">
|
||||
<div class="profileName">
|
||||
<h2>{$user->getFullName()}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="msg msg_yellow" style="width: 93%;margin-top: 10px;">
|
||||
{tr("you_blacklisted", $user->getMorphedName("genitive", false))}.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
|
@ -41,7 +41,6 @@
|
|||
<input type="submit" class="profile_link" value="{_friends_reject}" style="width: 194px;" />
|
||||
</form>
|
||||
{/if}
|
||||
<a id="_bl_toggler" data-name="{$user->getMorphedName('genitive', false)}" data-val="1" data-id="{$user->getRealId()}" class="profile_link" style="display:block;width:96%;">{_bl_add}</a>
|
||||
<a class="profile_link" style="display:block;width:96%;" href="javascript:reportUser({$user->getId()})">{_report}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -25,6 +25,7 @@ services:
|
|||
- openvk\Web\Presenters\AppsPresenter
|
||||
- openvk\Web\Presenters\ThemepacksPresenter
|
||||
- openvk\Web\Presenters\VKAPIPresenter
|
||||
- openvk\Web\Presenters\BlacklistPresenter
|
||||
- openvk\Web\Presenters\PollPresenter
|
||||
- openvk\Web\Presenters\BannedLinkPresenter
|
||||
- openvk\Web\Models\Repositories\Users
|
||||
|
@ -49,6 +50,7 @@ services:
|
|||
- openvk\Web\Models\Repositories\Topics
|
||||
- openvk\Web\Models\Repositories\Applications
|
||||
- openvk\Web\Models\Repositories\ContentSearchRepository
|
||||
- openvk\Web\Models\Repositories\Blacklists
|
||||
- openvk\Web\Models\Repositories\Aliases
|
||||
- openvk\Web\Models\Repositories\BannedLinks
|
||||
- openvk\Web\Models\Repositories\ChandlerGroups
|
||||
|
|
|
@ -107,6 +107,10 @@ routes:
|
|||
handler: "Group->sub"
|
||||
- url: "/setSub/v4/club"
|
||||
handler: "Group->attend"
|
||||
- url: "/removeFromBl"
|
||||
handler: "Blacklist->removeFromBlacklist"
|
||||
- url: "/addToBl"
|
||||
handler: "Blacklist->addToBlacklist"
|
||||
- url: "/groups/{num}/setNewOwner/{num}"
|
||||
handler: "Group->changeOwner"
|
||||
- url: "/comment{num}/like"
|
||||
|
|
|
@ -3597,11 +3597,6 @@ hr {
|
|||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.entity_vertical_list.scroll_container {
|
||||
height: unset;
|
||||
overflow-y: unset;
|
||||
}
|
||||
|
||||
.entity_vertical_list .entity_vertical_list_item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
@ -3616,15 +3611,6 @@ hr {
|
|||
gap: 4px;
|
||||
}
|
||||
|
||||
.entity_vertical_list.m_mini .entity_vertical_list_item .first_column {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.entity_vertical_list.m_mini .entity_vertical_list_item .first_column .avatar img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.entity_vertical_list .entity_vertical_list_item .avatar {
|
||||
display: block;
|
||||
}
|
||||
|
|
|
@ -2587,42 +2587,3 @@ async function changeStatus() {
|
|||
document.status_popup_form.submit.innerHTML = tr("send");
|
||||
document.status_popup_form.submit.disabled = false;
|
||||
}
|
||||
|
||||
u(document).on('click', '#_bl_toggler', async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
const target = u(e.target)
|
||||
const val = Number(target.attr('data-val'))
|
||||
const id = Number(target.attr('data-id'))
|
||||
const name = target.attr('data-name')
|
||||
|
||||
const fallback = (e) => {
|
||||
fastError(e.message)
|
||||
target.removeClass('lagged')
|
||||
}
|
||||
|
||||
if(val == 1) {
|
||||
const msg = new CMessageBox({
|
||||
title: tr('addition_to_bl'),
|
||||
body: `<span>${escapeHtml(tr('adding_to_bl_sure', name))}</span>`,
|
||||
buttons: [tr('yes'), tr('no')],
|
||||
callbacks: [async () => {
|
||||
try {
|
||||
target.addClass('lagged')
|
||||
await window.OVKAPI.call('account.ban', {'owner_id': id})
|
||||
window.router.route(location.href)
|
||||
} catch(e) {
|
||||
fallback(e)
|
||||
}
|
||||
}, () => Function.noop]
|
||||
})
|
||||
} else {
|
||||
try {
|
||||
target.addClass('lagged')
|
||||
await window.OVKAPI.call('account.unban', {'owner_id': id})
|
||||
window.router.route(location.href)
|
||||
} catch(e) {
|
||||
fallback(e)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -289,10 +289,6 @@ u(document).on('click', 'a', async (e) => {
|
|||
})
|
||||
|
||||
u(document).on('submit', 'form', async (e) => {
|
||||
if(e.defaultPrevented) {
|
||||
return
|
||||
}
|
||||
|
||||
if(u('#ajloader').hasClass('shown')) {
|
||||
e.preventDefault()
|
||||
return
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
CREATE TABLE `blacklist_relations` (
|
||||
CREATE TABLE `blacklists` (
|
||||
`index` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`author` BIGINT UNSIGNED NOT NULL,
|
||||
`target` BIGINT UNSIGNED NOT NULL,
|
||||
`created` BIGINT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`index`)
|
||||
) ENGINE = InnoDB;
|
||||
ALTER TABLE `blacklist_relations` ADD INDEX(`author`, `target`);
|
|
@ -1823,21 +1823,6 @@
|
|||
"user_blacklisted" = "$1 has been blacklisted";
|
||||
"user_removed_from_the_blacklist" = "$1 has been removed from the blacklist.";
|
||||
|
||||
"adding_to_bl_sure" = "You sure you want to blacklist $1?";
|
||||
|
||||
"bl_count_zero_desc" = "There are no users on your blacklist yet.";
|
||||
"bl_count_zero" = "There are no users on your blacklist";
|
||||
"bl_count_one" = "You have one user on your blacklist";
|
||||
"bl_count_few" = "You have $1 users on your blacklist";
|
||||
"bl_count_many" = "You have $1 users on your blacklist";
|
||||
"bl_count_other" = "You have $1 users on your blacklist";
|
||||
|
||||
"you_blacklisted" = "You blacklisted $1";
|
||||
"bl_add" = "Add to blacklist";
|
||||
"bl_remove" = "Remove from blacklist";
|
||||
|
||||
"addition_to_bl" = "Addition to blacklist";
|
||||
|
||||
/* Away */
|
||||
|
||||
"transition_is_blocked" = "Transition is blocked";
|
||||
|
|
|
@ -1719,21 +1719,6 @@
|
|||
"user_blacklisted" = "$1 занесён в чёрный список.";
|
||||
"user_removed_from_the_blacklist" = "$1 удалён из чёрного списка.";
|
||||
|
||||
"adding_to_bl_sure" = "Вы уверены, что хотите внести $1 в чёрный список?";
|
||||
|
||||
"bl_count_zero_desc" = "В вашем чёрном списке ещё нет пользователей.";
|
||||
"bl_count_zero" = "В вашем чёрном списке нет пользователей";
|
||||
"bl_count_one" = "В вашем чёрном списке один пользователь";
|
||||
"bl_count_few" = "В вашем чёрном списке $1 пользователя";
|
||||
"bl_count_many" = "В вашем чёрном списке $1 пользователей";
|
||||
"bl_count_other" = "В вашем чёрном списке $1 пользователей";
|
||||
|
||||
"you_blacklisted" = "Вы внесли $1 в чёрный список";
|
||||
"bl_add" = "Добавить в чёрный список";
|
||||
"bl_remove" = "Удалить из чёрного списка";
|
||||
|
||||
"addition_to_bl" = "Добавление в чёрный список";
|
||||
|
||||
/* Away */
|
||||
|
||||
"transition_is_blocked" = "Переход по ссылке заблокирован";
|
||||
|
|
|
@ -38,9 +38,8 @@ openvk:
|
|||
maxViolations: 50
|
||||
maxViolationsAge: 120
|
||||
autoban: true
|
||||
blacklists:
|
||||
limit: 100
|
||||
applyToAdmins: true
|
||||
blacklists:
|
||||
applyToAdmins: true
|
||||
registration:
|
||||
enable: true
|
||||
disablingReason: ""
|
||||
|
|
Loading…
Reference in a new issue