Exemple #1
1
        $view->display('post.tpl');
        break;
    case 'about':
        $view->display('about.tpl');
        break;
    case 'manage':
        check_login();
        /* Ing cache */
        require_once 'models/Ing.class.php';
        $Ing = new Ing();
        if (!($ing_list = $cache->load('ing'))) {
            $ing_list = $Ing->output('LOCAL');
            $view->assign(array('ing' => $ing_list, 'ingColor' => rand_color(true)));
            $view->assign('ing', $ing_list);
            $cache->save($ing_list, 'ing');
        } else {
            $view->assign(array('ing' => $ing_list, 'ingColor' => rand_color(true)));
        }
        $view->assign('num_rows', $num_rows);
        $view->assign('row', $row);
        $show = new Show();
        if (ROOT) {
            $topic_list = $show->getTopicList(true);
        } else {
            $topic_list = $show->getTopicList();
        }
        $view->assign('topic_list', $topic_list);
        $view->assign('count', count($topic_list));
        $view->display('manage.tpl');
        break;
}
 function setlist($parametros)
 {
     echo (string) $parametros;
     $show = intval(substr($parametros, 1, 3));
     $blocoantigo = substr($parametros, 4, 1);
     $bloconovo = substr($parametros, 5, 1);
     $musica = intval(substr($parametros, 6, 3));
     $posicaoinicial = intval(substr($parametros, 9, 3));
     $posicaofinal = intval(substr($parametros, 12, 3));
     $nshow = new Show();
     $nshow->gravaSetlist($show, $blocoantigo, $bloconovo, $musica, $posicaoinicial, $posicaofinal);
 }
Exemple #3
0
 public static function FetchByName($name)
 {
     $show = new Show();
     $show->set_condition('name = :name');
     $show->name = $name;
     try {
         $show->FetchInto();
         return $show;
     } catch (\phalanx\data\ModelException $e) {
         return NULL;
     }
 }
Exemple #4
0
 /**
  * Dashboard for user's content management, only for auth user.
  */
 public function dashboard()
 {
     $user = Sentry::getUser();
     $added_events = ep\Event::where('author_id', '=', $user->id)->orderBy('created_at', 'DESC')->paginate(25);
     $added_shows = Show::where('author_id', '=', $user->id)->orderBy('created_at', 'DESC')->paginate(25);
     return View::make('user.dashboard', array('user' => $user, 'added_events' => $added_events, 'added_shows' => $added_shows, 'pageTitle' => 'Dashboard'));
 }
Exemple #5
0
function createTestShow($showNumber, $showTime, $duration = "1:00")
{
    $data = array();
    $strTime = $showTime->format("Y-m-d H:i");
    echo "Adding show: {$strTime}\n";
    $data['add_show_name'] = 'automated show ' . $showNumber;
    $data['add_show_start_date'] = $showTime->format("Y-m-d");
    $data['add_show_start_time'] = $showTime->format("H:i");
    $data['add_show_duration'] = $duration;
    $data['add_show_no_end'] = 0;
    $data['add_show_repeats'] = 0;
    $data['add_show_description'] = 'automated show';
    $data['add_show_url'] = 'http://www.OfirGal.com';
    $data['add_show_color'] = "";
    $data['add_show_genre'] = "Ofir";
    $data['add_show_background_color'] = "";
    $data['add_show_record'] = 0;
    $data['add_show_hosts'] = "";
    $showId = Show::create($data);
    //echo "show created, ID: $showId\n";
    // populating the show with a playlist
    $instances = Show::getShows($showTime->format("Y-m-d H:i:s"), $showTime->format("Y-m-d H:i:s"));
    $instance = array_pop($instances);
    $show = new ShowInstance($instance["instance_id"]);
    //echo "Adding playlist to show instance ".$show->getShowInstanceId()."\n";
    $show->scheduleShow(array(1));
    //echo "done\n";
    //$show->scheduleShow(array($playlist->getId()));
}
Exemple #6
0
 public function carrega()
 {
     $this->conectar();
     $query = "SELECT * FROM shows;";
     $resultado = $this->query($query);
     $this->desconectar();
     if (!is_bool($resultado)) {
         foreach ($resultado as $result) {
             $show = new Show();
             $show->setId($result["id"]);
             $show->setLocal($result["local"]);
             $show->setData($result["data"]);
             $this->addShow($show);
         }
     }
 }
