mirror of
https://github.com/openvk/openvk
synced 2024-12-23 09:01:15 +03:00
VKAPI: Fix 500 error if user didn't subscribed or created a group
VKAPI: Add avatar sizes to the Groups.get method VKAPI: Fix strange avatar behaviour
This commit is contained in:
parent
f5bec29bf6
commit
2e1ef59353
2 changed files with 60 additions and 41 deletions
|
@ -37,50 +37,69 @@ final class Groups extends VKAPIRequestHandler
|
||||||
|
|
||||||
if(sizeof($clbs) > $count) $ic = $count;
|
if(sizeof($clbs) > $count) $ic = $count;
|
||||||
|
|
||||||
$clbs = array_slice($clbs, $offset * $count);
|
if (!empty($clbs)) {
|
||||||
|
$clbs = array_slice($clbs, $offset * $count);
|
||||||
|
|
||||||
for ($i=0; $i < $ic; $i++) {
|
for ($i=0; $i < $ic; $i++) {
|
||||||
$usr = $clbs[$i];
|
$usr = $clbs[$i];
|
||||||
if(is_null($usr))
|
if(is_null($usr))
|
||||||
{
|
{
|
||||||
$rClubs[$i] = (object)[
|
$rClubs[$i] = (object)[
|
||||||
"id" => $clbs[$i],
|
"id" => $clbs[$i],
|
||||||
"name" => "DELETED",
|
"name" => "DELETED",
|
||||||
"deactivated" => "deleted"
|
"deactivated" => "deleted"
|
||||||
];
|
];
|
||||||
}else if($clbs[$i] == NULL){
|
}else if($clbs[$i] == NULL){
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$rClubs[$i] = (object)[
|
$rClubs[$i] = (object)[
|
||||||
"id" => $usr->getId(),
|
"id" => $usr->getId(),
|
||||||
"name" => $usr->getName(),
|
"name" => $usr->getName(),
|
||||||
"screen_name" => $usr->getShortCode(),
|
"screen_name" => $usr->getShortCode(),
|
||||||
"is_closed" => false,
|
"is_closed" => false,
|
||||||
"can_access_closed" => true,
|
"can_access_closed" => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
$flds = explode(',', $fields);
|
$flds = explode(',', $fields);
|
||||||
|
|
||||||
foreach($flds as $field) {
|
foreach($flds as $field) {
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'verified':
|
case 'verified':
|
||||||
$rClubs[$i]->verified = intval($usr->isVerified());
|
$rClubs[$i]->verified = intval($usr->isVerified());
|
||||||
break;
|
break;
|
||||||
case 'has_photo':
|
case 'has_photo':
|
||||||
$rClubs[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
$rClubs[$i]->has_photo = is_null($usr->getAvatarPhoto()) ? 0 : 1;
|
||||||
break;
|
break;
|
||||||
case 'photo_max_orig':
|
case 'photo_max_orig':
|
||||||
$rClubs[$i]->photo_max_orig = $usr->getAvatarURL();
|
$rClubs[$i]->photo_max_orig = $usr->getAvatarURL();
|
||||||
break;
|
break;
|
||||||
case 'photo_max':
|
case 'photo_max':
|
||||||
$rClubs[$i]->photo_max = $usr->getAvatarURL();
|
$rClubs[$i]->photo_max = $usr->getAvatarURL("original"); // ORIGINAL ANDREI CHINITEL 🥵🥵🥵🥵
|
||||||
break;
|
break;
|
||||||
case 'members_count':
|
case 'photo_50':
|
||||||
$rClubs[$i]->members_count = $usr->getFollowersCount();
|
$rClubs[$i]->photo_50 = $usr->getAvatarURL();
|
||||||
break;
|
break;
|
||||||
|
case 'photo_100':
|
||||||
|
$rClubs[$i]->photo_100 = $usr->getAvatarURL("tiny");
|
||||||
|
break;
|
||||||
|
case 'photo_200':
|
||||||
|
$rClubs[$i]->photo_200 = $usr->getAvatarURL("normal");
|
||||||
|
break;
|
||||||
|
case 'photo_200_orig':
|
||||||
|
$rClubs[$i]->photo_200_orig = $usr->getAvatarURL("normal");
|
||||||
|
break;
|
||||||
|
case 'photo_400_orig':
|
||||||
|
$rClubs[$i]->photo_400_orig = $usr->getAvatarURL("normal");
|
||||||
|
break;
|
||||||
|
case 'members_count':
|
||||||
|
$rClubs[$i]->members_count = $usr->getFollowersCount();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$rClubs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (object) [
|
return (object) [
|
||||||
|
|
|
@ -68,16 +68,16 @@ final class Users extends VKAPIRequestHandler
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL();
|
$response[$i]->photo_50 = $usr->getAvatarURL();
|
||||||
break;
|
break;
|
||||||
case 'photo_100':
|
case 'photo_100':
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL("tiny");
|
$response[$i]->photo_100 = $usr->getAvatarURL("tiny");
|
||||||
break;
|
break;
|
||||||
case 'photo_200':
|
case 'photo_200':
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL("normal");
|
$response[$i]->photo_200 = $usr->getAvatarURL("normal");
|
||||||
break;
|
break;
|
||||||
case 'photo_200_orig': # вообще не ебу к чему эта строка ну пусть будет кек
|
case 'photo_200_orig': # вообще не ебу к чему эта строка ну пусть будет кек
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL("normal");
|
$response[$i]->photo_200_orig = $usr->getAvatarURL("normal");
|
||||||
break;
|
break;
|
||||||
case 'photo_400_orig':
|
case 'photo_400_orig':
|
||||||
$response[$i]->photo_50 = $usr->getAvatarURL("normal");
|
$response[$i]->photo_400_orig = $usr->getAvatarURL("normal");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
# Она хочет быть выебанной видя матан
|
# Она хочет быть выебанной видя матан
|
||||||
|
|
Loading…
Reference in a new issue