VKAPI: Fix privacy issues

Closes #622
This commit is contained in:
veselcraft 2022-07-31 13:25:00 +03:00
parent 6b86c204ab
commit 4ba7c5b982
No known key found for this signature in database
GPG key ID: AED66BC1AC628A4E
2 changed files with 9 additions and 4 deletions

View file

@ -25,7 +25,7 @@ final class Users extends VKAPIRequestHandler
for($i=0; $i < $ic; $i++) {
$usr = $users->get((int) $usrs[$i]);
if(is_null($usr)) {
if(is_null($usr) || $usr->isDeleted()) {
$response[$i] = (object)[
"id" => $usrs[$i],
"first_name" => "DELETED",

View file

@ -12,16 +12,21 @@ use openvk\Web\Models\Repositories\Comments as CommentsRepo;
final class Wall extends VKAPIRequestHandler
{
function get(string $owner_id, string $domain = "", int $offset = 0, int $count = 30, int $extended = 0): object
function get(int $owner_id, string $domain = "", int $offset = 0, int $count = 30, int $extended = 0): object
{
$posts = new PostsRepo;
$items = [];
$profiles = [];
$groups = [];
$count = $posts->getPostCountOnUserWall((int) $owner_id);
$count = $posts->getPostCountOnUserWall($owner_id);
foreach($posts->getPostsFromUsersWall((int)$owner_id, 1, $count, $offset) as $post) {
$wallOnwer = (new UsersRepo)->get($owner_id);
if(!$wallOnwer || $wallOnwer->isDeleted() || $wallOnwer->isDeleted())
$this->fail(18, "User was deleted or banned");
foreach($posts->getPostsFromUsersWall($owner_id, 1, $count, $offset) as $post) {
$from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId();
$attachments = [];