Compare commits
1 Commits
main
...
adriangl-p
Author | SHA1 | Date | |
---|---|---|---|
e37785d98a |
.envrc.git-blame-ignore-revs.php-cs-fixer.phpcomposer.jsoncomposer.lock
dist
config.local.phpconfig.source-env.phppvv.sqlpvv_mysql.sqlpvv_sqlite.sqlsimplesamlphp-authsources.phpsimplesamlphp-config.phpsimplesamlphp-idp.php
flake.lockflake.nixinc
nix
src
_autoload.php
pvv
www
admin
aktiviteter
anime
brettspill
css
door
driftkveld
galleri
hendelser
index.phpkalender
kontakt
nerdepitsa
om
paamelding
prosjekt
spaceapi.phptjenester
1
.envrc
1
.envrc
@ -1 +0,0 @@
|
|||||||
use flake
|
|
@ -1,3 +0,0 @@
|
|||||||
# The formattening
|
|
||||||
c5d308654744e116090e9ba165a968b8bf66006c
|
|
||||||
da8afe735c62e1f8ee9ad5f71291d87102fe126b
|
|
@ -1,58 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$finder = (new PhpCsFixer\Finder())
|
|
||||||
->ignoreDotFiles(false)
|
|
||||||
->ignoreVCSIgnored(true)
|
|
||||||
->in([
|
|
||||||
'inc',
|
|
||||||
'src',
|
|
||||||
'dist',
|
|
||||||
])
|
|
||||||
->exclude([
|
|
||||||
'vendor',
|
|
||||||
])
|
|
||||||
->append([
|
|
||||||
__DIR__ . '/config.php',
|
|
||||||
__DIR__ . '/.php-cs-fixer',
|
|
||||||
])
|
|
||||||
;
|
|
||||||
|
|
||||||
return (new PhpCsFixer\Config())
|
|
||||||
->setRiskyAllowed(true)
|
|
||||||
->setRules([
|
|
||||||
'@PhpCsFixer' => true,
|
|
||||||
'@Symfony' => true,
|
|
||||||
'@PER-CS' => true,
|
|
||||||
'@PHP71Migration' => true,
|
|
||||||
'@PHP73Migration' => true,
|
|
||||||
'@PHP74Migration' => true,
|
|
||||||
'@PHP80Migration' => true,
|
|
||||||
'@PHP81Migration' => true,
|
|
||||||
'@PHP82Migration' => true,
|
|
||||||
'@PHP83Migration' => true,
|
|
||||||
'@PHP84Migration' => true,
|
|
||||||
|
|
||||||
'@PhpCsFixer:risky' => true,
|
|
||||||
'@Symfony:risky' => true,
|
|
||||||
'@PER-CS:risky' => true,
|
|
||||||
'@PHP74Migration:risky' => true,
|
|
||||||
'@PHP80Migration:risky' => true,
|
|
||||||
'@PHP82Migration:risky' => true,
|
|
||||||
|
|
||||||
'strict_param' => true,
|
|
||||||
'array_syntax' => ['syntax' => 'short'],
|
|
||||||
'braces_position' => [
|
|
||||||
'functions_opening_brace' => 'same_line',
|
|
||||||
'classes_opening_brace' => 'same_line',
|
|
||||||
],
|
|
||||||
'simplified_if_return' => true,
|
|
||||||
'simplified_null_return' => true,
|
|
||||||
'yoda_style' => false,
|
|
||||||
|
|
||||||
// TODO: fix these
|
|
||||||
'psr_autoloading' => false,
|
|
||||||
])
|
|
||||||
->setFinder($finder)
|
|
||||||
->setIndent(" ")
|
|
||||||
->setLineEnding("\n")
|
|
||||||
;
|
|
@ -5,12 +5,11 @@
|
|||||||
|
|
||||||
"config": {
|
"config": {
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
"simplesamlphp/composer-module-installer": true,
|
"simplesamlphp/composer-module-installer": true
|
||||||
"simplesamlphp/composer-xmlprovider-installer": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"simplesamlphp/simplesamlphp": "^2.2.1",
|
"simplesamlphp/simplesamlphp": "^2.2",
|
||||||
"erusev/parsedown": "^1.7.4"
|
"erusev/parsedown": "^1.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1249
composer.lock
generated
1249
composer.lock
generated
File diff suppressed because it is too large
Load Diff
18
dist/config.local.php
vendored
18
dist/config.local.php
vendored
@ -1,24 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
$DB_DSN = 'sqlite:'.__DIR__.DIRECTORY_SEPARATOR.'pvv.sqlite';
|
||||||
|
|
||||||
$DB_DSN = 'sqlite:' . __DIR__ . \DIRECTORY_SEPARATOR . 'pvv.sqlite';
|
|
||||||
$DB_USER = null;
|
$DB_USER = null;
|
||||||
$DB_PASS = null;
|
$DB_PASS = null;
|
||||||
|
|
||||||
$DOOR_SECRET = 'changeme';
|
$DOOR_SECRET = "changeme";
|
||||||
|
|
||||||
$GALLERY_DIR = __DIR__ . \DIRECTORY_SEPARATOR . 'www' . \DIRECTORY_SEPARATOR . 'galleri' . \DIRECTORY_SEPARATOR . 'bilder' . \DIRECTORY_SEPARATOR . 'gallery';
|
$GALLERY_DIR = __DIR__.DIRECTORY_SEPARATOR.'www'.DIRECTORY_SEPARATOR.'galleri'.DIRECTORY_SEPARATOR.'bilder'.DIRECTORY_SEPARATOR.'gallery';
|
||||||
$GALLERY_SERVER_PATH = '/images/gallery/';
|
$GALLERY_SERVER_PATH = '/images/gallery/';
|
||||||
|
|
||||||
$SLIDESHOW_DIR = __DIR__ . \DIRECTORY_SEPARATOR . 'www' . \DIRECTORY_SEPARATOR . 'galleri' . \DIRECTORY_SEPARATOR . 'bilder' . \DIRECTORY_SEPARATOR . 'slideshow';
|
$SLIDESHOW_DIR = __DIR__.DIRECTORY_SEPARATOR.'www'.DIRECTORY_SEPARATOR.'galleri'.DIRECTORY_SEPARATOR.'bilder'.DIRECTORY_SEPARATOR.'slideshow';
|
||||||
$SLIDESHOW_SERVER_PATH = '/images/slideshow/';
|
$SLIDESHOW_SERVER_PATH = '/images/slideshow/';
|
||||||
|
|
||||||
$SAML_COOKIE_SALT = 'changeme';
|
$SAML_COOKIE_SALT = 'changeme';
|
||||||
$SAML_COOKIE_SECURE = false;
|
$SAML_COOKIE_SECURE = false;
|
||||||
$SAML_TRUSTED_DOMAINS = ['localhost:1080'];
|
$SAML_TRUSTED_DOMAINS = array("localhost:1080");
|
||||||
$SAML_ADMIN_PASSWORD = 'changeme';
|
$SAML_ADMIN_PASSWORD = "changeme";
|
||||||
$SAML_ADMIN_NAME = 'PVV Drift';
|
$SAML_ADMIN_NAME = 'PVV Drift';
|
||||||
$SAML_ADMIN_EMAIL = 'drift@pvv.ntnu.no';
|
$SAML_ADMIN_EMAIL = 'drift@pvv.ntnu.no';
|
||||||
|
|
||||||
$CACHE_DIRECTORY = __DIR__ . \DIRECTORY_SEPARATOR . 'cache';
|
$CACHE_DIRECTORY = __DIR__.DIRECTORY_SEPARATOR.'cache';
|
||||||
|
|
||||||
|
?>
|
||||||
|
6
dist/config.source-env.php
vendored
6
dist/config.source-env.php
vendored
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
$configFile = getenv('PVV_CONFIG_FILE');
|
$configFile = getenv('PVV_CONFIG_FILE');
|
||||||
require_once $configFile;
|
require_once($configFile);
|
||||||
|
|
||||||
|
?>
|
||||||
|
50
dist/pvv.sql
vendored
Normal file
50
dist/pvv.sql
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
CREATE TABLE "events" (
|
||||||
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
"name" TEXT,
|
||||||
|
"start" TEXT,
|
||||||
|
"stop" TEXT,
|
||||||
|
"organiser" TEXT,
|
||||||
|
"location" TEXT,
|
||||||
|
"description" TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "projects" (
|
||||||
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
"name" TEXT,
|
||||||
|
"description" TEXT,
|
||||||
|
"active" BOOLEAN
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "projectmembers" (
|
||||||
|
"projectid" INTEGER,
|
||||||
|
"name" TEXT,
|
||||||
|
"uname" TEXT,
|
||||||
|
"mail" TEXT,
|
||||||
|
"role" TEXT,
|
||||||
|
"lead" BOOLEAN DEFAULT 0,
|
||||||
|
"owner" BOOLEAN DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "users" (
|
||||||
|
"uname" TEXT,
|
||||||
|
"groups" INT DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "motd" (
|
||||||
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
"title" TEXT,
|
||||||
|
"content" TEXT
|
||||||
|
);
|
||||||
|
INSERT INTO motd (title, content)
|
||||||
|
VALUES ('MOTD ./dev.sh', 'du kan endre motd i admin panelet');
|
||||||
|
|
||||||
|
CREATE TABLE "door" (
|
||||||
|
"time" INTEGER PRIMARY KEY,
|
||||||
|
"open" BOOLEAN
|
||||||
|
);
|
||||||
|
INSERT INTO door (time, open)
|
||||||
|
VALUES (0, FALSE);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO users (uname, groups)
|
||||||
|
VALUES ('min_test_bruker', 1);
|
16
dist/pvv_mysql.sql
vendored
16
dist/pvv_mysql.sql
vendored
@ -25,21 +25,23 @@ CREATE TABLE projectmembers (
|
|||||||
`owner` BOOLEAN DEFAULT 0
|
`owner` BOOLEAN DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE users (`uname` TEXT, `groups` INT DEFAULT 0);
|
CREATE TABLE users (
|
||||||
|
`uname` TEXT,
|
||||||
|
`groups` INT DEFAULT 0
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE motd (
|
CREATE TABLE motd (
|
||||||
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
|
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||||
`title` TEXT,
|
`title` TEXT,
|
||||||
`content` TEXT
|
`content` TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
INSERT INTO motd (title, content)
|
INSERT INTO motd (title, content)
|
||||||
VALUES ("MOTD ./dev.sh", "du kan endre motd i admin panelet");
|
VALUES ("MOTD ./dev.sh", "du kan endre motd i admin panelet");
|
||||||
*/
|
*/
|
||||||
CREATE TABLE door (`time` INTEGER PRIMARY KEY, `open` BOOLEAN);
|
|
||||||
|
|
||||||
INSERT INTO
|
CREATE TABLE door (
|
||||||
door (time, open)
|
`time` INTEGER PRIMARY KEY,
|
||||||
VALUES
|
`open` BOOLEAN
|
||||||
(0, FALSE);
|
);
|
||||||
|
INSERT INTO door(time, open) VALUES (0, FALSE);
|
54
dist/pvv_sqlite.sql
vendored
54
dist/pvv_sqlite.sql
vendored
@ -1,54 +0,0 @@
|
|||||||
CREATE TABLE "events" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
"name" TEXT,
|
|
||||||
"start" TEXT,
|
|
||||||
"stop" TEXT,
|
|
||||||
"organiser" TEXT,
|
|
||||||
"location" TEXT,
|
|
||||||
"description" TEXT
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "projects" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
"name" TEXT,
|
|
||||||
"description" TEXT,
|
|
||||||
"active" BOOLEAN
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "projectmembers" (
|
|
||||||
"projectid" INTEGER,
|
|
||||||
"name" TEXT,
|
|
||||||
"uname" TEXT,
|
|
||||||
"mail" TEXT,
|
|
||||||
"role" TEXT,
|
|
||||||
"lead" BOOLEAN DEFAULT 0,
|
|
||||||
"owner" BOOLEAN DEFAULT 0
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "users" ("uname" TEXT, "groups" INT DEFAULT 0);
|
|
||||||
|
|
||||||
CREATE TABLE "motd" (
|
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
"title" TEXT,
|
|
||||||
"content" TEXT
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO
|
|
||||||
motd (title, content)
|
|
||||||
VALUES
|
|
||||||
(
|
|
||||||
'MOTD ./dev.sh',
|
|
||||||
'du kan endre motd i admin panelet'
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "door" ("time" INTEGER PRIMARY KEY, "open" BOOLEAN);
|
|
||||||
|
|
||||||
INSERT INTO
|
|
||||||
door (time, open)
|
|
||||||
VALUES
|
|
||||||
(0, FALSE);
|
|
||||||
|
|
||||||
INSERT INTO
|
|
||||||
users (uname, groups)
|
|
||||||
VALUES
|
|
||||||
('min_test_bruker', 1);
|
|
11
dist/simplesamlphp-authsources.php
vendored
11
dist/simplesamlphp-authsources.php
vendored
@ -1,12 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
$config = array(
|
||||||
declare(strict_types=1);
|
|
||||||
$config = [
|
|
||||||
|
|
||||||
/* This is the name of this authentication source, and will be used to access it later. */
|
/* This is the name of this authentication source, and will be used to access it later. */
|
||||||
'default-sp' => [
|
'default-sp' => array(
|
||||||
'saml:SP',
|
'saml:SP',
|
||||||
'entityID' => 'https://www.pvv.ntnu.no/simplesaml/',
|
|
||||||
'idp' => 'https://idp.pvv.ntnu.no/',
|
'idp' => 'https://idp.pvv.ntnu.no/',
|
||||||
],
|
),
|
||||||
];
|
);
|
||||||
|
87
dist/simplesamlphp-config.php
vendored
87
dist/simplesamlphp-config.php
vendored
@ -1,19 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
require_once(dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'config.php');
|
||||||
|
|
||||||
require_once dirname(__DIR__, 4) . \DIRECTORY_SEPARATOR . 'config.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration of SimpleSAMLphp.
|
* The configuration of SimpleSAMLphp
|
||||||
*/
|
*/
|
||||||
$httpUtils = new SimpleSAML\Utils\HTTP();
|
|
||||||
|
$httpUtils = new \SimpleSAML\Utils\HTTP();
|
||||||
|
|
||||||
$config = [
|
$config = [
|
||||||
|
|
||||||
/*
|
/*******************************
|
||||||
| BASIC CONFIGURATION OPTIONS |
|
| BASIC CONFIGURATION OPTIONS |
|
||||||
*/
|
*******************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup the following parameters to match your installation.
|
* Setup the following parameters to match your installation.
|
||||||
@ -180,9 +179,9 @@ $config = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**********************************
|
||||||
| SECURITY CONFIGURATION OPTIONS |
|
| SECURITY CONFIGURATION OPTIONS |
|
||||||
*/
|
**********************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a secret salt used by SimpleSAMLphp when it needs to generate a secure hash
|
* This is a secret salt used by SimpleSAMLphp when it needs to generate a secure hash
|
||||||
@ -288,9 +287,9 @@ $config = [
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/************************
|
||||||
| ERRORS AND DEBUGGING |
|
| ERRORS AND DEBUGGING |
|
||||||
*/
|
************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The 'debug' option allows you to control how SimpleSAMLphp behaves in certain
|
* The 'debug' option allows you to control how SimpleSAMLphp behaves in certain
|
||||||
@ -348,9 +347,9 @@ $config = [
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**************************
|
||||||
| LOGGING AND STATISTICS |
|
| LOGGING AND STATISTICS |
|
||||||
*/
|
**************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define the minimum log level to log. Available levels:
|
* Define the minimum log level to log. Available levels:
|
||||||
@ -410,7 +409,7 @@ $config = [
|
|||||||
*
|
*
|
||||||
* The default is to use LOG_LOCAL5 if available, and fall back to LOG_USER if not.
|
* The default is to use LOG_LOCAL5 if available, and fall back to LOG_USER if not.
|
||||||
*/
|
*/
|
||||||
'logging.facility' => defined('LOG_LOCAL5') ? constant('LOG_LOCAL5') : \LOG_USER,
|
'logging.facility' => defined('LOG_LOCAL5') ? constant('LOG_LOCAL5') : LOG_USER,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The process name that should be used when logging to syslog.
|
* The process name that should be used when logging to syslog.
|
||||||
@ -446,9 +445,9 @@ $config = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/***********************
|
||||||
| PROXY CONFIGURATION |
|
| PROXY CONFIGURATION |
|
||||||
*/
|
***********************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Proxy to use for retrieving URLs.
|
* Proxy to use for retrieving URLs.
|
||||||
@ -467,9 +466,9 @@ $config = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**************************
|
||||||
| DATABASE CONFIGURATION |
|
| DATABASE CONFIGURATION |
|
||||||
*/
|
**************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This database configuration is optional. If you are not using
|
* This database configuration is optional. If you are not using
|
||||||
@ -529,9 +528,9 @@ $config = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*************
|
||||||
| PROTOCOLS |
|
| PROTOCOLS |
|
||||||
*/
|
*************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Which functionality in SimpleSAMLphp do you want to enable. Normally you would enable only
|
* Which functionality in SimpleSAMLphp do you want to enable. Normally you would enable only
|
||||||
@ -543,9 +542,9 @@ $config = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/***********
|
||||||
| MODULES |
|
| MODULES |
|
||||||
*/
|
***********/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configuration for enabling/disabling modules. By default the 'core', 'admin' and 'saml' modules are enabled.
|
* Configuration for enabling/disabling modules. By default the 'core', 'admin' and 'saml' modules are enabled.
|
||||||
@ -563,13 +562,13 @@ $config = [
|
|||||||
'exampleauth' => false,
|
'exampleauth' => false,
|
||||||
'core' => true,
|
'core' => true,
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
'saml' => true,
|
'saml' => true
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*************************
|
||||||
| SESSION CONFIGURATION |
|
| SESSION CONFIGURATION |
|
||||||
*/
|
*************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This value is the duration of the session in seconds. Make sure that the time duration of
|
* This value is the duration of the session in seconds. Make sure that the time duration of
|
||||||
@ -693,9 +692,9 @@ $config = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**************************
|
||||||
| MEMCACHE CONFIGURATION |
|
| MEMCACHE CONFIGURATION |
|
||||||
*/
|
**************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configuration for the 'memcache' session store. This allows you to store
|
* Configuration for the 'memcache' session store. This allows you to store
|
||||||
@ -815,9 +814,9 @@ $config = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*************************************
|
||||||
| LANGUAGE AND INTERNATIONALIZATION |
|
| LANGUAGE AND INTERNATIONALIZATION |
|
||||||
*/
|
*************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Languages available, RTL languages, and what language is the default.
|
* Languages available, RTL languages, and what language is the default.
|
||||||
@ -847,7 +846,7 @@ $config = [
|
|||||||
'language.cookie.lifetime' => (60 * 60 * 24 * 900),
|
'language.cookie.lifetime' => (60 * 60 * 24 * 900),
|
||||||
'language.cookie.samesite' => $httpUtils->canSetSameSiteNone() ? 'None' : null,
|
'language.cookie.samesite' => $httpUtils->canSetSameSiteNone() ? 'None' : null,
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Custom getLanguage function called from SimpleSAML\Locale\Language::getLanguage().
|
* Custom getLanguage function called from SimpleSAML\Locale\Language::getLanguage().
|
||||||
* Function should return language code of one of the available languages or NULL.
|
* Function should return language code of one of the available languages or NULL.
|
||||||
* See SimpleSAML\Locale\Language::getLanguage() source code for more info.
|
* See SimpleSAML\Locale\Language::getLanguage() source code for more info.
|
||||||
@ -859,9 +858,9 @@ $config = [
|
|||||||
* 'language.get_language_function' => ['\SimpleSAML\Module\example\Template', 'getLanguage'],
|
* 'language.get_language_function' => ['\SimpleSAML\Module\example\Template', 'getLanguage'],
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**************
|
||||||
| APPEARANCE |
|
| APPEARANCE |
|
||||||
*/
|
**************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Which theme directory should be used?
|
* Which theme directory should be used?
|
||||||
@ -874,7 +873,7 @@ $config = [
|
|||||||
*/
|
*/
|
||||||
//'theme.header' => 'SimpleSAMLphp',
|
//'theme.header' => 'SimpleSAMLphp',
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* A template controller, if any.
|
* A template controller, if any.
|
||||||
*
|
*
|
||||||
* Used to intercept certain parts of the template handling, while keeping away unwanted/unexpected hooks. Set
|
* Used to intercept certain parts of the template handling, while keeping away unwanted/unexpected hooks. Set
|
||||||
@ -938,16 +937,16 @@ $config = [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Set to a full URL if you want to redirect users that land on SimpleSAMLphp's
|
* Set to a full URL if you want to redirect users that land on SimpleSAMLphp's
|
||||||
* front page to somewhere more useful. If left unset, a basic welcome message
|
* front page to somewhere more useful. If left unset, a basic welcome message
|
||||||
* is shown.
|
* is shown.
|
||||||
*/
|
*/
|
||||||
//'frontpage.redirect' => 'https://example.com/',
|
//'frontpage.redirect' => 'https://example.com/',
|
||||||
|
|
||||||
/*
|
/*********************
|
||||||
| DISCOVERY SERVICE |
|
| DISCOVERY SERVICE |
|
||||||
*/
|
*********************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Whether the discovery service should allow the user to save his choice of IdP.
|
* Whether the discovery service should allow the user to save his choice of IdP.
|
||||||
@ -976,9 +975,9 @@ $config = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*************************************
|
||||||
| AUTHENTICATION PROCESSING FILTERS |
|
| AUTHENTICATION PROCESSING FILTERS |
|
||||||
*/
|
*************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Authentication processing filters that will be executed for all IdPs
|
* Authentication processing filters that will be executed for all IdPs
|
||||||
@ -1060,9 +1059,9 @@ $config = [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**************************
|
||||||
| METADATA CONFIGURATION |
|
| METADATA CONFIGURATION |
|
||||||
*/
|
**************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This option allows you to specify a directory for your metadata outside of the standard metadata directory
|
* This option allows you to specify a directory for your metadata outside of the standard metadata directory
|
||||||
@ -1182,9 +1181,9 @@ $config = [
|
|||||||
'metadata.sign.algorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
|
'metadata.sign.algorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
|
||||||
|
|
||||||
|
|
||||||
/*
|
/****************************
|
||||||
| DATA STORE CONFIGURATION |
|
| DATA STORE CONFIGURATION |
|
||||||
*/
|
****************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configure the data store for SimpleSAMLphp.
|
* Configure the data store for SimpleSAMLphp.
|
||||||
@ -1288,9 +1287,9 @@ $config = [
|
|||||||
*/
|
*/
|
||||||
'store.redis.sentinels' => [],
|
'store.redis.sentinels' => [],
|
||||||
|
|
||||||
/*
|
/*********************
|
||||||
| IdP/SP PROXY MODE |
|
| IdP/SP PROXY MODE |
|
||||||
*/
|
*********************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the IdP in front of SimpleSAMLphp in IdP/SP proxy mode sends
|
* If the IdP in front of SimpleSAMLphp in IdP/SP proxy mode sends
|
||||||
|
26
dist/simplesamlphp-idp.php
vendored
26
dist/simplesamlphp-idp.php
vendored
@ -1,21 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
$metadata['https://idp.pvv.ntnu.no/'] = array (
|
||||||
declare(strict_types=1);
|
|
||||||
$metadata['https://idp.pvv.ntnu.no/'] = [
|
|
||||||
'metadata-set' => 'saml20-idp-remote',
|
'metadata-set' => 'saml20-idp-remote',
|
||||||
'entityid' => 'https://idp.pvv.ntnu.no/',
|
'entityid' => 'https://idp.pvv.ntnu.no/',
|
||||||
'SingleSignOnService' => [
|
'SingleSignOnService' =>
|
||||||
0 => [
|
array (
|
||||||
|
0 =>
|
||||||
|
array (
|
||||||
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||||
'Location' => 'https://idp.pvv.ntnu.no/simplesaml/saml2/idp/SSOService.php',
|
'Location' => 'https://idp.pvv.ntnu.no/simplesaml/saml2/idp/SSOService.php',
|
||||||
],
|
),
|
||||||
],
|
),
|
||||||
'SingleLogoutService' => [
|
'SingleLogoutService' =>
|
||||||
0 => [
|
array (
|
||||||
|
0 =>
|
||||||
|
array (
|
||||||
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||||
'Location' => 'https://idp.pvv.ntnu.no/simplesaml/saml2/idp/SingleLogoutService.php',
|
'Location' => 'https://idp.pvv.ntnu.no/simplesaml/saml2/idp/SingleLogoutService.php',
|
||||||
],
|
),
|
||||||
],
|
),
|
||||||
'certData' => 'MIIDpTCCAo2gAwIBAgIJAJIgibrB7NvsMA0GCSqGSIb3DQEBCwUAMGkxCzAJBgNVBAYTAk5PMR4wHAYDVQQKDBVQcm9ncmFtdmFyZXZlcmtzdGVkZXQxGDAWBgNVBAMMD2lkcC5wdnYubnRudS5ubzEgMB4GCSqGSIb3DQEJARYRZHJpZnRAcHZ2Lm50bnUubm8wHhcNMTcxMTEzMjI0NTQyWhcNMjcxMTEzMjI0NTQyWjBpMQswCQYDVQQGEwJOTzEeMBwGA1UECgwVUHJvZ3JhbXZhcmV2ZXJrc3RlZGV0MRgwFgYDVQQDDA9pZHAucHZ2Lm50bnUubm8xIDAeBgkqhkiG9w0BCQEWEWRyaWZ0QHB2di5udG51Lm5vMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAveLujCsgVCRA360y5yezy8FcSPhaqodggDqY12UTkYOMQLBFaph6uUL4oCUlXZqxScrAYVRt9yw+7BYpcm0p51VZzVCsfMxRVkn+O1eUvsaXq3f13f87QHKYP2f0uqkGf5PvnKIdSaI/ix8WJhD8XT+h0OkHEcaBvUtSG7zbEhvG21WPHwgw2rvZSneArQ8tOitZC0u8VXSfdhtf6ynRseo0xC95634UwQAZivhQ2v4A6Tp57QG5DCXIJ9/z3PkINx3KB/hOeh0EP6Dpbp+7V0/t9778E3whpm4llrH144kzROhA7EgUgkZOjAVjxGCYlcj3xQPnnItihVOZ5B5qLwIDAQABo1AwTjAdBgNVHQ4EFgQUPLhrB+Qb/Kzz7Car9GJkKmEkz6swHwYDVR0jBBgwFoAUPLhrB+Qb/Kzz7Car9GJkKmEkz6swDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAd+4E6t0j8/p8rbZE8y/gZ9GsiRhxkR4l6JbMRUfEpqHKi415qstChRcP2Lo3Yd5qdmj9tLDWoPsqet1QgyTTmQTgUmPhhMOQDqSh90LuqEJseKWafXGS/SfWLH6MWVmzDV5YofJEw2ThPiU58GiS06OLS2poq1eAesa2LQ22J8yYisXM4sxImIFte+LYQ1+1evfBWcvU1vrGsQ0VLJHdef9WoXp1swUFhq4Zk0c7gjHiB1CFVlExAAlk9L6W3CVXmKIYlf4eUnEBGkC061Ir42+uhAMWO9Y/L1NEuboTyd2KAI/6JdKdzpmfk7zPVxWlNxNCZ7OPNuvOKp6VlpB2EA==',
|
'certData' => 'MIIDpTCCAo2gAwIBAgIJAJIgibrB7NvsMA0GCSqGSIb3DQEBCwUAMGkxCzAJBgNVBAYTAk5PMR4wHAYDVQQKDBVQcm9ncmFtdmFyZXZlcmtzdGVkZXQxGDAWBgNVBAMMD2lkcC5wdnYubnRudS5ubzEgMB4GCSqGSIb3DQEJARYRZHJpZnRAcHZ2Lm50bnUubm8wHhcNMTcxMTEzMjI0NTQyWhcNMjcxMTEzMjI0NTQyWjBpMQswCQYDVQQGEwJOTzEeMBwGA1UECgwVUHJvZ3JhbXZhcmV2ZXJrc3RlZGV0MRgwFgYDVQQDDA9pZHAucHZ2Lm50bnUubm8xIDAeBgkqhkiG9w0BCQEWEWRyaWZ0QHB2di5udG51Lm5vMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAveLujCsgVCRA360y5yezy8FcSPhaqodggDqY12UTkYOMQLBFaph6uUL4oCUlXZqxScrAYVRt9yw+7BYpcm0p51VZzVCsfMxRVkn+O1eUvsaXq3f13f87QHKYP2f0uqkGf5PvnKIdSaI/ix8WJhD8XT+h0OkHEcaBvUtSG7zbEhvG21WPHwgw2rvZSneArQ8tOitZC0u8VXSfdhtf6ynRseo0xC95634UwQAZivhQ2v4A6Tp57QG5DCXIJ9/z3PkINx3KB/hOeh0EP6Dpbp+7V0/t9778E3whpm4llrH144kzROhA7EgUgkZOjAVjxGCYlcj3xQPnnItihVOZ5B5qLwIDAQABo1AwTjAdBgNVHQ4EFgQUPLhrB+Qb/Kzz7Car9GJkKmEkz6swHwYDVR0jBBgwFoAUPLhrB+Qb/Kzz7Car9GJkKmEkz6swDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAd+4E6t0j8/p8rbZE8y/gZ9GsiRhxkR4l6JbMRUfEpqHKi415qstChRcP2Lo3Yd5qdmj9tLDWoPsqet1QgyTTmQTgUmPhhMOQDqSh90LuqEJseKWafXGS/SfWLH6MWVmzDV5YofJEw2ThPiU58GiS06OLS2poq1eAesa2LQ22J8yYisXM4sxImIFte+LYQ1+1evfBWcvU1vrGsQ0VLJHdef9WoXp1swUFhq4Zk0c7gjHiB1CFVlExAAlk9L6W3CVXmKIYlf4eUnEBGkC061Ir42+uhAMWO9Y/L1NEuboTyd2KAI/6JdKdzpmfk7zPVxWlNxNCZ7OPNuvOKp6VlpB2EA==',
|
||||||
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
|
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
|
||||||
];
|
);
|
||||||
|
6
flake.lock
generated
6
flake.lock
generated
@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1741678040,
|
"lastModified": 1707939175,
|
||||||
"narHash": "sha256-rmBsz7BBcDwfvDkxnKHmolKceGJrr0nyz5PQYZg0kMk=",
|
"narHash": "sha256-D1xan0lgxbmXDyzVqXTiSYHLmAMrMRdD+alKzEO/p3w=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "3ee8818da146871cd570b164fc4f438f78479a50",
|
"rev": "f7e8132daca31b1e3859ac0fb49741754375ac3d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
in {
|
in {
|
||||||
packages = forAllSystems (system: pkgs: {
|
packages = forAllSystems (system: pkgs: {
|
||||||
default = self.packages.${system}.pvv-nettsiden;
|
default = self.packages.${system}.pvv-nettsiden;
|
||||||
pvv-nettsiden = pkgs.callPackage ./nix/package.nix { php = pkgs.php84; };
|
pvv-nettsiden = pkgs.callPackage ./nix/package.nix { php = pkgs.php82; };
|
||||||
});
|
});
|
||||||
|
|
||||||
overlays.default = final: prev: {
|
overlays.default = final: prev: {
|
||||||
@ -33,5 +33,9 @@
|
|||||||
devShells = forAllSystems (system: pkgs: {
|
devShells = forAllSystems (system: pkgs: {
|
||||||
default = pkgs.callPackage ./nix/shell.nix { inherit pkgs; };
|
default = pkgs.callPackage ./nix/shell.nix { inherit pkgs; };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# - Relicense the project to GPL or something
|
||||||
|
# - Write a module for the project
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
require __DIR__ . '/../src/_autoload.php';
|
require __DIR__ . '/../src/_autoload.php';
|
||||||
require __DIR__ . '/../config.php';
|
require __DIR__ . '/../config.php';
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$agenda = new pvv\side\Agenda([
|
$agenda = new \pvv\side\Agenda([
|
||||||
new pvv\side\social\NerdepitsaActivity(),
|
new \pvv\side\social\NerdepitsaActivity,
|
||||||
new pvv\side\social\AnimekveldActivity(),
|
new \pvv\side\social\AnimekveldActivity,
|
||||||
new pvv\side\DBActivity($pdo),
|
new \pvv\side\DBActivity($pdo),
|
||||||
]);
|
]);
|
||||||
|
@ -1,36 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
// Set up database and user system,
|
// Set up database and user system,
|
||||||
// and include common files such as HTML includes or SimplSAMLphp.
|
// and include common files such as HTML includes or SimplSAMLphp.
|
||||||
|
|
||||||
require_once __DIR__ . \DIRECTORY_SEPARATOR . 'agenda.php';
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'agenda.php';
|
||||||
require_once __DIR__ . \DIRECTORY_SEPARATOR . 'navbar.php';
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'navbar.php';
|
||||||
|
|
||||||
require_once dirname(__DIR__) . implode(\DIRECTORY_SEPARATOR, ['', 'config.php']);
|
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'config.php']);
|
||||||
|
|
||||||
require_once dirname(__DIR__) . implode(\DIRECTORY_SEPARATOR, ['', 'src', '_autoload.php']);
|
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'src', '_autoload.php']);
|
||||||
require_once dirname(__DIR__) . implode(\DIRECTORY_SEPARATOR, ['', 'vendor', 'simplesamlphp', 'simplesamlphp', 'lib', '_autoload.php']);
|
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'vendor', 'simplesamlphp', 'simplesamlphp', 'lib', '_autoload.php']);
|
||||||
|
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
$sp = 'default-sp';
|
$sp = 'default-sp';
|
||||||
$as = new SimpleSAML\Auth\Simple($sp);
|
$as = new \SimpleSAML\Auth\Simple($sp);
|
||||||
|
|
||||||
use pvv\side\Agenda;
|
use \pvv\side\Agenda;
|
||||||
|
$agenda = new \pvv\side\Agenda([
|
||||||
$agenda = new Agenda([
|
|
||||||
// new \pvv\side\social\NerdepitsaActivity,
|
// new \pvv\side\social\NerdepitsaActivity,
|
||||||
// new \pvv\side\social\AnimekveldActivity,
|
// new \pvv\side\social\AnimekveldActivity,
|
||||||
new pvv\side\social\HackekveldActivity(),
|
new \pvv\side\social\HackekveldActivity,
|
||||||
new pvv\side\social\BrettspillActivity(),
|
new \pvv\side\social\BrettspillActivity,
|
||||||
new pvv\side\social\DriftkveldActivity(),
|
new \pvv\side\social\DriftkveldActivity,
|
||||||
new pvv\side\DBActivity($pdo),
|
new \pvv\side\DBActivity($pdo),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$months_translations = ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'];
|
$months_translations = ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember'];
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
function navbar($depth, $active = NULL) {
|
||||||
declare(strict_types=1);
|
|
||||||
function navbar($depth, $active = null) {
|
|
||||||
$result = "\n\t<ul id=\"menu\">\n";
|
$result = "\n\t<ul id=\"menu\">\n";
|
||||||
$menuItems = [
|
$menuItems = [
|
||||||
'Hjem' => '',
|
'Hjem' => '',
|
||||||
@ -18,7 +16,7 @@ function navbar($depth, $active = null) {
|
|||||||
];
|
];
|
||||||
foreach($menuItems as $caption => $link) {
|
foreach($menuItems as $caption => $link) {
|
||||||
$isActive = $active === $link;
|
$isActive = $active === $link;
|
||||||
if (substr($link, 0, 4) !== 'http') {
|
if (substr( $link, 0, 4 ) != "http") {
|
||||||
$link = rtrim(str_repeat('../', $depth) . $link, '/') . '/';
|
$link = rtrim(str_repeat('../', $depth) . $link, '/') . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,19 +25,17 @@ function navbar($depth, $active = null) {
|
|||||||
$result .= "\t\t<li" . ($isActive ? ' class="active"' : '') . '>'
|
$result .= "\t\t<li" . ($isActive ? ' class="active"' : '') . '>'
|
||||||
. '<a href="' . $link . '">'
|
. '<a href="' . $link . '">'
|
||||||
. $caption
|
. $caption
|
||||||
. "</a></li>\n";
|
. "</a></li>\n"
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result . "\t</ul>\n";
|
return $result . "\t</ul>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function loginBar($sp = null, $pdo = null) {
|
function loginBar($sp = null, $pdo = null) {
|
||||||
if (null === $sp) {
|
if (is_null($sp)) $sp = 'default-sp';
|
||||||
$sp = 'default-sp';
|
|
||||||
}
|
|
||||||
$result = "\n";
|
$result = "\n";
|
||||||
require_once __DIR__ . '/../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple($sp);
|
$as = new \SimpleSAML\Auth\Simple($sp);
|
||||||
|
|
||||||
$svg = '<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 64 64">
|
$svg = '<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 64 64">
|
||||||
<circle cx="32" cy="27" r="14" stroke-width="0" />
|
<circle cx="32" cy="27" r="14" stroke-width="0" />
|
||||||
@ -52,7 +48,7 @@ function loginBar($sp = null, $pdo = null) {
|
|||||||
$uname = $attr['uid'][0];
|
$uname = $attr['uid'][0];
|
||||||
$isAdmin = false;
|
$isAdmin = false;
|
||||||
if (isset($pdo)) {
|
if (isset($pdo)) {
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
$isAdmin = $userManager->isAdmin($uname);
|
$isAdmin = $userManager->isAdmin($uname);
|
||||||
}
|
}
|
||||||
$result .= "\t<a id=\"login\" href=\"#usermenu\" aria-hidden=\"true\">{$svg}" . htmlspecialchars($uname) . "</a>\n";
|
$result .= "\t<a id=\"login\" href=\"#usermenu\" aria-hidden=\"true\">{$svg}" . htmlspecialchars($uname) . "</a>\n";
|
||||||
|
@ -7,7 +7,7 @@ php.buildComposerProject rec {
|
|||||||
src = ./..;
|
src = ./..;
|
||||||
pname = "pvv-nettsiden";
|
pname = "pvv-nettsiden";
|
||||||
version = "0.0.1";
|
version = "0.0.1";
|
||||||
vendorHash = "sha256-8UYf7FhrTKgCa2e8GwhU8EF1AfWzZtgseTZqUAGOL0U=";
|
vendorHash = "sha256-sWC5E60toa95re2NugvHVPT+vKYXc1I6Z3rSqXxTUu0=";
|
||||||
|
|
||||||
passthru.simplesamlphpPath = "share/php/pvv-nettsiden/vendor/simplesamlphp/simplesamlphp";
|
passthru.simplesamlphpPath = "share/php/pvv-nettsiden/vendor/simplesamlphp/simplesamlphp";
|
||||||
|
|
||||||
|
@ -1,31 +1,26 @@
|
|||||||
{ pkgs, lib }:
|
{ pkgs }:
|
||||||
let
|
let
|
||||||
phpEnv = pkgs.php84.buildEnv {
|
phpEnv = pkgs.php82.buildEnv {
|
||||||
extensions = { enabled, all }: enabled ++ (with all; [ iconv mbstring pdo_mysql pdo_sqlite ]);
|
extensions = { enabled, all }: enabled ++ (with all; [ iconv mbstring pdo_mysql pdo_sqlite ]);
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
pkgs.mkShellNoCC {
|
pkgs.mkShellNoCC {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
phpEnv
|
phpEnv
|
||||||
php84Packages.composer
|
php82Packages.composer
|
||||||
php84Packages.php-parallel-lint
|
|
||||||
php84Packages.php-cs-fixer
|
|
||||||
sqlite-interactive
|
|
||||||
sql-formatter
|
|
||||||
];
|
|
||||||
|
|
||||||
# Prepare dev environment with sqlite and config files
|
sqlite
|
||||||
|
git
|
||||||
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
alias runDev='php -S localhost:1080 -d error_reporting=E_ALL -d display_errors=1 -t www/'
|
alias runDev='php -S localhost:1080 -d error_reporting=E_ALL -d display_errors=1 -t www/'
|
||||||
|
|
||||||
declare -a PROJECT_ROOT="$("${lib.getExe pkgs.git}" rev-parse --show-toplevel)"
|
# Prepare dev environment with sqlite and config files
|
||||||
|
test -e pvv.sqlite || sqlite3 pvv.sqlite < dist/pvv.sql
|
||||||
|
test -e config.php || cp -v dist/config.local.php config.php
|
||||||
|
|
||||||
mkdir -p "$PROJECT_ROOT/www/galleri/bilder/slideshow"
|
|
||||||
test -e "$PROJECT_ROOT/pvv.sqlite" || sqlite3 "$PROJECT_ROOT/pvv.sqlite" < "$PROJECT_ROOT/dist/pvv_sqlite.sql"
|
|
||||||
test -e "$PROJECT_ROOT/config.php" || cp -v "$PROJECT_ROOT/dist/config.local.php" "$PROJECT_ROOT/config.php"
|
|
||||||
|
|
||||||
if [ ! -d "$PROJECT_ROOT/vendor" ] ; then
|
if [ ! -d vendor ] ; then
|
||||||
pushd "$PROJECT_ROOT"
|
|
||||||
composer install || exit $?
|
composer install || exit $?
|
||||||
|
|
||||||
cp dist/simplesamlphp-authsources.php vendor/simplesamlphp/simplesamlphp/config/authsources.php
|
cp dist/simplesamlphp-authsources.php vendor/simplesamlphp/simplesamlphp/config/authsources.php
|
||||||
@ -34,8 +29,7 @@ pkgs.mkShellNoCC {
|
|||||||
|
|
||||||
cp dist/config.local.php config.php
|
cp dist/config.local.php config.php
|
||||||
|
|
||||||
ln -s ../vendor/simplesamlphp/simplesamlphp/public/ www/simplesaml
|
ln -s ../vendor/simplesamlphp/simplesamlphp/www/ www/simplesaml
|
||||||
popd "$PROJECT_ROOT"
|
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2015, Jørn Åne de Jong <@jornane>
|
* Copyright (c) 2014-2015, Jørn Åne de Jong <@jornane>
|
||||||
*
|
*
|
||||||
@ -16,7 +14,7 @@ declare(strict_types=1);
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
/*
|
/**
|
||||||
* Register SPL autoloading for classes and interfaces. Put this file in your
|
* Register SPL autoloading for classes and interfaces. Put this file in your
|
||||||
* namespace root and make sure it gets included from your PHP entry-point.
|
* namespace root and make sure it gets included from your PHP entry-point.
|
||||||
*
|
*
|
||||||
@ -38,4 +36,4 @@ declare(strict_types=1);
|
|||||||
*/
|
*/
|
||||||
spl_autoload_extensions( '.php' );
|
spl_autoload_extensions( '.php' );
|
||||||
spl_autoload_register( 'spl_autoload' );
|
spl_autoload_register( 'spl_autoload' );
|
||||||
set_include_path(realpath(__DIR__) . \PATH_SEPARATOR . get_include_path());
|
set_include_path( realpath( __DIR__ ) . PATH_SEPARATOR . get_include_path() );
|
||||||
|
@ -1,38 +1,37 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\admin;
|
namespace pvv\admin;
|
||||||
|
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
class UserManager{
|
class UserManager{
|
||||||
private $pdo;
|
private $pdo;
|
||||||
|
|
||||||
public $usergroups = [
|
public $usergroups = [
|
||||||
'admin' => 1,
|
'admin' => 1,
|
||||||
'prosjekt' => 2,
|
'prosjekt' => 2,
|
||||||
'aktiviteter' => 4,
|
'aktiviteter' => 4
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct($pdo){
|
public function __construct($pdo){
|
||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setupUser($uname, $groups = 0): void {
|
public function setupUser($uname, $groups=0){
|
||||||
$query = 'INSERT INTO users (uname, groups) VALUES (:uname, :groups)';
|
$query = 'INSERT INTO users (uname, groups) VALUES (:uname, :groups)';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':uname', $uname, \PDO::PARAM_STR);
|
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
|
||||||
$statement->bindParam(':groups', $groups, \PDO::PARAM_INT);
|
$statement->bindParam(':groups', $groups, PDO::PARAM_INT);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateFlags($uname, $flags): void {
|
public function updateFlags($uname, $flags){
|
||||||
$query = 'UPDATE users set groups=:groups WHERE uname=:uname';
|
$query = 'UPDATE users set groups=:groups WHERE uname=:uname';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':groups', $flags, \PDO::PARAM_INT);
|
$statement->bindParam(':groups', $flags, PDO::PARAM_INT);
|
||||||
$statement->bindParam(':uname', $uname, \PDO::PARAM_STR);
|
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addGroup($uname, $group): void {
|
public function addGroup($uname, $group){
|
||||||
$userFlags = $this->getUsergroups($uname);
|
$userFlags = $this->getUsergroups($uname);
|
||||||
|
|
||||||
if($userFlags){
|
if($userFlags){
|
||||||
@ -41,7 +40,7 @@ class UserManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeGroup($uname, $group): void {
|
public function removeGroup($uname, $group){
|
||||||
$userFlags = $this->getUsergroups($uname);
|
$userFlags = $this->getUsergroups($uname);
|
||||||
|
|
||||||
if($userFlags){
|
if($userFlags){
|
||||||
@ -50,18 +49,18 @@ class UserManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setGroups($uname, $groups): void {
|
public function setGroups($uname, $groups){
|
||||||
$query = 'SELECT * FROM users WHERE uname=:uname LIMIT 1';
|
$query = 'SELECT * FROM users WHERE uname=:uname LIMIT 1';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':uname', $uname, \PDO::PARAM_STR);
|
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
$row = $statement->fetch();
|
$row = $statement->fetch();
|
||||||
|
|
||||||
if($row){
|
if($row){
|
||||||
$query = 'UPDATE users set groups=:groups WHERE uname=:uname';
|
$query = 'UPDATE users set groups=:groups WHERE uname=:uname';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':groups', $groups, \PDO::PARAM_INT);
|
$statement->bindParam(':groups', $groups, PDO::PARAM_INT);
|
||||||
$statement->bindParam(':uname', $uname, \PDO::PARAM_STR);
|
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
}else{
|
}else{
|
||||||
$this->setupUser($uname, $groups);
|
$this->setupUser($uname, $groups);
|
||||||
@ -71,7 +70,7 @@ class UserManager {
|
|||||||
public function hasGroup($uname, $groupName){
|
public function hasGroup($uname, $groupName){
|
||||||
$userFlags = $this->getUsergroups($uname);
|
$userFlags = $this->getUsergroups($uname);
|
||||||
|
|
||||||
return $userFlags & $this->usergroups[$groupName];
|
return ($userFlags & $this->usergroups[$groupName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for convenience
|
// for convenience
|
||||||
@ -83,7 +82,7 @@ class UserManager {
|
|||||||
$resultFlag = 0;
|
$resultFlag = 0;
|
||||||
|
|
||||||
foreach($this->usergroups as $name => $flag){
|
foreach($this->usergroups as $name => $flag){
|
||||||
if (\in_array($name, $names, true)) {
|
if(in_array($name, $names)){
|
||||||
$resultFlag = ($resultFlag | $flag);
|
$resultFlag = ($resultFlag | $flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,14 +93,11 @@ class UserManager {
|
|||||||
public function getUsergroups($uname){
|
public function getUsergroups($uname){
|
||||||
$query = 'SELECT groups FROM users WHERE uname=:uname LIMIT 1';
|
$query = 'SELECT groups FROM users WHERE uname=:uname LIMIT 1';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':uname', $uname, \PDO::PARAM_STR);
|
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$row = $statement->fetch();
|
$row = $statement->fetch();
|
||||||
if ($row === false) {
|
if ($row == false) return 0;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $row[0];
|
return $row[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +125,7 @@ class UserManager {
|
|||||||
$uname = $userData['uname'];
|
$uname = $userData['uname'];
|
||||||
$users[] = [
|
$users[] = [
|
||||||
'name' => $uname,
|
'name' => $uname,
|
||||||
'groups' => $this->getUsergroupNames($uname),
|
'groups' => $this->getUsergroupNames($uname)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
interface Activity {
|
use \DateTimeImmutable;
|
||||||
public function getNextEventFrom(\DateTimeImmutable $date) /* : Event */;
|
|
||||||
|
interface Activity {
|
||||||
|
|
||||||
|
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */;
|
||||||
|
|
||||||
|
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */;
|
||||||
|
|
||||||
public function getPreviousEventFrom(\DateTimeImmutable $date) /* : Event */;
|
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,33 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
class Agenda {
|
use \DateTimeImmutable;
|
||||||
private $activities;
|
use \DateInterval;
|
||||||
|
|
||||||
public const TODAY = 0;
|
class Agenda {
|
||||||
public const TOMORROW = 1;
|
|
||||||
public const THIS_WEEK = 2;
|
const TODAY = 0;
|
||||||
public const NEXT_WEEK = 3;
|
const TOMORROW = 1;
|
||||||
public const THIS_MONTH = 4;
|
const THIS_WEEK = 2;
|
||||||
public const NEXT_MONTH = 5;
|
const NEXT_WEEK = 3;
|
||||||
|
const THIS_MONTH = 4;
|
||||||
|
const NEXT_MONTH = 5;
|
||||||
|
|
||||||
public function __construct($activities) {
|
public function __construct($activities) {
|
||||||
$this->activities = $activities;
|
$this->activities = $activities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFormattedDate($date) {
|
public static function getFormattedDate($date) {
|
||||||
return $date->format('l j. M H.i');
|
return trim(strftime('%A %e. %b %H.%M', $date->getTimeStamp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEventsBetween(\DateTimeImmutable $from, \DateTimeImmutable $to) {
|
public function getEventsBetween(DateTimeImmutable $from, DateTimeImmutable $to) {
|
||||||
$results = [];
|
$results = [];
|
||||||
for ($i = 0; $i < \count($this->activities); ++$i) {
|
for($i = 0; $i < sizeof($this->activities); $i++) {
|
||||||
$result = [];
|
$result = [];
|
||||||
do {
|
do {
|
||||||
$run = false;
|
$run = false;
|
||||||
if (\count($result)) {
|
if (sizeof($result)) {
|
||||||
$date = end($result)->getStop();
|
$date = end($result)->getStop();
|
||||||
} else {
|
} else {
|
||||||
$date = $from;
|
$date = $from;
|
||||||
@ -42,73 +41,66 @@ class Agenda {
|
|||||||
$results[] = $result;
|
$results[] = $result;
|
||||||
}
|
}
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($results as $a) {
|
foreach($results as $a) foreach($a as $b) $result[] = $b;
|
||||||
foreach ($a as $b) {
|
usort($result, function($a, $b) {
|
||||||
$result[] = $b;
|
return ($a->getStart() < $b->getStart()) ? -1 : 1;
|
||||||
}
|
});
|
||||||
}
|
|
||||||
usort($result, static fn($a, $b) => ($a->getStart() < $b->getStart()) ? -1 : 1);
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextDays() {
|
public function getNextDays() {
|
||||||
$result = [[], [], [], [], [], []];
|
$result = [[], [], [], [], [], []];
|
||||||
$events = $this->getEventsBetween(
|
$events = $this->getEventsBetween(
|
||||||
(new \DateTimeImmutable())->setTime(0, 0),
|
(new DateTimeImmutable)->setTime(0, 0),
|
||||||
(new \DateTimeImmutable())->setTime(23, 59)->add(new \DateInterval('P1M'))
|
(new DateTimeImmutable)->setTime(23, 59)->add(new DateInterval('P1M'))
|
||||||
);
|
);
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
$index = self::NEXT_MONTH;
|
$index = self::NEXT_MONTH;
|
||||||
if (self::isToday($event->getStart())) {
|
if (self::isToday($event->getStart())) $index = self::TODAY;
|
||||||
$index = self::TODAY;
|
elseif (self::isTomorrow($event->getStart())) $index = self::TOMORROW;
|
||||||
} elseif (self::isTomorrow($event->getStart())) {
|
elseif (self::isThisWeek($event->getStart())) $index = self::THIS_WEEK;
|
||||||
$index = self::TOMORROW;
|
elseif (self::isNextWeek($event->getStart())) $index = self::NEXT_WEEK;
|
||||||
} elseif (self::isThisWeek($event->getStart())) {
|
elseif (self::isThisMonth($event->getStart())) $index = self::THIS_MONTH;
|
||||||
$index = self::THIS_WEEK;
|
|
||||||
} elseif (self::isNextWeek($event->getStart())) {
|
|
||||||
$index = self::NEXT_WEEK;
|
|
||||||
} elseif (self::isThisMonth($event->getStart())) {
|
|
||||||
$index = self::THIS_MONTH;
|
|
||||||
}
|
|
||||||
$result[$index][] = $event;
|
$result[$index][] = $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextOfEach(\DateTimeImmutable $startDate) {
|
public function getNextOfEach(DateTimeImmutable $startDate) {
|
||||||
$result = array_filter(array_map(
|
$result = array_filter(array_map(
|
||||||
static fn($a) => $a->getNextEventFrom($startDate),
|
function($a) use ($startDate){
|
||||||
$this->activities
|
return $a->getNextEventFrom($startDate);
|
||||||
), static fn($a) => isset($a));
|
}, $this->activities
|
||||||
usort(
|
), function($a){
|
||||||
$result,
|
return isset($a);
|
||||||
static fn($a, $b) => ($a->getStart()->getTimeStamp() < $b->getStart()->getTimeStamp())
|
});
|
||||||
|
usort($result, function($a, $b) {
|
||||||
|
return ($a->getStart()->getTimeStamp() < $b->getStart()->getTimeStamp())
|
||||||
? -1
|
? -1
|
||||||
: 1
|
: 1
|
||||||
);
|
;
|
||||||
|
});
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isToday(\DateTimeImmutable $date) {
|
public static function isToday(DateTimeImmutable $date) {
|
||||||
return $date->format('dmY') == date('dmY');
|
return $date->format('dmY') == date('dmY');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isTomorrow(\DateTimeImmutable $date) {
|
public static function isTomorrow(DateTimeImmutable $date) {
|
||||||
return $date->sub(new \DateInterval('P1D'))->format('dmY') == date('dmY');
|
return $date->sub(new DateInterval('P1D'))->format('dmY') == date('dmY');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isThisWeek(\DateTimeImmutable $date) {
|
public static function isThisWeek(DateTimeImmutable $date) {
|
||||||
return $date->format('WY') == date('WY');
|
return $date->format('WY') == date('WY');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isNextWeek(\DateTimeImmutable $date) {
|
public static function isNextWeek(DateTimeImmutable $date) {
|
||||||
return $date->sub(new \DateInterval('P7D'))->format('WY') == date('WY');
|
return $date->sub(new DateInterval('P7D'))->format('WY') == date('WY');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isThisMonth(\DateTimeImmutable $date) {
|
public static function isThisMonth(DateTimeImmutable $date) {
|
||||||
return $date->format('mY') == date('mY');
|
return $date->format('mY') == date('mY');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
class DBActivity implements Activity {
|
use \DateTimeImmutable;
|
||||||
private $pdo;
|
use \PDO;
|
||||||
|
|
||||||
public function __construct(\PDO $pdo) {
|
class DBActivity implements Activity {
|
||||||
|
|
||||||
|
public function __construct(PDO $pdo) {
|
||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,8 +20,8 @@ class DBActivity implements Activity {
|
|||||||
$event = new SimpleEvent(
|
$event = new SimpleEvent(
|
||||||
$dbEvent['id'],
|
$dbEvent['id'],
|
||||||
$dbEvent['name'],
|
$dbEvent['name'],
|
||||||
\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $dbEvent['start']),
|
DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $dbEvent['start']),
|
||||||
\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $dbEvent['stop']),
|
DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $dbEvent['stop']),
|
||||||
$dbEvent['organiser'],
|
$dbEvent['organiser'],
|
||||||
$dbEvent['location'],
|
$dbEvent['location'],
|
||||||
$dbEvent['description']
|
$dbEvent['description']
|
||||||
@ -36,48 +35,50 @@ class DBActivity implements Activity {
|
|||||||
public function getEventByID($id) {
|
public function getEventByID($id) {
|
||||||
$query = 'SELECT * FROM events WHERE id=:id LIMIT 1';
|
$query = 'SELECT * FROM events WHERE id=:id LIMIT 1';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':id', $id, \PDO::PARAM_INT);
|
$statement->bindParam(':id', $id, PDO::PARAM_INT);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$dbEvent = $statement->fetch();
|
$dbEvent = $statement->fetch();
|
||||||
|
$event = new SimpleEvent(
|
||||||
return new SimpleEvent(
|
|
||||||
$dbEvent['id'],
|
$dbEvent['id'],
|
||||||
$dbEvent['name'],
|
$dbEvent['name'],
|
||||||
\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $dbEvent['start']),
|
DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $dbEvent['start']),
|
||||||
\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $dbEvent['stop']),
|
DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $dbEvent['stop']),
|
||||||
$dbEvent['organiser'],
|
$dbEvent['organiser'],
|
||||||
$dbEvent['location'],
|
$dbEvent['location'],
|
||||||
$dbEvent['description']
|
$dbEvent['description']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextEventFrom(\DateTimeImmutable $date) {
|
|
||||||
$query = 'SELECT id,name,start,stop,organiser,location,description FROM events WHERE start > :date ORDER BY start ASC LIMIT 1';
|
|
||||||
|
|
||||||
|
public function getNextEventFrom(DateTimeImmutable $date) {
|
||||||
|
$query = 'SELECT id,name,start,stop,organiser,location,description FROM events WHERE start > :date ORDER BY start ASC LIMIT 1';
|
||||||
return $this->retrieve($date, $query);
|
return $this->retrieve($date, $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(\DateTimeImmutable $date) {
|
public function getPreviousEventFrom(DateTimeImmutable $date) {
|
||||||
$query = 'SELECT id,name,start,stop,organiser,location,description FROM events WHERE start < :date ORDER BY start DESC LIMIT 1';
|
$query = 'SELECT id,name,start,stop,organiser,location,description FROM events WHERE start < :date ORDER BY start DESC LIMIT 1';
|
||||||
|
|
||||||
return $this->retrieve($date, $query);
|
return $this->retrieve($date, $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function retrieve($date, $query) {
|
private function retrieve($date, $query) {
|
||||||
$stmt = $this->pdo->prepare($query);
|
$stmt = $this->pdo->prepare($query);
|
||||||
$stmt->execute(['date' => $date->format('Y-m-d H:i:s')]);
|
$stmt->execute(['date' => $date->format('Y-m-d H:i:s')]);
|
||||||
if ($result = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
if ($result = $stmt->fetch(PDO::FETCH_ASSOC)){
|
||||||
return new SimpleEvent(
|
$ev = new SimpleEvent(
|
||||||
$result['id'],
|
$result['id'],
|
||||||
$result['name'],
|
$result['name'],
|
||||||
\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $result['start']),
|
DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $result['start']),
|
||||||
\DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $result['stop']),
|
DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $result['stop']),
|
||||||
$result['organiser'],
|
$result['organiser'],
|
||||||
$result['location'],
|
$result['location'],
|
||||||
$result['description']
|
$result['description']
|
||||||
);
|
);
|
||||||
|
return $ev;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
class Door{
|
class Door{
|
||||||
private $pdo;
|
private $pdo;
|
||||||
|
|
||||||
public function __construct(\PDO $pdo) {
|
public function __construct(PDO $pdo){
|
||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ class Door {
|
|||||||
foreach($statement->fetchAll() as $row){
|
foreach($statement->fetchAll() as $row){
|
||||||
$doorEvents[] = [
|
$doorEvents[] = [
|
||||||
'time' => (int)$row['time'],
|
'time' => (int)$row['time'],
|
||||||
'open' => (bool) $row['open'],
|
'open' => (bool)$row['open']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,14 +29,14 @@ class Door {
|
|||||||
public function getEntriesAfter($startTime) {
|
public function getEntriesAfter($startTime) {
|
||||||
$query = 'SELECT time, open FROM door WHERE time > :startTime ORDER BY time DESC';
|
$query = 'SELECT time, open FROM door WHERE time > :startTime ORDER BY time DESC';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':startTime', $startTime, \PDO::PARAM_STR);
|
$statement->bindParam(':startTime', $startTime, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$doorEvents = [];
|
$doorEvents = [];
|
||||||
foreach($statement->fetchAll() as $row){
|
foreach($statement->fetchAll() as $row){
|
||||||
$doorEvents[] = [
|
$doorEvents[] = [
|
||||||
'time' => (int)$row['time'],
|
'time' => (int)$row['time'],
|
||||||
'open' => (bool) $row['open'],
|
'open' => (bool)$row['open']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,26 +48,25 @@ class Door {
|
|||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
$row = $statement->fetch();
|
$row = $statement->fetch();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'time' => (int)$row['time'],
|
'time' => (int)$row['time'],
|
||||||
'open' => (bool) $row['open'],
|
'open' => (bool)$row['open']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function removeOld(): void {
|
private function removeOld() {
|
||||||
$firstValidTime = time() - 60*60*24*7; //One week before now
|
$firstValidTime = time() - 60*60*24*7; //One week before now
|
||||||
$query = 'DELETE FROM door WHERE time < :firstValid';
|
$query = 'DELETE FROM door WHERE time < :firstValid';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':firstValid', $firstValidTime, \PDO::PARAM_STR);
|
$statement->bindParam(':firstValid', $firstValidTime, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createEvent($time, $open): void {
|
public function createEvent($time, $open) {
|
||||||
$query = 'INSERT INTO door(time, open) VALUES (:time, :open)';
|
$query = 'INSERT INTO door(time, open) VALUES (:time, :open)';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':time', $time, \PDO::PARAM_STR);
|
$statement->bindParam(':time', $time, PDO::PARAM_STR);
|
||||||
$statement->bindParam(':open', $open, \PDO::PARAM_STR);
|
$statement->bindParam(':open', $open, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$this->removeOld();
|
$this->removeOld();
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
use DateTimeImmutable;
|
use \DateTimeImmutable;
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
abstract class Event {
|
abstract class Event {
|
||||||
|
|
||||||
private $start;
|
private $start;
|
||||||
|
|
||||||
public function __construct(\DateTimeImmutable $start) {
|
public function __construct(DateTimeImmutable $start) {
|
||||||
$this->start = $start;
|
$this->start = $start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,8 +23,8 @@ abstract class Event {
|
|||||||
if (Agenda::isTomorrow($this->getStart())) {
|
if (Agenda::isTomorrow($this->getStart())) {
|
||||||
return 'i morgen';
|
return 'i morgen';
|
||||||
}
|
}
|
||||||
if (Agenda::isThisWeek($this->getStart()) || $this->getStart()->sub(new \DateInterval('P4D'))->getTimestamp() < time()) {
|
if (Agenda::isThisWeek($this->getStart()) || $this->getStart()->sub(new DateInterval('P4D'))->getTimestamp() < time()) {
|
||||||
return $this->getStart()->format('l');
|
return strftime('%A', $this->getStart()->getTimestamp());
|
||||||
}
|
}
|
||||||
if (Agenda::isNextWeek($this->getStart())) {
|
if (Agenda::isNextWeek($this->getStart())) {
|
||||||
return 'neste uke';
|
return 'neste uke';
|
||||||
@ -33,23 +32,22 @@ abstract class Event {
|
|||||||
if (Agenda::isThisMonth($this->getStart())) {
|
if (Agenda::isThisMonth($this->getStart())) {
|
||||||
return 'denne måneden';
|
return 'denne måneden';
|
||||||
}
|
}
|
||||||
|
return trim(strftime('%e. %B', $this->getStart()->getTimestamp()));
|
||||||
return $this->getStart()->format('j. F');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract public function getStop(); /* : DateTimeImmutable */
|
public abstract function getStop(); /* : DateTimeImmutable */
|
||||||
|
|
||||||
abstract public function getName();
|
public abstract function getName();
|
||||||
|
|
||||||
abstract public function getLocation();
|
public abstract function getLocation();
|
||||||
|
|
||||||
abstract public function getOrganiser();
|
public abstract function getOrganiser();
|
||||||
|
|
||||||
abstract public function getURL(); /* : string */
|
public abstract function getURL(); /* : string */
|
||||||
|
|
||||||
abstract public function getImageURL(); /* : string */
|
public abstract function getImageURL(); /* : string */
|
||||||
|
|
||||||
abstract public function getDescription(); /* : string */
|
public abstract function getDescription(); /* : string */
|
||||||
|
|
||||||
abstract public function getColor(); /* : string */
|
public abstract function getColor(); /* : string */
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
class MOTD{
|
class MOTD{
|
||||||
private $pdo;
|
private $pdo;
|
||||||
|
|
||||||
@ -11,15 +10,15 @@ class MOTD {
|
|||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMOTD($title, $content): void {
|
public function setMOTD($title, $content) {
|
||||||
if (\is_array($content)) {
|
if (is_array($content)) {
|
||||||
$content = implode('_', $content);
|
$content = implode("_", $content);
|
||||||
}
|
}
|
||||||
$query = 'INSERT INTO motd(title, content) VALUES (:title, :content);';
|
$query = 'INSERT INTO motd(title, content) VALUES (:title, :content);';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
|
|
||||||
$statement->bindParam(':title', $title, \PDO::PARAM_STR);
|
$statement->bindParam(':title', $title, PDO::PARAM_STR);
|
||||||
$statement->bindParam(':content', $content, \PDO::PARAM_STR);
|
$statement->bindParam(':content', $content, PDO::PARAM_STR);
|
||||||
|
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
}
|
}
|
||||||
@ -30,18 +29,21 @@ class MOTD {
|
|||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$data = $statement->fetch();
|
$data = $statement->fetch();
|
||||||
|
$motd = array("title" => $data[0], "content" => explode("\n", $data[1]));
|
||||||
|
|
||||||
return ['title' => $data[0], 'content' => explode("\n", $data[1])];
|
return $motd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMOTD_history($limit = 5) {
|
public function getMOTD_history($limit = 5) {
|
||||||
$query = 'SELECT motd.title, motd.content FROM motd ORDER BY motd.id DESC LIMIT :limit';
|
$query = 'SELECT motd.title, motd.content FROM motd ORDER BY motd.id DESC LIMIT :limit';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':limit', $limit, \PDO::PARAM_STR);
|
$statement->bindParam(':limit', $limit, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$data = $statement->fetch();
|
$data = $statement->fetch();
|
||||||
|
$motd = array("title" => $data[0], "content" => explode("\n", $data[1]));
|
||||||
|
|
||||||
return ['title' => $data[0], 'content' => explode("\n", $data[1])];
|
return $motd;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
class Project{
|
class Project{
|
||||||
private $id;
|
private $id, $name, $descr, $active;
|
||||||
private $name;
|
|
||||||
private $descr;
|
|
||||||
private $active;
|
|
||||||
|
|
||||||
public function __construct($id, $name, $descr, $active){
|
public function __construct($id, $name, $descr, $active){
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
|
use \PDO;
|
||||||
|
|
||||||
class ProjectManager{
|
class ProjectManager{
|
||||||
private $pdo;
|
private $pdo;
|
||||||
|
|
||||||
public function __construct(\PDO $pdo) {
|
public function __construct(PDO $pdo){
|
||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,26 +32,27 @@ class ProjectManager {
|
|||||||
public function getByID($id){
|
public function getByID($id){
|
||||||
$query = 'SELECT * FROM projects WHERE id=:id LIMIT 1';
|
$query = 'SELECT * FROM projects WHERE id=:id LIMIT 1';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':id', $id, \PDO::PARAM_INT);
|
$statement->bindParam(':id', $id, PDO::PARAM_INT);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$dbProj = $statement->fetch();
|
$dbProj = $statement->fetch();
|
||||||
if (!$dbProj) {
|
if (!$dbProj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$project = new Project(
|
||||||
return new Project(
|
|
||||||
$dbProj['id'],
|
$dbProj['id'],
|
||||||
$dbProj['name'],
|
$dbProj['name'],
|
||||||
$dbProj['description'],
|
$dbProj['description'],
|
||||||
$dbProj['active']
|
$dbProj['active']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return $project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getByOwner($uname){
|
public function getByOwner($uname){
|
||||||
$query = 'SELECT projectid FROM projectmembers WHERE uname=:uname';
|
$query = 'SELECT projectid FROM projectmembers WHERE uname=:uname';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':uname', $uname, \PDO::PARAM_STR);
|
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$projectIDs = $statement->fetchAll();
|
$projectIDs = $statement->fetchAll();
|
||||||
@ -62,7 +62,7 @@ class ProjectManager {
|
|||||||
|
|
||||||
$query = 'SELECT * FROM projects WHERE id=:id';
|
$query = 'SELECT * FROM projects WHERE id=:id';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':id', $id, \PDO::PARAM_INT);
|
$statement->bindParam(':id', $id, PDO::PARAM_INT);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
foreach($statement->fetchAll() as $dbProj){
|
foreach($statement->fetchAll() as $dbProj){
|
||||||
@ -82,7 +82,7 @@ class ProjectManager {
|
|||||||
public function getProjectMembers($id){
|
public function getProjectMembers($id){
|
||||||
$query = 'SELECT * FROM projectmembers WHERE projectid=:id';
|
$query = 'SELECT * FROM projectmembers WHERE projectid=:id';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':id', $id, \PDO::PARAM_STR);
|
$statement->bindParam(':id', $id, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$members = [];
|
$members = [];
|
||||||
@ -93,7 +93,7 @@ class ProjectManager {
|
|||||||
'mail' => $dbUsr['mail'],
|
'mail' => $dbUsr['mail'],
|
||||||
'role' => $dbUsr['role'],
|
'role' => $dbUsr['role'],
|
||||||
'lead' => $dbUsr['lead'],
|
'lead' => $dbUsr['lead'],
|
||||||
'owner' => $dbUsr['owner'],
|
'owner' => $dbUsr['owner']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,18 +103,19 @@ class ProjectManager {
|
|||||||
public function getProjectOwner($id){
|
public function getProjectOwner($id){
|
||||||
$query = 'SELECT * FROM projectmembers WHERE (projectid=:id AND owner=1)';
|
$query = 'SELECT * FROM projectmembers WHERE (projectid=:id AND owner=1)';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->bindParam(':id', $id, \PDO::PARAM_STR);
|
$statement->bindParam(':id', $id, PDO::PARAM_STR);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$dbOwner = $statement->fetch();
|
$dbOwner = $statement->fetch();
|
||||||
|
$owner = [
|
||||||
return [
|
|
||||||
'name' => $dbOwner['name'],
|
'name' => $dbOwner['name'],
|
||||||
'uname' => $dbOwner['uname'],
|
'uname' => $dbOwner['uname'],
|
||||||
'mail' => $dbOwner['mail'],
|
'mail' => $dbOwner['mail'],
|
||||||
'role' => $dbOwner['role'],
|
'role' => $dbOwner['role'],
|
||||||
'lead' => $dbOwner['lead'],
|
'lead' => $dbOwner['lead'],
|
||||||
'owner' => $dbOwner['owner'],
|
'owner' => $dbOwner['owner']
|
||||||
];
|
];
|
||||||
|
|
||||||
|
return $owner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
class SimpleEvent extends Event {
|
class SimpleEvent extends Event {
|
||||||
private $id;
|
|
||||||
private $name;
|
|
||||||
private $descr;
|
|
||||||
private $start;
|
|
||||||
private $end;
|
|
||||||
private $org;
|
|
||||||
private $loc;
|
|
||||||
|
|
||||||
public function __construct($id, $name, \DateTimeImmutable $start, \DateTimeImmutable $end, $org, $loc, $descr, $_isDBEvent = false) {
|
private $id, $name, $descr, $start, $end, $org, $loc;
|
||||||
|
|
||||||
|
public function __construct($id, $name,\DateTimeImmutable $start,\DateTimeImmutable $end,$org, $loc, $descr, $isDBEvent = false){
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->start = $start;
|
$this->start = $start;
|
||||||
@ -21,6 +13,7 @@ class SimpleEvent extends Event {
|
|||||||
$this->org = $org;
|
$this->org = $org;
|
||||||
$this->loc = $loc;
|
$this->loc = $loc;
|
||||||
$this->descr = explode("\n", $descr);
|
$this->descr = explode("\n", $descr);
|
||||||
|
$this->isDBEvent = $isDBEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getID(){
|
public function getID(){
|
||||||
@ -48,16 +41,23 @@ class SimpleEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() {
|
public function getURL() {
|
||||||
return '/hendelser/info.php?id=' . $this->id;
|
return ('/hendelser/info.php?id=' . $this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getImageURL(): void {}
|
public function getImageURL() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDescription() {
|
public function getDescription() {
|
||||||
return $this->descr;
|
return $this->descr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isDBEvent() {
|
||||||
|
return $this->isDBEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor() {
|
||||||
return '#3b7';
|
return "#3b7";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,41 +1,36 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Activity;
|
use \pvv\side\Activity;
|
||||||
|
use \DateTimeImmutable;
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class AnimekveldActivity implements Activity {
|
class AnimekveldActivity implements Activity {
|
||||||
public function nextDate(\DateTimeImmutable $date) {
|
|
||||||
if (intval($date->format('H')) > 20 || intval($date->format('H')) === 19 && intval($date->format('i')) > 30) {
|
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D'))->setTime(19, 30, 0));
|
|
||||||
}
|
|
||||||
$date = $date->setTime(19, 30, 0);
|
|
||||||
if (intval($date->format('N')) !== 5) {
|
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D')));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public function nextDate(DateTimeImmutable $date) {
|
||||||
|
if ($date->format('H') > 20 || $date->format('H') == 19 && $date->format('i') > 30)
|
||||||
|
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(19, 30, 0));
|
||||||
|
$date = $date->setTime(19, 30, 0);
|
||||||
|
if ($date->format('N') != 5)
|
||||||
|
return $this->nextDate($date->add(new DateInterval('P1D')));
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prevDate(\DateTimeImmutable $date) {
|
public function prevDate(DateTimeImmutable $date) {
|
||||||
if (intval($date->format('H')) < 19 || intval($date->format('H')) === 20 && intval($date->format('i')) < 30) {
|
if ($date->format('H') < 19 || $date->format('H') == 20 && $date->format('i') < 30)
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D'))->setTime(19, 30, 0));
|
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(19, 30, 0));
|
||||||
}
|
|
||||||
$date = $date->setTime(19, 30, 0);
|
$date = $date->setTime(19, 30, 0);
|
||||||
if (intval($date->format('N')) !== 5) {
|
if ($date->format('N') != 5)
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D')));
|
return $this->prevDate($date->sub(new DateInterval('P1D')));
|
||||||
}
|
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextEventFrom(\DateTimeImmutable $date) { /* : Event */
|
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
return new AnimekveldEvent($this->nextDate($date));
|
return new AnimekveldEvent($this->nextDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(\DateTimeImmutable $date) { /* : Event */
|
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
return new AnimekveldEvent($this->prevDate($date));
|
return new AnimekveldEvent($this->prevDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Event;
|
use \pvv\side\Event;
|
||||||
|
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class AnimekveldEvent extends Event {
|
class AnimekveldEvent extends Event {
|
||||||
|
|
||||||
public function getStop() {
|
public function getStop() {
|
||||||
return $this->getStart()->add(new \DateInterval('PT4H1800S'));
|
return $this->getStart()->add(new DateInterval('PT4H1800S'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() { /* : string */
|
public function getName() /* : string */ {
|
||||||
return 'Animekveld';
|
return "Animekveld";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLocation() { /* : Location */
|
public function getLocation() /* : Location */ {
|
||||||
return 'Koserommet';
|
return "Koserommet";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() { /* : User */
|
public function getOrganiser() /* : User */ {
|
||||||
return 'Christoffer Viken';
|
return "Christoffer Viken";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() { /* : string */
|
public function getURL() /* : string */ {
|
||||||
return '/anime/';
|
return '/anime/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,10 +38,12 @@ class AnimekveldEvent extends Event {
|
|||||||
'',
|
'',
|
||||||
'Alle kan være med på å anbefale eller veto serier.',
|
'Alle kan være med på å anbefale eller veto serier.',
|
||||||
'',
|
'',
|
||||||
|
'I disse tider blir visningene i all hovedsak holdt online på vår <a href="https://discord.gg/cx4aXU7">Discord server</a>'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor() {
|
||||||
return '#35a';
|
return "#35a";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,41 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Activity;
|
use \pvv\side\Activity;
|
||||||
|
use \DateTimeImmutable;
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class BrettspillActivity implements Activity {
|
class BrettspillActivity implements Activity {
|
||||||
public function nextDate(\DateTimeImmutable $date) {
|
|
||||||
if (intval($date->format('H')) > 17 || intval($date->format('H')) === 16 && intval($date->format('i')) > 15) {
|
public function nextDate(DateTimeImmutable $date) {
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D'))->setTime(16, 15, 0));
|
if ($date->format('H') > 17 || $date->format('H') == 16 && $date->format('i') > 15)
|
||||||
}
|
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(16, 15, 0));
|
||||||
$date = $date->setTime(16, 15, 0);
|
$date = $date->setTime(16, 15, 0);
|
||||||
if (intval($date->format('N')) !== 7) {
|
if ($date->format('N') != 7)
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D')));
|
return $this->nextDate($date->add(new DateInterval('P1D')));
|
||||||
}
|
if ($date->format('W') % 2 - 1)
|
||||||
if (intval($date->format('W')) % 2 - 1) {
|
return $this->nextDate($date->add(new DateInterval('P7D')));
|
||||||
return $this->nextDate($date->add(new \DateInterval('P7D')));
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function prevDate(DateTimeImmutable $date) {
|
||||||
|
if ($date->format('H') < 16 || $date->format('H') == 17 && $date->format('i') < 15)
|
||||||
|
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(16, 15, 0));
|
||||||
|
$date = $date->setTime(16, 15, 0);
|
||||||
|
if ($date->format('N') != 7)
|
||||||
|
return $this->prevDate($date->sub(new DateInterval('P1D')));
|
||||||
|
if ($date->format('W') % 2 - 1)
|
||||||
|
return $this->prevDate($date->sub(new DateInterval('P7D')));
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prevDate(\DateTimeImmutable $date) {
|
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
if (intval($date->format('H')) < 16 || intval($date->format('H')) === 17 && intval($date->format('i')) < 15) {
|
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D'))->setTime(16, 15, 0));
|
|
||||||
}
|
|
||||||
$date = $date->setTime(16, 15, 0);
|
|
||||||
if (intval($date->format('N')) !== 7) {
|
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D')));
|
|
||||||
}
|
|
||||||
if (intval($date->format('W')) % 2 - 1) {
|
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P7D')));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNextEventFrom(\DateTimeImmutable $date) { /* : Event */
|
|
||||||
return new BrettspillEvent($this->nextDate($date));
|
return new BrettspillEvent($this->nextDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(\DateTimeImmutable $date) { /* : Event */
|
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
return new BrettspillEvent($this->prevDate($date));
|
return new BrettspillEvent($this->prevDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Event;
|
use \pvv\side\Event;
|
||||||
|
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class BrettspillEvent extends Event {
|
class BrettspillEvent extends Event {
|
||||||
|
|
||||||
public function getStop() {
|
public function getStop() {
|
||||||
return $this->getStart()->add(new \DateInterval('PT4H1800S'));
|
return $this->getStart()->add(new DateInterval('PT4H1800S'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() { /* : string */
|
public function getName() /* : string */ {
|
||||||
return 'Brettspillkveld';
|
return "Brettspillkveld";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLocation() { /* : Location */
|
public function getLocation() /* : Location */ {
|
||||||
return 'Programvareverkstedet';
|
return "Programvareverkstedet";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() { /* : User */
|
public function getOrganiser() /* : User */ {
|
||||||
return 'Programvareverkstedet';
|
return "Programvareverkstedet";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() { /* : string */
|
public function getURL() /* : string */ {
|
||||||
return '/brettspill/';
|
return '/brettspill/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +59,7 @@ class BrettspillEvent extends Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor() {
|
||||||
return '#000';
|
return "#000";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,40 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Activity;
|
use \pvv\side\Activity;
|
||||||
|
use \DateTimeImmutable;
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class DriftkveldActivity implements Activity {
|
class DriftkveldActivity implements Activity {
|
||||||
public function nextDate(\DateTimeImmutable $date) {
|
|
||||||
if (intval($date->format('H')) > 18 || intval($date->format('H')) === 17 && intval($date->format('i')) > 30) {
|
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D'))->setTime(18, 15, 0));
|
|
||||||
}
|
|
||||||
$date = $date->setTime(18, 15, 0);
|
|
||||||
if (intval($date->format('N')) !== 6) {
|
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D')));
|
|
||||||
}
|
|
||||||
if (intval($date->format('W')) % 2 - 1) {
|
|
||||||
return $this->nextDate($date->add(new \DateInterval('P7D')));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public function nextDate(DateTimeImmutable $date) {
|
||||||
|
if ($date->format('H') > 18 || $date->format('H') == 17 && $date->format('i') > 30)
|
||||||
|
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(18, 15, 0));
|
||||||
|
$date = $date->setTime(18, 15, 0);
|
||||||
|
if ($date->format('N') != 6)
|
||||||
|
return $this->nextDate($date->add(new DateInterval('P1D')));
|
||||||
|
if ($date->format('W') % 2 - 1)
|
||||||
|
return $this->nextDate($date->add(new DateInterval('P7D')));
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prevDate(\DateTimeImmutable $date) {
|
public function prevDate(DateTimeImmutable $date) {
|
||||||
if (intval($date->format('H')) < 17 || intval($date->format('H')) === 18 && intval($date->format('i')) < 30) {
|
if ($date->format('H') < 17 || $date->format('H') == 18 && $date->format('i') < 30)
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D'))->setTime(18, 15, 0));
|
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(18, 15, 0));
|
||||||
}
|
|
||||||
$date = $date->setTime(18, 15, 0);
|
$date = $date->setTime(18, 15, 0);
|
||||||
if (intval($date->format('N')) !== 6) {
|
if ($date->format('N') != 6)
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D')));
|
return $this->prevDate($date->sub(new DateInterval('P1D')));
|
||||||
}
|
if ($date->format('W') % 2 - 1)
|
||||||
if (intval($date->format('W')) % 2 - 1) {
|
return $this->prevDate($date->sub(new DateInterval('P7D')));
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P7D')));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextEventFrom(\DateTimeImmutable $date) { /* : Event */
|
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
return new DriftkveldEvent($this->nextDate($date));
|
return new DriftkveldEvent($this->nextDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(\DateTimeImmutable $date) { /* : Event */
|
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
return new DriftkveldEvent($this->prevDate($date));
|
return new DriftkveldEvent($this->prevDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Event;
|
use \pvv\side\Event;
|
||||||
|
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class DriftkveldEvent extends Event {
|
class DriftkveldEvent extends Event {
|
||||||
|
|
||||||
public function getStop() {
|
public function getStop() {
|
||||||
return $this->getStart()->add(new \DateInterval('PT4H1800S'));
|
return $this->getStart()->add(new DateInterval('PT4H1800S'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() { /* : string */
|
public function getName() /* : string */ {
|
||||||
return 'Driftkveld';
|
return "Driftkveld";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLocation() { /* : Location */
|
public function getLocation() /* : Location */ {
|
||||||
return 'Terminalrommet / Discord / IRC';
|
return "Terminalrommet / Discord / IRC";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() { /* : User */
|
public function getOrganiser() /* : User */ {
|
||||||
return 'Torstein Nordgård-Hansen';
|
return "Torstein Nordgård-Hansen";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() { /* : string */
|
public function getURL() /* : string */ {
|
||||||
return '/driftkveld/';
|
return '/driftkveld/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,11 +38,12 @@ class DriftkveldEvent extends Event {
|
|||||||
'Kom på driftkveld!',
|
'Kom på driftkveld!',
|
||||||
'',
|
'',
|
||||||
'Vi møtes annenhver uke for å ta unna driftarbeid og drikke kaffe.',
|
'Vi møtes annenhver uke for å ta unna driftarbeid og drikke kaffe.',
|
||||||
'Alle PVVere er velkommene, enten de er erfarne driftere eller helt utenforstående!',
|
'Alle PVVere er velkommene, enten de er erfarne driftere eller helt utenforstående!'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor() {
|
||||||
return '#35a';
|
return "#35a";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,40 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Activity;
|
use \pvv\side\Activity;
|
||||||
|
use \DateTimeImmutable;
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class HackekveldActivity implements Activity {
|
class HackekveldActivity implements Activity {
|
||||||
public function nextDate(\DateTimeImmutable $date) {
|
|
||||||
if (intval($date->format('H')) > 18 || intval($date->format('H')) === 17 && intval($date->format('i')) > 30) {
|
public function nextDate(DateTimeImmutable $date) {
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D'))->setTime(18, 15, 0));
|
if ($date->format('H') > 18 || $date->format('H') == 17 && $date->format('i') > 30)
|
||||||
}
|
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(18, 15, 0));
|
||||||
$date = $date->setTime(16, 15, 0);
|
$date = $date->setTime(16, 15, 0);
|
||||||
if (intval($date->format('N')) !== 6) {
|
if ($date->format('N') != 6)
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D')));
|
return $this->nextDate($date->add(new DateInterval('P1D')));
|
||||||
}
|
if ($date->format('W') % 2)
|
||||||
if (intval($date->format('W')) % 2) {
|
return $this->nextDate($date->add(new DateInterval('P7D')));
|
||||||
return $this->nextDate($date->add(new \DateInterval('P7D')));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prevDate(\DateTimeImmutable $date) {
|
public function prevDate(DateTimeImmutable $date) {
|
||||||
if (intval($date->format('H')) < 17 || intval($date->format('H')) === 18 && intval($date->format('i')) < 30) {
|
if ($date->format('H') < 17 || $date->format('H') == 18 && $date->format('i') < 30)
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D'))->setTime(18, 15, 0));
|
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(18, 15, 0));
|
||||||
}
|
|
||||||
$date = $date->setTime(18, 15, 0);
|
$date = $date->setTime(18, 15, 0);
|
||||||
if (intval($date->format('N')) !== 6) {
|
if ($date->format('N') != 6)
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D')));
|
return $this->prevDate($date->sub(new DateInterval('P1D')));
|
||||||
}
|
if ($date->format('W') % 2)
|
||||||
if (intval($date->format('W')) % 2) {
|
return $this->prevDate($date->sub(new DateInterval('P7D')));
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P7D')));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextEventFrom(\DateTimeImmutable $date) { /* : Event */
|
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
return new HackekveldEvent($this->nextDate($date));
|
return new HackekveldEvent($this->nextDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(\DateTimeImmutable $date) { /* : Event */
|
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
return new HackekveldEvent($this->prevDate($date));
|
return new HackekveldEvent($this->prevDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Event;
|
use \pvv\side\Event;
|
||||||
|
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class HackekveldEvent extends Event {
|
class HackekveldEvent extends Event {
|
||||||
|
|
||||||
public function getStop() {
|
public function getStop() {
|
||||||
return $this->getStart()->add(new \DateInterval('PT4H1800S'));
|
return $this->getStart()->add(new DateInterval('PT4H1800S'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() { /* : string */
|
public function getName() /* : string */ {
|
||||||
return 'Hackekveld';
|
return "Hackekveld";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLocation() { /* : Location */
|
public function getLocation() /* : Location */ {
|
||||||
return 'Terminalrommet / Discord / IRC';
|
return "Terminalrommet / Discord / IRC";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() { /* : User */
|
public function getOrganiser() /* : User */ {
|
||||||
return 'PVV';
|
return "PVV";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() { /* : string */
|
public function getURL() /* : string */ {
|
||||||
return '#';
|
return '#';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,11 +34,12 @@ class HackekveldEvent extends Event {
|
|||||||
public function getDescription() {
|
public function getDescription() {
|
||||||
return [
|
return [
|
||||||
'Mange PVV-medlemmer liker å programmere.',
|
'Mange PVV-medlemmer liker å programmere.',
|
||||||
'Hvis du også liker å programmere, så bli med! Her kan du jobbe med dine egne prosjekter eller starte noe med andre nerder her på huset. Vi møtes for en hyggelig prat, mye god programmering og delsponset pizza.',
|
'Hvis du også liker å programmere, så bli med! Her kan du jobbe med dine egne prosjekter eller starte noe med andre nerder her på huset. Vi møtes for en hyggelig prat, mye god programmering og delsponset pizza.'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor() {
|
||||||
return '#35a';
|
return "#35a";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,40 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Activity;
|
use \pvv\side\Activity;
|
||||||
|
use \DateTimeImmutable;
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class NerdepitsaActivity implements Activity {
|
class NerdepitsaActivity implements Activity {
|
||||||
public function nextDate(\DateTimeImmutable $date) {
|
|
||||||
if (intval($date->format('H')) > 19) {
|
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D'))->setTime(19, 0, 0));
|
|
||||||
}
|
|
||||||
$date = $date->setTime(19, 0, 0);
|
|
||||||
if (intval($date->format('N')) !== 5) {
|
|
||||||
return $this->nextDate($date->add(new \DateInterval('P1D')));
|
|
||||||
}
|
|
||||||
if (intval($date->format('W')) % 2) {
|
|
||||||
return $this->nextDate($date->add(new \DateInterval('P7D')));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public function nextDate(DateTimeImmutable $date) {
|
||||||
|
if ($date->format('H') > 19)
|
||||||
|
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(19, 0, 0));
|
||||||
|
$date = $date->setTime(19, 0, 0);
|
||||||
|
if ($date->format('N') != 5)
|
||||||
|
return $this->nextDate($date->add(new DateInterval('P1D')));
|
||||||
|
if ($date->format('W') % 2)
|
||||||
|
return $this->nextDate($date->add(new DateInterval('P7D')));
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prevDate(\DateTimeImmutable $date) {
|
public function prevDate(DateTimeImmutable $date) {
|
||||||
if (intval($date->format('H')) < 19) {
|
if ($date->format('H') < 19)
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D'))->setTime(19, 0, 0));
|
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(19, 0, 0));
|
||||||
}
|
|
||||||
$date = $date->setTime(19, 0, 0);
|
$date = $date->setTime(19, 0, 0);
|
||||||
if (intval($date->format('N')) !== 5) {
|
if ($date->format('N') != 5)
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P1D')));
|
return $this->prevDate($date->sub(new DateInterval('P1D')));
|
||||||
}
|
if ($date->format('W') % 2)
|
||||||
if (intval($date->format('W')) % 2) {
|
return $this->prevDate($date->sub(new DateInterval('P7D')));
|
||||||
return $this->prevDate($date->sub(new \DateInterval('P7D')));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextEventFrom(\DateTimeImmutable $date) { /* : Event */
|
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
return new NerdepitsaEvent($this->nextDate($date));
|
return new NerdepitsaEvent($this->nextDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(\DateTimeImmutable $date) { /* : Event */
|
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
||||||
return new NerdepitsaEvent($this->prevDate($date));
|
return new NerdepitsaEvent($this->prevDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use pvv\side\Event;
|
use \pvv\side\Event;
|
||||||
|
|
||||||
|
use \DateInterval;
|
||||||
|
|
||||||
class NerdepitsaEvent extends Event {
|
class NerdepitsaEvent extends Event {
|
||||||
|
|
||||||
public function getStop() {
|
public function getStop() {
|
||||||
return $this->getStart()->add(new \DateInterval('PT2H1800S'));
|
return $this->getStart()->add(new DateInterval('PT2H1800S'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName() {
|
||||||
return 'Nerdepitsa';
|
return "Nerdepitsa";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLocation() { /* : Location */
|
public function getLocation() /* : Location */ {
|
||||||
return 'Peppes Kjøpmansgata';
|
return "Peppes Kjøpmansgata";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() { /* : User */
|
public function getOrganiser() /* : User */ {
|
||||||
return 'Anders Christensen';
|
return "Anders Christensen";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() { /* : string */
|
public function getURL() /* : string */ {
|
||||||
return '/nerdepitsa/';
|
return '/nerdepitsa/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,11 +39,12 @@ class NerdepitsaEvent extends Event {
|
|||||||
'',
|
'',
|
||||||
'Det er ikke noe krav at du er nerd... noen av oss virker faktisk nesten normale! Det er heller ikke noe krav at du kjenner noen fra før. Det er ikke engang et krav at du må like pizza! (selv om det hjelper) Dersom du har lyst til å treffe personer fra datamiljøet ved NTNU så bare still opp! Vi biter ikke, vel, bortsett fra pizzaen da.',
|
'Det er ikke noe krav at du er nerd... noen av oss virker faktisk nesten normale! Det er heller ikke noe krav at du kjenner noen fra før. Det er ikke engang et krav at du må like pizza! (selv om det hjelper) Dersom du har lyst til å treffe personer fra datamiljøet ved NTNU så bare still opp! Vi biter ikke, vel, bortsett fra pizzaen da.',
|
||||||
'',
|
'',
|
||||||
'Vi bestiller så mye pizza som vi i fellesskap klarer å stappe i oss, og splitter dermed pizza-regningen broderlig, mens hver enkelt betaler for sin egen drikke, dessert mm. Vell møtt!',
|
'Vi bestiller så mye pizza som vi i fellesskap klarer å stappe i oss, og splitter dermed pizza-regningen broderlig, mens hver enkelt betaler for sin egen drikke, dessert mm. Vell møtt!'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor() {
|
||||||
return '#c35';
|
return "#c35";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
ini_set('date.timezone', 'Europe/Oslo');
|
ini_set('date.timezone', 'Europe/Oslo');
|
||||||
|
|
||||||
require implode(\DIRECTORY_SEPARATOR, [\dirname(__DIR__, 3), '', '_autoload.php']);
|
require implode(DIRECTORY_SEPARATOR, [dirname(dirname(dirname(__DIR__))), '', '_autoload.php']);
|
||||||
|
|
||||||
$c = new AnimekveldActivity();
|
$c = new AnimekveldActivity;
|
||||||
exit($c->nextDate(new \DateTimeImmutable())->format(\DATE_RFC2822));
|
die($c->nextDate(new \DateTimeImmutable)->format(DATE_RFC2822));
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
<?php
|
<?php //declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
ini_set('date.timezone', 'Europe/Oslo');
|
ini_set('date.timezone', 'Europe/Oslo');
|
||||||
|
|
||||||
require implode(\DIRECTORY_SEPARATOR, [\dirname(__DIR__, 3), '', '_autoload.php']);
|
require implode(DIRECTORY_SEPARATOR, [dirname(dirname(dirname(__DIR__))), '', '_autoload.php']);
|
||||||
|
|
||||||
$c = new NerdepitsaActivity();
|
$c = new NerdepitsaActivity;
|
||||||
exit($c->prevDate(new \DateTimeImmutable())->format(\DATE_RFC2822));
|
die($c->prevDate(new \DateTimeImmutable)->format(DATE_RFC2822));
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$eventID = $_GET['id'];
|
$eventID = $_GET['id'];
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
require __DIR__ . '/../../../inc/navbar.php';
|
require __DIR__ . '/../../../inc/navbar.php';
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
@ -18,10 +18,10 @@ $name = $attrs['cn'][0];
|
|||||||
|
|
||||||
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$customActivity = new pvv\side\DBActivity($pdo);
|
$customActivity = new \pvv\side\DBActivity($pdo);
|
||||||
|
|
||||||
$new = 0;
|
$new = 0;
|
||||||
if(isset($_GET['new'])){
|
if(isset($_GET['new'])){
|
||||||
@ -33,20 +33,21 @@ if (isset($_GET['id'])) {
|
|||||||
$eventID = $_GET['id'];
|
$eventID = $_GET['id'];
|
||||||
}else if($new == 0){
|
}else if($new == 0){
|
||||||
echo "\nID not set";
|
echo "\nID not set";
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$today = new DateTimeImmutable();
|
$today = new DateTimeImmutable;
|
||||||
$today = $today->setTime(18, 15);
|
$today = $today->setTime(18, 15);
|
||||||
$defaultStart = $today->format('Y-m-d H:15:00');
|
$defaultStart = $today->format("Y-m-d H:15:00");
|
||||||
$inTwoHours = $today->add(new DateInterval('PT1H45M'));
|
$inTwoHours = $today->add(new DateInterval('PT1H45M'));
|
||||||
$defaultEnd = $inTwoHours->format('Y-m-d H:00:00');
|
$defaultEnd = $inTwoHours->format("Y-m-d H:00:00");
|
||||||
|
|
||||||
|
|
||||||
|
$event;
|
||||||
if($new == 0){
|
if($new == 0){
|
||||||
$event = $customActivity->getEventByID($eventID);
|
$event = $customActivity->getEventByID($eventID);
|
||||||
} else {
|
}
|
||||||
$event = new pvv\side\SimpleEvent(
|
else {
|
||||||
|
$event = new \pvv\side\SimpleEvent(
|
||||||
0,
|
0,
|
||||||
'',
|
'',
|
||||||
$today,
|
$today,
|
||||||
@ -85,26 +86,26 @@ if ($new == 0) {
|
|||||||
<h2>Aktivietsadministrasjon</h2>
|
<h2>Aktivietsadministrasjon</h2>
|
||||||
<hr class="ruler">
|
<hr class="ruler">
|
||||||
|
|
||||||
<h2><?php echo $new == 1 ? 'Ny hendelse' : 'Rediger hendelse'; ?></h2>
|
<h2><?= ($new == 1 ? "Ny hendelse" : "Rediger hendelse"); ?></h2>
|
||||||
|
|
||||||
<form action="update.php", method="post" class="gridsplit fullwidth_inputs">
|
<form action="update.php", method="post" class="gridsplit fullwidth_inputs">
|
||||||
<div class="gridl">
|
<div class="gridl">
|
||||||
<p class="subtitle">Tittel</p>
|
<p class="subtitle">Tittel</p>
|
||||||
<input type="text" name="title" value="<?php echo $event->getName(); ?>" class="boxinput" required placeholder="En kul hendelse"><br>
|
<input type="text" name="title" value="<?= $event->getName() ?>" class="boxinput" required placeholder="En kul hendelse"><br>
|
||||||
|
|
||||||
<div class="gridsplit5050">
|
<div class="gridsplit5050">
|
||||||
<div class="gridl">
|
<div class="gridl">
|
||||||
<p class="subtitle">Arrangør</p>
|
<p class="subtitle">Arrangør</p>
|
||||||
<input type="text" name="organiser" value="<?php echo $event->getOrganiser(); ?>" class="boxinput" required placeholder="<?php echo $name; ?>"><br>
|
<input type="text" name="organiser" value="<?= $event->getOrganiser() ?>" class="boxinput" required placeholder="<?= $name ?>"><br>
|
||||||
</div>
|
</div>
|
||||||
<div class="gridr noborder">
|
<div class="gridr noborder">
|
||||||
<p class="subtitle">Sted</p>
|
<p class="subtitle">Sted</p>
|
||||||
<input type="text" name="location" value="<?php echo $event->getLocation(); ?>" class="boxinput" required placeholder="Terminalrommet"><br>
|
<input type="text" name="location" value="<?= $event->getLocation() ?>" class="boxinput" required placeholder="Terminalrommet"><br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="subtitle">Beskrivelse (<i>markdown</i>)</p>
|
<p class="subtitle">Beskrivelse (<i>markdown</i>)</p>
|
||||||
<textarea name="desc" rows="8" class="boxinput" placeholder="Beskrivelse" required><?php echo implode("\n", $event->getDescription()); ?></textarea>
|
<textarea name="desc" rows="8" class="boxinput" placeholder="Beskrivese" required><?= implode($event->getDescription(), "\n"); ?></textarea>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -112,22 +113,22 @@ if ($new == 0) {
|
|||||||
<div class="gridr" style="line-height: 1.3em;">
|
<div class="gridr" style="line-height: 1.3em;">
|
||||||
<h4>Starttid</h4><br>
|
<h4>Starttid</h4><br>
|
||||||
<i>Måned:</i><br>
|
<i>Måned:</i><br>
|
||||||
<input name="start_mon" type="month" class="boxinput" required value="<?php echo $event->getStart()->format('Y-m'); ?>"><br>
|
<input name="start_mon" type="month" class="boxinput" required value="<?= $event->getStart()->format('Y-m') ?>"><br>
|
||||||
<i>Dag:</i><br>
|
<i>Dag:</i><br>
|
||||||
<input name="start_day" type="number" min="1" max="31" required class="boxinput" value="<?php echo $event->getStart()->format('d'); ?>"><br>
|
<input name="start_day" type="number" min="1" max="31" required class="boxinput" value="<?= $event->getStart()->format('d') ?>"><br>
|
||||||
<i>Klokkeslett:</i><br>
|
<i>Klokkeslett:</i><br>
|
||||||
<input name="start_time" type="time" class="boxinput" required value="<?php echo $event->getStart()->format('H:i:s'); ?>"><br>
|
<input name="start_time" type="time" class="boxinput" required value="<?= $event->getStart()->format('H:i:s') ?>"><br>
|
||||||
<br>
|
<br>
|
||||||
<h4>Varighet</h4><br>
|
<h4>Varighet</h4><br>
|
||||||
<?php $diff = $event->getStart()->diff($event->getStop()); ?>
|
<?php $diff = $event->getStart()->diff($event->getStop()); ?>
|
||||||
<i>Timer:</i><br>
|
<i>Timer:</i><br>
|
||||||
<input name="lasts_hours" type="number" min="0" class="boxinput" required value="<?php echo $diff->h; ?>"><br>
|
<input name="lasts_hours" type="number" min="0" class="boxinput" required value="<?= $diff->h ?>"><br>
|
||||||
<i>Minutter:</i><br>
|
<i>Minutter:</i><br>
|
||||||
<input name="lasts_minutes" type="number" min="0" max="59" class="boxinput" required value="<?php echo $diff->i; ?>"><br>
|
<input name="lasts_minutes" type="number" min="0" max="59" class="boxinput" required value="<?= $diff->i ?>"><br>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="id" value="<?php echo $event->getID(); ?>" />
|
<input type="hidden" name="id" value="<?= $event->getID() ?>" />
|
||||||
|
|
||||||
<div class="allgrids" style="margin-top: 2em;">
|
<div class="allgrids" style="margin-top: 2em;">
|
||||||
<hr class="ruler">
|
<hr class="ruler">
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
require __DIR__ . '/../../../inc/navbar.php';
|
require __DIR__ . '/../../../inc/navbar.php';
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$customActivity = new pvv\side\DBActivity($pdo);
|
$customActivity = new \pvv\side\DBActivity($pdo);
|
||||||
$events = $customActivity->getAllEvents();
|
$events = $customActivity->getAllEvents();
|
||||||
|
|
||||||
$page = 1;
|
$page = 1;
|
||||||
@ -41,7 +41,9 @@ if (isset($_GET['organiser'])) {
|
|||||||
// filter
|
// filter
|
||||||
$events = array_values(array_filter(
|
$events = array_values(array_filter(
|
||||||
$events,
|
$events,
|
||||||
static fn($event) => (preg_match('/.*' . $filterTitle . '.*/i', $event->getName()) && preg_match('/.*' . $filterOrganiser . '.*/i', $event->getOrganiser()))
|
function($event) use ($filterTitle, $filterOrganiser){
|
||||||
|
return (preg_match('/.*'.$filterTitle.'.*/i', $event->getName()) and preg_match('/.*'.$filterOrganiser.'.*/i', $event->getOrganiser()));
|
||||||
|
}
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -80,7 +82,7 @@ $events = array_values(array_filter(
|
|||||||
$counter = 0;
|
$counter = 0;
|
||||||
$pageLimit = 10;
|
$pageLimit = 10;
|
||||||
|
|
||||||
for ($i = ($pageLimit * ($page - 1)); $i < count($events); ++$i) {
|
for($i = ($pageLimit * ($page - 1)); $i < count($events) ;$i++){
|
||||||
if($counter == $pageLimit){
|
if($counter == $pageLimit){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -92,25 +94,25 @@ $events = array_values(array_filter(
|
|||||||
<li>
|
<li>
|
||||||
<div class="event admin">
|
<div class="event admin">
|
||||||
<div class="event-info">
|
<div class="event-info">
|
||||||
<h3 class="no-chin"><?php echo $event->getName() . ' (ID: ' . $eventID . ')'; ?></h3>
|
<h3 class="no-chin"><?= $event->getName() . " (ID: " . $eventID . ")"; ?></h3>
|
||||||
<p class="subnote">
|
<p class="subnote">
|
||||||
<?php echo $event->getStart()->format('(Y-m-d H:i:s)') . ' - ' . $event->getStop()->format('(Y-m-d H:i:s)'); ?>
|
<?= $event->getStart()->format("(Y-m-d H:i:s)") . " - " . $event->getStop()->format("(Y-m-d H:i:s)"); ?>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", $event->getDescription()));
|
echo $Parsedown->text(implode("\n", $event->getDescription()));
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="event-actions">
|
<div class="event-actions">
|
||||||
<a class="btn" href="edit.php?id=<?php echo $eventID; ?>">Rediger</a><br>
|
<a class="btn" href="edit.php?id=<?= $eventID ?>">Rediger</a><br>
|
||||||
<a class="btn" href="delete.php?id=<?php echo $eventID; ?>" onclick="return confirm('Knallsikker? (ID: <?php echo $eventID; ?>)');">Slett</a>
|
<a class="btn" href="delete.php?id=<?= $eventID ?>" onclick="return confirm('Knallsikker? (ID: <?= $eventID ?>)');">Slett</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
++$counter;
|
$counter++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
@ -120,7 +122,7 @@ $events = array_values(array_filter(
|
|||||||
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '&title=' . urlencode($filterTitle) . '&organiser=' . urlencode($filterOrganiser) . '">Forrige side</a>';
|
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '&title=' . urlencode($filterTitle) . '&organiser=' . urlencode($filterOrganiser) . '">Forrige side</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($counter == $pageLimit) && (($pageLimit * $page) < count($events))) {
|
if(($counter == $pageLimit) and (($pageLimit * $page) < count($events))){
|
||||||
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '&title=' . urlencode($filterTitle) . '&organiser=' . urlencode($filterOrganiser) . '">Neste side</a>';
|
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '&title=' . urlencode($filterTitle) . '&organiser=' . urlencode($filterOrganiser) . '">Neste side</a>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -132,9 +134,9 @@ $events = array_values(array_filter(
|
|||||||
<h2>Filter</h2>
|
<h2>Filter</h2>
|
||||||
<form action="." method="get">
|
<form action="." method="get">
|
||||||
<p class="no-chin">Navn</p>
|
<p class="no-chin">Navn</p>
|
||||||
<?php echo '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">'; ?><br>
|
<?= '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">' ?><br>
|
||||||
<p class="no-chin">Organisator</p>
|
<p class="no-chin">Organisator</p>
|
||||||
<?php echo '<input type="text" name="organiser" class="boxinput" value="' . $filterOrganiser . '">'; ?><br>
|
<?= '<input type="text" name="organiser" class="boxinput" value="' . $filterOrganiser . '">' ?><br>
|
||||||
|
|
||||||
<div style="margin-top: 2em;">
|
<div style="margin-top: 2em;">
|
||||||
<input type="submit" class="btn" value="Filtrer"></input>
|
<input type="submit" class="btn" value="Filtrer"></input>
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
if(!$userManager->hasGroup($uname, 'aktiviteter')){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if((!isset($_POST['title']))
|
if((!isset($_POST['title']))
|
||||||
|| (!isset($_POST['desc']))
|
or (!isset($_POST['desc']))
|
||||||
|| (!isset($_POST['organiser']))
|
or (!isset($_POST['organiser']))
|
||||||
|| (!isset($_POST['location']))
|
or (!isset($_POST['location']))
|
||||||
|| (!isset($_POST['start_mon']))
|
or (!isset($_POST['start_mon']))
|
||||||
|| (!isset($_POST['start_day']))
|
or (!isset($_POST['start_day']))
|
||||||
|| (!isset($_POST['start_time']))
|
or (!isset($_POST['start_time']))
|
||||||
|| (!isset($_POST['lasts_hours']))
|
or (!isset($_POST['lasts_hours']))
|
||||||
|| (!isset($_POST['lasts_minutes']))) {
|
or (!isset($_POST['lasts_minutes']))) {
|
||||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = 0;
|
$id = 0;
|
||||||
@ -50,12 +50,12 @@ $date_part_lasts_hours = $_POST['lasts_hours'];
|
|||||||
$date_part_lasts_minutes = $_POST['lasts_minutes'];
|
$date_part_lasts_minutes = $_POST['lasts_minutes'];
|
||||||
|
|
||||||
while (strlen($date_part_start_day) < 2) {
|
while (strlen($date_part_start_day) < 2) {
|
||||||
$date_part_start_day = '0' . $date_part_start_day;
|
$date_part_start_day = "0" . $date_part_start_day;
|
||||||
}
|
}
|
||||||
|
|
||||||
$start = ($date_part_start_mon . '-' . $date_part_start_day . ' ' . $date_part_start_time);
|
$start = ($date_part_start_mon . "-" . $date_part_start_day . " " . $date_part_start_time);
|
||||||
if (count(explode(':', $date_part_start_time)) == 2) {
|
if (sizeof(explode(":", $date_part_start_time))==2) {
|
||||||
$start .= ':00';
|
$start .= ":00";
|
||||||
}
|
}
|
||||||
|
|
||||||
$start_date = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $start);
|
$start_date = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $start);
|
||||||
@ -65,10 +65,10 @@ $stop = $stop_date->format('Y-m-d H:i:s');
|
|||||||
|
|
||||||
if ($start_date >= $stop_date) {
|
if ($start_date >= $stop_date) {
|
||||||
echo 'Invalid dates. End date must come after the start date!';
|
echo 'Invalid dates. End date must come after the start date!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$statement;
|
||||||
if($id == 0){
|
if($id == 0){
|
||||||
$query = 'INSERT INTO events (name, start, stop, organiser, location, description) VALUES (:title, :start, :stop, :organiser, :loc, :desc)';
|
$query = 'INSERT INTO events (name, start, stop, organiser, location, description) VALUES (:title, :start, :stop, :organiser, :loc, :desc)';
|
||||||
$statement = $pdo->prepare($query);
|
$statement = $pdo->prepare($query);
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
ini_set('display_errors', '1');
|
ini_set('display_errors', '1');
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
error_reporting(\E_ALL);
|
error_reporting(E_ALL);
|
||||||
require __DIR__ . '/../../../inc/navbar.php';
|
require __DIR__ . '/../../../inc/navbar.php';
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->isAdmin($uname)){
|
if(!$userManager->isAdmin($uname)){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = $userManager->getAllUserData();
|
$users = $userManager->getAllUserData();
|
||||||
@ -59,16 +59,16 @@ $users = $userManager->getAllUserData();
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$users_to_update = [];
|
$users_to_update = array();
|
||||||
foreach($users as $i => $data){
|
foreach($users as $i => $data){
|
||||||
$uname = $data['name'];
|
$uname = $data['name'];
|
||||||
$groupFlag = $userManager->getUsergroups($uname);
|
$groupFlag = $userManager->getUsergroups($uname);
|
||||||
|
|
||||||
$users_to_update[] = $uname;
|
array_push($users_to_update, $uname);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $uname; ?></td>
|
<td><?= $uname ?></td>
|
||||||
<?php
|
<?php
|
||||||
foreach($userManager->usergroups as $name => $group){
|
foreach($userManager->usergroups as $name => $group){
|
||||||
echo '<td><input type="checkbox" ' . (($groupFlag & $group) ? 'checked' : '') . ' name="' . $uname . '_' . $name . '" class="usergroupcheckbox">' . $name . '</td>';
|
echo '<td><input type="checkbox" ' . (($groupFlag & $group) ? 'checked' : '') . ' name="' . $uname . '_' . $name . '" class="usergroupcheckbox">' . $name . '</td>';
|
||||||
|
@ -1,36 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
ini_set('display_errors', '1');
|
ini_set('display_errors', '1');
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
error_reporting(\E_ALL);
|
error_reporting(E_ALL);
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->isAdmin($uname)){
|
if(!$userManager->isAdmin($uname)){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$newUser;
|
||||||
if(isset($_POST['newuser'])){
|
if(isset($_POST['newuser'])){
|
||||||
$newUser = $_POST['newuser'];
|
$newUser = $_POST['newuser'];
|
||||||
unset($_POST['newuser']);
|
unset($_POST['newuser']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$updatingUsers = explode('_', $_POST['users']);
|
//$updatingUsers = explode('_', $_POST['users']);
|
||||||
$updatingUsers = [];
|
$updatingUsers = array();
|
||||||
foreach ($_POST as $key => $value) {
|
foreach ($_POST as $key => $value) { if ($key === "user_to_update") {
|
||||||
if ($key === 'user_to_update') {
|
array_push($updatingUsers, $value);
|
||||||
$updatingUsers[] = $value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($_POST['user_to_update']);
|
unset($_POST['user_to_update']);
|
||||||
@ -44,7 +43,7 @@ if ($newUser) {
|
|||||||
foreach($_POST as $namegroup => $info){
|
foreach($_POST as $namegroup => $info){
|
||||||
$data = explode('_', $namegroup);
|
$data = explode('_', $namegroup);
|
||||||
$group = array_pop($data);
|
$group = array_pop($data);
|
||||||
$uname = implode('_', $data);
|
$uname = implode("_", $data);
|
||||||
if($uname == 'newuser'){
|
if($uname == 'newuser'){
|
||||||
if(!$newUser){
|
if(!$newUser){
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
@ -17,7 +17,7 @@ $activityGroup = $userManager->hasGroup($uname, 'aktiviteter');
|
|||||||
if(!($isAdmin | $projectGroup | $activityGroup)){
|
if(!($isAdmin | $projectGroup | $activityGroup)){
|
||||||
header('Content-Type: text/plain', true, 403);
|
header('Content-Type: text/plain', true, 403);
|
||||||
echo "Her har du ikke lov't'å'værra!!!\r\n";
|
echo "Her har du ikke lov't'å'værra!!!\r\n";
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
ini_set('display_errors', '1');
|
ini_set('display_errors', '1');
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'no_NO');
|
setlocale(LC_ALL, 'no_NO');
|
||||||
error_reporting(\E_ALL);
|
error_reporting(E_ALL);
|
||||||
require __DIR__ . '/../../../inc/navbar.php';
|
require __DIR__ . '/../../../inc/navbar.php';
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->isAdmin($uname)){
|
if(!$userManager->isAdmin($uname)){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$motdfetcher = new pvv\side\MOTD($pdo);
|
$motdfetcher = new \pvv\side\MOTD($pdo);
|
||||||
$motd = $motdfetcher->getMOTD();
|
$motd = $motdfetcher->getMOTD();
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -56,15 +56,15 @@ $motd = $motdfetcher->getMOTD();
|
|||||||
<form action="update.php", method="post">
|
<form action="update.php", method="post">
|
||||||
<p class="subtitle no-chin">Tittel</p>
|
<p class="subtitle no-chin">Tittel</p>
|
||||||
<p class="subnote">Ikke nødvendig</p>
|
<p class="subnote">Ikke nødvendig</p>
|
||||||
<input type="text" name="title" value="<?php echo $motd['title']; ?>" class="boxinput" style="width:66%;"><br>
|
<input type="text" name="title" value="<?= $motd['title'] ?>" class="boxinput" style="width:66%;"><br>
|
||||||
|
|
||||||
<p class="subtitle no-chin">Innhold (<i>markdown</i>)</p>
|
<p class="subtitle no-chin">Innhold (<i>markdown</i>)</p>
|
||||||
<textarea name="content" style="width:100%" rows="8" class="boxinput"><?php echo implode("\n", $motd['content']); ?></textarea>
|
<textarea name="content" style="width:100%" rows="8" class="boxinput"><?= implode("\n", $motd["content"]) ?></textarea>
|
||||||
|
|
||||||
<div style="margin-top: 2em;">
|
<div style="margin-top: 2em;">
|
||||||
<hr class="ruler">
|
<hr class="ruler">
|
||||||
|
|
||||||
<?php echo '<input type="submit" class="btn" value="Lagre endringer"></a>'; ?>
|
<?= '<input type="submit" class="btn" value="Lagre endringer"></a>'; ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
ini_set('display_errors', '1');
|
ini_set('display_errors', '1');
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'no_NO');
|
setlocale(LC_ALL, 'no_NO');
|
||||||
error_reporting(\E_ALL);
|
error_reporting(E_ALL);
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if (!isset($_POST['title']) || !isset($_POST['content'])) {
|
if(!isset($_POST['title']) or !isset($_POST['content'])){
|
||||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$userManager->isAdmin($uname)){
|
if(!$userManager->isAdmin($uname)){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$motdfetcher = new pvv\side\MOTD($pdo);
|
$motdfetcher = new \pvv\side\MOTD($pdo);
|
||||||
$motdfetcher->setMOTD($_POST['title'], $_POST['content']);
|
$motdfetcher->setMOTD($_POST['title'], $_POST['content']);
|
||||||
|
|
||||||
header('Location: .');
|
header('Location: .');
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->hasGroup($uname, 'prosjekt')){
|
if(!$userManager->hasGroup($uname, 'prosjekt')){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$projectID = $_GET['id'];
|
$projectID = $_GET['id'];
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
require __DIR__ . '/../../../inc/navbar.php';
|
require __DIR__ . '/../../../inc/navbar.php';
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->hasGroup($uname, 'prosjekt')){
|
if(!$userManager->hasGroup($uname, 'prosjekt')){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$projectManager = new pvv\side\ProjectManager($pdo);
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
||||||
$projects = $projectManager->getAll();
|
$projects = $projectManager->getAll();
|
||||||
|
|
||||||
$new = 0;
|
$new = 0;
|
||||||
@ -33,10 +33,10 @@ if (isset($_GET['id'])) {
|
|||||||
$projectID = $_GET['id'];
|
$projectID = $_GET['id'];
|
||||||
}else if($new == 0){
|
}else if($new == 0){
|
||||||
echo "\nID not set";
|
echo "\nID not set";
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$project = new pvv\side\Project(
|
$project = new \pvv\side\Project(
|
||||||
0,
|
0,
|
||||||
'Kult Prosjekt',
|
'Kult Prosjekt',
|
||||||
'',
|
'',
|
||||||
@ -85,32 +85,32 @@ foreach ($members as $i => $data) {
|
|||||||
<h2>Prosjektadministrasjon</h2>
|
<h2>Prosjektadministrasjon</h2>
|
||||||
<hr class="ruler">
|
<hr class="ruler">
|
||||||
|
|
||||||
<h2><?php echo $new == 1 ? 'Nytt prosjekt' : 'Rediger prosjekt'; ?></h2>
|
<h2><?= ($new == 1 ? "Nytt prosjekt" : "Rediger prosjekt"); ?></h2>
|
||||||
|
|
||||||
<form action="update.php", method="post" class="gridsplit5050">
|
<form action="update.php", method="post" class="gridsplit5050">
|
||||||
<div class="gridl">
|
<div class="gridl">
|
||||||
<p class="subtitle">Tittel</p>
|
<p class="subtitle">Tittel</p>
|
||||||
<?php echo '<input type="text" name="title" value="' . $project->getName() . '" class="boxinput">'; ?><br>
|
<?= '<input type="text" name="title" value="' . $project->getName() . '" class="boxinput">' ?><br>
|
||||||
|
|
||||||
<p class="subtitle">Beskrivelse (<i>markdown</i>)</p>
|
<p class="subtitle">Beskrivelse (<i>markdown</i>)</p>
|
||||||
<textarea name="desc" cols="40" rows="5" class="boxinput"><?php echo implode("\n", $project->getDescription()); ?></textarea>
|
<textarea name="desc" cols="40" rows="5" class="boxinput"><?= implode($project->getDescription(), "\n"); ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="gridr noborder">
|
<div class="gridr noborder">
|
||||||
<p class="subtitle">Prosjektleder (Brukernavn)</p>
|
<p class="subtitle">Prosjektleder (Brukernavn)</p>
|
||||||
<?php echo '<input type="text" name="organiser" value="' . $owner['uname'] . '" class="boxinput">'; ?><br>
|
<?= '<input type="text" name="organiser" value="' . $owner['uname'] . '" class="boxinput">' ?><br>
|
||||||
|
|
||||||
<p class="subtitle">Prosjektleder (Navn)</p>
|
<p class="subtitle">Prosjektleder (Navn)</p>
|
||||||
<?php echo '<input type="text" name="organisername" value="' . $owner['name'] . '" class="boxinput">'; ?>
|
<?= '<input type="text" name="organisername" value="' . $owner['name'] . '" class="boxinput">' ?>
|
||||||
|
|
||||||
<p class="subtitle">Prosjektleder E-post</p>
|
<p class="subtitle">Prosjektleder E-post</p>
|
||||||
<?php echo '<input type="text" name="organiseremail" value="' . $owner['mail'] . '" class="boxinput">'; ?><br>
|
<?= '<input type="text" name="organiseremail" value="' . $owner['mail'] . '" class="boxinput">' ?><br>
|
||||||
|
|
||||||
<p class="subtitle">Aktiv</p>
|
<p class="subtitle">Aktiv</p>
|
||||||
<?php echo '<input type="checkbox" ' . ($project->getActive() ? 'checked' : '') . ' name="active"/>'; ?>
|
<?= '<input type="checkbox" '. ($project->getActive() ? 'checked' : '') . ' name="active"/>' ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php echo '<input type="hidden" name="id" value="' . $project->getID() . '" />'; ?>
|
<?= '<input type="hidden" name="id" value="' . $project->getID() . '" />' ?>
|
||||||
|
|
||||||
<?php if(!$new){ ?>
|
<?php if(!$new){ ?>
|
||||||
<div style="grid-column: span 2;">
|
<div style="grid-column: span 2;">
|
||||||
@ -123,9 +123,9 @@ foreach ($members as $i => $data) {
|
|||||||
<tr><th>Brukernavn</th><th>Navn</th><th>Rolle</th></tr>
|
<tr><th>Brukernavn</th><th>Navn</th><th>Rolle</th></tr>
|
||||||
<?php foreach($members as $i => $data) { ?>
|
<?php foreach($members as $i => $data) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $data['uname']; ?></td>
|
<td><?= $data['uname']; ?></td>
|
||||||
<td><?php echo $data['name']; ?></td>
|
<td><?= $data['name']; ?></td>
|
||||||
<td><?php echo $data['role']; ?></td>
|
<td><?= $data['role']; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
require __DIR__ . '/../../../inc/navbar.php';
|
require __DIR__ . '/../../../inc/navbar.php';
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->hasGroup($uname, 'prosjekt')){
|
if(!$userManager->hasGroup($uname, 'prosjekt')){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$projectManager = new pvv\side\ProjectManager($pdo);
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
||||||
$projects = $projectManager->getAll();
|
$projects = $projectManager->getAll();
|
||||||
|
|
||||||
$page = 1;
|
$page = 1;
|
||||||
@ -43,7 +43,9 @@ if(isset($_POST['organiser'])){
|
|||||||
// filter
|
// filter
|
||||||
$projects = array_values(array_filter(
|
$projects = array_values(array_filter(
|
||||||
$projects,
|
$projects,
|
||||||
static fn($project) => preg_match('/.*' . $filterTitle . '.*/i', $project->getName())
|
function($project) use ($filterTitle){
|
||||||
|
return (preg_match('/.*'.$filterTitle.'.*/i', $project->getName()));
|
||||||
|
}
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -80,7 +82,7 @@ $projects = array_values(array_filter(
|
|||||||
$counter = 0;
|
$counter = 0;
|
||||||
$pageLimit = 4;
|
$pageLimit = 4;
|
||||||
|
|
||||||
for ($i = ($pageLimit * ($page - 1)); $i < count($projects); ++$i) {
|
for($i = ($pageLimit * ($page - 1)); $i < count($projects); $i++){
|
||||||
if($counter == $pageLimit){
|
if($counter == $pageLimit){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -93,23 +95,23 @@ $projects = array_values(array_filter(
|
|||||||
<li>
|
<li>
|
||||||
<div class="event admin">
|
<div class="event admin">
|
||||||
<div class="event-info">
|
<div class="event-info">
|
||||||
<h3 class="no-chin"><?php echo $project->getName() . ' (ID: ' . $projectID . ')'; ?></h3>
|
<h3 class="no-chin"><?= $project->getName() . " (ID: " . $projectID . ")"; ?></h3>
|
||||||
<p class="subnote"><?php echo 'Organisert av: ' . $owner['name']; ?></p>
|
<p class="subnote"><?= 'Organisert av: ' . $owner['name']; ?></p>
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", $project->getDescription()));
|
echo $Parsedown->text(implode("\n", $project->getDescription()));
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="event-actions">
|
<div class="event-actions">
|
||||||
<?php echo '<a href="edit.php?id=' . $projectID . '">🖊</a>'; ?>
|
<?= '<a href="edit.php?id=' . $projectID . '">🖊</a>'; ?>
|
||||||
<?php echo '<a href="delete.php?id=' . $projectID . '" onclick="return confirm(\'Knallsikker? (ID: ' . $projectID . ')\');">🗑</a>'; ?>
|
<?= '<a href="delete.php?id=' . $projectID . '" onclick="return confirm(\'Knallsikker? (ID: ' . $projectID . ')\');">🗑</a>'; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
++$counter;
|
$counter++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
@ -119,7 +121,7 @@ $projects = array_values(array_filter(
|
|||||||
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '">Forrige side</a>';
|
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '">Forrige side</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($counter == $pageLimit) && (($pageLimit * $page) < count($projects))) {
|
if(($counter == $pageLimit) and (($pageLimit * $page) < count($projects))){
|
||||||
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '">Neste side</a>';
|
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '">Neste side</a>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -131,9 +133,9 @@ $projects = array_values(array_filter(
|
|||||||
<h2>Filter</h2>
|
<h2>Filter</h2>
|
||||||
<form action="." method="post">
|
<form action="." method="post">
|
||||||
<p class="no-chin">Prosjektnavn</p>
|
<p class="no-chin">Prosjektnavn</p>
|
||||||
<?php echo '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">'; ?><br>
|
<?= '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">' ?><br>
|
||||||
<p class="no-chin">Leders brukernavn</p>
|
<p class="no-chin">Leders brukernavn</p>
|
||||||
<?php echo '<input type="text" name="organiser" class="boxinput" value="">'; ?><br>
|
<?= '<input type="text" name="organiser" class="boxinput" value="">' ?><br>
|
||||||
|
|
||||||
<div style="margin-top: 2em;">
|
<div style="margin-top: 2em;">
|
||||||
<input type="submit" class="btn" value="Filtrer"></input>
|
<input type="submit" class="btn" value="Filtrer"></input>
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
require __DIR__ . '/../../../src/_autoload.php';
|
require __DIR__ . '/../../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../../config.php';
|
require __DIR__ . '/../../../config.php';
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
|
|
||||||
if(!$userManager->hasGroup($uname, 'prosjekt')){
|
if(!$userManager->hasGroup($uname, 'prosjekt')){
|
||||||
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
echo 'Her har du ikke lov\'t\'å\'værra!!!';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_POST['title']) || !isset($_POST['desc']) || !isset($_POST['organisername']) || !isset($_POST['organiser'])) {
|
if(!isset($_POST['title']) or !isset($_POST['desc']) or !isset($_POST['organisername']) or !isset($_POST['organiser'])){
|
||||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = 0;
|
$id = 0;
|
||||||
@ -33,9 +33,9 @@ $desc = $_POST['desc'];
|
|||||||
$name = $_POST['organisername'];
|
$name = $_POST['organisername'];
|
||||||
$uname = $_POST['organiser'];
|
$uname = $_POST['organiser'];
|
||||||
$mail = $_POST['organiseremail'];
|
$mail = $_POST['organiseremail'];
|
||||||
$active = ($_POST['active'] ?? 0);
|
$active = (isset($_POST['active']) ? $_POST['active'] : 0);
|
||||||
|
|
||||||
|
|
||||||
|
$statement;
|
||||||
if($id == 0){
|
if($id == 0){
|
||||||
$query = 'INSERT INTO projects (name, description, active) VALUES (:title, :desc, :active)';
|
$query = 'INSERT INTO projects (name, description, active) VALUES (:title, :desc, :active)';
|
||||||
$statement = $pdo->prepare($query);
|
$statement = $pdo->prepare($query);
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
<?php
|
<?php namespace pvv\side;
|
||||||
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
namespace pvv\side;
|
|
||||||
|
|
||||||
require_once \dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
|
||||||
|
|
||||||
$year = (isset($_GET['year']))
|
$year = (isset($_GET['year']))
|
||||||
? $_GET['year']
|
? $_GET['year']
|
||||||
: date('Y');
|
: date("Y");
|
||||||
$month = (isset($_GET['month']))
|
$month = (isset($_GET['month']))
|
||||||
? $_GET['month']
|
? $_GET['month']
|
||||||
: date('m');
|
: date("m");
|
||||||
$day = (isset($_GET['day']))
|
$day = (isset($_GET['day']))
|
||||||
? $_GET['day']
|
? $_GET['day']
|
||||||
: -1;
|
: -1;
|
||||||
@ -37,42 +34,38 @@ $day = (isset($_GET['day']))
|
|||||||
|
|
||||||
<main>
|
<main>
|
||||||
<?php
|
<?php
|
||||||
use DateTimeImmutable;
|
use \DateTimeImmutable;
|
||||||
|
|
||||||
$events = ($day==-1)
|
$events = ($day==-1)
|
||||||
? $agenda->getNextOfEach(new DateTimeImmutable())
|
? $agenda->getNextOfEach(new \DateTimeImmutable)
|
||||||
: $agenda->getEventsBetween(
|
: $agenda->getEventsBetween(
|
||||||
new DateTimeImmutable("{$year}-{$month}-{$day} 00:00:00"),
|
new DateTimeImmutable("$year-$month-$day 00:00:00"),
|
||||||
new DateTimeImmutable("{$year}-{$month}-{$day} 23:59:59")
|
new DateTimeImmutable("$year-$month-$day 23:59:59"));
|
||||||
);
|
|
||||||
|
|
||||||
$limit = 0;
|
$limit = 0;
|
||||||
foreach($events as $event) {
|
foreach($events as $event) {
|
||||||
?>
|
?>
|
||||||
<article>
|
<article>
|
||||||
<h2>
|
<h2>
|
||||||
<?php if (Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
|
<?php if (\pvv\side\Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
|
||||||
<em><?php echo $event->getRelativeDate(); ?></em>
|
<em><?= $event->getRelativeDate() ?></em>
|
||||||
<?php if (Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
|
<?php if (\pvv\side\Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
|
||||||
<?php if ($event->getURL()) { ?>
|
<?php if ($event->getURL()) { ?>
|
||||||
<a href="<?php echo $event->getURL(); ?>"><?php echo $event->getName(); ?></a>
|
<a href="<?= $event->getURL() ?>"><?= $event->getName() ?></a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<?php echo $event->getName(); ?>
|
<?= $event->getName() ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($event->getImageURL()) { ?>
|
<?php if ($event->getImageURL()) { ?>
|
||||||
<img src="<?php echo $event->getImageURL(); ?>">
|
<img src="<?= $event->getImageURL() ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid: <strong><?php echo Agenda::getFormattedDate($event->getStart()); ?></strong></li>
|
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong></li>
|
||||||
<li>Sted: <strong><?php echo $event->getLocation(); ?></strong></li>
|
<li>Sted: <strong><?= $event->getLocation() ?></strong></li>
|
||||||
<li>Arrangør: <strong><?php echo $event->getOrganiser(); ?></strong></li>
|
<li>Arrangør: <strong><?= $event->getOrganiser() ?></strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?php $description = $event->getDescription(); ?>
|
<?php $description = $event->getDescription(); ?>
|
||||||
<?php if ($limit) {
|
<?php if ($limit) array_splice($description, $limit); ?>
|
||||||
array_splice($description, $limit);
|
|
||||||
} ?>
|
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new \Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", $description));
|
echo $Parsedown->text(implode("\n", $description));
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
use pvv\side\Agenda;
|
use \pvv\side\Agenda;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@ -21,33 +20,33 @@ use pvv\side\Agenda;
|
|||||||
<main>
|
<main>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$activity = new pvv\side\social\AnimekveldActivity();
|
$activity = new \pvv\side\social\AnimekveldActivity;
|
||||||
$nextEvent = $activity->getNextEventFrom(new DateTimeImmutable());
|
$nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<h2><em><?php echo $nextEvent->getRelativeDate(); ?></em> Animekveld
|
<h2><em><?= $nextEvent->getRelativeDate()?></em> Animekveld
|
||||||
<?php if ($nextEvent->getImageURL()) { ?>
|
<?php if ($nextEvent->getImageURL()) { ?>
|
||||||
<img src="<?php echo $nextEvent->getImageURL(); ?>">
|
<img src="<?= $nextEvent->getImageURL() ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid:
|
<li>Tid:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo Agenda::getFormattedDate($nextEvent->getStart()); ?>
|
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Sted:
|
<li>Sted:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo $nextEvent->getLocation(); ?>
|
<?= $nextEvent->getLocation();?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Arrangør:
|
<li>Arrangør:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo $nextEvent->getOrganiser(); ?>
|
<?= $nextEvent->getOrganiser();?>
|
||||||
</strong>
|
</strong>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
|
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
|
||||||
?>
|
?>
|
||||||
</article>
|
</article>
|
||||||
@ -55,6 +54,6 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable());
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?php echo navbar(1, 'aktiviteter'); ?>
|
<?= navbar(1, 'aktiviteter'); ?>
|
||||||
<?php echo loginbar($sp, $pdo); ?>
|
<?= loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
use pvv\side\Agenda;
|
use \pvv\side\Agenda;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@ -21,34 +20,34 @@ use pvv\side\Agenda;
|
|||||||
<main>
|
<main>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$activity = new pvv\side\social\BrettspillActivity();
|
$activity = new \pvv\side\social\BrettspillActivity;
|
||||||
$nextEvent = $activity->getNextEventFrom(new DateTimeImmutable());
|
$nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
|
|
||||||
<h2><em><?php echo $nextEvent->getRelativeDate(); ?></em> Brettspillkveld
|
<h2><em><?= $nextEvent->getRelativeDate()?></em> Brettspillkveld
|
||||||
<?php if ($nextEvent->getImageURL()) { ?>
|
<?php if ($nextEvent->getImageURL()) { ?>
|
||||||
<img src="<?php echo $nextEvent->getImageURL(); ?>">
|
<img src="<?= $nextEvent->getImageURL() ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid:
|
<li>Tid:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo Agenda::getFormattedDate($nextEvent->getStart()); ?>
|
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Sted:
|
<li>Sted:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo $nextEvent->getLocation(); ?>
|
<?= $nextEvent->getLocation();?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Arrangør:
|
<li>Arrangør:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo $nextEvent->getOrganiser(); ?>
|
<?= $nextEvent->getOrganiser();?>
|
||||||
</strong>
|
</strong>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
|
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
|
||||||
?>
|
?>
|
||||||
</article>
|
</article>
|
||||||
@ -56,6 +55,6 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable());
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?php echo navbar(1, 'aktiviteter'); ?>
|
<?= navbar(1, 'aktiviteter'); ?>
|
||||||
<?php echo loginbar($sp, $pdo); ?>
|
<?= loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -65,23 +65,39 @@ img.float-right {
|
|||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.calendar-events ul li :not(.date):not(.time) {
|
||||||
|
display: inline-block;
|
||||||
|
width: calc(100% - 7em);
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.calendar-events ul .date {
|
||||||
|
color: rgba(0, 0, 0, 0.5);
|
||||||
|
font-size: 0.8em;
|
||||||
|
margin-top: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar-events > li > p {
|
||||||
|
border-bottom: 0.1em dotted rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
.calendar-events ul {
|
.calendar-events ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-events a {
|
.calendar-events a,
|
||||||
color: rgba(0,0,0, 0.85);
|
|
||||||
}
|
|
||||||
|
|
||||||
.calendar-events ul .datetime {
|
.calendar-events ul .time {
|
||||||
color: rgba(0, 0, 0, 0.5);
|
color: rgba(0, 0, 0, 0.5);
|
||||||
float: right;
|
float: right;
|
||||||
margin-left: 0.2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-events ul li {
|
.calendar-events ul .icon,
|
||||||
margin-bottom: 0.4em;
|
.calendar-events ul .date {
|
||||||
|
float: right;
|
||||||
|
margin-right: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
main.contentsplit {
|
main.contentsplit {
|
||||||
|
@ -1,67 +1,65 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
|
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
$door = new pvv\side\Door($pdo);
|
$door = new \pvv\side\Door($pdo);
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
|
if (isset($_SERVER["HTTP_AUTHORIZATION"])) {
|
||||||
[$type, $data] = explode(' ', $_SERVER['HTTP_AUTHORIZATION'], 2);
|
list($type, $data) = explode(" ", $_SERVER["HTTP_AUTHORIZATION"], 2);
|
||||||
if (strcasecmp($type, 'Bearer') == 0) {
|
if (strcasecmp($type, "Bearer") == 0) {
|
||||||
if (hash_equals($data, $DOOR_SECRET)) {
|
if (hash_equals($data, $DOOR_SECRET)) {
|
||||||
handleSetState();
|
handleSetState();
|
||||||
} else {
|
} else {
|
||||||
echo '{"status": "error", "message": "Invalid authentication key"}';
|
echo '{"status": "error", "message": "Invalid authentication key"}';
|
||||||
exit;
|
die();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '{"status": "error", "message": "Invalid authentication method"}';
|
echo '{"status": "error", "message": "Invalid authentication method"}';
|
||||||
exit;
|
die();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '{"status": "error", "message": "Missing authentication"}';
|
echo '{"status": "error", "message": "Missing authentication"}';
|
||||||
exit;
|
die();
|
||||||
}
|
}
|
||||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
} elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||||
|
|
||||||
if (isset($_GET['period'])) {
|
if (isset($_GET["period"])) {
|
||||||
$period = (string) htmlspecialchars($_GET['period']);
|
$period = (string)htmlspecialchars($_GET["period"]);
|
||||||
|
|
||||||
if ($period == 'day') {
|
if ($period == "day") {
|
||||||
$startTime = time() - (60*60*24);
|
$startTime = time() - (60*60*24);
|
||||||
} elseif ($period == 'week') {
|
} else if ($period == "week") {
|
||||||
$startTime = time() - (60*60*24*7);
|
$startTime = time() - (60*60*24*7);
|
||||||
} else {
|
} else {
|
||||||
echo '{"status": "error", "message": "Invalid period"}';
|
echo '{"status": "error", "message": "Invalid period"}';
|
||||||
exit;
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$lines = $door->getEntriesAfter($startTime);
|
$lines = $door->getEntriesAfter($startTime);
|
||||||
if (isset($_GET['edgeonly']) && (bool) htmlspecialchars($_GET['edgeonly'])) {
|
if (isset($_GET["edgeonly"]) && (bool)htmlspecialchars($_GET["edgeonly"])) {
|
||||||
//Ignore repeats
|
//Ignore repeats
|
||||||
$lines = getChanges($lines);
|
$lines = getChanges($lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
'status' => 'OK',
|
'status' => "OK",
|
||||||
'entries' => $lines,
|
'entries' => $lines
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
//Only last entry
|
//Only last entry
|
||||||
$line = (object)$door->getCurrent();
|
$line = (object)$door->getCurrent();
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
'status' => 'OK',
|
'status' => "OK",
|
||||||
'time' => $line->time,
|
'time' => $line->time,
|
||||||
'open' => $line->open,
|
'open' => $line->open
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function handleSetState(): void {
|
function handleSetState() {
|
||||||
global $door;
|
global $door;
|
||||||
|
|
||||||
$jsonobj = file_get_contents('php://input');
|
$jsonobj = file_get_contents('php://input');
|
||||||
@ -69,14 +67,14 @@ function handleSetState(): void {
|
|||||||
|
|
||||||
if ((!isset($event->time)) || (!is_numeric($event->time))) {
|
if ((!isset($event->time)) || (!is_numeric($event->time))) {
|
||||||
echo '{"status": "error", "message": "Invalid timestamp"}';
|
echo '{"status": "error", "message": "Invalid timestamp"}';
|
||||||
exit;
|
die();
|
||||||
}
|
}
|
||||||
if ((!isset($event->isDoorOpen)) || (!is_bool($event->isDoorOpen))) {
|
if ((!isset($event->isDoorOpen)) || (!is_bool($event->isDoorOpen))) {
|
||||||
echo '{"status": "error", "message": "Invalid door state"}';
|
echo '{"status": "error", "message": "Invalid door state"}';
|
||||||
exit;
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$door->createEvent((int) $event->time, $event->isDoorOpen ? 1 : 0);
|
$door->createEvent((int)($event->time), $event->isDoorOpen ? 1 : 0);
|
||||||
echo '{"status": "OK"}';
|
echo '{"status": "OK"}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,9 +83,9 @@ function getChanges($items) {
|
|||||||
$res = [];
|
$res = [];
|
||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
if ($item['open'] !== $prevState) {
|
if ($item["open"] !== $prevState) {
|
||||||
$res[] = $item;
|
array_push($res, $item);
|
||||||
$prevState = $item['open'];
|
$prevState = $item["open"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
use pvv\side\Agenda;
|
use \pvv\side\Agenda;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@ -21,33 +20,33 @@ use pvv\side\Agenda;
|
|||||||
<main>
|
<main>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$activity = new pvv\side\social\DriftkveldActivity();
|
$activity = new \pvv\side\social\DriftkveldActivity;
|
||||||
$nextEvent = $activity->getNextEventFrom(new DateTimeImmutable());
|
$nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<h2><em><?php echo $nextEvent->getRelativeDate(); ?></em> Driftkveld
|
<h2><em><?= $nextEvent->getRelativeDate()?></em> Driftkveld
|
||||||
<?php if ($nextEvent->getImageURL()) { ?>
|
<?php if ($nextEvent->getImageURL()) { ?>
|
||||||
<img src="<?php echo $nextEvent->getImageURL(); ?>">
|
<img src="<?= $nextEvent->getImageURL() ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid:
|
<li>Tid:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo Agenda::getFormattedDate($nextEvent->getStart()); ?>
|
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Sted:
|
<li>Sted:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo $nextEvent->getLocation(); ?>
|
<?= $nextEvent->getLocation();?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Arrangør:
|
<li>Arrangør:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo $nextEvent->getOrganiser(); ?>
|
<?= $nextEvent->getOrganiser();?>
|
||||||
</strong>
|
</strong>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
|
echo $Parsedown->text(implode("\n", $nextEvent->getDescription()));
|
||||||
?>
|
?>
|
||||||
</article>
|
</article>
|
||||||
@ -55,6 +54,6 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable());
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?php echo navbar(1, 'aktiviteter'); ?>
|
<?= navbar(1, 'aktiviteter'); ?>
|
||||||
<?php echo loginbar($sp, $pdo); ?>
|
<?= loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
$userManager = new pvv\admin\UserManager($pdo);
|
$userManager = new \pvv\admin\UserManager($pdo);
|
||||||
|
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
$loginname = $attrs['uid'][0];
|
$loginname = $attrs['uid'][0];
|
||||||
@ -15,40 +15,39 @@ $loginname = $attrs['uid'][0];
|
|||||||
if(!$loginname) {
|
if(!$loginname) {
|
||||||
header('Content-Type: text/plain', true, 403);
|
header('Content-Type: text/plain', true, 403);
|
||||||
echo "Du må være logget inn for å se bildegalleriet.\r\n";
|
echo "Du må være logget inn for å se bildegalleriet.\r\n";
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sourced from config.php through include.php
|
# Sourced from config.php through include.php
|
||||||
$galleryDir = $GALLERY_DIR;
|
$galleryDir = $GALLERY_DIR;
|
||||||
$serverPath = $GALLERY_SERVER_PATH;
|
$serverPath = $GALLERY_SERVER_PATH;
|
||||||
|
|
||||||
$allowedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp'];
|
$allowedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp'];
|
||||||
$unamefile = $galleryDir . '/usernames.txt';
|
$unamefile = $galleryDir . "/usernames.txt";
|
||||||
|
|
||||||
$unamepairs = file($unamefile);
|
$unamepairs = file($unamefile);
|
||||||
|
|
||||||
function getDirContents($dir, &$results = []) {
|
function getDirContents($dir, &$results = array()) {
|
||||||
$files = scandir($dir);
|
$files = scandir($dir);
|
||||||
foreach ($files as $key => $value) {
|
foreach ($files as $key => $value) {
|
||||||
$path = realpath($dir . \DIRECTORY_SEPARATOR . $value);
|
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
|
||||||
if (!is_dir($path)) {
|
if (!is_dir($path)) {
|
||||||
//Remove the full path on disk, keep username and relative path to image.
|
//Remove the full path on disk, keep username and relative path to image.
|
||||||
$pos = strpos($path, $GLOBALS['galleryDir']);
|
$pos = strpos($path, $GLOBALS["galleryDir"]);
|
||||||
if ($pos !== false) {
|
if ($pos !== false) {
|
||||||
$cleanPath = substr_replace($path, '', $pos, strlen($GLOBALS['galleryDir']));
|
$cleanPath = substr_replace($path, "", $pos, strlen($GLOBALS["galleryDir"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if the file is an image
|
//Check if the file is an image
|
||||||
$ext = strtolower(pathinfo($path, \PATHINFO_EXTENSION));
|
$ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
|
||||||
if (in_array($ext, $GLOBALS['allowedExtensions'], true)) {
|
if (in_array($ext, $GLOBALS["allowedExtensions"])) {
|
||||||
$results[] = $cleanPath;
|
$results[] = $cleanPath;
|
||||||
}
|
}
|
||||||
} elseif ($value != '.' && $value != '..' && $value != '.thumbnails') {
|
} else if ($value != "." && $value != ".." && $value != ".thumbnails") {
|
||||||
//recursively scan directories
|
//recursively scan directories
|
||||||
getDirContents($path, $results);
|
getDirContents($path, $results);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
$images = getDirContents($galleryDir);
|
$images = getDirContents($galleryDir);
|
||||||
@ -62,7 +61,7 @@ function cmpModifyTime($a, $b) {
|
|||||||
return ($mtime_a > $mtime_b) ? -1 : 1;
|
return ($mtime_a > $mtime_b) ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($images, 'cmpModifyTime');
|
usort($images, "cmpModifyTime");
|
||||||
|
|
||||||
$imageTemplate = '
|
$imageTemplate = '
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@ -78,7 +77,7 @@ $imageTemplate = '
|
|||||||
<p class="card-footer-item">%time</p>
|
<p class="card-footer-item">%time</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
';
|
'
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -102,12 +101,12 @@ $imageTemplate = '
|
|||||||
<main class="gallery-container">
|
<main class="gallery-container">
|
||||||
<?php
|
<?php
|
||||||
foreach ($images as $key => $value) {
|
foreach ($images as $key => $value) {
|
||||||
$modTime = date('d.m.Y H:i', filemtime($galleryDir . $value));
|
$modTime = date("d.m.Y H:i", filemtime($galleryDir . $value));
|
||||||
$imguser = explode('/', $value)[1];
|
$imguser = explode("/", $value)[1];
|
||||||
$displaypath = implode('/', array_slice(explode('/', $value), 2));
|
$displaypath = implode("/", array_slice(explode("/", $value), 2));
|
||||||
$realname = 'Ukjent';
|
$realname = "Ukjent";
|
||||||
foreach ($unamepairs as $unamepair) {
|
foreach ($unamepairs as $unamepair) {
|
||||||
$unamepair = explode(':', $unamepair);
|
$unamepair = explode(":", $unamepair);
|
||||||
if ($unamepair[0] == $imguser) {
|
if ($unamepair[0] == $imguser) {
|
||||||
$realname = $unamepair[1];
|
$realname = $unamepair[1];
|
||||||
break;
|
break;
|
||||||
@ -115,12 +114,12 @@ $imageTemplate = '
|
|||||||
}
|
}
|
||||||
|
|
||||||
$vars = [
|
$vars = [
|
||||||
'%user' => htmlspecialchars($imguser),
|
"%user" => htmlspecialchars($imguser),
|
||||||
'%time' => $modTime,
|
"%time" => $modTime,
|
||||||
'%name' => htmlspecialchars($displaypath),
|
"%name" => htmlspecialchars($displaypath),
|
||||||
'%path' => $serverPath . $value,
|
"%path" => $serverPath . $value,
|
||||||
'%thumbnail' => $serverPath . '/.thumbnails' . $value . '.png',
|
"%thumbnail" => $serverPath . "/.thumbnails" . $value . ".png",
|
||||||
'%realname' => htmlspecialchars($realname),
|
"%realname" => htmlspecialchars($realname)
|
||||||
];
|
];
|
||||||
echo strtr($imageTemplate, $vars);
|
echo strtr($imageTemplate, $vars);
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
require __DIR__ . '/../../config.php';
|
require __DIR__ . '/../../config.php';
|
||||||
|
|
||||||
$searchDir = $SLIDESHOW_DIR;
|
$searchDir = $SLIDESHOW_DIR;
|
||||||
$serverPath = $SLIDESHOW_SERVER_PATH;
|
$serverPath = $SLIDESHOW_SERVER_PATH;
|
||||||
|
|
||||||
$splashImg = '/PNG/PVV-logo-big-bluebg.png';
|
$splashImg = "/PNG/PVV-logo-big-bluebg.png";
|
||||||
|
|
||||||
// Note: This does not support nested directories
|
// Note: This does not support nested directories
|
||||||
$filenames = scandir($searchDir);
|
$filenames = sCaNdIr($searchDir);
|
||||||
|
|
||||||
//Remove the expected non-images
|
//Remove the expected non-images
|
||||||
foreach($filenames as $k => $value) {
|
foreach($filenames as $k => $value) {
|
||||||
if (in_array($value, ['.', '..'], true)) {
|
if(in_array($value, [".", ".."])) {
|
||||||
unset($filenames[$k]);
|
unset($filenames[$k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFullPath($fname) {
|
function getFullPath($fname) { return ($GLOBALS["serverPath"] . "/" . $fname ); }
|
||||||
return $GLOBALS['serverPath'] . '/' . $fname;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort filenames alphabetically and prepend the path prefix to each item.
|
// Sort filenames alphabetically and prepend the path prefix to each item.
|
||||||
asort($filenames);
|
asort($filenames);
|
||||||
$slideshowimagefilenames = aRrAy_MaP('getFullPath', $filenames);
|
$slideshowimagefilenames = aRrAy_MaP("getFullPath", $filenames);
|
||||||
|
|
||||||
// Prepend the cover photo
|
// Prepend the cover photo
|
||||||
ArRaY_uNsHiFt($slideshowimagefilenames, $splashImg);
|
ArRaY_uNsHiFt($slideshowimagefilenames, $splashImg);
|
||||||
|
|
||||||
eChO '<img class="slideshowimg slideshowactive" id="slideshowImage1" src="' . $slideshowimagefilenames[0] . '">';
|
eChO('<img class="slideshowimg slideshowactive" id="slideshowImage1" src="' . $slideshowimagefilenames[0] . '">');
|
||||||
ecHo '<img class="slideshowimg" id="slideshowImage2" src="' . $slideshowimagefilenames[1] . '">';
|
ecHo('<img class="slideshowimg" id="slideshowImage2" src="' . $slideshowimagefilenames[1] . '">');
|
||||||
// Store list of file names in a globel JS variable
|
// Store list of file names in a globel JS variable
|
||||||
EchO '<script> const slideshowFnames =' . jSoN_eNcOdE($slideshowimagefilenames) . '; </script>';
|
EchO("<script> const slideshowFnames =" . jSoN_eNcOdE($slideshowimagefilenames) . "; </script>");
|
||||||
|
|
||||||
|
?>
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?php
|
<?php namespace pvv\side;
|
||||||
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
namespace pvv\side;
|
|
||||||
|
|
||||||
require_once \dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
|
||||||
|
|
||||||
$translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden', 'Neste måned'];
|
$translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden', 'Neste måned'];
|
||||||
?>
|
?>
|
||||||
@ -21,8 +18,8 @@ $translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden',
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<?php echo navbar(1, 'hendelser'); ?>
|
<?= navbar(1, 'hendelser'); ?>
|
||||||
<?php echo loginbar($sp, $pdo); ?>
|
<?= loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
<main>
|
<main>
|
||||||
<h1 style="pointer-events:none; text-align: left;">Hendelser</h1>
|
<h1 style="pointer-events:none; text-align: left;">Hendelser</h1>
|
||||||
@ -33,22 +30,20 @@ $translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden',
|
|||||||
$description_paragraphs = 2; //description length
|
$description_paragraphs = 2; //description length
|
||||||
foreach($agenda->getNextDays() as $period => $events) {
|
foreach($agenda->getNextDays() as $period => $events) {
|
||||||
if ($events) { ?>
|
if ($events) { ?>
|
||||||
<h2 style="text-align: left;"><?php echo $translation[$period]; ?></h2>
|
<h2 style="text-align: left;"><?= $translation[$period] ?></h2>
|
||||||
<ul class="events">
|
<ul class="events">
|
||||||
<?php foreach($events as $event) {?>
|
<?php foreach($events as $event) {?>
|
||||||
<li style="border-color: <?php echo $event->getColor(); ?>">
|
<li style="border-color: <?= $event->getColor() ?>">
|
||||||
<h4><strong>
|
<h4><strong>
|
||||||
<?php if ($event->getURL()) { ?>
|
<?php if ($event->getURL()) { ?>
|
||||||
<a href="<?php echo $event->getURL(); ?>"><?php echo $event->getName(); ?></a>
|
<a href="<?= $event->getURL() ?>"><?= $event->getName() ?></a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<?php echo $event->getName(); ?>
|
<?= $event->getName() ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</strong></h4>
|
</strong></h4>
|
||||||
|
|
||||||
<?php $description = $event->getDescription(); ?>
|
<?php $description = $event->getDescription(); ?>
|
||||||
<?php if ($description_paragraphs) {
|
<?php if ($description_paragraphs) array_splice($description, $description_paragraphs); ?>
|
||||||
array_splice($description, $description_paragraphs);
|
|
||||||
} ?>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new \Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
@ -56,9 +51,9 @@ $translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden',
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid: <strong><?php echo Agenda::getFormattedDate($event->getStart()); ?></strong></li>
|
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong></li>
|
||||||
<li>Sted: <strong><?php echo $event->getLocation(); ?></strong></li>
|
<li>Sted: <strong><?= $event->getLocation() ?></strong></li>
|
||||||
<li>Arrangør: <strong><?php echo $event->getOrganiser(); ?></strong></li>
|
<li>Arrangør: <strong><?= $event->getOrganiser() ?></strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
use pvv\side\Agenda;
|
use \pvv\side\Agenda;
|
||||||
|
|
||||||
$eventID = 0;
|
$eventID = 0;
|
||||||
if(isset($_GET['id'])){
|
if(isset($_GET['id'])){
|
||||||
$eventID = $_GET['id'];
|
$eventID = $_GET['id'];
|
||||||
}else{
|
}else{
|
||||||
echo 'No event ID provided';
|
echo 'No event ID provided';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbActivity = new pvv\side\DBActivity($pdo);
|
$dbActivity = new \pvv\side\DBActivity($pdo);
|
||||||
$event = $dbActivity->getEventByID($eventID);
|
$event = $dbActivity->getEventByID($eventID);
|
||||||
if(!$event){
|
if(!$event){
|
||||||
echo 'Failed to retrieve event info';
|
echo 'Failed to retrieve event info';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -34,21 +34,21 @@ if (!$event) {
|
|||||||
<main>
|
<main>
|
||||||
<article>
|
<article>
|
||||||
<h2>
|
<h2>
|
||||||
<?php if (Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
|
<?php if (\pvv\side\Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
|
||||||
<em><?php echo $event->getRelativeDate(); ?></em>
|
<em><?= $event->getRelativeDate() ?></em>
|
||||||
<?php if (Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
|
<?php if (\pvv\side\Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
|
||||||
|
|
||||||
<?php echo $event->getName(); ?>
|
<?= $event->getName() ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid: <strong><?php echo Agenda::getFormattedDate($event->getStart()); ?></strong></li>
|
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong></li>
|
||||||
<li>Sted: <strong><?php echo $event->getLocation(); ?></strong></li>
|
<li>Sted: <strong><?= $event->getLocation() ?></strong></li>
|
||||||
<li>Arrangør: <strong><?php echo $event->getOrganiser(); ?></strong></li>
|
<li>Arrangør: <strong><?= $event->getOrganiser() ?></strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?php $description = $event->getDescription(); ?>
|
<?php $description = $event->getDescription(); ?>
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", $description));
|
echo $Parsedown->text(implode("\n", $description));
|
||||||
?>
|
?>
|
||||||
</article>
|
</article>
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
|
|
||||||
$translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden', 'Neste måned'];
|
$translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden', 'Neste måned'];
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
$motdfetcher = new pvv\side\MOTD($pdo);
|
$motdfetcher = new \pvv\side\MOTD($pdo);
|
||||||
$motd = $motdfetcher->getMOTD();
|
$motd = $motdfetcher->getMOTD();
|
||||||
|
|
||||||
$door = new pvv\side\Door($pdo);
|
$door = new \pvv\side\Door($pdo);
|
||||||
$doorEntry = (object) $door->getCurrent();
|
$doorEntry = (object)($door->getCurrent());
|
||||||
if ($doorEntry->time < (time() - 60*30)) {
|
if ($doorEntry->time < (time() - 60*30)) {
|
||||||
$doorStateText = 'Ingen data fra dørsensor';
|
$doorStateText = "Ingen data fra dørsensor";
|
||||||
} else {
|
} else {
|
||||||
if ($doorEntry->open) {
|
if ($doorEntry->open) { $doorStateText = "Døren er <b>åpen</b>";
|
||||||
$doorStateText = 'Døren er <b>åpen</b>';
|
} else { $doorStateText = "Døren er <b>ikke åpen</b>"; }
|
||||||
} else {
|
|
||||||
$doorStateText = 'Døren er <b>ikke åpen</b>';
|
|
||||||
}
|
}
|
||||||
}
|
$doorTime = date("H:i", $doorEntry->time);
|
||||||
$doorTime = date('H:i', $doorEntry->time);
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@ -44,7 +41,7 @@ $doorTime = date('H:i', $doorEntry->time);
|
|||||||
|
|
||||||
<header class="landing">
|
<header class="landing">
|
||||||
<div id="imageSlideshow">
|
<div id="imageSlideshow">
|
||||||
<?php include 'galleri/slideshow.php'; ?>
|
<?php include("galleri/slideshow.php"); ?>
|
||||||
<script src="js/slideshow.js"></script>
|
<script src="js/slideshow.js"></script>
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
@ -55,9 +52,9 @@ $doorTime = date('H:i', $doorEntry->time);
|
|||||||
<a class="btn" href="om/"><li>Om PVV</li></a>
|
<a class="btn" href="om/"><li>Om PVV</li></a>
|
||||||
<a class="btn focus" href="paamelding/"><li>Bli medlem!</li></a>
|
<a class="btn focus" href="paamelding/"><li>Bli medlem!</li></a>
|
||||||
<a class="btn" href="https://use.mazemap.com/#config=ntnu&v=1&zlevel=2¢er=10.406281,63.417093&zoom=19.5&campuses=ntnu&campusid=1&sharepoitype=poi&sharepoi=38159&utm_medium=longurl">Veibeskrivelse</li></a>
|
<a class="btn" href="https://use.mazemap.com/#config=ntnu&v=1&zlevel=2¢er=10.406281,63.417093&zoom=19.5&campuses=ntnu&campusid=1&sharepoitype=poi&sharepoi=38159&utm_medium=longurl">Veibeskrivelse</li></a>
|
||||||
<div id="doorIndicator" class="<?php echo $doorEntry->open ? 'doorIndicator_OPEN' : 'doorIndicator_CLOSED'; ?>" onclick="location.href='/door/graph.html'">
|
<div id="doorIndicator" class="<?php echo($doorEntry->open ? "doorIndicator_OPEN" : "doorIndicator_CLOSED"); ?>" onclick="location.href='/door/graph.html'">
|
||||||
<p class="doorStateText"><?php echo $doorStateText; ?></p>
|
<p class="doorStateText"><?php echo($doorStateText) ?></p>
|
||||||
<p class="doorStateTime">(Oppdatert <?php echo $doorTime; ?>)</p>
|
<p class="doorStateTime">(Oppdatert <?php echo($doorTime) ?>)</p>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -69,59 +66,51 @@ $doorTime = date('H:i', $doorEntry->time);
|
|||||||
<div class="calendar-events">
|
<div class="calendar-events">
|
||||||
<?php $counter1 = 0; ?>
|
<?php $counter1 = 0; ?>
|
||||||
<?php $counter2 = 0; ?>
|
<?php $counter2 = 0; ?>
|
||||||
<?php foreach ($agenda->getNextDays() as $period => $events) {
|
<?php foreach($agenda->getNextDays() as $period => $events) if ($events && $counter1 < 3 && $counter2 < 10) { $counter1++ ?>
|
||||||
if ($events && $counter1 < 3 && $counter2 < 10) {
|
<p class="no-chin"><?= $translation[$period] ?></p>
|
||||||
$counter1++; ?>
|
|
||||||
<p class="no-chin"><?php echo $translation[$period]; ?></p>
|
|
||||||
<hr>
|
<hr>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($events as $event) {
|
<?php foreach($events as $event) { $counter2++ ?>
|
||||||
$counter2++; ?>
|
|
||||||
<li>
|
<li>
|
||||||
<?php if ($event->getURL()) { ?>
|
<?php if ($event->getURL()) { ?>
|
||||||
<a href="<?php echo htmlspecialchars($event->getURL()); ?>"><?php echo $event->getName(); ?></a>
|
<a href="<?= htmlspecialchars($event->getURL()) ?>"><?= $event->getName(); ?></a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<strong><?php echo $event->getName(); ?></strong>
|
<strong><?= $event->getName(); ?></strong>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<?php /* <a class="icon subscribe">+</a> */ ?>
|
||||||
<span class="datetime">
|
<?php if ($period !== \pvv\side\Agenda::TODAY) {
|
||||||
<?php if ($period !== pvv\side\Agenda::TODAY) {
|
echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
|
||||||
echo $event->getStart()->format('H:i') . ' ';
|
if (\pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) {
|
||||||
if (pvv\side\Agenda::isThisWeek($event->getStart()) || $event->getStart()->sub(new DateInterval('P3D'))->getTimestamp() < time()) {
|
echo '<span class="date">' . strftime('%a', $event->getStart()->getTimestamp()) . '</span>';
|
||||||
echo $event->getStart()->format('D');
|
|
||||||
} else {
|
} else {
|
||||||
echo $event->getStart()->format('j. F');
|
echo '<span class="date">' . strftime('%e. %b', $event->getStart()->getTimestamp()) . '</span>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo $event->getStart()->format('H:i');
|
echo '<span class="time">' . $event->getStart()->format('H:i') . '</span>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</span>
|
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php
|
<?php } ?>
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
<p><a class="btn" href="hendelser/">Flere aktiviteter</a></p>
|
<p><a class="btn" href="hendelser/">Flere aktiviteter</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="gridl">
|
<div class="gridl">
|
||||||
<?php
|
<?php
|
||||||
$title = $motd['title'];
|
$title = $motd["title"];
|
||||||
|
|
||||||
echo '<h1>';
|
echo "<h1>";
|
||||||
if ($title == '') {
|
if($title == ""){
|
||||||
echo 'Dagens melding';
|
echo "Dagens melding";
|
||||||
}else{
|
}else{
|
||||||
echo $title;
|
echo $title;
|
||||||
}
|
}
|
||||||
echo '</h1>';
|
echo "</h1>";
|
||||||
|
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", $motd['content']));
|
echo $Parsedown->text(implode("\n", $motd["content"]));
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
|
|
||||||
$year = (isset($_GET['year']))
|
$year = (isset($_GET['year']))
|
||||||
? $_GET['year']
|
? $_GET['year']
|
||||||
: date('Y');
|
: date("Y");
|
||||||
$month = (isset($_GET['month']))
|
$month = (isset($_GET['month']))
|
||||||
? $_GET['month']
|
? $_GET['month']
|
||||||
: date('m');
|
: date("m");
|
||||||
$days_before_the_first = (new DateTime($year . '-' . $month . '-01'))->format('w') - 1;
|
$days_before_the_first = (new DateTime($year."-".$month."-01"))->format("w") - 1;
|
||||||
if ($days_before_the_first == -1) {
|
if ($days_before_the_first==-1) {$days_before_the_first = 6;}
|
||||||
$days_before_the_first = 6;
|
$day_of_month = ($month == date("m"))
|
||||||
}
|
? date("j")
|
||||||
$day_of_month = ($month == date('m'))
|
|
||||||
? date('j')
|
|
||||||
: -1;
|
: -1;
|
||||||
$days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
|
$days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
|
||||||
|
|
||||||
@ -38,25 +36,18 @@ $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h2 style="text-align:center;">PVV Kalender for <?php echo $months_translations[$month - 1]; ?> <?php echo $year; ?></h2>
|
<h2 style="text-align:center;">PVV Kalender for <?=$months_translations[$month-1]?> <?=$year?></h2>
|
||||||
|
|
||||||
<div class="pagination_bar">
|
<div class="pagination_bar"><?php
|
||||||
<?php
|
|
||||||
$pmonth = $month-1;
|
$pmonth = $month-1;
|
||||||
$nmonth = $month+1;
|
$nmonth = $month+1;
|
||||||
$pyear=$year;
|
$pyear=$year;
|
||||||
$nyear=$year;
|
$nyear=$year;
|
||||||
if ($pmonth == 0) {
|
if ($pmonth==0) {$pmonth=12; $pyear--;}
|
||||||
$pmonth = 12;
|
if ($nmonth==13) {$nmonth=1; $nyear++;}
|
||||||
--$pyear;
|
|
||||||
}
|
|
||||||
if ($nmonth == 13) {
|
|
||||||
$nmonth = 1;
|
|
||||||
++$nyear;
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<a class="btn noselect" href="../kalender?year=<?php echo $pyear; ?>&month=<?php echo $pmonth; ?>">Forrige måned</a>
|
<a class="btn noselect" href="../kalender?year=<?=$pyear?>&month=<?=$pmonth?>">Forrige måned</a>
|
||||||
<a class="btn noselect" href="../kalender?year=<?php echo $nyear; ?>&month=<?php echo $nmonth; ?>">Neste måned</a>
|
<a class="btn noselect" href="../kalender?year=<?=$nyear?>&month=<?=$nmonth?>">Neste måned</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<figure class="calendar">
|
<figure class="calendar">
|
||||||
@ -70,30 +61,30 @@ $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
|
|||||||
<li class="header noselect">søndag
|
<li class="header noselect">søndag
|
||||||
|
|
||||||
<?php if ($days_before_the_first != 0) { ?>
|
<?php if ($days_before_the_first != 0) { ?>
|
||||||
<li class="outOfMonth" style="grid-column: 1/<?php echo $days_before_the_first + 1; ?>;">
|
<li class="outOfMonth" style="grid-column: 1/<?=$days_before_the_first+1?>;">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php for ($day = 1; $day <= $days_in_month; ++$day) { ?>
|
<?php for ($day=1; $day <= $days_in_month; $day++) { ?>
|
||||||
<?php $events = $agenda->getEventsBetween(
|
<?php $events = $agenda->getEventsBetween(
|
||||||
new DateTimeImmutable("{$year}-{$month}-{$day} 00:00:00"),
|
new DateTimeImmutable("$year-$month-$day 00:00:00"),
|
||||||
new DateTimeImmutable("{$year}-{$month}-{$day} 23:59:59")
|
new DateTimeImmutable("$year-$month-$day 23:59:59")); ?>
|
||||||
); ?>
|
|
||||||
<?php if ($day==$day_of_month) { ?>
|
<?php if ($day==$day_of_month) { ?>
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<li>
|
<li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (count($events) != 0) { ?>
|
<?php if (sizeof($events)!=0) { ?>
|
||||||
<a href="../aktiviteter/?<?php echo "year={$year}&month={$month}&day={$day}"; ?>"><div>
|
<a href="../aktiviteter/?<?="year=$year&month=$month&day=$day"?>"><div>
|
||||||
<span class="noselect day"><?php echo $day; ?>.</span>
|
<span class="noselect day"><?= $day ?>.</span>
|
||||||
<?php foreach($events as $event) { ?>
|
<?php foreach($events as $event) { ?>
|
||||||
<section style="background: <?php echo $event->getColor(); ?>"><?php echo $event->getName(); ?></section>
|
<section style="background: <?=$event->getColor()?>"><?=$event->getName()?></section>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div></a>
|
</div></a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<span class="noselect day"><?php echo $day; ?>.</span>
|
<span class="noselect day"><?= $day ?>.</span>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</figure>
|
</figure>
|
||||||
</main>
|
</main>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@ -43,11 +43,11 @@ require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'in
|
|||||||
|
|
||||||
<p>Vi har en <a href="http://list.pvv.org/mailman/listinfo/aktive">e-postliste for aktive medlemmer</a>. All offisiell informasjon blir sendt på denne listen, og alle arrengementer blir også annonsert her.</p>
|
<p>Vi har en <a href="http://list.pvv.org/mailman/listinfo/aktive">e-postliste for aktive medlemmer</a>. All offisiell informasjon blir sendt på denne listen, og alle arrengementer blir også annonsert her.</p>
|
||||||
|
|
||||||
<p>Vi har et <a target="_blank" href="https://matrix.to/#/#pvv:pvv.ntnu.no">Matrix Space™</a> for chat, memes, og all annen kommunikasjon. Den er bridget med IRC-kanalen og Discord-serveren vår. Hvis du er medlem kan du bruke vår egen instans av <a href="https://chat.pvv.ntnu.no">Element web</a>.</p>
|
<p>Vi har en <a target="_blank" href="https://matrix.to/#/#pvv:pvv.ntnu.no">Matrix-server</a> for chat, memes, og all annen kommunikasjon. Den er bridget med IRC-kanalen og Discord-guilden vår. Hvis du er medlem kan du bruke vår <a href="https://chat.pvv.ntnu.no">self-hosted web client</a>.</p>
|
||||||
|
|
||||||
<p>Vi har en IRC-kanal på <a href="http://webchat.ircnet.net/">IRCnet</a> kalt #pvv.</p>
|
<p>Vi har en IRC-kanal på <a href="http://webchat.ircnet.net/">IRCnet</a> kalt #pvv.</p>
|
||||||
|
|
||||||
<p>Vi har en <a target="_blank" href="https://discord.gg/8VTBr6Q">Discord-server</a> for de som foretrekker Discord over Matrix. </p>
|
<p>Vi har en <a target="_blank" href="https://discord.gg/8VTBr6Q">Discord-guild</a> for de som foretrekker Discord over Matrix. </p>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
use pvv\side\Agenda;
|
use \pvv\side\Agenda;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@ -35,28 +34,28 @@ use pvv\side\Agenda;
|
|||||||
<main>
|
<main>
|
||||||
<div id="outDatedBanner"><p><br>Denne siden er trolig utdatert! Hvis du er interessert, ta kontakt i discord-kanalen. <br> This page is probably outdated! If you're interested, check in with someone in our discord-channel. </p></div>
|
<div id="outDatedBanner"><p><br>Denne siden er trolig utdatert! Hvis du er interessert, ta kontakt i discord-kanalen. <br> This page is probably outdated! If you're interested, check in with someone in our discord-channel. </p></div>
|
||||||
<?php
|
<?php
|
||||||
$activity = new pvv\side\social\NerdepitsaActivity();
|
$activity = new \pvv\side\social\NerdepitsaActivity;
|
||||||
$nextEvent = $activity->getNextEventFrom(new DateTimeImmutable());
|
$nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<h2><em><?php echo $nextEvent->getRelativeDate(); ?></em> Nerdepitsa
|
<h2><em><?= $nextEvent->getRelativeDate()?></em> Nerdepitsa
|
||||||
<?php if ($nextEvent->getImageURL()) { ?>
|
<?php if ($nextEvent->getImageURL()) { ?>
|
||||||
<img src="<?php echo $nextEvent->getImageURL(); ?>">
|
<img src="<?= $nextEvent->getImageURL() ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid:
|
<li>Tid:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo Agenda::getFormattedDate($nextEvent->getStart()); ?>
|
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Sted:
|
<li>Sted:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo $nextEvent->getLocation(); ?>
|
<?= $nextEvent->getLocation();?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Arrangør:
|
<li>Arrangør:
|
||||||
<strong>
|
<strong>
|
||||||
<?php echo $nextEvent->getOrganiser(); ?>
|
<?= $nextEvent->getOrganiser();?>
|
||||||
</strong>
|
</strong>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -69,6 +68,6 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable());
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?php echo navbar(1, 'aktiviteter'); ?>
|
<?= navbar(1, 'aktiviteter'); ?>
|
||||||
<?php echo loginbar($sp, $pdo); ?>
|
<?= loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@ -89,6 +89,6 @@ p {hyphens: auto;}
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?php echo navbar(1); ?>
|
<?= navbar(1); ?>
|
||||||
<?php echo loginbar($sp, $pdo); ?>
|
<?= loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ $attrs = $as->getAttributes();
|
|||||||
|
|
||||||
<?php if($attrs) { //logged in with pvv account?>
|
<?php if($attrs) { //logged in with pvv account?>
|
||||||
<p>
|
<p>
|
||||||
Du er nå logget in som <i><?php echo htmlspecialchars($attrs['uid'][0]); ?></i>,
|
Du er nå logget in som <i><?= htmlspecialchars($attrs['uid'][0]) ?></i>,
|
||||||
og trenger klart ikke sende melding om å få ny PVV bruker.
|
og trenger klart ikke sende melding om å få ny PVV bruker.
|
||||||
</p>
|
</p>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
require __DIR__ . '/../../inc/navbar.php';
|
require __DIR__ . '/../../inc/navbar.php';
|
||||||
require __DIR__ . '/../../src/_autoload.php';
|
require __DIR__ . '/../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../config.php';
|
require __DIR__ . '/../../config.php';
|
||||||
|
|
||||||
require_once __DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once __DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$projectManager = new pvv\side\ProjectManager($pdo);
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
||||||
|
|
||||||
$new = 0;
|
$new = 0;
|
||||||
if(isset($_GET['new'])){
|
if(isset($_GET['new'])){
|
||||||
@ -24,26 +24,26 @@ if (isset($_GET['id'])) {
|
|||||||
$projectID = $_GET['id'];
|
$projectID = $_GET['id'];
|
||||||
}else if($new == 0){
|
}else if($new == 0){
|
||||||
echo "\nID not set";
|
echo "\nID not set";
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$project = new pvv\side\Project(
|
$project = new \pvv\side\Project(
|
||||||
0,
|
0,
|
||||||
'Nytt Prosjekt',
|
'Nytt Prosjekt',
|
||||||
'',
|
'',
|
||||||
$attrs['cn'][0],
|
$attrs["cn"][0],
|
||||||
$attrs['uid'][0],
|
$attrs["uid"][0],
|
||||||
$attrs['mail'][0],
|
$attrs["mail"][0],
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
if($new == 0){
|
if($new == 0){
|
||||||
$project = $projectManager->getByID($projectID);
|
$project = $projectManager->getByID($projectID);
|
||||||
$owner = $projectManager->getProjectOwner($projectID);
|
$owner = $projectManager->getProjectOwner($projectID);
|
||||||
|
|
||||||
if ($owner['uname'] != $attrs['uid'][0]) {
|
if($owner['uname'] != $attrs["uid"][0]){
|
||||||
header('HTTP/1.0 403 Forbidden');
|
header('HTTP/1.0 403 Forbidden');
|
||||||
echo 'wrong user';
|
echo "wrong user";
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -74,19 +74,19 @@ if ($new == 0) {
|
|||||||
<form action="update.php", method="post">
|
<form action="update.php", method="post">
|
||||||
<p class="subtitle no-chin">Prosjektnavn</p>
|
<p class="subtitle no-chin">Prosjektnavn</p>
|
||||||
<p class="subnote">Gi prosjektet ditt et passende navn</p>
|
<p class="subnote">Gi prosjektet ditt et passende navn</p>
|
||||||
<input class="wide" type="text" name="title" value="<?php echo $project->getName(); ?>" class="boxinput"><br>
|
<input class="wide" type="text" name="title" value="<?= $project->getName() ?>" class="boxinput"><br>
|
||||||
|
|
||||||
<p class="subtitle no-chin">Beskrivelse (<i style="opacity:0.5;">markdown</i>)</p>
|
<p class="subtitle no-chin">Beskrivelse (<i style="opacity:0.5;">markdown</i>)</p>
|
||||||
<p class="subnote no-chin">Hva går prosjektet ditt ut på?</p>
|
<p class="subnote no-chin">Hva går prosjektet ditt ut på?</p>
|
||||||
<p class="subnote">De første to linjene blir vist på prosjektkortet, prøv å gjøre de til et fint sammendrag eller intro!</p>
|
<p class="subnote">De første to linjene blir vist på prosjektkortet, prøv å gjøre de til et fint sammendrag eller intro!</p>
|
||||||
<textarea class="tall" name="desc" style="width:100%" rows="8" class="boxinput"><?php echo implode("\n", $project->getDescription()); ?></textarea>
|
<textarea class="tall" name="desc" style="width:100%" rows="8" class="boxinput"><?= implode($project->getDescription(), "\n"); ?></textarea>
|
||||||
|
|
||||||
<?php echo '<input type="hidden" name="id" value="' . $project->getID() . '" />'; ?>
|
<?= '<input type="hidden" name="id" value="' . $project->getID() . '" />' ?>
|
||||||
<input type="hidden" name="active" value="1"/>
|
<input type="hidden" name="active" value="1"/>
|
||||||
|
|
||||||
<div style="margin-top: 0.2em;">
|
<div style="margin-top: 0.2em;">
|
||||||
<hr class="ruler">
|
<hr class="ruler">
|
||||||
<input type="submit" class="btn" value="<?php echo $new ? 'Opprett prosjekt' : 'Lagre endringer'; ?>"></input>
|
<input type="submit" class="btn" value="<?= ($new ? 'Opprett prosjekt' : 'Lagre endringer') ?>"></input>
|
||||||
<?php if (!$new){?><input type="submit" class="btn" name="delete" value="Slett"></input><?php } ?>
|
<?php if (!$new){?><input type="submit" class="btn" name="delete" value="Slett"></input><?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
|
|
||||||
$translation = ['i dag', 'i morgen', 'denne uka', 'neste uke', 'denne måneden', 'neste måned'];
|
$translation = ['i dag', 'i morgen', 'denne uka', 'neste uke', 'denne måneden', 'neste måned'];
|
||||||
$projectManager = new pvv\side\ProjectManager($pdo);
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
||||||
$projects = $projectManager->getAll();
|
$projects = $projectManager->getAll();
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -87,21 +87,21 @@ $projects = $projectManager->getAll();
|
|||||||
$randProjects = array_rand($projects, min(6, count($projects)));
|
$randProjects = array_rand($projects, min(6, count($projects)));
|
||||||
if (!is_array($randProjects)) {
|
if (!is_array($randProjects)) {
|
||||||
$randProjects = [$randProjects];
|
$randProjects = [$randProjects];
|
||||||
}
|
};
|
||||||
foreach($randProjects as $i) {
|
foreach($randProjects as $i) {
|
||||||
$project = $projects[$i];
|
$project = $projects[$i];
|
||||||
$owner = $projectManager->getProjectOwner($project->getID());
|
$owner = $projectManager->getProjectOwner($project->getID());
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<a class="nostyle" href="info.php?id=<?php echo $project->getID(); ?>"><div class="project-card">
|
<a class="nostyle" href="info.php?id=<?= $project->getID() ?>"><div class="project-card">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<h4 class="project-title"><?php echo $project->getName(); ?></h4>
|
<h4 class="project-title"><?= $project->getName(); ?></h4>
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", array_slice($project->getDescription(), 0, 2)));
|
echo $Parsedown->text(implode("\n", array_slice($project->getDescription(), 0, 2)));
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<p class="project-organizer">Organisert av <?php echo $owner['name']; ?></p>
|
<p class="project-organizer">Organisert av <?= $owner['name']; ?></p>
|
||||||
</div></a>
|
</div></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
|
|
||||||
$projectID = 0;
|
$projectID = 0;
|
||||||
if(isset($_GET['id'])){
|
if(isset($_GET['id'])){
|
||||||
$projectID = $_GET['id'];
|
$projectID = $_GET['id'];
|
||||||
}else{
|
}else{
|
||||||
echo 'No project ID provided';
|
echo 'No project ID provided';
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
|
|
||||||
$projectManager = new pvv\side\ProjectManager($pdo);
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
||||||
$project = $projectManager->getByID($projectID);
|
$project = $projectManager->getByID($projectID);
|
||||||
if (!$project) {
|
if (!$project) {
|
||||||
echo ':^)';
|
echo ":^)";
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$members = $projectManager->getProjectMembers($projectID);
|
$members = $projectManager->getProjectMembers($projectID);
|
||||||
@ -28,16 +28,17 @@ foreach ($normal_members as $i => $data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_owner = false;
|
$is_owner = False;
|
||||||
$is_member = false;
|
$is_member = False;
|
||||||
if ($attrs){
|
if ($attrs){
|
||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
foreach($members as $member){
|
foreach($members as $member){
|
||||||
if ($member['uname'] == $uname){
|
if ($member['uname'] == $uname){
|
||||||
if ($member['owner']==1){
|
if ($member['owner']==1){
|
||||||
$is_owner = true;
|
$is_owner = True;
|
||||||
} elseif ($member['owner'] == 0) {
|
}
|
||||||
$is_member = true;
|
else if ($member['owner']==0){
|
||||||
|
$is_member = True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,9 +66,9 @@ if ($attrs) {
|
|||||||
|
|
||||||
<main class="contentsplit">
|
<main class="contentsplit">
|
||||||
<div class="gridr">
|
<div class="gridr">
|
||||||
<h2><?php echo $project->getName(); ?></h2>
|
<h2><?= $project->getName(); ?></h2>
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
echo $Parsedown->text(implode("\n", $project->getDescription()));
|
echo $Parsedown->text(implode("\n", $project->getDescription()));
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -81,27 +82,27 @@ if ($attrs) {
|
|||||||
<?php foreach($members as $i => $data){
|
<?php foreach($members as $i => $data){
|
||||||
if($data['lead']){
|
if($data['lead']){
|
||||||
?>
|
?>
|
||||||
<p><?php echo $data['name']; ?></p>
|
<p><?= $data['name']; ?></p>
|
||||||
<p class="memberrole"><?php echo $data['role']; ?></p>
|
<p class="memberrole"><?= $data['role'] ?></p>
|
||||||
<p class="memberuname"><?php echo $data['uname']; ?></p>
|
<p class="memberuname"><?= $data['uname']; ?></p>
|
||||||
<p class="memberemail"><?php echo $data['mail']; ?></p>
|
<p class="memberemail"><?= $data['mail']; ?></p>
|
||||||
<?php }
|
<?php }
|
||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (count($normal_members) > 0) {
|
if(sizeof($normal_members) > 0){
|
||||||
?>
|
?>
|
||||||
<div class="projectmembers">
|
<div class="projectmembers">
|
||||||
<h2>Medlemmer</h2>
|
<h2>Medlemmer</h2>
|
||||||
<?php foreach($normal_members as $i => $data){
|
<?php foreach($normal_members as $i => $data){
|
||||||
?>
|
?>
|
||||||
<div class="projectmember" style="border-color: #6a0;">
|
<div class="projectmember" style="border-color: #6a0;">
|
||||||
<p><?php echo $data['name']; ?></p>
|
<p><?= $data['name']; ?></p>
|
||||||
<p class="memberrole"><?php echo $data['role'] ?: 'Deltaker'; ?></p>
|
<p class="memberrole"><?= $data['role'] ? $data['role'] : 'Deltaker' ?></p>
|
||||||
<p class="memberuname"><?php echo $data['uname']; ?></p>
|
<p class="memberuname"><?= $data['uname']; ?></p>
|
||||||
<p class="memberemail"><?php echo $data['mail']; ?></p>
|
<p class="memberemail"><?= $data['mail']; ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
@ -115,8 +116,8 @@ if ($attrs) {
|
|||||||
<input type="hidden" name="title" value="derp"/>
|
<input type="hidden" name="title" value="derp"/>
|
||||||
<input type="hidden" name="desc" value="derp"/>
|
<input type="hidden" name="desc" value="derp"/>
|
||||||
<input type="hidden" name="active" value="derp"/>
|
<input type="hidden" name="active" value="derp"/>
|
||||||
<input type="hidden" name="id" value="<?php echo $projectID; ?>"/>
|
<input type="hidden" name="id" value="<?= $projectID ?>"/>
|
||||||
<input type="submit" class="btn" name="join_or_leave" value="<?php echo $is_member ? 'Forlat' : 'Bli med!'; ?>"></input>
|
<input type="submit" class="btn" name="join_or_leave" value="<?= ($is_member ? 'Forlat' : 'Bli med!') ?>"></input>
|
||||||
</p></form>
|
</p></form>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
require __DIR__ . '/../../inc/navbar.php';
|
require __DIR__ . '/../../inc/navbar.php';
|
||||||
require __DIR__ . '/../../src/_autoload.php';
|
require __DIR__ . '/../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../config.php';
|
require __DIR__ . '/../../config.php';
|
||||||
|
|
||||||
require_once __DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$projectManager = new pvv\side\ProjectManager($pdo);
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
||||||
$projects = $projectManager->getByOwner($attrs['uid'][0]);
|
$projects = $projectManager->getByOwner($attrs['uid'][0]);
|
||||||
|
|
||||||
$page = 1;
|
$page = 1;
|
||||||
@ -28,7 +28,9 @@ if (isset($_GET['filter'])) {
|
|||||||
// filter
|
// filter
|
||||||
$projects = array_values(array_filter(
|
$projects = array_values(array_filter(
|
||||||
$projects,
|
$projects,
|
||||||
static fn($project) => (preg_match('/.*' . $filter . '.*/i', $project->getName()) || preg_match('/.*' . $filter . '.*/i', implode(' ', $project->getDescription())))
|
function($project) use ($filter){
|
||||||
|
return (preg_match('/.*'.$filter.'.*/i', $project->getName()) or preg_match('/.*'.$filter.'.*/i', implode(" ", $project->getDescription())));
|
||||||
|
}
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -48,8 +50,8 @@ $projects = array_values(array_filter(
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<?php echo navbar(1, 'prosjekt'); ?>
|
<?= navbar(1, 'prosjekt'); ?>
|
||||||
<?php echo loginbar(); ?>
|
<?= loginbar(); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main class="gridsplit">
|
<main class="gridsplit">
|
||||||
@ -61,7 +63,7 @@ $projects = array_values(array_filter(
|
|||||||
$counter = 0;
|
$counter = 0;
|
||||||
$pageLimit = 8;
|
$pageLimit = 8;
|
||||||
|
|
||||||
for ($i = ($pageLimit * ($page - 1)); $i < count($projects); ++$i) {
|
for($i = ($pageLimit * ($page - 1)); $i < count($projects); $i++){
|
||||||
if($counter == $pageLimit){
|
if($counter == $pageLimit){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -78,16 +80,16 @@ $projects = array_values(array_filter(
|
|||||||
<li>
|
<li>
|
||||||
<div class="event">
|
<div class="event">
|
||||||
<div class="event-info">
|
<div class="event-info">
|
||||||
<a href="edit.php?id=<?php echo $project->getID(); ?>">
|
<a href="edit.php?id=<?= $project->getID() ?>">
|
||||||
<h3 class="no-chin"><?php echo $project->getName(); ?></h3>
|
<h3 class="no-chin"><?= $project->getName()?></h3>
|
||||||
</a>
|
</a>
|
||||||
<p style="text-decoration: none;"><?php echo implode('<br>', array_slice($project->getDescription(), 0, 4)); ?></p>
|
<p style="text-decoration: none;"><?= implode("<br>", array_slice($project->getDescription(), 0, 4)); ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
++$counter;
|
$counter++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
@ -97,7 +99,7 @@ $projects = array_values(array_filter(
|
|||||||
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '&filter=' . urlencode($filter) . '">Forrige side</a>';
|
echo '<a class="btn float-left" href="?page=' . ($page - 1) . '&filter=' . urlencode($filter) . '">Forrige side</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($counter == $pageLimit) && (($pageLimit * $page) < count($projects))) {
|
if(($counter == $pageLimit) and (($pageLimit * $page) < count($projects))){
|
||||||
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '&filter=' . urlencode($filter) . '">Neste side</a>';
|
echo '<a class="btn float-right" href="?page=' . ($page + 1) . '&filter=' . urlencode($filter) . '">Neste side</a>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -109,7 +111,7 @@ $projects = array_values(array_filter(
|
|||||||
<h2>Filter</h2>
|
<h2>Filter</h2>
|
||||||
<form action="mine.php" method="get">
|
<form action="mine.php" method="get">
|
||||||
<p class="no-chin">Navn</p>
|
<p class="no-chin">Navn</p>
|
||||||
<?php echo '<input type="text" name="filter" class="boxinput" value="' . $filter . '">'; ?><br>
|
<?= '<input type="text" name="filter" class="boxinput" value="' . $filter . '">' ?><br>
|
||||||
|
|
||||||
<div style="margin-top: 2em;">
|
<div style="margin-top: 2em;">
|
||||||
<input type="submit" class="btn" value="Filtrer"></input>
|
<input type="submit" class="btn" value="Filtrer"></input>
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('Europe/Oslo');
|
date_default_timezone_set('Europe/Oslo');
|
||||||
setlocale(\LC_ALL, 'nb_NO');
|
setlocale(LC_ALL, 'nb_NO');
|
||||||
require __DIR__ . '/../../src/_autoload.php';
|
require __DIR__ . '/../../src/_autoload.php';
|
||||||
require __DIR__ . '/../../config.php';
|
require __DIR__ . '/../../config.php';
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
if (!isset($_POST['title']) || !isset($_POST['desc']) || !isset($_POST['active'])) {
|
if(!isset($_POST['title']) or !isset($_POST['desc']) or !isset($_POST['active'])){
|
||||||
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php';
|
require_once(__DIR__ . '/../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php');
|
||||||
$as = new SimpleSAML\Auth\Simple('default-sp');
|
$as = new \SimpleSAML\Auth\Simple('default-sp');
|
||||||
$as->requireAuth();
|
$as->requireAuth();
|
||||||
$attrs = $as->getAttributes();
|
$attrs = $as->getAttributes();
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ $name = $attrs['cn'][0];
|
|||||||
$uname = $attrs['uid'][0];
|
$uname = $attrs['uid'][0];
|
||||||
$mail = $attrs['mail'][0];
|
$mail = $attrs['mail'][0];
|
||||||
|
|
||||||
|
$statement;
|
||||||
if($id == 0){
|
if($id == 0){
|
||||||
$query = 'INSERT INTO projects (name, description, active) VALUES (:title, :desc, 1)';
|
$query = 'INSERT INTO projects (name, description, active) VALUES (:title, :desc, 1)';
|
||||||
$statement = $pdo->prepare($query);
|
$statement = $pdo->prepare($query);
|
||||||
@ -47,29 +47,31 @@ if ($id == 0) {
|
|||||||
$statement->bindParam(':owneremail', $mail, PDO::PARAM_STR);
|
$statement->bindParam(':owneremail', $mail, PDO::PARAM_STR);
|
||||||
|
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
} else {
|
}
|
||||||
$projectManager = new pvv\side\ProjectManager($pdo);
|
else {
|
||||||
|
$projectManager = new \pvv\side\ProjectManager($pdo);
|
||||||
$owner = $projectManager->getProjectOwner($id);
|
$owner = $projectManager->getProjectOwner($id);
|
||||||
$members = $projectManager->getProjectMembers($id);
|
$members = $projectManager->getProjectMembers($id);
|
||||||
|
|
||||||
//if ($do_join_or_leave and $owner['uname'] != $uname) {
|
//if ($do_join_or_leave and $owner['uname'] != $uname) {
|
||||||
if ($do_join_or_leave) {
|
if ($do_join_or_leave) {
|
||||||
$is_member = false;
|
$is_member = False;
|
||||||
foreach($members as $member){
|
foreach($members as $member){
|
||||||
if ($member['uname'] == $uname && $member['owner'] == 0) {
|
if ($member['uname'] == $uname and $member['owner']==0){
|
||||||
$is_member = true;
|
$is_member = True;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($is_member){//leave
|
if ($is_member){//leave
|
||||||
$query = 'DELETE FROM projectmembers WHERE projectid=:id AND uname=:uname and lead=0 and owner=0;';
|
$query = "DELETE FROM projectmembers WHERE projectid=:id AND uname=:uname and lead=0 and owner=0;";
|
||||||
$statement = $pdo->prepare($query);
|
$statement = $pdo->prepare($query);
|
||||||
$statement->bindParam(':id', $id, PDO::PARAM_STR);
|
$statement->bindParam(':id', $id, PDO::PARAM_STR);
|
||||||
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
|
$statement->bindParam(':uname', $uname, PDO::PARAM_STR);
|
||||||
|
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
echo 'leave';
|
print("leave");
|
||||||
} else {// join
|
}
|
||||||
|
else{//join
|
||||||
$query = "INSERT INTO projectmembers (projectid, name, uname, mail, role, lead, owner) VALUES (:id, :name, :uname, :mail, 'Medlem', 0, 0)";
|
$query = "INSERT INTO projectmembers (projectid, name, uname, mail, role, lead, owner) VALUES (:id, :name, :uname, :mail, 'Medlem', 0, 0)";
|
||||||
$statement = $pdo->prepare($query);
|
$statement = $pdo->prepare($query);
|
||||||
$statement->bindParam(':id', $id, PDO::PARAM_STR);
|
$statement->bindParam(':id', $id, PDO::PARAM_STR);
|
||||||
@ -78,16 +80,16 @@ if ($id == 0) {
|
|||||||
$statement->bindParam(':mail', $mail, PDO::PARAM_STR);
|
$statement->bindParam(':mail', $mail, PDO::PARAM_STR);
|
||||||
|
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
echo 'join';
|
print("join");
|
||||||
}
|
}
|
||||||
header('Location: ./info.php?id=' . $id);
|
header('Location: ./info.php?id=' . $id);
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($uname != $owner['uname']){
|
if($uname != $owner['uname']){
|
||||||
header('Content-Type: text/plain', true, 403);
|
header('Content-Type: text/plain', true, 403);
|
||||||
echo "Illegal action, you're not the project owner for project with ID " . $id . "\r\n";
|
echo "Illegal action, you're not the project owner for project with ID " . $id . "\r\n";
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($do_delete) {
|
if ($do_delete) {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(__DIR__) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
|
||||||
$pdo = new PDO($DB_DSN, $DB_USER, $DB_PASS);
|
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
$door = new pvv\side\Door($pdo);
|
$door = new \pvv\side\Door($pdo);
|
||||||
$doorEntry = (object) $door->getCurrent();
|
$doorEntry = (object)($door->getCurrent());
|
||||||
|
|
||||||
?>
|
?>
|
||||||
{
|
{
|
||||||
@ -23,8 +23,8 @@ $doorEntry = (object) $door->getCurrent();
|
|||||||
"ext_mazemap": "https://link.mazemap.com/2n2HWa7H",
|
"ext_mazemap": "https://link.mazemap.com/2n2HWa7H",
|
||||||
"address": "Sem Sælands vei 1, 7034 Trondheim, Norway",
|
"address": "Sem Sælands vei 1, 7034 Trondheim, Norway",
|
||||||
"timezone": "Europe/Oslo",
|
"timezone": "Europe/Oslo",
|
||||||
"lon": 10.4063852,
|
"lon": 10.4038103,
|
||||||
"lat": 63.4170226
|
"lat": 63.417025
|
||||||
},
|
},
|
||||||
"contact": {
|
"contact": {
|
||||||
"irc": "irc://irc.pvv.ntnu.no/pvv",
|
"irc": "irc://irc.pvv.ntnu.no/pvv",
|
||||||
@ -35,9 +35,9 @@ $doorEntry = (object) $door->getCurrent();
|
|||||||
},
|
},
|
||||||
"issue_report_channels": ["email"],
|
"issue_report_channels": ["email"],
|
||||||
"state": {
|
"state": {
|
||||||
"open": <?php echo $doorEntry->open ? 'true' : 'false'; ?>,
|
"open": <?php echo($doorEntry->open ? "true" : "false"); ?>,
|
||||||
"lastchange": <?php echo $doorEntry->time ? $doorEntry->time : 0; ?>,
|
"lastchange": <?php echo($doorEntry->time ? $doorEntry->time : 0); ?>,
|
||||||
"message": "<?php echo $doorEntry->open ? 'open for public, members are present' : 'closed'; ?>"
|
"message": "<?php echo($doorEntry->open ? "open for public, members are present" : "closed"); ?>"
|
||||||
},
|
},
|
||||||
"feeds": {
|
"feeds": {
|
||||||
"wiki": {
|
"wiki": {
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?php
|
<?php namespace pvv\side;
|
||||||
|
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
namespace pvv\side;
|
|
||||||
|
|
||||||
require_once \dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@ -19,8 +16,8 @@ require_once \dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'i
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<?php echo navbar(1, 'tjenester'); ?>
|
<?= navbar(1, 'tjenester'); ?>
|
||||||
<?php echo loginbar($sp, $pdo); ?>
|
<?= loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
@ -113,7 +110,7 @@ require_once \dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'i
|
|||||||
<div class="serviceContent">
|
<div class="serviceContent">
|
||||||
<h2 class="serviceTitle">Brukernettsider</h2>
|
<h2 class="serviceTitle">Brukernettsider</h2>
|
||||||
<p class="serviceDescription">Alle brukere får automatisk en egen side for html og php. Denne er offentlig på pvv.ntnu.no/~brukernavn.</p>
|
<p class="serviceDescription">Alle brukere får automatisk en egen side for html og php. Denne er offentlig på pvv.ntnu.no/~brukernavn.</p>
|
||||||
<div class="serviceLink"><a href="https://wiki.pvv.ntnu.no/wiki/Tjenester/Hjemmesider" target="_blank">Gå til dokumentasjon på wiki</a></div>
|
<div class="serviceLink"><a href="https://wiki.pvv.ntnu.no/wiki/Hjemmesider" target="_blank">Gå til dokumentasjon på wiki</a></div>
|
||||||
</div>
|
</div>
|
||||||
<img class="serviceImage" src="img/php.png" alt="En elephpant">
|
<img class="serviceImage" src="img/php.png" alt="En elephpant">
|
||||||
</div>
|
</div>
|
||||||
@ -122,7 +119,7 @@ require_once \dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'i
|
|||||||
<div class="serviceContent">
|
<div class="serviceContent">
|
||||||
<h2 class="serviceTitle">PVV-siden</h2>
|
<h2 class="serviceTitle">PVV-siden</h2>
|
||||||
<p class="serviceDescription">Du befinner deg nå på PVV sin offisielle hjemmeside. Den er skrevet i PHP og kjører på en egen server.</p>
|
<p class="serviceDescription">Du befinner deg nå på PVV sin offisielle hjemmeside. Den er skrevet i PHP og kjører på en egen server.</p>
|
||||||
<div class="serviceLink"><a href="https://git.pvv.ntnu.no/Projects/nettsiden" target="_blank">Se koden på gitea</a></div>
|
<div class="serviceLink"><a href="https://github.com/Programvareverkstedet/nettsiden" target="_blank">Se koden på github</a></div>
|
||||||
</div>
|
</div>
|
||||||
<img class="serviceImage" src="../pvv-logo.png" alt="PVV-logo">
|
<img class="serviceImage" src="../pvv-logo.png" alt="PVV-logo">
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user