Exemple #7
0
 public static function GetDataGridData($viewType, $dateString)
 {
     if ($viewType == "now") {
         $date = new DateHelper();
         $timeNow = $date->getTimestamp();
         $startCutoff = 60;
         $endCutoff = 86400;
         //60*60*24 - seconds in a day
     } else {
         $date = new DateHelper();
         $time = $date->getTime();
         $date->setDate($dateString . " " . $time);
         $timeNow = $date->getTimestamp();
         $startCutoff = $date->getNowDayStartDiff();
         $endCutoff = $date->getNowDayEndDiff();
     }
     $data = array();
     $showIds = ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
     foreach ($showIds as $showId) {
         $instanceId = $showId['id'];
         $si = new ShowInstance($instanceId);
         $showId = $si->getShowId();
         $show = new Show($showId);
         //append show header row
         $data[] = Application_Model_Nowplaying::CreateHeaderRow($show->getName(), $si->getShowStart(), $si->getShowEnd());
         $scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff);
         $dataTablesRows = Application_Model_Nowplaying::CreateDatatableRows($scheduledItems);
         //append show audio item rows
         $data = array_merge($data, $dataTablesRows);
         //append show gap time row
         $gapTime = Application_Model_Nowplaying::FormatDuration($si->getShowEndGapTime(), true);
         if ($si->isRecorded()) {
             $data[] = Application_Model_Nowplaying::CreateRecordingRow($si);
         } else {
             if ($gapTime > 0) {
                 $data[] = Application_Model_Nowplaying::CreateGapRow($gapTime);
             }
         }
     }
     return array("currentShow" => Show_DAL::GetCurrentShow($timeNow), "rows" => $data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $users = User::all();
     $events_submitted = ep\Event::where('approved', '=', '0')->get();
     $event_count = ep\Event::all()->count();
     $shows_submitted = Show::where('approved', '=', '0')->get();
     $show_count = Show::all()->count();
     $extras_submitted = Extra::where('approved', '=', '0')->get();
     $extra_count = Extra::all()->count();
     $beta_count = DB::table('beta_newsletters')->count();
     return View::make('admin.admin_panel', array('pageTitle' => 'Admin Panel', 'users' => $users, 'event_count' => $event_count, 'events_submitted' => $events_submitted, 'show_count' => $show_count, 'shows_submitted' => $shows_submitted, 'extra_count' => $extra_count, 'beta_count' => $beta_count, 'extras_submitted' => $extras_submitted));
 }
Exemple #9
0
 public function as_input()
 {
     if ($this->type == self::PRIMARY_KEY) {
         return $this->as_pk();
     }
     $html = file_get_contents(realpath(dirname(__FILE__)) . "/html/table.html");
     $selc = file_get_contents(realpath(dirname(__FILE__)) . "/html/selectable.html");
     $selc = str_replace('{{MORE}}', 'required', $selc);
     $cont = "";
     $model = Kernel::instance($this->refer);
     $models = $model->filter();
     if (isset($models[0])) {
         $show = new Show($models[0]);
         $head = $show->as_headrow(false, false, '#');
         foreach ($models as $model) {
             $inps = "";
             $pk = $model->get_pk();
             $reflex = new ReflectionClass($model->get_called_class());
             $properts = $reflex->getProperties();
             $val = $this->val();
             if ($val == $pk->get()) {
                 $sel = str_replace('required', 'required checked ', $selc);
             } else {
                 $sel = $selc;
             }
             foreach ($properts as $propert) {
                 $name = $propert->getName();
                 $value = $model->{"get" . ucfirst($name)}();
                 if ($value instanceof Input && !$value instanceof Constrain || $value instanceof Constrain && $value->getType() != Constrain::PRIMARY_KEY) {
                     $inps .= $value->as_list();
                 }
             }
             $cont .= str_replace(array('{{NAME}}', '{{VALUE}}', '{{CONTENT}}'), array($this->name(), $pk->get(), $inps), $sel);
         }
         $html = str_replace(array('{{HEAD}}', '{{BODY}}'), array($head, $cont), $html);
     } else {
         $html = '<<-empty->>';
     }
     return $html;
 }
