diff --git a/inc/include.php b/inc/include.php new file mode 100644 index 0000000..01d9a56 --- /dev/null +++ b/inc/include.php @@ -0,0 +1,33 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +$userManager = new \pvv\admin\UserManager($pdo); + +$sp = 'default-sp'; +$as = new SimpleSAML_Auth_Simple($sp); + +use \pvv\side\Agenda; +$agenda = new \pvv\side\Agenda([ + new \pvv\side\social\NerdepitsaActivity, + new \pvv\side\social\AnimekveldActivity, + new \pvv\side\DBActivity($pdo), + ]); + +$months_translations = ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember']; diff --git a/www/admin/index.php b/www/admin/index.php index 906631c..c3cfe4d 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -1,14 +1,6 @@ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -$userManager = new \pvv\admin\UserManager($pdo); - -$as = new SimpleSAML_Auth_Simple('default-sp'); $as->requireAuth(); $attrs = $as->getAttributes(); $uname = $attrs['uid'][0]; diff --git a/www/aktiviteter/index.php b/www/aktiviteter/index.php index c9bca84..1c3f433 100644 --- a/www/aktiviteter/index.php +++ b/www/aktiviteter/index.php @@ -1,18 +1,5 @@ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); -use \pvv\side\Agenda; -$agenda = new \pvv\side\Agenda([ - new \pvv\side\social\NerdepitsaActivity, - new \pvv\side\social\AnimekveldActivity, - new \pvv\side\DBActivity($pdo), - ]); +require_once dirname(__DIR__, 2) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']); $year = (isset($_GET['year'])) ? $_GET['year'] @@ -80,5 +67,5 @@ foreach($events as $event) { diff --git a/www/index.php b/www/index.php index 0fe4c80..d1eadaf 100644 --- a/www/index.php +++ b/www/index.php @@ -1,8 +1,5 @@ @@ -91,5 +88,5 @@ For å bli med i våre prosjekter og komitéer må du søke. diff --git a/www/kalender/index.php b/www/kalender/index.php index a77ea10..ac2882e 100644 --- a/www/kalender/index.php +++ b/www/kalender/index.php @@ -1,10 +1,5 @@ = navbar(1, 'kalender'); ?> - = loginbar(); ?> + = loginbar($sp, $pdo); ?> diff --git a/www/kontakt/index.php b/www/kontakt/index.php index 053683b..5703b04 100755 --- a/www/kontakt/index.php +++ b/www/kontakt/index.php @@ -1,11 +1,6 @@ - +require_once dirname(__DIR__, 2) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']); +?>