From c39780c3f9c4b126cc316f93ccff9b08db03eba3 Mon Sep 17 00:00:00 2001 From: lalka2016 <99399973+lalka2016@users.noreply.github.com> Date: Tue, 11 Jul 2023 15:09:37 +0300 Subject: [PATCH] Fih --- VKAPI/Handlers/Groups.php | 2 +- VKAPI/Handlers/Users.php | 2 +- Web/Models/Entities/Video.php | 2 +- Web/Models/Repositories/Clubs.php | 4 ++-- Web/Presenters/GroupPresenter.php | 2 +- Web/Presenters/templates/Search/Index.xml | 2 +- Web/Presenters/templates/User/View.xml | 6 +++--- locales/en.strings | 1 + locales/ru.strings | 1 + 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/VKAPI/Handlers/Groups.php b/VKAPI/Handlers/Groups.php index 54742b65..95068a78 100644 --- a/VKAPI/Handlers/Groups.php +++ b/VKAPI/Handlers/Groups.php @@ -21,7 +21,7 @@ final class Groups extends VKAPIRequestHandler if(is_null($user) || $user->isDeleted() || $user->isBanned()) $this->fail(15, "Invalid user"); - if($user->getPrivacyPermission("page.info.read", $this->getUser() ?? NULL)) { + if(!$user->getPrivacyPermission("groups.read", $this->getUser() ?? NULL)) { $this->fail(8, "Access denied: this user chose to hide his groups."); } diff --git a/VKAPI/Handlers/Users.php b/VKAPI/Handlers/Users.php index f15199df..a1d95848 100644 --- a/VKAPI/Handlers/Users.php +++ b/VKAPI/Handlers/Users.php @@ -223,7 +223,7 @@ final class Users extends VKAPIRequestHandler $user = $users->get($user_id); if(!$user || $user->isDeleted()) { - $this->fail(4, "User deleted"); + $this->fail(4, "User is deleted"); } if(!$user->canBeViewedBy($this->getUser() ?? NULL)) { diff --git a/Web/Models/Entities/Video.php b/Web/Models/Entities/Video.php index ae069ac0..0299f5ce 100644 --- a/Web/Models/Entities/Video.php +++ b/Web/Models/Entities/Video.php @@ -230,7 +230,7 @@ class Video extends Media return $this->getOwner()->canBeViewedBy($user) && $this->getOwner()->getPrivacyPermission('videos.read', $user); } else { # когда у видосов появятся группы - return true; + return $this->getOwner()->canBeViewedBy($user); } } } diff --git a/Web/Models/Repositories/Clubs.php b/Web/Models/Repositories/Clubs.php index c00fc12a..d0077e99 100644 --- a/Web/Models/Repositories/Clubs.php +++ b/Web/Models/Repositories/Clubs.php @@ -52,7 +52,7 @@ class Clubs $nnparamsCount = 0; foreach($pars as $paramName => $paramValue) - if($paramName != "before" && $paramName != "after" && $paramName != "gender" && $paramName != "maritalstatus" && $paramName != "politViews" && $paramName != "doNotSearchMe") + if($paramName != "doNotShowDeleted") $paramValue != NULL ? $notNullParams += ["$paramName" => "%$paramValue%"] : NULL; else $paramValue != NULL ? $notNullParams += ["$paramName" => "$paramValue"] : NULL; @@ -93,7 +93,7 @@ class Clubs ]; */ } - + function getWriteableClubs(int $id): \Traversable { $result = $this->clubs->where("owner", $id)->where("deleted", 0); diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php index ba474d67..7266ee93 100644 --- a/Web/Presenters/GroupPresenter.php +++ b/Web/Presenters/GroupPresenter.php @@ -454,7 +454,7 @@ final class GroupPresenter extends OpenVKPresenter } if($club->isBanned()) { - $this->flashFail("err", tr("error")); + $this->flashFail("err", tr("error"), tr("banned_restore")); } $club->setDeleted(0); diff --git a/Web/Presenters/templates/Search/Index.xml b/Web/Presenters/templates/Search/Index.xml index 4d322f2a..78d27267 100644 --- a/Web/Presenters/templates/Search/Index.xml +++ b/Web/Presenters/templates/Search/Index.xml @@ -188,7 +188,7 @@ {elseif $type == "posts"}
- {if !$dat->canBeViewedBy($thisUser ?? NULL) || $dat->getTargetWall() < 0 && $dat->getOwner()->isHideFromGlobalFeedEnabled()} + {if !$dat->canBeViewedBy($thisUser ?? NULL) || $dat->getTargetWall() < 0 && $dat->getWallOwner()->isHideFromGlobalFeedEnabled()} {_dont_need_to_see_post} {else} {include "../components/post.xml", post => $dat, commentSection => true, onWallOf => true} diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index 9fd4c049..d2b16bda 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -59,7 +59,7 @@ {/block} {block content} - {if !is_null($thisUser) && $thisUser->getId() != $user->getId() && $user->getProfileType() == 1 && $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)} + {if !is_null($thisUser) && $thisUser->getId() != $user->getId() && $user->getProfileType() == 1 && $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL) && $thisUser->getSubscriptionStatus($user) < 3}
{_private_profile_warning}
@@ -124,7 +124,7 @@ {/if}
-
+
@@ -134,7 +134,7 @@
-
+
{var $m = $user->isFemale() ? "f" : "m"} {tr("limited_access_to_page_$m", $user->getFirstName())} diff --git a/locales/en.strings b/locales/en.strings index 1092c03a..e83ff7d5 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -348,6 +348,7 @@ "search_group_desc" = "Here you can browse through the existing groups and choose a group to suit your needs..."; "owners_delete" = "Only group's creator can delete it."; "owners_restore" = "Only group's creator can restore it?"; +"banned_restore" = "You can't unban banned club."; "delete_group" = "Delete group"; "restore_group" = "Restore group"; diff --git a/locales/ru.strings b/locales/ru.strings index 628d64b7..257a2d0a 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -332,6 +332,7 @@ "owners_delete" = "Только создатель группы может удалить её."; "owners_restore" = "Только создатель группы может восстановить её?"; +"banned_restore" = "Вы не можете разблокировать заблокированную группу."; "delete_group" = "Удалить группу"; "restore_group" = "Восстановить группу";