Exemple #10
0
 public static function SendMessageToShowRecorder($event_type)
 {
     global $CC_CONFIG;
     $conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"], $CC_CONFIG["rabbitmq"]["port"], $CC_CONFIG["rabbitmq"]["user"], $CC_CONFIG["rabbitmq"]["password"]);
     $channel = $conn->channel();
     $channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
     $EXCHANGE = 'airtime-show-recorder';
     $channel->exchange_declare($EXCHANGE, 'direct', false, true);
     $today_timestamp = date("Y-m-d H:i:s");
     $now = new DateTime($today_timestamp);
     $end_timestamp = $now->add(new DateInterval("PT2H"));
     $end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
     $temp['event_type'] = $event_type;
     if ($event_type = "update_schedule") {
         $temp['shows'] = Show::getShows($today_timestamp, $end_timestamp, $excludeInstance = NULL, $onlyRecord = TRUE);
     }
     $data = json_encode($temp);
     $msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
     $channel->basic_publish($msg, $EXCHANGE);
     $channel->close();
     $conn->close();
 }
Exemple #11
0
 /**
  * Метод по умолчанию
  *
  */
 function index()
 {
     $this->noCache();
     $this->load->library('Log');
     $this->load->model('global_variables');
     // Создаем объект поиска
     $this->load->library('search_builder');
     $this->search_builder->setSite($this->id_site);
     $this->search_builder->setChannel($this->id_channel);
     $channel = $this->search_builder->getChannelInfo();
     $this->log->write_log('sppc', 'id_site = ' . $this->id_site . ' id_channel = ' . $this->id_channel);
     /* Если у ченела установлено показывать внешний javascript (google adsens или что-то подобное)
      * при отсутствие рекламы. Тогда запускаем старую схему. 
      * В противном случае показываем сразу новый iframe
      */
     if ('google_adsense' == $channel->ad_settings) {
         parent::wrapper();
     } else {
         $data = array('id_site' => $this->id_site, 'id_channel' => $this->id_channel, 'width' => $channel->width, 'height' => $channel->height, 'id_dimension' => $channel->id_dimension, 'id_publisher' => $channel->id_publisher, 'id' => 'iframe', 'ident' => $this->ident, 'referer' => urlencode($this->input->server('HTTP_REFERER')), 'base_url' => base_url());
         $view = 'show_ads/iframe_wrapper_ex.html';
         $this->output->set_header('Content-Type: text/javascript');
         $this->parser->parse($view, $data);
     }
 }
