diff --git a/VKAPI/Handlers/Users.php b/VKAPI/Handlers/Users.php index 52c80c64..5b6be1d0 100644 --- a/VKAPI/Handlers/Users.php +++ b/VKAPI/Handlers/Users.php @@ -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; } } } diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index 4418247c..0f048b1b 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -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) { diff --git a/Web/Presenters/BlacklistPresenter.php b/Web/Presenters/BlacklistPresenter.php index a9cb3752..ede24240 100644 --- a/Web/Presenters/BlacklistPresenter.php +++ b/Web/Presenters/BlacklistPresenter.php @@ -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 удалён из чёрного списка."); } -} \ No newline at end of file +} diff --git a/Web/Presenters/NotesPresenter.php b/Web/Presenters/NotesPresenter.php index 9cfc067f..363d814c 100644 --- a/Web/Presenters/NotesPresenter.php +++ b/Web/Presenters/NotesPresenter.php @@ -1,6 +1,6 @@ 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"))) { diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 1d8223f1..db9a6427 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -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")); } } diff --git a/Web/Presenters/VideosPresenter.php b/Web/Presenters/VideosPresenter.php index b2f40bd1..e7752385 100644 --- a/Web/Presenters/VideosPresenter.php +++ b/Web/Presenters/VideosPresenter.php @@ -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")); } diff --git a/Web/Presenters/templates/User/Settings.xml b/Web/Presenters/templates/User/Settings.xml index ff02fd06..4c357b66 100644 --- a/Web/Presenters/templates/User/Settings.xml +++ b/Web/Presenters/templates/User/Settings.xml @@ -28,7 +28,7 @@ {_interface}
diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index 5a3881fa..f046d7a9 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -368,9 +368,9 @@