Beispiel #1
0
<?php

use App\CoreUtils;
use App\Models\Episode;
use App\Episodes;
use App\RegExp;
if (!preg_match(new RegExp('^(\\d+)?(-?[a-z\\-]+)?$', 'i'), $data, $title)) {
    CoreUtils::notFound();
}
$Database->where('season', 0);
if (isset($title[1]) && is_numeric($title[1])) {
    $Database->where('episode', intval($data, 10));
} else {
    if (!empty($title[2])) {
        $data = strtolower($title[2]);
        $Database->where("regexp_replace(regexp_replace(lower(\"title\"), '[^a-z]', '-', 'g'), '-{2,}', '-', 'g') = '{$data}'");
    } else {
        $Database->reset();
        CoreUtils::notFound();
    }
}
/** @var $CurrtentEpisode Episode */
$CurrtentEpisode = $Database->getOne('episodes');
if (empty($CurrtentEpisode)) {
    CoreUtils::notFound();
}
$CurrtentEpisode = $CurrtentEpisode->addAiringData();
Episodes::loadPage($CurrtentEpisode);
Beispiel #2
0
use App\CGUtils;
use App\CoreUtils;
use App\CSRFProtection;
use App\Models\Episode;
use App\Models\EpisodeVideo;
use App\Episodes;
use App\Input;
use App\Logs;
use App\Permission;
use App\Posts;
use App\Response;
use App\VideoProvider;
/** @var $Episode Episode */
if (!POST_REQUEST) {
    Episodes::loadPage();
}
CSRFProtection::protect();
if (empty($data)) {
    CoreUtils::notFound();
}
$data = explode('/', $data);
$action = array_splice($data, 0, 1)[0] ?? null;
$data = implode('/', $data);
$EpData = Episodes::parseID(!empty($data) ? $data : $_POST['epid'] ?? null);
if (!empty($EpData)) {
    $Episode = Episodes::getActual($EpData['season'], $EpData['episode'], Episodes::ALLOW_MOVIES);
    if (empty($Episode)) {
        Response::fail("There's no episode with this season & episode number");
    }
    $isMovie = $Episode->isMovie;
Beispiel #3
0
<?php

use App\CoreUtils;
use App\Episodes;
use App\HTTP;
use App\RegExp;
if (POST_REQUEST) {
    HTTP::statusCode(400, AND_DIE);
}
/** @var $data string */
if (!preg_match(new RegExp('^(req|res)/(\\d+)$'), $data, $match)) {
    CoreUtils::notFound();
}
$match[1] .= array('req' => 'uest', 'res' => 'ervation')[$match[1]];
/** @var $LinkedPost \App\Models\Post */
$LinkedPost = $Database->where('id', $match[2])->getOne("{$match[1]}s");
if (empty($LinkedPost)) {
    CoreUtils::notFound();
}
$Episode = Episodes::getActual($LinkedPost->season, $LinkedPost->episode);
if (empty($Episode)) {
    CoreUtils::notFound();
}
$Episode->LinkedPost = $LinkedPost;
Episodes::loadPage($Episode, false);