streaming-website/index.php

199 lines
3.8 KiB
PHP
Raw Normal View History

2014-10-01 08:33:00 +00:00
<?php
if(!ini_get('short_open_tag'))
die('`short_open_tag = On` is required');
require_once('lib/helper.php');
2015-03-07 16:58:07 +00:00
require_once('config.php');
2015-03-07 16:58:07 +00:00
require_once('lib/PhpTemplate.php');
require_once('lib/Exceptions.php');
2015-10-05 15:28:23 +00:00
require_once('lib/less.php/Less.php');
2015-03-07 16:58:07 +00:00
require_once('model/ModelBase.php');
require_once('model/Conference.php');
require_once('model/Feedback.php');
require_once('model/Schedule.php');
require_once('model/Overview.php');
require_once('model/Room.php');
require_once('model/RoomTab.php');
require_once('model/RoomSelection.php');
require_once('model/Stream.php');
require_once('model/Relive.php');
require_once('model/Upcoming.php');
$route = @$_GET['route'];
$route = rtrim($route, '/');
2014-10-01 08:33:00 +00:00
$conference = new Conference();
2015-03-07 16:58:07 +00:00
$tpl = new PhpTemplate('template/page.phtml');
$tpl->set(array(
2015-07-13 12:03:13 +00:00
'baseurl' => forceslash(baseurl()),
'route' => $route,
2015-07-13 12:03:13 +00:00
'canonicalurl' => forceslash(baseurl()).forceslash($route),
2015-03-07 16:58:07 +00:00
'assemblies' => './template/assemblies/',
'conference' => $conference,
'feedback' => new Feedback(),
'schedule' => new Schedule(),
2015-03-07 16:58:07 +00:00
));
2015-07-13 12:03:13 +00:00
if(startswith('//', @$GLOBALS['CONFIG']['BASEURL']))
{
$tpl->set(array(
'httpsurl' => forceslash('https:'.$GLOBALS['CONFIG']['BASEURL']).forceslash($route),
'httpurl' => forceslash('http:'. $GLOBALS['CONFIG']['BASEURL']).forceslash($route),
));
}
2015-03-27 13:21:34 +00:00
ob_start();
try {
if($route == 'feedback/read')
{
require('view/feedback-read.php');
}
else if($route == 'schedule.json')
{
require('view/schedule-json.php');
}
2015-04-05 17:05:33 +00:00
else if($route == 'streams/v1.json')
{
require('view/streams-json-v1.php');
}
else if($route == 'gen/main.css')
2015-10-05 15:28:23 +00:00
{
2015-10-05 15:37:25 +00:00
$dir = forceslash(sys_get_temp_dir());
$css_file = Less_Cache::Get([
'assets/css/main.less' => forceslash(baseurl()).'assets/css/',
], [
2015-10-05 15:28:23 +00:00
'sourceMap' => true,
'compress' => true,
'relativeUrls' => true,
2015-10-05 15:37:25 +00:00
'cache_dir' => $dir,
2015-10-05 15:28:23 +00:00
]);
2015-10-05 15:37:25 +00:00
$css = file_get_contents($dir.$css_file);
2015-10-05 15:28:23 +00:00
header('Content-Type: text/css');
header('Content-Length: '.strlen($css));
print($css);
}
2015-09-02 13:58:48 +00:00
else if(!$conference->hasBegun())
{
require('view/not-started.php');
}
else if(preg_match('@^relive/([0-9]+)$@', $route, $m))
{
$_GET = array(
'id' => $m[1],
);
require('view/relive-player.php');
}
else if($route == 'relive')
{
require('view/relive.php');
}
else if($conference->hasEnded())
{
require('view/closed.php');
}
else if($route == '')
{
2015-03-31 19:59:22 +00:00
require('view/overview.php');
}
else if($route == 'about')
{
2015-03-31 19:59:22 +00:00
require('view/about.php');
}
else if($route == 'multiview')
2015-04-03 18:46:10 +00:00
{
require('view/multiview.php');
}
else if($route == 'feedback')
{
2015-03-31 19:59:22 +00:00
require('view/feedback.php');
}
else if(preg_match('@^([^/]+)$@', $route, $m))
{
$_GET = array(
'room' => $m[1],
'selection' => '',
'language' => 'native',
);
2015-03-31 19:59:22 +00:00
require('view/room.php');
}
else if(preg_match('@^([^/]+)/translated$@', $route, $m))
{
$_GET = array(
'room' => $m[1],
'selection' => '',
'language' => 'translated',
);
2015-03-31 19:59:22 +00:00
require('view/room.php');
}
else if(preg_match('@^([^/]+)/(sd|audio|slides)$@', $route, $m))
{
$_GET = array(
'room' => $m[1],
'selection' => $m[2],
'language' => 'native',
);
2015-03-31 19:59:22 +00:00
require('view/room.php');
}
else if(preg_match('@^([^/]+)/(sd|audio|slides)/translated$@', $route, $m))
{
$_GET = array(
'room' => $m[1],
'selection' => $m[2],
'language' => 'translated',
);
2015-03-31 19:59:22 +00:00
require('view/room.php');
}
2015-08-13 16:18:08 +00:00
else if(preg_match('@^embed/([^/]+)/(hd|sd|audio|slides)/(native|translated|stereo)(/no-autoplay)?$@', $route, $m))
2015-04-05 22:28:03 +00:00
{
$_GET = array(
'room' => $m[1],
'selection' => $m[2],
'language' => $m[3],
2015-08-13 16:18:08 +00:00
'autoplay' => !isset($m[4]),
2015-04-05 22:28:03 +00:00
);
require('view/embed.php');
}
else
{
throw new NotFoundException();
}
2015-03-02 06:35:29 +00:00
2015-03-01 15:16:18 +00:00
}
catch(NotFoundException $e)
{
2015-03-27 13:21:34 +00:00
ob_clean();
2015-03-31 19:59:22 +00:00
require('view/404.php');
}
catch(Exception $e)
{
2015-03-27 13:21:34 +00:00
ob_clean();
2015-03-31 19:59:22 +00:00
require('view/500.php');
}