requireUser(); if(!empty($videos)) { $vids = explode(',', $videos); foreach($vids as $vid) { $id = explode("_", $vid); $items = []; $video = (new VideosRepo)->getByOwnerAndVID(intval($id[0]), intval($id[1])); if($video) { $items[] = $video->getApiStructure($this->getUser()); } } return (object) [ "count" => count($items), "items" => $items ]; } else { if ($owner_id > 0) $owner = (new UsersRepo)->get($owner_id); else $owner = (new ClubsRepo)->get(abs($owner_id)); if(!$owner) $this->fail(20, "Invalid user"); if($owner_id > 0 && !$owner->getPrivacyPermission('videos.read', $this->getUser())) $this->fail(20, "Access denied: this user chose to hide his videos"); $videos = (new VideosRepo)->getByEntityId($owner_id, $offset, $count); $videosCount = (new VideosRepo)->getVideosCountByEntityId($owner_id); $items = []; foreach ($videos as $video) $items[] = $video->getApiStructure($this->getUser()); return (object) [ "count" => $videosCount, "items" => $items ]; } } }