index.php 2.35 KB
Newer Older
Andreas Müller's avatar
Andreas Müller committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
<?php

/**
 * index.php
 *
 * @author     Andreas Mueller <webmaster@am-wd.de>
 * @copyright  (c) 2016 Andreas Mueller
 * @license    MIT - http://am-wd.de/?p=about#license
 */

// Report everything just to be sure it's clean code
// But notices sucks some times
@error_reporting(E_ALL ^ E_NOTICE);
@ini_set('display_errors', 'on');

require_once('base.php');

// Define output content type
header('Content-Type: text/html; Charset=UTF-8');

// Load all needed stuff
require_once BASEDIR.'/php/includes/include.php';

// Enforce using TLS encrypted connection (HTTPS)
// Except: it is disabled in the config
if ($config['require_https'] && !ISHTTPS)
{
	header('HTTP/1.1 302 Found');
	header('Location: '.str_replace('http:', 'https:', BASEURL));
	die('Please reload the page: <a href="'.str_replace('http:', 'https:', BASEURL).'">'.str_replace('http:', 'https:', BASEURL).'</a>');
}

// Prepare statics for the page
// Load the template
$page = new AMWD\Page(BASEDIR.'/php/layout.html');

// Set the brand (at the left of the navbar)
$page->setBrand('<span class="fa fa-heartbeat"></span> BS Erlangen');

// Set the title shown in the browsers head
$page->setTitle('SSD BS Erlangen');

// Set the footer with some information
$page->setFooter('&copy; '.date('Y').' BS Erlangen | <a href="'.BASEURL.'/?p=imprint">Impressum</a> - <a href="'.BASEURL.'/?p=privacy">Datenschutz</a>');

// Load CSS and JS files needed
Andreas Müller's avatar
Andreas Müller committed
47
$page->addCSS('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');
Andreas Müller's avatar
Andreas Müller committed
48
$page->addCSS(BASEURL.'/css/bootstrap-outline.min.css');
Andreas Müller's avatar
Andreas Müller committed
49
$page->addCSS('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css');
Andreas Müller's avatar
Andreas Müller committed
50 51 52 53
$page->addCSS(BASEURL.'/submodules/bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css');
$page->addCSS(BASEURL.'/css/layout.min.css');
$page->addCSS(BASEURL.'/css/main.css');

Andreas Müller's avatar
Andreas Müller committed
54 55
$page->addJS('https://code.jquery.com/jquery-3.2.1.min.js');
$page->addJS('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js');
Andreas Müller's avatar
Andreas Müller committed
56 57 58 59 60 61 62 63 64 65 66
$page->addJS(BASEURL.'/submodules/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js');
$page->addJS(BASEURL.'/submodules/bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js');
$page->addJS(BASEURL.'/js/api.js');
$page->addJS(BASEURL.'/js/main.js');

// Load the contents
require_once BASEDIR.'/php/contents/load.php';

echo $page;

?>