Exemple #12
0
    if (Sentry::check()) {
        $event_id = Request::segment(3);
        $event_author = ep\Event::find($event_id)->author_id;
        $current_user = Sentry::getUser();
        if ($current_user->id == $event_author || $current_user->hasAccess('admin')) {
        } else {
            return Redirect::to('/')->with('global_error', 'This is restricted area. You shall not pass.');
        }
    } else {
        return Redirect::guest('login');
    }
});
Route::filter('authorShow', function () {
    if (Sentry::check()) {
        $show_id = Request::segment(3);
        $show_author = Show::find($show_id)->author_id;
        $current_user = Sentry::getUser();
        if ($current_user->id == $show_author || $current_user->hasAccess('admin')) {
        } else {
            return Redirect::to('/')->with('global_error', 'This is restricted area. You shall not pass.');
        }
    } else {
        return Redirect::guest('login');
    }
});
/*
|--------------------------------------------------------------------------
| Cache
|--------------------------------------------------------------------------
|
|	Caches current route. Don't use with hello view, it has custom cache per user.
Exemple #13
0
 function populateShowsArray($m, $y)
 {
     $db = new db();
     $mPadded = sprintf("%02d", $m);
     $q = "select DATE_FORMAT(date, '%d') as day, ID from Shows where is_active = 1 and DATE_FORMAT(date, '%m') = '{$mPadded}' and DATE_FORMAT(date, '%Y') = '{$y}' order by date asc";
     $r = mysql_query($q);
     if ($db->isError($r)) {
         return Error::MySQL();
     }
     while ($row = mysql_fetch_assoc($r)) {
         $this->showsArray[(int) $row['day']][] = Show::get($row['ID']);
     }
 }
Exemple #14
0
     $sortdir = "DESC";
 }
 if (isset($_GET['iDisplayLength'])) {
     $per_page = $_GET['iDisplayLength'];
 } else {
     $per_page = 50;
 }
 if ($per_page > 500) {
     $per_page = 1;
 }
 if (isset($_GET['iDisplayStart'])) {
     $start = $_GET['iDisplayStart'];
 } else {
     $start = 0;
 }
 $show = new Show();
 if (isset($_GET['sSearch']) && $_GET['sSearch']) {
     $shows = $show->getList(null, $start, $per_page, $sortby, $sortdir, $_GET['sSearch']);
 } else {
     $shows = $show->getList(null, $start, $per_page, $sortby, $sortdir);
 }
 $res = array();
 $res['sEcho'] = $echo;
 if (isset($_GET['sSearch']) && $_GET['sSearch']) {
     $res['iTotalDisplayRecords'] = $show->getShowCount($_GET['sSearch']);
 } else {
     $res['iTotalDisplayRecords'] = $show->getShowCount();
 }
 $res['iTotalRecords'] = count($shows);
 $res['aaData'] = array();
 if (count($shows)) {
Exemple #15
0
 public static function as_table(array $models, $edit = null, $delete = null)
 {
     $html = file_get_contents(realpath(dirname(__FILE__)) . "/html/table.html");
     $show = new Show($models[0]);
     $head = $show->as_headrow($edit, $delete);
     $body = "";
     foreach ($models as $model) {
         $show->model = $model;
         $body .= $show->as_row($edit, $delete);
     }
     $html = str_replace(array('{{HEAD}}', '{{BODY}}'), array($head, $body), $html);
     return $html;
 }
Exemple #16
0
if (!isset($_POST['id']) && !isset($_GET['id'])) {
    $response['status'] = 99;
    print json_encode($response);
    exit;
} elseif (isset($_POST['id'])) {
    $id = $_POST['id'];
} elseif (isset($_GET['id'])) {
    $id = $_GET['id'];
}
require_once "../../vars.php";
require_once "../../includes/curl.php";
require_once "../../includes/show.class.php";
require_once "../../includes/settings.class.php";
require_once "../../includes/sidereel.class.php";
$settings = new Settings();
$shows = new Show();
$sidereel = new Sidereel();
$curl = new Curl();
$decaptcher = $settings->getSetting("decaptcher");
if (!isset($decaptcher->url) || !$decaptcher->url) {
    $decaptcher->url = "poster.decaptcher.com";
}
if (!isset($decaptcher->username) || !$decaptcher->username || !isset($decaptcher->password) || !$decaptcher->password) {
    $response['status'] = 3;
    print json_encode($response);
    exit;
}
if (isset($decaptcher->port) && $decaptcher->port) {
    require_once "../../includes/ccproto_client.php";
    $ccp = new ccproto();
    $ccp->init();
<?php

include 'functions.php';
$showid = intval(addslashes($_GET['showid']));
$season = intval(addslashes($_GET['season']));
$episode = intval(addslashes($_GET['id']));
$thumbPath = sprintf("cache/%02d-%02d%02d-thumb.jpg", $showid, $season, $episode);
if (!file_exists($thumbPath)) {
    $show = new Show($showid, NO_EPISODE_CHECK);
    $show->getEpisode($season . 'x' . $episode)->getThumbnail();
} else {
    header('Location: /' . $thumbPath);
    die;
}
$page_title = 'Add Show';
include 'layout/header.php';
$bi = BandInformation::get();
$defaultStateProvince = $bi->getDefaultStateProvince();
$defaultCity = $bi->getDefaultcity();
$defaultCountry = $bi->getDefaultCountry();
?>

<div id="breadcrumb">
	<a href="index.php">Audition &#62;</a>
	<a href="live.php">Live &#62;</a>
	<a href="shows.php">Shows &#62;</a>
	Add Show
</div>
<?php 
if (!Show::canAdd()) {
    Error::outputDialog('Return to Shows', 'shows.php', 'You are not an administrator, and you are not a band member. Therefore, you cannot add shows.');
} else {
    if (db::isError($sh)) {
        $sh->outputList();
    }
    ?>
	<h1>new entry:</h1>
	<div class="inset">
	<form id="edit_entry" action="<?php 
    echo $PHP_SELF;
    ?>
?task=add" method="post">
	<table border="0" class="edit-form" cellspacing="0" cellpadding="0">
	
	<?php 
<?php

include 'base.php';
User::protect();
$section = 'shows';
include_class('shows');
include_class('m2');
$editors = array('description');
$sh = Show::get($_GET['id']);
if (!db::isError($sh)) {
    $mi = MediaInstance::get($_GET['media_instance_id']);
    if (!db::isError($mi)) {
        $type = $mi->getAreaID() == $sh->getAVAreaID() ? "av" : "photos";
        switch ($_GET['task']) {
            case 'update':
                $res = $mi->update($_POST, $sh);
                if (!db::isError($res)) {
                    header('Location: show_media_edit.php?id=' . $_GET['id'] . '&media_instance_id=' . $_GET['media_instance_id']);
                }
                break;
            case 'deactivate':
                $res = $mi->deactivate($sh);
                if (!db::isError($res)) {
                    header('Location: show_media_edit.php?id=' . $_GET['id'] . '&media_instance_id=' . $_GET['media_instance_id']);
                }
                break;
            case 'activate':
                $res = $mi->activate($sh);
                if (!db::isError($res)) {
                    header('Location: show_media_edit.php?id=' . $_GET['id'] . '&media_instance_id=' . $_GET['media_instance_id']);
                }
Exemple #20
0
 function getShows()
 {
     $q = "select Shows.ID from Shows, Tours where Shows.date >= Tours.start_date and Shows.date <= Tours.end_date and Tours.ID = {$this->ID} and Shows.is_active = 1 order by Shows.date asc";
     $r = mysql_query($q);
     if (!$r) {
         return Error::MySQL();
     }
     $showOArray = array();
     while ($row = mysql_fetch_assoc($r)) {
         $showOArray[] = Show::get($row['ID']);
     }
     return $showOArray;
 }
Exemple #21
0
if ($user_id && $target_id && $target_type) {
    $data = array();
    $data['user_id'] = $user_id;
    $data['target_id'] = $target_id;
    $data['target_type'] = $target_type;
    $data['date_added'] = date("Y-m-d H:i:s");
    $res = $stream->addWatch($data);
    if ($res) {
        $data = array();
        $data['user_id'] = $user_id;
        $data['target_id'] = $target_id;
        $data['user_data'] = $_SESSION['loggeduser_details'];
        $data['target_type'] = $target_type;
        if ($target_type == 1) {
            // show
            $show = new Show();
            $data['target_data'] = $show->getShow($target_id, 0);
        } elseif ($target_type == 2) {
            // movie
            $movie = new Movie();
            $data['target_data'] = $movie->getMovie($target_id);
        } elseif ($target_type == 3) {
            // episode
            $show = new Show();
            $data['target_data'] = $show->getEpisodeById($target_id);
        }
        $data['event_type'] = 5;
        $data['event_date'] = date("Y-m-d H:i:s");
        $stream->addActivity($data);
    }
}
Exemple #22
0
<?php

session_start();
if (!isset($_SESSION['admin_user_id']) || !$_SESSION['admin_user_id'] || !isset($_SESSION['admin_username'])) {
    exit;
}
require_once "../../vars.php";
require_once "../../includes/show.class.php";
if (isset($_POST['show_ids']) && $_POST['show_ids']) {
    $show = new Show();
    $show_ids = explode(",", $_POST['show_ids']);
    if (count($show_ids)) {
        foreach ($show_ids as $key => $show_id) {
            if ($show_id) {
                $show->deleteShow($show_id);
            }
        }
    }
}
Exemple #23
0
<?php

session_start();
if (!isset($_SESSION['admin_user_id']) || !$_SESSION['admin_user_id']) {
    exit;
}
set_time_limit(0);
@extract($_POST);
@extract($_GET);
require_once "../../vars.php";
require_once "../../includes/show.class.php";
require_once "../../includes/sidereel.class.php";
$show = new Show();
$sidereel = new Sidereel();
$thisshow = $show->getShow($showid, true, "en");
$title = $sidereel->sidereelURL($thisshow[$showid]['title'], $thisshow[$showid]['sidereel_url']);
$link = "http://www.sidereel.com/{$title}/season-{$season}/episode-{$episode}";
$details = $sidereel->getEpisodeDetails($link);
if (@$details['title'] || @$details['description']) {
    $t = $details['title'];
    if (!$t) {
        $t = "Season {$season}, Episode {$episode}";
    }
    $description = $details['description'];
    if (substr_count(strtolower($t), "season") == 0 && substr_count(strtolower($t), "episode") == 0) {
        $t = "Season {$season}, Episode {$episode} - {$t}";
    }
    $ret = array();
    $ret['title'] = str_replace('"', '', $t);
    $ret['description'] = $description;
    print json_encode($ret);
Exemple #24
0
$smarty->config_dir = "{$basepath}/templates/smarty/configs";
$smarty->cache_dir = "{$basepath}/cachefiles";
$smarty->assign("templatepath", "{$baseurl}/templates/{$theme}");
if (!isset($_REQUEST['date'])) {
    $date = date("Y-m-d");
} else {
    $date = $_REQUEST['date'];
}
$check = date("Y", strtotime($date));
if ($check < 2010) {
    $date = date("Y-m-d");
}
require_once "../vars.php";
require_once "../includes/curl.php";
$curl = new Curl();
$show = new Show();
$cache_file = "tv_guide_" . $date . ".txt";
$from_cache = false;
if (file_exists($basepath . "/cachefiles/" . $cache_file)) {
    $data = file_get_contents($basepath . "/cachefiles/" . $cache_file);
    $from_cache = true;
} else {
    $today = date("Ymd");
    $b64 = 'aHR0cDovL2FwaS50cmFrdC50di9jYWxlbmRhci9zaG93cy5qc29uLzUyMWRmZjU0NTQyM2RiNGE1NmUxNzUwMTNkYmFkNGFiLw==';
    $request = '' . base64_decode($b64) . urlencode($today) . '/1/';
    $data = $curl->get($request);
}
if ($from_cache || $curl->getHttpCode() >= 200 && $curl->getHttpCode() < 400) {
    if (!$from_cache && is_writable($basepath . "/cachefiles/")) {
        @file_put_contents($basepath . "/cachefiles/" . $cache_file, $data);
    }
Exemple #25
0
else if ( isset($_GET['downloadtvdb']) ) {
	if ( $show = Show::get($_GET['downloadtvdb']) ) {
		$filepath = tempnam(sys_get_temp_dir(), 'series_');
		if ( $show->downloadTVDVInfo($filepath) ) {
			header('Content-type: application/zip');
			header('Content-disposition: attachment; filename="show-' . $show->id . '.zip"');
			readfile($filepath);
		}
	}

	exit;
}

// reset one show
else if ( isset($_GET['resetshow']) ) {
	if ( $show = Show::get($_GET['resetshow']) ) {
		// delete seasons/episodes
		$db->delete('seasons', array('series_id' => $_GET['resetshow']));

		// delete tvdb series id
		$db->update('series', array('tvdb_series_id' => 0, 'changed' => time()), array('id' => $_GET['resetshow']));
	}

	return do_redirect('index');
}

// keep db hot
else if ( isset($_GET['keepalive']) ) {
	$db->delete('variables', array('name' => 'keepalive'));
	$db->insert('variables', array('name' => 'keepalive', 'value' => time()));
	exit('OK');
Exemple #26
0
 public function createRoutes()
 {
     $entityManager = $this->entityManager;
     $app = $this->app;
     // Get all Shows
     $app->get('/shows/', function () use($entityManager, $app) {
         try {
             $shows = $entityManager->getRepository('Show')->createQueryBuilder('e')->select('e')->getQuery()->getResult(Query::HYDRATE_ARRAY);
             if ($shows) {
                 $app->response->setStatus(200);
                 $app->response()->headers->set('Content-Type', 'application/json');
                 echo json_encode($shows);
             } else {
                 throw new PDOException('No records found.');
             }
         } catch (PDOException $e) {
             $app->response()->setStatus(404);
             echo json_encode(['error' => ['text' => $e->getMessage()]]);
         }
     });
     // Get Show by id
     $app->get('/shows/:id', function ($id) use($entityManager, $app) {
         try {
             $show = $entityManager->getRepository('Show')->createQueryBuilder('a')->select('a')->where('a =:id')->setParameter('id', $id)->getQuery()->getSingleResult(Query::HYDRATE_ARRAY);
             if ($show) {
                 $app->response->setStatus(200);
                 $app->response()->headers->set('Content-Type', 'application/json');
                 echo json_encode($show);
             } else {
                 throw new PDOException('No Show found.');
             }
         } catch (PDOException $e) {
             $app->response()->setStatus(404);
             echo json_encode(['error' => ['text' => $e->getMessage()]]);
         }
     });
     // Create Show
     $app->post('/shows/', function () use($entityManager, $app) {
         $allPostVars = json_decode($app->request->getBody());
         try {
             $show = new Show();
             $show->setName($allPostVars->name);
             $show->setSorder($allPostVars->sorder);
             $show->setCreationDate(date("Y-m-d H:i:s"));
             $show->setLastUpdate(date("Y-m-d H:i:s"));
             $entityManager->persist($show);
             $entityManager->flush();
             $app->response->setStatus(200);
             $app->response()->headers->set('Content-Type', 'application/json');
             echo json_encode(array("status" => "success", "code" => true, $show->getId()));
         } catch (PDOException $e) {
             $app->response()->setStatus(404);
             echo json_encode(['error' => ['text' => $e->getMessage()]]);
         }
     });
     // Update Show
     $app->put('/shows/:id', function ($id) use($entityManager, $app) {
         $allPostVars = json_decode($app->request->getBody());
         try {
             $show = $entityManager->find('Show', $id);
             $show->setName($allPostVars->name);
             $show->setSorder($allPostVars->sorder);
             $show->setLastUpdate(date("Y-m-d H:i:s"));
             $entityManager->flush();
             $app->response->setStatus(200);
             $app->response()->headers->set('Content-Type', 'application/json');
             echo json_encode(array("status" => "success", "code" => true));
         } catch (PDOException $e) {
             $app->response()->setStatus(404);
             echo json_encode(['error' => ['text' => $e->getMessage()]]);
         }
     });
     // Delete Show
     $app->delete('/shows/:id', function ($id) use($entityManager, $app) {
         try {
             $show = $entityManager->find('Show', $id);
             $entityManager->remove($show);
             $entityManager->flush();
             $app->response->setStatus(200);
             $app->response()->headers->set('Content-Type', 'application/json');
             echo json_encode(array("status" => "success", "code" => true));
         } catch (PDOException $e) {
             $app->response()->setStatus(404);
             echo json_encode(['error' => ['text' => $e->getMessage()]]);
         }
     });
 }
Exemple #27
0
<?php
	if (isset($_GET['ajax'])) {
		include 'functions.php';
		$showid = addslashes($_GET['showid']);
		$show = new Show($showid, NO_EPISODE_CHECK);
	} else {
		include 'header.php';
		$showid = addslashes($_GET['showid']);
		$show = new Show($showid);
	}
	if ($_GET['update'] == '1') # Force update
		$show->updateShow(1);
?>
				<div class="seriesdetails">
					<div class="imagecontainer">
						<a href="show.php?showid=<?=$show->getID()?>"><img class="thumbnail" alt="<?=$show->getTitle()?>" src="cache/<?=$show->getID()?>-poster.jpg" /></a>
					</div>
					<?=addSubscribeText($show->isSubscribed(), $show->getID(), 1)?> <a href="show.php?showid=<?=$show->getID()?>&amp;update=1" class="updatethis">Force Update</a>
					<h2><a id="showtitle" href="show.php?showid=<?=$show->getID()?>"><?=$show->getTitle()?></a></h2>
					<div class="plot"><?=$show->getPlot()?></div>
				</div>
				<?php
				if (!isset($_GET['ajax'])) { ?>
					<div class="fullcontent">
						<div class="contentleft">
							<?php 
								$seasonSplit = $show->splitSeasons();
								foreach ($seasonSplit[0] as $season) { if (!isset($season[0])) break; // PHP BUG?!?!
							?>
							<div class="contentbox normalbox seasons">
								<h3>Season <?php printf("%02d", $season[0]->getSeason())?> <a href="show.php?showid=<?=$season[0]->getShowID()?>" class="subscribe dldmissingeps"><span>Download missing episodes</span></a></h3>
Exemple #28
0
<?php
	$showid = intval(addslashes($_GET['showid']));
	$season = intval(addslashes($_GET['season']));
	$episode = intval(addslashes($_GET['id']));
	if (isset($_GET['ajax'])) {
		include 'functions.php';
		$show = new Show($showid, NO_EPISODE_CHECK);
	} else {
		include 'header.php';
		$show = new Show($showid);
	}
?>
				<div class="episodedetails">
					<div class="imagecontainer">
						<a href="show.php?showid=<?=$show->getID()?>"><img class="thumbnail" alt="<?=$show->getTitle()?> - <?php printf("%02d", $show->getEpisode($season.'x'.$episode)->getSeason())?>x<?=printf("%02d", $show->getEpisode($season.'x'.$episode)->getEpisodeID())?> - <?=$show->getEpisode($season.'x'.$episode)->getTitle()?>" src="thumbnail.php?showid=<?=$showid?>&amp;season=<?=$season?>&amp;id=<?=$episode?>" /></a>
					</div>
					<?=addSubscribeText($show->isSubscribed(), $show->getID(), 1)?> <a href="show.php?showid=<?=$show->getID()?>&amp;update=1" class="updatethis">Force Update</a>
					<h2><a id="showtitle" href="show.php?showid=<?=$show->getID()?>"><?=$show->getTitle()?></a> &raquo; <a href="episode.php?showid=<?=$show->getID()?>&amp;season=<?=$show->getEpisode($season.'x'.$episode)->getSeason()?>&amp;id=<?=$show->getEpisode($season.'x'.$episode)->getEpisodeID()?>"><?php printf("%02d", $show->getEpisode($season.'x'.$episode)->getSeason())?>x<?php printf("%02d", $show->getEpisode($season.'x'.$episode)->getEpisodeID()); ?> - <?=$show->getEpisode($season.'x'.$episode)->getTitle()?></a></h2>
					<div class="plot"><?=$show->getEpisode($season.'x'.$episode)->getPlot()?></div>
				</div>
				<?php
				if (!isset($_GET['ajax'])) { ?>
					<div class="fullcontent">
						<div class="contentleft">
							<?php 
								$seasonSplit = $show->splitSeasons();
								foreach ($seasonSplit[0] as $season) { if (!isset($season[0])) break; // PHP BUG?!?!
							?>
							<div class="contentbox normalbox seasons">
								<h3>Season <?php printf("%02d", $season[0]->getSeason())?> <a href="show.php?showid=<?=$season[0]->getShowID()?>" class="subscribe dldmissingeps"><span>Download missing episodes</span></a></h3>
								<ul>
Exemple #29
0
$header = new SectionTemplate();
$header->file = "header.php";
$footer = new SectionTemplate();
$footer->file = "footer.php";
$search = new SectionTemplate();
$search->file = "shows_search.php";
include_class('shows');
include_class('venues');
include_class('locations');
include_class('m2');
include_class('tours');
include_class('band_members');
$view = '';
if ($_GET['id']) {
    $bs = Show::get($_GET['id']);
    if ($_GET['media_instance_id'] > 0) {
        $mi = MediaInstance::get($_GET['media_instance_id']);
        if (!db::isError($mi) && !db::isError($bs)) {
            if (($mi->getAreaID() == $bs->getAVAreaID() || $mi->getAreaID() == $bs->getPhotoAreaID()) && $bs->isActive()) {
                $view = 'media';
                $media = new SectionTemplate();
                $media->file = "media_detail.php";
                $media->args['media'] = $mi;
                $media->args['exitURL'] = USE_MOD_REWRITE ? '/show/' . $bs->getID() . '/' : '/shows.php?id=' . $bs->getID();
            }
        }
    }
    if ($view != 'media' && !db::isError($bs)) {
        $view = 'detail';
        $detail = new SectionTemplate();
 public function cancelShowAction()
 {
     $userInfo = Zend_Auth::getInstance()->getStorage()->read();
     $user = new User($userInfo->id);
     if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
         $showInstanceId = $this->_getParam('id');
         $showInstance = new ShowInstance($showInstanceId);
         $show = new Show($showInstance->getShowId());
         $show->cancelShow($showInstance->getShowStart());
     }
 }