public function get(RESTApiRequest $request, $parent_id) { $epg = \Epg::getById(intval($parent_id)); if (empty($epg)) { throw new RESTNotFound("Program not found"); } $channel = \Itv::getChannelById(intval($epg['ch_id'])); if (empty($channel)) { throw new RESTNotFound("Channel not found"); } if ($channel["enable_tv_archive"] != 1) { throw new RESTForbidden("This channel does not have tv archive"); } try { $archive = new \TvArchive(); $url = $archive->getUrlByProgramId(intval($epg['id'])); } catch (\StorageSessionLimitException $e) { throw new RESTTemporaryUnavailable("Session limit"); } catch (\Exception $e) { throw new RESTServerError("Failed to obtain url"); } return $url; }
include "./common.php"; if (empty($_GET['lid'])) { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); exit; } $link = Mysql::getInstance()->from('download_links')->where(array('link_hash' => $_GET['lid']))->get()->first(); if (empty($link)) { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); exit; } $user = User::getInstance((int) $link['uid']); ob_start(); if ($link['type'] == 'tv_archive') { $tv_archive = new TvArchive(); try { $url = $tv_archive->getUrlByProgramId($link['media_id']); } catch (\Exception $e) { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); exit; } if ($url) { header("Location: " . $url); ob_end_clean(); exit; } } elseif ($link['type'] == 'vclub') { $video = Vod::getInstance(); try { $url = $video->getUrlByVideoId($link['media_id'], (int) $link['param1']); } catch (\Exception $e) { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");