Пример #1
0
     if (!Permission::sufficient('user')) {
         Response::fail();
     }
     if (!$Episode->aired) {
         Response::fail('You can only vote on this episode after it has aired.');
     }
     $UserVote = Episodes::getUserVote($Episode);
     if (!empty($UserVote)) {
         Response::fail('You already voted for this episode');
     }
     $vote = (new Input('vote', 'int', array(Input::IN_RANGE => [1, 5], Input::CUSTOM_ERROR_MESSAGES => array(Input::ERROR_MISSING => 'Vote value missing from request', Input::ERROR_RANGE => 'Vote value must be an integer between @min and @max (inclusive)'))))->out();
     if (!$Database->insert('episodes__votes', array('season' => $Episode->season, 'episode' => $Episode->episode, 'user' => $currentUser->id, 'vote' => $vote))) {
         Response::dbError();
     }
     $Episode->updateScore();
     Response::done(array('newhtml' => Episodes::getSidebarVoting($Episode)));
     break;
 case "videos":
     Response::done(Episodes::getVideoEmbeds($Episode));
     break;
 case "getvideos":
     $return = array('twoparter' => $Episode->twoparter, 'vidlinks' => array(), 'fullep' => array(), 'airs' => date('c', strtotime($Episode->airs)));
     /** @var $Vids EpisodeVideo[] */
     $Vids = $Database->whereEp($Episode)->get('episodes__videos');
     foreach ($Vids as $part => $vid) {
         if (!empty($vid->id)) {
             $return['vidlinks']["{$vid->provider}_{$vid->part}"] = VideoProvider::getEmbed($vid, VideoProvider::URL_ONLY);
         }
         if ($vid->fullep) {
             $return['fullep'][] = $vid->provider;
         }
Пример #2
0
			<a class="btn typcn discord-join" href="http://fav.me/d9zt1wv" target="_blank">Join Discord</a>
<?php 
    }
    ?>
		</div>
	</section>
<?php 
    if ($view === 'episode' && !empty($CurrentEpisode)) {
        ?>
	<section id="voting">
		<h2><?php 
        echo $CurrentEpisode->isMovie ? 'Movie' : 'Episode';
        ?>
 rating</h2>
		<?php 
        echo Episodes::getSidebarVoting($CurrentEpisode);
        ?>
	</section>
<?php 
        if ($CurrentEpisode->isLatest() && time() > $CurrentEpisode->willairts && $CurrentEpisode->willairts + Time::$IN_SECONDS['hour'] * 4 > time()) {
            ?>
	<section id="live-update">
		<h2>Live reload</h2>
		<p>The episode has just aired, and posts are likely changing faster than usual.</p>
		<div>
			<p>The posts will reload in <strong class="timer">&hellip;</strong> to reflect the changes.</p>
			<p class="hidden">Live reloading is disabled.</p>
			<button class="blue reload typcn typcn-refresh">Reload now</button> <button class="red disable typcn typcn-times">Disable</button>
		</div>
	</section>
<?php