2014-10-01 08:33:00 +00:00
|
|
|
<?php
|
|
|
|
|
2015-04-06 13:03:11 +00:00
|
|
|
if(!ini_get('short_open_tag'))
|
2016-12-11 18:55:39 +00:00
|
|
|
die("`short_open_tag = On` is required\n");
|
2015-04-06 13:03:11 +00:00
|
|
|
|
2016-12-17 13:11:47 +00:00
|
|
|
$GLOBALS['BASEDIR'] = dirname(__FILE__);
|
|
|
|
chdir($GLOBALS['BASEDIR']);
|
|
|
|
|
2015-11-14 11:18:49 +00:00
|
|
|
require_once('config.php');
|
2015-07-03 11:09:15 +00:00
|
|
|
require_once('lib/helper.php');
|
2015-11-06 15:45:55 +00:00
|
|
|
|
2015-11-08 13:40:30 +00:00
|
|
|
require_once('lib/PhpTemplate.php');
|
|
|
|
require_once('lib/Exceptions.php');
|
|
|
|
require_once('lib/less.php/Less.php');
|
2015-11-06 15:45:55 +00:00
|
|
|
|
2015-11-08 13:40:30 +00:00
|
|
|
require_once('model/ModelBase.php');
|
|
|
|
require_once('model/Conferences.php');
|
|
|
|
require_once('model/Conference.php');
|
2015-11-08 14:15:53 +00:00
|
|
|
require_once('model/GenericConference.php');
|
2015-11-08 13:40:30 +00:00
|
|
|
require_once('model/Feedback.php');
|
|
|
|
require_once('model/Schedule.php');
|
2015-12-20 14:29:09 +00:00
|
|
|
require_once('model/Subtitles.php');
|
2015-11-08 13:40:30 +00:00
|
|
|
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');
|
2015-11-06 15:45:55 +00:00
|
|
|
|
|
|
|
|
2015-11-08 16:17:16 +00:00
|
|
|
ob_start();
|
2016-12-11 18:56:22 +00:00
|
|
|
if(isset($argv) && isset($argv[1]))
|
|
|
|
{
|
|
|
|
require('lib/command-helper.php');
|
|
|
|
|
|
|
|
switch($argv[1])
|
|
|
|
{
|
|
|
|
case 'download':
|
|
|
|
require('command/download.php');
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
stderr("Unknown Command: %s", $argv[1]);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-08 16:17:16 +00:00
|
|
|
try {
|
2016-06-20 20:41:47 +00:00
|
|
|
if(isset($_GET['htaccess']))
|
|
|
|
{
|
|
|
|
$route = @$_GET['route'];
|
|
|
|
}
|
|
|
|
elseif(isset($_SERVER["REQUEST_URI"]))
|
|
|
|
{
|
|
|
|
$route = ltrim(@$_SERVER["REQUEST_URI"], '/');
|
|
|
|
|
|
|
|
// serve static
|
|
|
|
if($route != '' && file_exists($_SERVER["DOCUMENT_ROOT"].'/'.$route))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else $route = '';
|
|
|
|
|
2016-09-03 17:38:25 +00:00
|
|
|
|
|
|
|
$pieces = parse_url($route);
|
2016-10-17 21:06:14 +00:00
|
|
|
$route = isset($pieces['path']) ? $pieces['path'] : '';
|
2015-11-08 16:17:16 +00:00
|
|
|
$route = rtrim($route, '/');
|
2015-11-06 15:45:55 +00:00
|
|
|
|
2016-09-03 17:50:34 +00:00
|
|
|
$GLOBALS['forceopen'] = isset($_GET['forceopen']);
|
|
|
|
|
2015-11-14 11:18:49 +00:00
|
|
|
// generic template
|
|
|
|
$tpl = new PhpTemplate('template/page.phtml');
|
|
|
|
$tpl->set(array(
|
|
|
|
'baseurl' => forceslash(baseurl()),
|
|
|
|
'route' => $route,
|
|
|
|
'canonicalurl' => forceslash(baseurl()).forceslash($route),
|
|
|
|
'assemblies' => 'template/assemblies/',
|
2016-12-10 17:22:34 +00:00
|
|
|
'assets' => forceslash('assets'),
|
|
|
|
'conference_assets' => '/',
|
2015-11-14 11:18:49 +00:00
|
|
|
|
|
|
|
'conference' => new GenericConference(),
|
|
|
|
));
|
|
|
|
|
|
|
|
if(startswith('//', @$GLOBALS['CONFIG']['BASEURL']))
|
|
|
|
{
|
|
|
|
$tpl->set(array(
|
2016-10-17 21:16:37 +00:00
|
|
|
'httpsurl' => forceslash(forceslash('https:'.$GLOBALS['CONFIG']['BASEURL']).@$GLOBALS['MANDATOR']).forceslash($route).url_params(),
|
|
|
|
'httpurl' => forceslash(forceslash('http:'. $GLOBALS['CONFIG']['BASEURL']).@$GLOBALS['MANDATOR']).forceslash($route).url_params(),
|
2015-11-14 11:18:49 +00:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-08 19:36:34 +00:00
|
|
|
// GLOBAL ROUTES
|
2015-11-08 16:17:16 +00:00
|
|
|
if($route == 'gen/main.css')
|
|
|
|
{
|
2015-11-08 19:36:34 +00:00
|
|
|
// global css (for conferences overview)
|
2015-11-08 16:17:16 +00:00
|
|
|
handle_lesscss_request('assets/css/main.less', '../assets/css/');
|
|
|
|
exit;
|
|
|
|
}
|
2015-11-08 15:31:29 +00:00
|
|
|
|
2015-11-08 19:36:34 +00:00
|
|
|
else if($route == 'streams/v1.json')
|
|
|
|
{
|
|
|
|
require('view/streams-json-v1.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2015-12-20 15:28:02 +00:00
|
|
|
else if($route == 'about')
|
|
|
|
{
|
|
|
|
// global about-page
|
|
|
|
require('view/about-global.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2015-11-08 16:17:16 +00:00
|
|
|
@list($mandator, $route) = explode('/', $route, 2);
|
|
|
|
if(!$mandator)
|
2015-11-06 15:45:55 +00:00
|
|
|
{
|
2015-11-08 16:17:16 +00:00
|
|
|
// root requested
|
|
|
|
|
|
|
|
if(Conferences::getActiveConferencesCount() == 0)
|
|
|
|
{
|
|
|
|
// no clients
|
|
|
|
// error
|
|
|
|
|
|
|
|
require('view/allclosed.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
else if(Conferences::getActiveConferencesCount() == 1)
|
|
|
|
{
|
|
|
|
// one client
|
|
|
|
// redirect
|
|
|
|
|
|
|
|
$clients = Conferences::getActiveConferences();
|
2016-12-10 17:22:34 +00:00
|
|
|
header('Location: '.joinpath([baseurl(), $clients[0]->getSlug()]));
|
2015-11-08 16:17:16 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// multiple clients
|
|
|
|
// show overview
|
|
|
|
|
|
|
|
require('view/allconferences.php');
|
|
|
|
exit;
|
|
|
|
}
|
2015-11-06 15:45:55 +00:00
|
|
|
}
|
2015-11-08 16:17:16 +00:00
|
|
|
else if(!Conferences::exists($mandator))
|
2015-11-06 15:45:55 +00:00
|
|
|
{
|
2015-11-08 16:17:16 +00:00
|
|
|
// old url OR wrong client OR
|
|
|
|
// -> error
|
|
|
|
require('view/404.php');
|
2015-11-06 15:45:55 +00:00
|
|
|
exit;
|
|
|
|
}
|
2016-12-10 17:22:34 +00:00
|
|
|
else {
|
|
|
|
// fallthrough through to the main mandator-based routes
|
|
|
|
}
|
2015-11-06 15:45:55 +00:00
|
|
|
}
|
2015-11-08 16:17:16 +00:00
|
|
|
catch(Exception $e)
|
2015-11-06 15:45:55 +00:00
|
|
|
{
|
2015-11-08 16:17:16 +00:00
|
|
|
ob_clean();
|
2016-12-10 17:23:22 +00:00
|
|
|
try {
|
|
|
|
require('view/500.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
catch(Exception $e) {
|
|
|
|
header("HTTP/1.1 500 Internal Server Error");
|
|
|
|
header("Content-Type: text/plain");
|
|
|
|
print_r($e);
|
|
|
|
exit;
|
|
|
|
}
|
2015-11-06 15:45:55 +00:00
|
|
|
}
|
|
|
|
|
2015-03-08 12:42:58 +00:00
|
|
|
|
2015-11-08 13:40:30 +00:00
|
|
|
// PER-CONFERENCE CODE
|
2015-03-27 13:21:34 +00:00
|
|
|
ob_start();
|
2015-03-08 12:42:58 +00:00
|
|
|
try {
|
2016-12-11 19:01:33 +00:00
|
|
|
$conference = Conferences::getConference($mandator);
|
|
|
|
|
|
|
|
// update template information
|
|
|
|
$tpl->set(array(
|
|
|
|
'baseurl' => forceslash(baseurl()),
|
|
|
|
'route' => $route,
|
|
|
|
'canonicalurl' => joinpath([baseurl(), $mandator, $route]),
|
|
|
|
'conference_assets' => forceslash($mandator),
|
|
|
|
|
|
|
|
'conference' => $conference,
|
|
|
|
'feedback' => $conference->getFeedback(),
|
|
|
|
'schedule' => $conference->getSchedule(),
|
|
|
|
'subtitles' => $conference->getSubtitles(),
|
|
|
|
));
|
2015-04-04 18:11:25 +00:00
|
|
|
|
2015-11-08 13:40:30 +00:00
|
|
|
// ALWAYS AVAILABLE ROUTES
|
2015-04-04 18:11:25 +00:00
|
|
|
if($route == 'feedback/read')
|
|
|
|
{
|
|
|
|
require('view/feedback-read.php');
|
|
|
|
}
|
|
|
|
|
2015-10-22 15:23:22 +00:00
|
|
|
else if($route == 'gen/main.css')
|
2015-10-05 15:28:23 +00:00
|
|
|
{
|
2015-11-08 13:40:30 +00:00
|
|
|
if(Conferences::hasCustomStyles($mandator))
|
|
|
|
{
|
|
|
|
handle_lesscss_request(
|
|
|
|
Conferences::getCustomStyles($mandator),
|
|
|
|
'../../'.Conferences::getCustomStylesDir($mandator)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
handle_lesscss_request('assets/css/main.less', '../../assets/css/');
|
|
|
|
}
|
2015-10-05 15:28:23 +00:00
|
|
|
}
|
|
|
|
|
2016-08-23 11:13:28 +00:00
|
|
|
else if($route == 'multiview')
|
|
|
|
{
|
|
|
|
require('view/multiview.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
else if($route == 'schedule')
|
|
|
|
{
|
|
|
|
require('view/schedule.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
else if($route == 'multiview/audio')
|
|
|
|
{
|
|
|
|
$_GET['selection'] = 'audio';
|
|
|
|
require('view/multiview.php');
|
|
|
|
}
|
|
|
|
|
2016-12-10 17:23:45 +00:00
|
|
|
else if($route == 'about')
|
|
|
|
{
|
|
|
|
require('view/about.php');
|
|
|
|
}
|
|
|
|
|
2015-11-08 13:40:30 +00:00
|
|
|
// HAS-NOT-BEGUN VIEW
|
2015-09-02 13:58:48 +00:00
|
|
|
else if(!$conference->hasBegun())
|
2015-09-02 10:56:32 +00:00
|
|
|
{
|
2015-09-02 14:01:42 +00:00
|
|
|
require('view/not-started.php');
|
2015-09-02 10:56:32 +00:00
|
|
|
}
|
|
|
|
|
2015-11-08 13:40:30 +00:00
|
|
|
// ROUTES AVAILABLE AFTER BUT NOT BEFORE THE CONFERENCE
|
2015-09-02 14:19:39 +00:00
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
2015-11-08 13:40:30 +00:00
|
|
|
|
|
|
|
// HAS-ENDED VIEW
|
2015-09-02 10:56:32 +00:00
|
|
|
else if($conference->hasEnded())
|
2015-04-04 18:11:25 +00:00
|
|
|
{
|
|
|
|
require('view/closed.php');
|
|
|
|
}
|
|
|
|
|
2015-11-08 13:40:30 +00:00
|
|
|
// ROUTES AVAILABLE ONLY DURING THE CONFERENCE
|
2015-04-04 18:11:25 +00:00
|
|
|
else if($route == '')
|
2015-03-08 12:42:58 +00:00
|
|
|
{
|
2015-03-31 19:59:22 +00:00
|
|
|
require('view/overview.php');
|
2015-03-08 12:42:58 +00:00
|
|
|
}
|
|
|
|
|
2015-04-04 18:11:25 +00:00
|
|
|
else if($route == 'feedback')
|
2015-03-08 12:42:58 +00:00
|
|
|
{
|
2015-03-31 19:59:22 +00:00
|
|
|
require('view/feedback.php');
|
2015-03-08 12:42:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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');
|
2015-03-08 12:42:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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');
|
2015-03-08 12:42:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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');
|
2015-03-08 12:42:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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-03-08 12:42:58 +00:00
|
|
|
}
|
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
2015-11-08 13:40:30 +00:00
|
|
|
// UNKNOWN ROUTE
|
2015-03-08 12:42:58 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
throw new NotFoundException();
|
|
|
|
}
|
2015-03-02 06:35:29 +00:00
|
|
|
|
2015-03-01 15:16:18 +00:00
|
|
|
}
|
2015-03-08 12:42:58 +00:00
|
|
|
catch(NotFoundException $e)
|
2014-11-29 18:31:21 +00:00
|
|
|
{
|
2015-03-27 13:21:34 +00:00
|
|
|
ob_clean();
|
2015-03-31 19:59:22 +00:00
|
|
|
require('view/404.php');
|
2014-11-29 18:31:21 +00:00
|
|
|
}
|
2015-03-08 12:42:58 +00:00
|
|
|
catch(Exception $e)
|
2014-11-29 18:31:21 +00:00
|
|
|
{
|
2015-03-27 13:21:34 +00:00
|
|
|
ob_clean();
|
2015-03-31 19:59:22 +00:00
|
|
|
require('view/500.php');
|
2014-11-29 18:31:21 +00:00
|
|
|
}
|