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) $user = (new UsersRepo)->get($owner_id); else $this->fail(1, "Not implemented"); if(!$user || $user->isDeleted()) $this->fail(14, "Invalid user"); if(!$user->getPrivacyPermission('videos.read', $this->getUser())) $this->fail(21, "This user chose to hide his videos."); $videos = (new VideosRepo)->getByUser($user, $offset + 1, $count); $videosCount = (new VideosRepo)->getUserVideosCount($user); $items = []; foreach ($videos as $video) { $items[] = $video->getApiStructure($this->getUser()); } return (object) [ "count" => $videosCount, "items" => $items ]; } } }