function getVideosAction() { $request = $_GET; $videoClass = new BuckysVideo(); $categoryID = isset($request['cat']) ? buckys_escape_query_integer($request['cat']) : null; $videoID = isset($request['video']) ? buckys_escape_query_integer($request['video']) : null; $token = isset($request['TOKEN']) ? trim($request['TOKEN']) : null; if (!$token) { return ['STATUS_CODE' => STATUS_CODE_BAD_REQUEST, 'DATA' => ['STATUS' => 'ERROR', 'ERROR' => 'Api token should not be blank']]; } if ($token != THENEWBOSTON_PUBLIC_API_KEY) { return ['STATUS_CODE' => STATUS_CODE_UNAUTHORIZED, 'DATA' => ['STATUS' => 'ERROR', 'ERROR' => 'Api token is not valid.']]; } $videos = $videoClass->getVideos($categoryID); return ['STATUS_CODE' => STATUS_CODE_OK, "DATA" => $videos]; }
require dirname(__FILE__) . '/includes/bootstrap.php'; $videoClass = new BuckysVideo(); $subjectID = isset($_GET['subject']) ? buckys_escape_query_string($_GET['subject']) : 0; $categoryID = isset($_GET['cat']) ? buckys_escape_query_integer($_GET['cat']) : null; $videoID = isset($_GET['video']) ? buckys_escape_query_integer($_GET['video']) : null; if ($videoID) { $video = $videoClass->getVideo($videoID); if (!$video) { buckys_redirect("/videos.php", MSG_INVALID_REQUEST, MSG_TYPE_ERROR); exit; } $categoryID = $video['categoryID']; } if ($categoryID) { $category = $videoClass->getCategory($categoryID); $categoryVideos = $videoClass->getVideos($categoryID); if (!$videoID) { $video = $categoryVideos[0]; } //Getting Forum Recent Posts $topics = BuckysForumTopic::getTopics(1, 'publish', $category['forumCategoryID'], 'lastReplyDate DESC', 10); $forumCategory = BuckysForumCategory::getCategory($category['forumCategoryID']); //Get Prev, Next Video $prevVideoId = null; $nextVideoId = null; foreach ($categoryVideos as $idx => $v) { if ($v['videoID'] == $video['videoID']) { $nextVideoId = isset($categoryVideos[$idx + 1]) ? $categoryVideos[$idx + 1]['videoID'] : null; break; } $prevVideoId = $v['videoID'];