aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorMaZderMind2016-12-18 13:34:57 +0100
committerMaZderMind2016-12-18 13:34:57 +0100
commita12d86ec058bc89e6feeda6ec8cfce691269b0a9 (patch)
tree6be1f764a8addd025eb774bcd2039788a4b1873f /index.php
parent521f0e2e1c94538fdce65a021144180f368364d9 (diff)
parentefd0b59f8ed363e12211894d8892e4d18b198c04 (diff)
Merge branch 'master' into events/33c3
Diffstat (limited to '')
-rw-r--r--index.php88
1 files changed, 55 insertions, 33 deletions
diff --git a/index.php b/index.php
index 6713cee..a100570 100644
--- a/index.php
+++ b/index.php
@@ -1,7 +1,10 @@
<?php
if(!ini_get('short_open_tag'))
- die('`short_open_tag = On` is required');
+ die("`short_open_tag = On` is required\n");
+
+$GLOBALS['BASEDIR'] = dirname(__FILE__);
+chdir($GLOBALS['BASEDIR']);
require_once('config.php');
require_once('lib/helper.php');
@@ -27,6 +30,22 @@ require_once('model/Upcoming.php');
ob_start();
+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);
+}
+
+
try {
if(isset($_GET['htaccess']))
{
@@ -59,7 +78,8 @@ try {
'route' => $route,
'canonicalurl' => forceslash(baseurl()).forceslash($route),
'assemblies' => 'template/assemblies/',
- 'assets' => 'assets/',
+ 'assets' => forceslash('assets'),
+ 'conference_assets' => '/',
'conference' => new GenericConference(),
));
@@ -113,7 +133,7 @@ try {
// redirect
$clients = Conferences::getActiveConferences();
- header('Location: '.forceslash( baseurl() . $clients[0]['link'] ));
+ header('Location: '.joinpath([baseurl(), $clients[0]->getSlug()]));
exit;
}
else
@@ -132,36 +152,43 @@ try {
require('view/404.php');
exit;
}
-
- Conferences::load($mandator);
+ else {
+ // fallthrough through to the main mandator-based routes
+ }
}
catch(Exception $e)
{
ob_clean();
- require('view/500.php');
+ 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;
+ }
}
-
// PER-CONFERENCE CODE
-$GLOBALS['MANDATOR'] = $mandator;
-$conference = new Conference();
-
-// update template information
-$tpl->set(array(
- 'baseurl' => forceslash(baseurl()),
- 'route' => $route,
- 'canonicalurl' => forceslash(baseurl()).forceslash($route),
- 'assets' => '../assets/',
-
- 'conference' => $conference,
- 'feedback' => new Feedback(),
- 'schedule' => new Schedule(),
- 'subtitles' => new Subtitles(),
-));
-
ob_start();
try {
+ $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(),
+ ));
// ALWAYS AVAILABLE ROUTES
if($route == 'feedback/read')
@@ -169,11 +196,6 @@ try {
require('view/feedback-read.php');
}
- else if($route == 'schedule.json')
- {
- require('view/schedule-json.php');
- }
-
else if($route == 'gen/main.css')
{
if(Conferences::hasCustomStyles($mandator))
@@ -204,6 +226,11 @@ try {
require('view/multiview.php');
}
+ else if($route == 'about')
+ {
+ require('view/about.php');
+ }
+
// HAS-NOT-BEGUN VIEW
else if(!$conference->hasBegun())
{
@@ -237,11 +264,6 @@ try {
require('view/overview.php');
}
- else if($route == 'about')
- {
- require('view/about.php');
- }
-
else if($route == 'feedback')
{
require('view/feedback.php');