Skip to content

Commit

Permalink
Merge branch 'openvk:master' into instance_mtn
Browse files Browse the repository at this point in the history
  • Loading branch information
tretdm authored Nov 8, 2023
2 parents 32be0cd + c9665ac commit c59ba66
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
13 changes: 5 additions & 8 deletions VKAPI/Handlers/Photos.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,11 @@ function get(int $owner_id, int $album_id, string $photo_ids = "", bool $extende
if(empty($photo_ids)) {
$album = (new Albums)->getAlbumByOwnerAndId($owner_id, $album_id);

if(!$album->getOwner()->getPrivacyPermission('photos.read', $this->getUser())) {
$this->fail(21, "This user chose to hide his albums.");
}

if(!$album || $album->isDeleted()) {
if(!$album || $album->isDeleted())
$this->fail(21, "Invalid album");
}

if(!$album->getOwner()->getPrivacyPermission('photos.read', $this->getUser()))
$this->fail(21, "This user chose to hide his albums.");

$photos = array_slice(iterator_to_array($album->getPhotos(1, $count + $offset)), $offset);
$res["count"] = sizeof($photos);
Expand All @@ -456,8 +454,7 @@ function get(int $owner_id, int $album_id, string $photo_ids = "", bool $extende
"items" => []
];

foreach($photos as $photo)
{
foreach($photos as $photo) {
$id = explode("_", $photo);

$phot = (new PhotosRepo)->getByOwnerAndVID((int)$id[0], (int)$id[1]);
Expand Down
4 changes: 2 additions & 2 deletions Web/Models/Entities/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,8 @@ function generate2faBackupCodes(): void

for($i = 0; $i < 10 - $this->get2faBackupCodeCount(); $i++) {
$codes[] = [
owner => $this->getId(),
code => random_int(10000000, 99999999)
"owner" => $this->getId(),
"code" => random_int(10000000, 99999999)
];
}

Expand Down
4 changes: 2 additions & 2 deletions Web/Models/Repositories/Albums.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function getAlbumByOwnerAndId(int $owner, int $id)
"owner" => $owner,
"id" => $id
])->fetch();
return new Album($album);

return $album ? new Album($album) : NULL;
}
}

0 comments on commit c59ba66

Please sign in to comment.