mirror of
https://github.com/openvk/openvk
synced 2024-11-15 11:39:13 +03:00
ok
This commit is contained in:
parent
0c65856108
commit
a11cb49b60
12 changed files with 114 additions and 108 deletions
|
@ -43,104 +43,106 @@ final class Users extends VKAPIRequestHandler
|
|||
"last_name" => $usr->getLastName(),
|
||||
"is_closed" => (new Blacklists)->isBanned($usr, $authuser),
|
||||
"can_access_closed" => !(new Blacklists)->isBanned($usr, $authuser),
|
||||
"blacklisted" => (new Blacklists)->isBanned($usr, $authuser),
|
||||
"blacklisted_by_me" => (new Blacklists)->isBanned($authuser, $usr)
|
||||
];
|
||||
|
||||
$flds = explode(',', $fields);
|
||||
|
||||
if (!(new Blacklists)->isBanned($usr, $authuser))
|
||||
foreach($flds as $field) {
|
||||
switch($field) {
|
||||
case "verified":
|
||||
$response[$i]->verified = intval($usr->isVerified());
|
||||
break;
|
||||
case "sex":
|
||||
$response[$i]->sex = $usr->isFemale() ? 1 : 2;
|
||||
break;
|
||||
case "has_photo":
|
||||
$response[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
||||
break;
|
||||
case "photo_max_orig":
|
||||
$response[$i]->photo_max_orig = $usr->getAvatarURL();
|
||||
break;
|
||||
case "photo_max":
|
||||
$response[$i]->photo_max = $usr->getAvatarURL("original");
|
||||
break;
|
||||
case "photo_50":
|
||||
$response[$i]->photo_50 = $usr->getAvatarURL();
|
||||
break;
|
||||
case "photo_100":
|
||||
$response[$i]->photo_100 = $usr->getAvatarURL("tiny");
|
||||
break;
|
||||
case "photo_200":
|
||||
$response[$i]->photo_200 = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
case "photo_200_orig": # вообще не ебу к чему эта строка ну пусть будет кек
|
||||
$response[$i]->photo_200_orig = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
case "photo_400_orig":
|
||||
$response[$i]->photo_400_orig = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
|
||||
# Она хочет быть выебанной видя матан
|
||||
# Покайфу когда ты Виет а вокруг лишь дискриминант
|
||||
switch($field) {
|
||||
case "verified":
|
||||
$response[$i]->verified = intval($usr->isVerified());
|
||||
break;
|
||||
case "sex":
|
||||
$response[$i]->sex = $usr->isFemale() ? 1 : 2;
|
||||
break;
|
||||
case "has_photo":
|
||||
$response[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
||||
break;
|
||||
case "photo_max_orig":
|
||||
$response[$i]->photo_max_orig = $usr->getAvatarURL();
|
||||
break;
|
||||
case "photo_max":
|
||||
$response[$i]->photo_max = $usr->getAvatarURL("original");
|
||||
break;
|
||||
case "photo_50":
|
||||
$response[$i]->photo_50 = $usr->getAvatarURL();
|
||||
break;
|
||||
case "photo_100":
|
||||
$response[$i]->photo_100 = $usr->getAvatarURL("tiny");
|
||||
break;
|
||||
case "photo_200":
|
||||
$response[$i]->photo_200 = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
case "photo_200_orig": # вообще не ебу к чему эта строка ну пусть будет кек
|
||||
$response[$i]->photo_200_orig = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
case "photo_400_orig":
|
||||
$response[$i]->photo_400_orig = $usr->getAvatarURL("normal");
|
||||
break;
|
||||
|
||||
# ору а когда я это успел написать
|
||||
# вова кстати не матерись в коде мамка же спалит азщазаззазщазазаззазазазх
|
||||
case "status":
|
||||
if($usr->getStatus() != NULL)
|
||||
$response[$i]->status = $usr->getStatus();
|
||||
break;
|
||||
case "screen_name":
|
||||
if($usr->getShortCode() != NULL)
|
||||
$response[$i]->screen_name = $usr->getShortCode();
|
||||
break;
|
||||
case "friend_status":
|
||||
switch($usr->getSubscriptionStatus($authuser)) {
|
||||
case 3:
|
||||
# NOTICE falling through
|
||||
case 0:
|
||||
$response[$i]->friend_status = $usr->getSubscriptionStatus($authuser);
|
||||
break;
|
||||
case 1:
|
||||
$response[$i]->friend_status = 2;
|
||||
break;
|
||||
case 2:
|
||||
$response[$i]->friend_status = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "last_seen":
|
||||
if ($usr->onlineStatus() == 0)
|
||||
$response[$i]->last_seen = (object) [
|
||||
"platform" => 1,
|
||||
"time" => $usr->getOnline()->timestamp()
|
||||
];
|
||||
case "music":
|
||||
$response[$i]->music = $usr->getFavoriteMusic();
|
||||
break;
|
||||
case "movies":
|
||||
$response[$i]->movies = $usr->getFavoriteFilms();
|
||||
break;
|
||||
case "tv":
|
||||
$response[$i]->tv = $usr->getFavoriteShows();
|
||||
break;
|
||||
case "books":
|
||||
$response[$i]->books = $usr->getFavoriteBooks();
|
||||
break;
|
||||
case "city":
|
||||
$response[$i]->city = $usr->getCity();
|
||||
break;
|
||||
case "interests":
|
||||
$response[$i]->interests = $usr->getInterests();
|
||||
break;
|
||||
}
|
||||
}
|
||||
# Она хочет быть выебанной видя матан
|
||||
# Покайфу когда ты Виет а вокруг лишь дискриминант
|
||||
|
||||
# ору а когда я это успел написать
|
||||
# вова кстати не матерись в коде мамка же спалит азщазаззазщазазаззазазазх
|
||||
case "status":
|
||||
if($usr->getStatus() != NULL)
|
||||
$response[$i]->status = $usr->getStatus();
|
||||
break;
|
||||
case "screen_name":
|
||||
if($usr->getShortCode() != NULL)
|
||||
$response[$i]->screen_name = $usr->getShortCode();
|
||||
break;
|
||||
case "friend_status":
|
||||
switch($usr->getSubscriptionStatus($authuser)) {
|
||||
case 3:
|
||||
# NOTICE falling through
|
||||
case 0:
|
||||
$response[$i]->friend_status = $usr->getSubscriptionStatus($authuser);
|
||||
break;
|
||||
case 1:
|
||||
$response[$i]->friend_status = 2;
|
||||
break;
|
||||
case 2:
|
||||
$response[$i]->friend_status = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "last_seen":
|
||||
if ($usr->onlineStatus() == 0)
|
||||
$response[$i]->last_seen = (object) [
|
||||
"platform" => 1,
|
||||
"time" => $usr->getOnline()->timestamp()
|
||||
];
|
||||
case "music":
|
||||
$response[$i]->music = $usr->getFavoriteMusic();
|
||||
break;
|
||||
case "movies":
|
||||
$response[$i]->movies = $usr->getFavoriteFilms();
|
||||
break;
|
||||
case "tv":
|
||||
$response[$i]->tv = $usr->getFavoriteShows();
|
||||
break;
|
||||
case "books":
|
||||
$response[$i]->books = $usr->getFavoriteBooks();
|
||||
break;
|
||||
case "city":
|
||||
$response[$i]->city = $usr->getCity();
|
||||
break;
|
||||
case "interests":
|
||||
$response[$i]->interests = $usr->getInterests();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(new Blacklists)->isBanned($usr, $authuser))
|
||||
if($usr->getOnline()->timestamp() + 300 > time())
|
||||
$response[$i]->online = 1;
|
||||
else
|
||||
$response[$i]->online = 0;
|
||||
if($usr->getOnline()->timestamp() + 300 > time())
|
||||
$response[$i]->online = 1;
|
||||
else
|
||||
$response[$i]->online = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -439,10 +439,7 @@ class User extends RowModel
|
|||
else if($user->getId() === $this->getId())
|
||||
return true;
|
||||
else if ((new Blacklists)->isBanned($this, $user)) {
|
||||
if ($user->isAdmin() && !OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"])
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return $user->isAdmin() && !OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"];
|
||||
}
|
||||
|
||||
switch($permStatus) {
|
||||
|
|
|
@ -13,7 +13,7 @@ final class BlacklistPresenter extends OpenVKPresenter
|
|||
$this->blacklists = $blacklists;
|
||||
}
|
||||
|
||||
function renderAddToBl(): void
|
||||
function renderAddToBlacklist(): void
|
||||
{
|
||||
$this->willExecuteWriteAction();
|
||||
$this->assertUserLoggedIn();
|
||||
|
@ -29,7 +29,7 @@ final class BlacklistPresenter extends OpenVKPresenter
|
|||
$this->flashFail("succ", "Успех", $target->getCanonicalName() . " занесён в чёрный список.");
|
||||
}
|
||||
|
||||
function renderRemoveFromBl(): void
|
||||
function renderRemoveFromBlacklist(): void
|
||||
{
|
||||
$this->willExecuteWriteAction();
|
||||
$this->assertUserLoggedIn();
|
||||
|
@ -41,4 +41,4 @@ final class BlacklistPresenter extends OpenVKPresenter
|
|||
|
||||
$this->flashFail("succ", "Успех", "$name удалён из чёрного списка.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php declare(strict_types=1);
|
||||
namespace openvk\Web\Presenters;
|
||||
use openvk\Web\Models\Repositories\{Users, Notes, Blacklists};
|
||||
use openvk\Web\Models\Repositories\{Users, Notes};
|
||||
use openvk\Web\Models\Entities\Note;
|
||||
|
||||
final class NotesPresenter extends OpenVKPresenter
|
||||
|
|
|
@ -139,7 +139,7 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
|
||||
if ((new Blacklists)->isBanned($album->getOwner(), $this->user->identity)) {
|
||||
if (!$this->user->identity->isAdmin() OR $this->user->identity->isAdmin() AND OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"])
|
||||
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список.");
|
||||
$this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you"));
|
||||
}
|
||||
|
||||
if($owner > 0 /* bc we currently don't have perms for clubs */) {
|
||||
|
@ -166,7 +166,7 @@ final class PhotosPresenter extends OpenVKPresenter
|
|||
|
||||
if ((new Blacklists)->isBanned($photo->getOwner(), $this->user->identity)) {
|
||||
if (!$this->user->identity->isAdmin() OR $this->user->identity->isAdmin() AND OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"])
|
||||
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список.");
|
||||
$this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you"));
|
||||
}
|
||||
|
||||
if(!is_null($this->queryParam("from"))) {
|
||||
|
|
|
@ -35,10 +35,10 @@ final class UserPresenter extends OpenVKPresenter
|
|||
if ($this->blacklists->isBanned($user, $this->user->identity)) {
|
||||
if ($this->user->identity->isAdmin()) {
|
||||
if (OPENVK_ROOT_CONF["openvk"]["preferences"]["security"]["blacklists"]["applyToAdmins"]) {
|
||||
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список.");
|
||||
$this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you"));
|
||||
}
|
||||
} else {
|
||||
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список.");
|
||||
$this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ final class VideosPresenter extends OpenVKPresenter
|
|||
if(!$user) $this->notFound();
|
||||
if(!$user->getPrivacyPermission('videos.read', $this->user->identity ?? NULL)) {
|
||||
if ((new Blacklists)->isBanned($user, $this->user->identity))
|
||||
$this->flashFail("err", tr("forbidden"), "Пользователь внёс Вас в чёрный список.");
|
||||
$this->flashFail("err", tr("forbidden"), tr("user_blacklisted_you"));
|
||||
|
||||
$this->flashFail("err", tr("forbidden"), tr("forbidden_comment"));
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<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">Чёрный список</a>
|
||||
<a n:attr="id => ($isBlackList ? 'act_tab_a' : 'ki')" href="/settings?act=blacklist">{_blacklist}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -368,9 +368,9 @@
|
|||
<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>Будьте осторожны с этой информацией:</b>
|
||||
<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()}
|
||||
|
|
|
@ -43,4 +43,4 @@ 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\Blacklists
|
||||
|
|
|
@ -98,9 +98,9 @@ routes:
|
|||
- url: "/setSub/v4/club"
|
||||
handler: "Group->attend"
|
||||
- url: "/removeFromBl"
|
||||
handler: "Blacklist->removeFromBl"
|
||||
handler: "Blacklist->removeFromBlacklist"
|
||||
- url: "/addToBl"
|
||||
handler: "Blacklist->addToBl"
|
||||
handler: "Blacklist->addToBlacklist"
|
||||
- url: "/groups/{num}/setNewOwner/{num}"
|
||||
handler: "Group->changeOwner"
|
||||
- url: "/comment{num}/like"
|
||||
|
|
|
@ -1111,6 +1111,8 @@
|
|||
"admin_commerce_disabled" = "Коммерция отключена системным администратором";
|
||||
"admin_commerce_disabled_desc" = "Настройки ваучеров и подарков будут сохранены, но не будут оказывать никакого влияния.";
|
||||
|
||||
"admin_privacy_warning" = "Будьте осторожны с этой информацией";
|
||||
|
||||
/* Paginator (deprecated) */
|
||||
|
||||
"paginator_back" = "Назад";
|
||||
|
@ -1174,3 +1176,8 @@
|
|||
|
||||
"cookies_popup_content" = "Все дети любят печенье, поэтому этот веб-сайт использует Cookies для того, чтобы идентифицировать вашу сессию и ничего более. Ознакомьтесь с нашей <a href='/privacy'>политикой конфиденциальности</a> для получения дополнительной информации.";
|
||||
"cookies_popup_agree" = "Согласен";
|
||||
|
||||
/* Blacklist */
|
||||
|
||||
"blacklist" = "Чёрный список";
|
||||
"user_blacklisted_you" = "Пользователь внёс Вас в чёрный список.";
|
Loading…
Reference in a new issue