Compare commits
54 Commits
readd-webm
...
local-dev-
| Author | SHA1 | Date | |
|---|---|---|---|
|
19c49b4a00
|
|||
|
3d07547f80
|
|||
|
fc8ca571fb
|
|||
|
6fd4a0599c
|
|||
|
f782d20e56
|
|||
|
0a77f46fe1
|
|||
|
ed720af80b
|
|||
|
f8acc4b815
|
|||
| da1113341a | |||
| cd31bd4476 | |||
| 77e5d336eb | |||
| 403afdc472 | |||
| 86816489e3 | |||
| c38c502598 | |||
| 3d843667ad | |||
| 617a799ad8 | |||
| 0be8e51af4 | |||
| 381f67189a | |||
| 2e56c7aed4 | |||
| 5b7a04dc69 | |||
| 485110bf43 | |||
| 3498cb7d8e | |||
| ed3f307b9b | |||
| 7070a12e16 | |||
| 6bda1a91bd | |||
| 559b7ec03b | |||
| 602ae1f396 | |||
| f3c439d038 | |||
| 2b3a9dd6ec | |||
| 59b071d8be | |||
| f732582d0d | |||
| de72342018 | |||
| b54bbda71f | |||
|
20bab54235
|
|||
|
c3d8ce017d
|
|||
|
02cfe9feaa
|
|||
|
4d4ec78ea3
|
|||
|
a74ea31356
|
|||
|
0653672a17
|
|||
|
8a1ff1a265
|
|||
|
c1802e7cf2
|
|||
|
84de16fc25
|
|||
|
23b8e91a6c
|
|||
|
da8afe735c
|
|||
|
b6697e5750
|
|||
|
ece3c8ab80
|
|||
|
7297c83cea
|
|||
|
74662af3ef
|
|||
|
32e147fd02
|
|||
|
d5c28d4e0f
|
|||
|
f1b3c63311
|
|||
| a4ebe6ded0 | |||
| 2930f9863f | |||
| e7b66b4bc6 |
3
.git-blame-ignore-revs
Normal file
3
.git-blame-ignore-revs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# The formattening
|
||||||
|
c5d308654744e116090e9ba165a968b8bf66006c
|
||||||
|
da8afe735c62e1f8ee9ad5f71291d87102fe126b
|
||||||
BIN
.gitea/hosting.jpg
Normal file
BIN
.gitea/hosting.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
/result
|
|
||||||
/config.php
|
|
||||||
*.sqlite
|
*.sqlite
|
||||||
|
/cache
|
||||||
|
/config.php
|
||||||
|
/result
|
||||||
/test.sql
|
/test.sql
|
||||||
/vendor/
|
/vendor/
|
||||||
/www/simplesaml
|
/www/simplesaml
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "lib/OAuth2-Client"]
|
|
||||||
path = lib/OAuth2-Client
|
|
||||||
url = https://github.com/UNINETT/OAuth2-Client.git
|
|
||||||
58
.php-cs-fixer.php
Normal file
58
.php-cs-fixer.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?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")
|
||||||
|
;
|
||||||
62
README.md
62
README.md
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
# Programvareverkstedets nettside
|
# Programvareverkstedets nettside
|
||||||
|
|
||||||
A website created with the latest and greatest web technologies.
|
A website created with the latest and greatest web technologies.
|
||||||
@@ -11,53 +12,19 @@ Put it in a folder your webserver can find.
|
|||||||
|
|
||||||
## Development setup
|
## Development setup
|
||||||
|
|
||||||
Make sure you have `sqlite3`, `php` and `pdo-sqlite` installed.
|
The development environment can be setup with:
|
||||||
These can be obtained from your package manager.
|
|
||||||
Then make sure PHP has the `curl`, `pdo-sqlite`, `ext-dom` and `sqlite3` extensions enabled, see `/etc/php/php.ini`.
|
|
||||||
|
|
||||||
To install all mentioned requirements on debian: `apt install composer sqlite3 php8.1-sqlite3 simplesamlphp php-xml`, followed by `composer update`.
|
nix develop
|
||||||
|
|
||||||
./dev.sh
|
For this you will need to install the nix package manager and possibly set the experimental features in your nix config, likely located at /etc/nix/nix.conf or $HOME/.config/nix/nix.conf.
|
||||||
|
|
||||||
On Windows you can use chocolatey and git bash to run `./dev.sh`.
|
Installing nix with your package manager might not work without some tweaking, but the upstream script should just work which you can find [here](https://nixos.org/download/).
|
||||||
Install `php` and `sqlite`, then enable these extensions in `C:\tools\php80\php.ini`:
|
|
||||||
`mbstring`, `openssl`, `curl`, `pdo-sqlite` and `sqlite3`
|
|
||||||
|
|
||||||
Alternatively you may use `cmd` on Windows.
|
experimental-features = flakes nix-command
|
||||||
In this case you'll have to perform a `composer install` manually beforehand.
|
|
||||||
Good luck.
|
|
||||||
|
|
||||||
dev.bat
|
You can then run the server with:
|
||||||
|
|
||||||
|
|
||||||
### Dependency management
|
|
||||||
|
|
||||||
`dev.sh` will ensure the git submodules have been properly pulled, then download the `composer` package manager to a php archive file named `composer.phar`, then run it.
|
|
||||||
Composer will then check for the php extensions needed, such as `pdo_sqlite`, which must be enabled on your system.
|
|
||||||
This usually includes installing a php-sqlite3 package and enabling it in `/etc/php/php.ini`:
|
|
||||||
|
|
||||||
[PHP]
|
|
||||||
extension=pdo_sqlite
|
|
||||||
extension=sqlite3
|
|
||||||
extension=ext-curl
|
|
||||||
|
|
||||||
Composer is used as such:
|
|
||||||
|
|
||||||
php composer.phar update
|
|
||||||
php composer.phar install
|
|
||||||
|
|
||||||
|
|
||||||
### Docker
|
|
||||||
|
|
||||||
We provide a simple docker-compose setup for local development.
|
|
||||||
First ensure that docker is running:
|
|
||||||
|
|
||||||
sudo systemctl start docker
|
|
||||||
|
|
||||||
then
|
|
||||||
|
|
||||||
DOCKER_USER=$(id -u):$(id -g) docker-compose up
|
|
||||||
|
|
||||||
|
runDev
|
||||||
|
|
||||||
### Admin account
|
### Admin account
|
||||||
|
|
||||||
@@ -65,15 +32,8 @@ Login goes through `idp.pvv.ntnu.no` via SAML, so you have to use your PVV accou
|
|||||||
(This only works if you use access the local development site via the the hostname `localhost`)
|
(This only works if you use access the local development site via the the hostname `localhost`)
|
||||||
To make your account into an admin account, run:
|
To make your account into an admin account, run:
|
||||||
|
|
||||||
sqlite3 pvv.sqlite 'INSERT INTO users (uname, groups) VALUES ("YOUR_USERNAME", 1);'
|
sqlite3 pvv.sqlite "INSERT INTO users (uname, groups) VALUES ('YOUR_USERNAME', 1);"
|
||||||
|
|
||||||
If using docker, when already running:
|
|
||||||
|
|
||||||
DOCKER_USER=$(id -u):$(id -g) docker-compose exec nettside sqlite3 pvv.sqlite 'INSERT INTO users (uname, groups) VALUES ("YOUR_USERNAME", 1);'
|
|
||||||
|
|
||||||
If not already running:
|
|
||||||
|
|
||||||
DOCKER_USER=$(id -u):$(id -g) docker-compose run nettside sqlite3 pvv.sqlite 'INSERT INTO users (uname, groups) VALUES ("YOUR_USERNAME", 1);'
|
|
||||||
|
|
||||||
|
|
||||||
## Hosting
|
## Hosting
|
||||||
|
|
||||||
|

|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
|
|
||||||
"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",
|
"simplesamlphp/simplesamlphp": "^2.2.1",
|
||||||
"erusev/parsedown": "^1.7"
|
"erusev/parsedown": "^1.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1854
composer.lock
generated
1854
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
|
||||||
|
|
||||||
$DB_DSN = 'sqlite:'.__DIR__.DIRECTORY_SEPARATOR.'pvv.sqlite';
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$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 = array("localhost:1080");
|
$SAML_TRUSTED_DOMAINS = ['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
|
||||||
|
|
||||||
$configFile = getenv('PVV_CONFIG_FILE');
|
declare(strict_types=1);
|
||||||
require_once($configFile);
|
|
||||||
|
|
||||||
?>
|
$configFile = getenv('PVV_CONFIG_FILE');
|
||||||
|
require_once $configFile;
|
||||||
|
|||||||
50
dist/pvv.sql
vendored
50
dist/pvv.sql
vendored
@@ -1,50 +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);
|
|
||||||
47
dist/pvv_mysql.sql
vendored
47
dist/pvv_mysql.sql
vendored
@@ -1,47 +0,0 @@
|
|||||||
CREATE TABLE events (
|
|
||||||
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
|
|
||||||
`name` TEXT,
|
|
||||||
`start` TEXT,
|
|
||||||
`stop` TEXT,
|
|
||||||
`organiser` TEXT,
|
|
||||||
`location` TEXT,
|
|
||||||
`description` TEXT
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE projects (
|
|
||||||
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
|
|
||||||
`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 AUTO_INCREMENT,
|
|
||||||
`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);
|
|
||||||
36
dist/simplesaml-dev/authsources.php
vendored
Normal file
36
dist/simplesaml-dev/authsources.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
$config = [
|
||||||
|
// This is used by the service provider to contact the identity provider
|
||||||
|
'default-sp' => [
|
||||||
|
'saml:SP',
|
||||||
|
'entityID' => 'http://localhost:1080/simplesaml/sp',
|
||||||
|
'idp' => 'http://localhost:1080/simplesaml/idp',
|
||||||
|
],
|
||||||
|
|
||||||
|
// This is used by the identity provider to authenticate users
|
||||||
|
'example-userpass' => [
|
||||||
|
'exampleauth:UserPass',
|
||||||
|
'users' => [
|
||||||
|
'user:user' => [
|
||||||
|
'uid' => ['user'],
|
||||||
|
'group' => ['users'],
|
||||||
|
'cn' => '/home/pvv/d/user',
|
||||||
|
'mail' => 'user+test@pvv.ntnu.no',
|
||||||
|
],
|
||||||
|
'admin:admin' => [
|
||||||
|
'uid' => ['admin'],
|
||||||
|
'group' => ['admins'],
|
||||||
|
'cn' => '/home/pvv/d/admin',
|
||||||
|
'mail' => 'admin+test@pvv.ntnu.no',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
// This is also used by the identity provider to authenticate IDP admins
|
||||||
|
// See http://localhost:1080/simplesaml/admin/
|
||||||
|
'admin' => [
|
||||||
|
'core:AdminPassword',
|
||||||
|
],
|
||||||
|
];
|
||||||
1416
dist/simplesaml-dev/config.php
vendored
Normal file
1416
dist/simplesaml-dev/config.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10
dist/simplesaml-dev/saml20-idp-hosted.php
vendored
Normal file
10
dist/simplesaml-dev/saml20-idp-hosted.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$metadata['http://localhost:1080/simplesaml/idp'] = [
|
||||||
|
'host' => '__DEFAULT__',
|
||||||
|
'privatekey' => 'localhost.pem',
|
||||||
|
'certificate' => 'localhost.crt',
|
||||||
|
'auth' => 'example-userpass',
|
||||||
|
];
|
||||||
50
dist/simplesaml-dev/saml20-idp-remote.php
vendored
Normal file
50
dist/simplesaml-dev/saml20-idp-remote.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$metadata['https://idp.pvv.ntnu.no/'] = [
|
||||||
|
'metadata-set' => 'saml20-idp-remote',
|
||||||
|
'entityid' => 'https://idp.pvv.ntnu.no/',
|
||||||
|
'SingleSignOnService' => [
|
||||||
|
0 => [
|
||||||
|
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||||
|
'Location' => 'https://idp.pvv.ntnu.no/simplesaml/saml2/idp/SSOService.php',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'SingleLogoutService' => [
|
||||||
|
0 => [
|
||||||
|
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||||
|
'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==',
|
||||||
|
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
|
||||||
|
];
|
||||||
|
|
||||||
|
function getCertData(string $path): string
|
||||||
|
{
|
||||||
|
$cert = file_get_contents($path);
|
||||||
|
$cert = str_replace("-----BEGIN CERTIFICATE-----", "", $cert);
|
||||||
|
$cert = str_replace("-----END CERTIFICATE-----", "", $cert);
|
||||||
|
$cert = str_replace(["\r", "\n"], "", $cert);
|
||||||
|
return $cert;
|
||||||
|
}
|
||||||
|
|
||||||
|
$metadata['http://localhost:1080/simplesaml/idp'] = [
|
||||||
|
'metadata-set' => 'saml20-idp-remote',
|
||||||
|
'entityid' => 'https://localhost:1080/simplesaml/idp',
|
||||||
|
'SingleSignOnService' => [
|
||||||
|
0 => [
|
||||||
|
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||||
|
'Location' => 'http://localhost:1080/simplesaml/saml2/idp/SSOService.php',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'SingleLogoutService' => [
|
||||||
|
0 => [
|
||||||
|
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||||
|
'Location' => 'http://localhost:1080/simplesaml/saml2/idp/SingleLogoutService.php',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'certData' => getCertData(__DIR__ . '/../cert/localhost.crt'),
|
||||||
|
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
|
||||||
|
];
|
||||||
16
dist/simplesaml-dev/saml20-sp-remote.php
vendored
Normal file
16
dist/simplesaml-dev/saml20-sp-remote.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$metadata['http://localhost:1080/simplesaml/sp'] = [
|
||||||
|
'AssertionConsumerService' => [
|
||||||
|
[
|
||||||
|
'Location' => 'http://localhost:1080/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp',
|
||||||
|
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'SingleLogoutService' => [
|
||||||
|
[
|
||||||
|
'Location' => 'http://localhost:1080/simplesaml/module.php/saml/sp/saml2-logout.php/default-sp',
|
||||||
|
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
12
dist/simplesaml-prod/authsources.php
vendored
Normal file
12
dist/simplesaml-prod/authsources.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
$config = [
|
||||||
|
|
||||||
|
/* This is the name of this authentication source, and will be used to access it later. */
|
||||||
|
'default-sp' => [
|
||||||
|
'saml:SP',
|
||||||
|
'entityID' => 'https://www.pvv.ntnu.no/simplesaml/',
|
||||||
|
'idp' => 'https://idp.pvv.ntnu.no/',
|
||||||
|
],
|
||||||
|
];
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'config.php');
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require_once dirname(__DIR__, 4) . \DIRECTORY_SEPARATOR . 'config.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration of SimpleSAMLphp
|
* The configuration of SimpleSAMLphp
|
||||||
@@ -64,15 +66,12 @@ $config = [
|
|||||||
* - 'loggingdir': Where to write logs. MUST be set to NULL when using a logging
|
* - 'loggingdir': Where to write logs. MUST be set to NULL when using a logging
|
||||||
* handler other than `file`.
|
* handler other than `file`.
|
||||||
* - 'datadir': Storage of general data.
|
* - 'datadir': Storage of general data.
|
||||||
* - 'tempdir': Saving temporary files. SimpleSAMLphp will attempt to create
|
|
||||||
* this directory if it doesn't exist. DEPRECATED - replaced by cachedir.
|
|
||||||
* When specified as a relative path, this is relative to the SimpleSAMLphp
|
* When specified as a relative path, this is relative to the SimpleSAMLphp
|
||||||
* root directory.
|
* root directory.
|
||||||
*/
|
*/
|
||||||
'cachedir' => $CACHE_DIRECTORY,
|
'cachedir' => $CACHE_DIRECTORY,
|
||||||
//'loggingdir' => '/var/log/',
|
//'loggingdir' => '/var/log/',
|
||||||
//'datadir' => '/var/data/',
|
//'datadir' => '/var/data/',
|
||||||
//'tempdir' => '/tmp/simplesamlphp',
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Certificate and key material can be loaded from different possible
|
* Certificate and key material can be loaded from different possible
|
||||||
@@ -198,6 +197,10 @@ $config = [
|
|||||||
* This password will give access to the installation page of SimpleSAMLphp with
|
* This password will give access to the installation page of SimpleSAMLphp with
|
||||||
* metadata listing and diagnostics pages.
|
* metadata listing and diagnostics pages.
|
||||||
* You can also put a hash here; run "bin/pwgen.php" to generate one.
|
* You can also put a hash here; run "bin/pwgen.php" to generate one.
|
||||||
|
*
|
||||||
|
* If you are using Ansible you might like to use
|
||||||
|
* ansible.builtin.password_hash(hashtype='blowfish', ident='2y', rounds=13)
|
||||||
|
* to generate this hashed value.
|
||||||
*/
|
*/
|
||||||
'auth.adminpassword' => $SAML_ADMIN_PASSWORD,
|
'auth.adminpassword' => $SAML_ADMIN_PASSWORD,
|
||||||
|
|
||||||
@@ -279,7 +282,17 @@ $config = [
|
|||||||
* Whenever you change any of these headers, make sure to validate your config by running your
|
* Whenever you change any of these headers, make sure to validate your config by running your
|
||||||
* hostname through a security-test like https://en.internet.nl
|
* hostname through a security-test like https://en.internet.nl
|
||||||
'headers.security' => [
|
'headers.security' => [
|
||||||
'Content-Security-Policy' => "default-src 'none'; frame-ancestors 'self'; object-src 'none'; script-src 'self'; style-src 'self'; font-src 'self'; connect-src 'self'; img-src 'self' data:; base-uri 'none'",
|
'Content-Security-Policy' =>
|
||||||
|
"default-src 'none'; " .
|
||||||
|
"frame-ancestors 'self'; " .
|
||||||
|
"object-src 'none'; " .
|
||||||
|
"script-src 'self'; " .
|
||||||
|
"style-src 'self'; " .
|
||||||
|
"font-src 'self'; " .
|
||||||
|
"connect-src 'self'; " .
|
||||||
|
"media-src data:; " .
|
||||||
|
"img-src 'self' data:; " .
|
||||||
|
"base-uri 'none'",
|
||||||
'X-Frame-Options' => 'SAMEORIGIN',
|
'X-Frame-Options' => 'SAMEORIGIN',
|
||||||
'X-Content-Type-Options' => 'nosniff',
|
'X-Content-Type-Options' => 'nosniff',
|
||||||
'Referrer-Policy' => 'origin-when-cross-origin',
|
'Referrer-Policy' => 'origin-when-cross-origin',
|
||||||
@@ -335,9 +348,69 @@ $config = [
|
|||||||
* When 'errorreporting' is enabled, a form will be presented for the user to report
|
* When 'errorreporting' is enabled, a form will be presented for the user to report
|
||||||
* the error to 'technicalcontact_email'.
|
* the error to 'technicalcontact_email'.
|
||||||
*/
|
*/
|
||||||
'showerrors' => true,
|
'showerrors' => false,
|
||||||
'errorreporting' => true,
|
'errorreporting' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When showerrors is true, this is an array of which errors
|
||||||
|
* should still be shown to the user. By default an error will
|
||||||
|
* always be shown if showerrors==true and this setting is at the default value to allow all.
|
||||||
|
*
|
||||||
|
* If you list anything in this option you have to explicitly list each error
|
||||||
|
* you would like to be shown to the user. You can also set the value to false
|
||||||
|
* to hide that error. If this setting is used with anything other than the default
|
||||||
|
* value and an error is not listed in the list then a backtrace for that error
|
||||||
|
* will not be shown.
|
||||||
|
*
|
||||||
|
* These can be any of the error codes in
|
||||||
|
* src/SimpleSAML/Error/ErrorCodes.php
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
'showerrors.whitelist' => [ '*' => true ],
|
||||||
|
/*
|
||||||
|
some of the many possibilities for this setting
|
||||||
|
|
||||||
|
'showerrors.whitelist' => [
|
||||||
|
'ACSPARAMS' => true,
|
||||||
|
'ADMINNOTHASHED' => true,
|
||||||
|
'ARSPARAMS' => true,
|
||||||
|
'AUTHSOURCEERROR' => true,
|
||||||
|
'BADREQUEST' => true,
|
||||||
|
'CASERROR' => true,
|
||||||
|
'CONFIG' => true,
|
||||||
|
'CREATEREQUEST' => true,
|
||||||
|
'DISCOPARAMS' => true,
|
||||||
|
'GENERATEAUTHNRESPONSE' => true,
|
||||||
|
'INVALIDCERT' => true,
|
||||||
|
'LDAPERROR' => true,
|
||||||
|
'LOGOUTINFOLOST' => true,
|
||||||
|
'LOGOUTREQUEST' => true,
|
||||||
|
'MEMCACHEDOWN' => true,
|
||||||
|
'METADATA' => true,
|
||||||
|
'METADATANOTFOUND' => true,
|
||||||
|
'METHODNOTALLOWED' => true,
|
||||||
|
'NOACCESS' => true,
|
||||||
|
'NOCERT' => true,
|
||||||
|
'NORELAYSTATE' => true,
|
||||||
|
'NOSTATE' => true,
|
||||||
|
'NOTFOUND' => true,
|
||||||
|
'NOTFOUNDREASON' => true,
|
||||||
|
'NOTSET' => true,
|
||||||
|
'NOTVALIDCERT' => true,
|
||||||
|
'NOTVALIDCERTSIGNATURE' => true,
|
||||||
|
'PROCESSASSERTION' => true,
|
||||||
|
'PROCESSAUTHNREQUEST' => true,
|
||||||
|
'RESPONSESTATUSNOSUCCESS' => true,
|
||||||
|
'SLOSERVICEPARAMS' => true,
|
||||||
|
'SSOPARAMS' => true,
|
||||||
|
'UNHANDLEDEXCEPTION' => true,
|
||||||
|
'UNKNOWNCERT' => true,
|
||||||
|
'USERABORTED' => true,
|
||||||
|
'WRONGUSERPASS' => true,
|
||||||
|
],
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Custom error show function called from SimpleSAML\Error\Error::show.
|
* Custom error show function called from SimpleSAML\Error\Error::show.
|
||||||
* See docs/simplesamlphp-errorhandling.md for function code example.
|
* See docs/simplesamlphp-errorhandling.md for function code example.
|
||||||
@@ -453,7 +526,7 @@ $config = [
|
|||||||
* Proxy to use for retrieving URLs.
|
* Proxy to use for retrieving URLs.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* 'proxy' => 'tcp://proxy.example.com:5100'
|
* 'proxy' => 'http://proxy.example.com:5100'
|
||||||
*/
|
*/
|
||||||
'proxy' => null,
|
'proxy' => null,
|
||||||
|
|
||||||
@@ -547,22 +620,20 @@ $config = [
|
|||||||
***********/
|
***********/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* 'module.enable' => [
|
* 'module.enable' => [
|
||||||
* 'exampleauth' => true, // Setting to TRUE enables.
|
* 'exampleauth' => true, // Setting to TRUE enables.
|
||||||
* 'consent' => false, // Setting to FALSE disables.
|
* 'consent' => false, // Setting to FALSE disables.
|
||||||
* 'core' => null, // Unset or NULL uses default.
|
* 'core' => null, // Unset or NULL uses default from \SimpleSAML\Module::$core_modules.
|
||||||
* ],
|
* ],
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'module.enable' => [
|
'module.enable' => [
|
||||||
'exampleauth' => false,
|
|
||||||
'core' => true,
|
'core' => true,
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
'saml' => true
|
'saml' => true,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
@@ -823,7 +894,7 @@ $config = [
|
|||||||
*/
|
*/
|
||||||
'language.available' => [
|
'language.available' => [
|
||||||
'en', 'no', 'nn', 'se', 'da', 'de', 'sv', 'fi', 'es', 'ca', 'fr', 'it', 'nl', 'lb',
|
'en', 'no', 'nn', 'se', 'da', 'de', 'sv', 'fi', 'es', 'ca', 'fr', 'it', 'nl', 'lb',
|
||||||
'cs', 'sk', 'sl', 'lt', 'hr', 'hu', 'pl', 'pt', 'pt-br', 'tr', 'ja', 'zh', 'zh-tw',
|
'cs', 'sk', 'sl', 'lt', 'hr', 'hu', 'pl', 'pt', 'pt_BR', 'tr', 'ja', 'zh', 'zh_TW',
|
||||||
'ru', 'et', 'he', 'id', 'sr', 'lv', 'ro', 'eu', 'el', 'af', 'zu', 'xh', 'st',
|
'ru', 'et', 'he', 'id', 'sr', 'lv', 'ro', 'eu', 'el', 'af', 'zu', 'xh', 'st',
|
||||||
],
|
],
|
||||||
'language.rtl' => ['ar', 'dv', 'fa', 'ur', 'he'],
|
'language.rtl' => ['ar', 'dv', 'fa', 'ur', 'he'],
|
||||||
@@ -899,6 +970,14 @@ $config = [
|
|||||||
*/
|
*/
|
||||||
'template.auto_reload' => false,
|
'template.auto_reload' => false,
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the 'template.debug' to true to enable debugging for Twig templates.
|
||||||
|
* This is useful during development as it provides better error messages.
|
||||||
|
* Defaults to false.
|
||||||
|
*/
|
||||||
|
//'template.debug' => false,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set this option to true to indicate that your installation of SimpleSAMLphp
|
* Set this option to true to indicate that your installation of SimpleSAMLphp
|
||||||
* is running in a production environment. This will affect the way resources
|
* is running in a production environment. This will affect the way resources
|
||||||
@@ -916,6 +995,19 @@ $config = [
|
|||||||
* The serving of the resources can be configured through these settings.
|
* The serving of the resources can be configured through these settings.
|
||||||
*/
|
*/
|
||||||
'assets' => [
|
'assets' => [
|
||||||
|
/*
|
||||||
|
* Used to generate cache buster tags. This salt is only used for this purpose.
|
||||||
|
* You should set this in the same way as secretsalt.
|
||||||
|
*
|
||||||
|
* You can change this salt at any time. This will have the effect of explicit
|
||||||
|
* cache busting as the tags for resources will change and thus all resources
|
||||||
|
* will be fetched again.
|
||||||
|
*
|
||||||
|
* Leaving the default value in place can allow an attacker the opportunity
|
||||||
|
* to work out the version of SSP you have installed.
|
||||||
|
*/
|
||||||
|
'salt' => 'assets.salt.default',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These settings adjust the caching headers that are sent
|
* These settings adjust the caching headers that are sent
|
||||||
* when serving static resources.
|
* when serving static resources.
|
||||||
@@ -1129,6 +1221,21 @@ $config = [
|
|||||||
* ['type' => 'xml', 'file' => 'idp.example.org-idpMeta.xml'],
|
* ['type' => 'xml', 'file' => 'idp.example.org-idpMeta.xml'],
|
||||||
* ],
|
* ],
|
||||||
*
|
*
|
||||||
|
* This example defines a remote xml-file with optional connection context.
|
||||||
|
* See PHP documentation for possible context options: https://www.php.net/manual/en/context.php
|
||||||
|
*
|
||||||
|
* 'metadata.sources' => [
|
||||||
|
* [
|
||||||
|
* 'type' => 'xml',
|
||||||
|
* 'url' => 'https://example.org/idp.example.org-idpMeta.xml',
|
||||||
|
* 'context' => [
|
||||||
|
* 'ssl' => [
|
||||||
|
* 'verify_peer' => true,
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
*
|
||||||
* This example defines an mdq source.
|
* This example defines an mdq source.
|
||||||
* 'metadata.sources' => [
|
* 'metadata.sources' => [
|
||||||
* [
|
* [
|
||||||
@@ -1,23 +1,21 @@
|
|||||||
<?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' => [
|
||||||
array (
|
0 => [
|
||||||
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' => [
|
||||||
array (
|
0 => [
|
||||||
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',
|
||||||
);
|
];
|
||||||
9
dist/simplesamlphp-authsources.php
vendored
9
dist/simplesamlphp-authsources.php
vendored
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
$config = array(
|
|
||||||
|
|
||||||
/* This is the name of this authentication source, and will be used to access it later. */
|
|
||||||
'default-sp' => array(
|
|
||||||
'saml:SP',
|
|
||||||
'idp' => 'https://idp.pvv.ntnu.no/',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
45
dist/sql/pvv_mysql.sql
vendored
Normal file
45
dist/sql/pvv_mysql.sql
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
CREATE TABLE events (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
`name` TEXT,
|
||||||
|
`start` TEXT,
|
||||||
|
`stop` TEXT,
|
||||||
|
`organiser` TEXT,
|
||||||
|
`location` TEXT,
|
||||||
|
`description` TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE projects (
|
||||||
|
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
`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 AUTO_INCREMENT,
|
||||||
|
`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);
|
||||||
54
dist/sql/pvv_sqlite.sql
vendored
Normal file
54
dist/sql/pvv_sqlite.sql
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
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);
|
||||||
6
flake.lock
generated
6
flake.lock
generated
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1707939175,
|
"lastModified": 1765803225,
|
||||||
"narHash": "sha256-D1xan0lgxbmXDyzVqXTiSYHLmAMrMRdD+alKzEO/p3w=",
|
"narHash": "sha256-xwaZV/UgJ04+ixbZZfoDE8IsOWjtvQZICh9aamzPnrg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "f7e8132daca31b1e3859ac0fb49741754375ac3d",
|
"rev": "ac9a217389ee622d4e1e727c4efcc9c4bc9089ba",
|
||||||
"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.php82; };
|
pvv-nettsiden = pkgs.callPackage ./nix/package.nix { php = pkgs.php84; };
|
||||||
});
|
});
|
||||||
|
|
||||||
overlays.default = final: prev: {
|
overlays.default = final: prev: {
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?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,33 +1,36 @@
|
|||||||
<?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,5 +1,7 @@
|
|||||||
<?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' => '',
|
||||||
@@ -16,7 +18,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, '/') . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,17 +27,19 @@ 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 (is_null($sp)) $sp = 'default-sp';
|
if (null === $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" />
|
||||||
@@ -48,7 +52,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";
|
||||||
|
|||||||
@@ -4,18 +4,33 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
php.buildComposerProject rec {
|
php.buildComposerProject rec {
|
||||||
src = ./..;
|
src = lib.fileset.toSource {
|
||||||
|
root = ./..;
|
||||||
|
fileset = lib.fileset.difference
|
||||||
|
(lib.fileset.unions [
|
||||||
|
../dist
|
||||||
|
../inc
|
||||||
|
../src
|
||||||
|
../www
|
||||||
|
../composer.json
|
||||||
|
../composer.lock
|
||||||
|
])
|
||||||
|
(lib.fileset.unions [
|
||||||
|
(lib.fileset.maybeMissing ../www/simplesaml)
|
||||||
|
(lib.fileset.maybeMissing ../www/simplesaml-idp)
|
||||||
|
]);
|
||||||
|
};
|
||||||
pname = "pvv-nettsiden";
|
pname = "pvv-nettsiden";
|
||||||
version = "0.0.1";
|
version = "0.0.1";
|
||||||
vendorHash = "sha256-sWC5E60toa95re2NugvHVPT+vKYXc1I6Z3rSqXxTUu0=";
|
vendorHash = "sha256-7I7Fdp5DvCwCdYY66Mv0hZ+a8xRzQt+WMUKG544k7Fc=";
|
||||||
|
|
||||||
passthru.simplesamlphpPath = "share/php/pvv-nettsiden/vendor/simplesamlphp/simplesamlphp";
|
passthru.simplesamlphpPath = "share/php/pvv-nettsiden/vendor/simplesamlphp/simplesamlphp";
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
install -Dm644 dist/simplesamlphp-config.php $out/${passthru.simplesamlphpPath}/config/config.php
|
install -Dm644 dist/simplesaml-prod/config.php "$out"/${passthru.simplesamlphpPath}/config/config.php
|
||||||
install -Dm644 dist/simplesamlphp-authsources.php $out/${passthru.simplesamlphpPath}/config/authsources.php
|
install -Dm644 dist/simplesaml-prod/authsources.php "$$out/${passthru.simplesamlphpPath}/config/authsources.php
|
||||||
install -Dm644 dist/simplesamlphp-idp.php $out/${passthru.simplesamlphpPath}/metadata/saml20-idp-remote.php
|
install -Dm644 dist/simplesaml-prod/saml20-idp-remote.php "$$out/${passthru.simplesamlphpPath}/metadata/saml20-idp-remote.php
|
||||||
install -Dm644 dist/config.source-env.php $out/share/php/pvv-nettsiden/config.php
|
install -Dm644 dist/config.source-env.php "$$out/share/php/pvv-nettsiden/config.php
|
||||||
|
|
||||||
${lib.pipe extra_files [
|
${lib.pipe extra_files [
|
||||||
(lib.mapAttrsToList (target_path: source_path: ''
|
(lib.mapAttrsToList (target_path: source_path: ''
|
||||||
|
|||||||
@@ -1,39 +1,58 @@
|
|||||||
{ pkgs }:
|
{ pkgs, lib }:
|
||||||
let
|
let
|
||||||
phpEnv = pkgs.php82.buildEnv {
|
phpEnv = pkgs.php84.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
|
||||||
php82Packages.composer
|
php84Packages.composer
|
||||||
|
php84Packages.php-parallel-lint
|
||||||
sqlite
|
php84Packages.php-cs-fixer
|
||||||
git
|
sqlite-interactive
|
||||||
|
sql-formatter
|
||||||
|
openssl
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Prepare dev environment with sqlite and config files
|
||||||
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/'
|
||||||
|
|
||||||
# Prepare dev environment with sqlite and config files
|
declare -a PROJECT_ROOT="$("${lib.getExe pkgs.git}" rev-parse --show-toplevel)"
|
||||||
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/sql/pvv_sqlite.sql"
|
||||||
|
test -e "$PROJECT_ROOT/config.php" || cp -v "$PROJECT_ROOT/dist/config.local.php" "$PROJECT_ROOT/config.php"
|
||||||
|
|
||||||
if [ ! -d www/galleri/bilder/slideshow ] ; then
|
if [ ! -d "$PROJECT_ROOT/vendor" ] ; then
|
||||||
mkdir -p www/galleri/bilder/slideshow
|
pushd "$PROJECT_ROOT"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d vendor ] ; then
|
|
||||||
composer install || exit $?
|
composer install || exit $?
|
||||||
|
|
||||||
cp dist/simplesamlphp-authsources.php vendor/simplesamlphp/simplesamlphp/config/authsources.php
|
# Set up SimpleSAMLphp identity provider (for local testing)
|
||||||
cp dist/simplesamlphp-idp.php vendor/simplesamlphp/simplesamlphp/metadata/saml20-idp-remote.php
|
install -m644 dist/simplesaml-dev/authsources.php -t vendor/simplesamlphp/simplesamlphp/config/
|
||||||
cp dist/simplesamlphp-config.php vendor/simplesamlphp/simplesamlphp/config/config.php
|
install -m644 dist/simplesaml-dev/config.php -t vendor/simplesamlphp/simplesamlphp/config/
|
||||||
|
install -m644 dist/simplesaml-dev/saml20-idp-remote.php -t vendor/simplesamlphp/simplesamlphp/metadata/
|
||||||
|
install -m644 dist/simplesaml-dev/saml20-idp-hosted.php -t vendor/simplesamlphp/simplesamlphp/metadata/
|
||||||
|
install -m644 dist/simplesaml-dev/saml20-sp-remote.php -t vendor/simplesamlphp/simplesamlphp/metadata/
|
||||||
|
|
||||||
|
# See session.phpsession.savepath in config.php
|
||||||
|
mkdir -p vendor/simplesamlphp/simplesamlphp/sessions/
|
||||||
|
|
||||||
|
openssl req \
|
||||||
|
-newkey rsa:4096 \
|
||||||
|
-new \
|
||||||
|
-x509 \
|
||||||
|
-days 3652 \
|
||||||
|
-nodes \
|
||||||
|
-out vendor/simplesamlphp/simplesamlphp/cert/localhost.crt \
|
||||||
|
-keyout vendor/simplesamlphp/simplesamlphp/cert/localhost.pem \
|
||||||
|
-subj "/C=NO/ST=Trondheim/L=Trondheim/O=Programvareverkstedet/CN=localhost"
|
||||||
|
|
||||||
cp dist/config.local.php config.php
|
cp dist/config.local.php config.php
|
||||||
|
|
||||||
ln -s ../vendor/simplesamlphp/simplesamlphp/www/ www/simplesaml
|
ln -s ../vendor/simplesamlphp/simplesamlphp/public/ www/simplesaml
|
||||||
|
popd
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?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>
|
||||||
*
|
*
|
||||||
@@ -14,7 +16,7 @@
|
|||||||
* 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.
|
||||||
*
|
*
|
||||||
@@ -36,4 +38,4 @@
|
|||||||
*/
|
*/
|
||||||
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,37 +1,38 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pvv\admin;
|
namespace pvv\admin;
|
||||||
|
|
||||||
use \PDO;
|
|
||||||
|
|
||||||
class UserManager {
|
class UserManager {
|
||||||
private $pdo;
|
private \PDO $pdo;
|
||||||
|
|
||||||
public $usergroups = [
|
public array $usergroups = [
|
||||||
'admin' => 1,
|
'admin' => 1,
|
||||||
'prosjekt' => 2,
|
'prosjekt' => 2,
|
||||||
'aktiviteter' => 4
|
'aktiviteter' => 4,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct($pdo){
|
public function __construct(\PDO $pdo) {
|
||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setupUser($uname, $groups=0){
|
public function setupUser(string $uname, int $groups = 0): void {
|
||||||
$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){
|
public function updateFlags(string $uname, int $flags): void {
|
||||||
$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){
|
public function addGroup(string $uname, int $group): void {
|
||||||
$userFlags = $this->getUsergroups($uname);
|
$userFlags = $this->getUsergroups($uname);
|
||||||
|
|
||||||
if ($userFlags) {
|
if ($userFlags) {
|
||||||
@@ -40,7 +41,7 @@ class UserManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeGroup($uname, $group){
|
public function removeGroup(string $uname, int $group): void {
|
||||||
$userFlags = $this->getUsergroups($uname);
|
$userFlags = $this->getUsergroups($uname);
|
||||||
|
|
||||||
if ($userFlags) {
|
if ($userFlags) {
|
||||||
@@ -49,40 +50,40 @@ class UserManager{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setGroups($uname, $groups){
|
public function setGroups(string $uname, int $groups): void {
|
||||||
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasGroup($uname, $groupName){
|
public function hasGroup(string $uname, string $groupName): bool {
|
||||||
$userFlags = $this->getUsergroups($uname);
|
$userFlags = $this->getUsergroups($uname);
|
||||||
|
|
||||||
return ($userFlags & $this->usergroups[$groupName]);
|
return (bool) ($userFlags & $this->usergroups[$groupName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for convenience
|
// for convenience
|
||||||
public function isAdmin($uname){
|
public function isAdmin(string $uname): bool {
|
||||||
return $this->hasGroup($uname, 'admin');
|
return $this->hasGroup($uname, 'admin');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFlagfromNames($names){
|
public function getFlagfromNames(array $names): int {
|
||||||
$resultFlag = 0;
|
$resultFlag = 0;
|
||||||
|
|
||||||
foreach ($this->usergroups as $name => $flag) {
|
foreach ($this->usergroups as $name => $flag) {
|
||||||
if(in_array($name, $names)){
|
if (\in_array($name, $names, true)) {
|
||||||
$resultFlag = ($resultFlag | $flag);
|
$resultFlag = ($resultFlag | $flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,18 +91,24 @@ class UserManager{
|
|||||||
return $resultFlag;
|
return $resultFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUsergroups($uname){
|
public function getUsergroups(string $uname): int {
|
||||||
$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) return 0;
|
if ($row === false) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return $row[0];
|
return $row[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUsergroupNames($uname){
|
/**
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getUsergroupNames($uname): array {
|
||||||
$usersGroups = [];
|
$usersGroups = [];
|
||||||
|
|
||||||
$userFlags = $this->getUsergroups($uname);
|
$userFlags = $this->getUsergroups($uname);
|
||||||
@@ -115,7 +122,10 @@ class UserManager{
|
|||||||
return $usersGroups;
|
return $usersGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAllUserData(){
|
/**
|
||||||
|
* @return array<int,array{name:string,groups:string[]}>
|
||||||
|
*/
|
||||||
|
public function getAllUserData(): array {
|
||||||
$query = 'SELECT uname FROM users ORDER BY uname ASC';
|
$query = 'SELECT uname FROM users ORDER BY uname ASC';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
@@ -125,7 +135,7 @@ class UserManager{
|
|||||||
$uname = $userData['uname'];
|
$uname = $userData['uname'];
|
||||||
$users[] = [
|
$users[] = [
|
||||||
'name' => $uname,
|
'name' => $uname,
|
||||||
'groups' => $this->getUsergroupNames($uname)
|
'groups' => $this->getUsergroupNames($uname),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
use \DateTimeImmutable;
|
|
||||||
|
|
||||||
interface Activity {
|
interface Activity {
|
||||||
|
public function getNextEventFrom(\DateTimeImmutable $date): ?Event;
|
||||||
|
|
||||||
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */;
|
public function getPreviousEventFrom(\DateTimeImmutable $date): ?Event;
|
||||||
|
|
||||||
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,43 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
use \DateTimeImmutable;
|
|
||||||
use \DateInterval;
|
|
||||||
|
|
||||||
class Agenda {
|
class Agenda {
|
||||||
|
private array $activities;
|
||||||
|
|
||||||
private $activities;
|
public const int TODAY = 0;
|
||||||
|
public const int TOMORROW = 1;
|
||||||
|
public const int THIS_WEEK = 2;
|
||||||
|
public const int NEXT_WEEK = 3;
|
||||||
|
public const int THIS_MONTH = 4;
|
||||||
|
public const int NEXT_MONTH = 5;
|
||||||
|
|
||||||
const TODAY = 0;
|
/**
|
||||||
const TOMORROW = 1;
|
* @param array<int,DBActivity> $activities
|
||||||
const THIS_WEEK = 2;
|
*/
|
||||||
const NEXT_WEEK = 3;
|
public function __construct(array $activities) {
|
||||||
const THIS_MONTH = 4;
|
|
||||||
const NEXT_MONTH = 5;
|
|
||||||
|
|
||||||
public function __construct($activities) {
|
|
||||||
$this->activities = $activities;
|
$this->activities = $activities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFormattedDate($date) {
|
public static function getFormattedDate(\DateTimeImmutable $date): string {
|
||||||
return $date->format("l j. M H.i");
|
return $date->format('l j. M H.i');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEventsBetween(DateTimeImmutable $from, DateTimeImmutable $to) {
|
/**
|
||||||
|
* @return array<Event>
|
||||||
|
*/
|
||||||
|
public function getEventsBetween(
|
||||||
|
\DateTimeImmutable $from,
|
||||||
|
\DateTimeImmutable $to,
|
||||||
|
) {
|
||||||
$results = [];
|
$results = [];
|
||||||
for($i = 0; $i < sizeof($this->activities); $i++) {
|
for ($i = 0; $i < \count($this->activities); ++$i) {
|
||||||
$result = [];
|
$result = [];
|
||||||
do {
|
do {
|
||||||
$run = false;
|
$run = false;
|
||||||
if (sizeof($result)) {
|
if (\count($result)) {
|
||||||
$date = end($result)->getStop();
|
$date = end($result)->getStop();
|
||||||
} else {
|
} else {
|
||||||
$date = $from;
|
$date = $from;
|
||||||
@@ -43,66 +51,86 @@ class Agenda {
|
|||||||
$results[] = $result;
|
$results[] = $result;
|
||||||
}
|
}
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach($results as $a) foreach($a as $b) $result[] = $b;
|
foreach ($results as $a) {
|
||||||
usort($result, function($a, $b) {
|
foreach ($a as $b) {
|
||||||
return ($a->getStart() < $b->getStart()) ? -1 : 1;
|
$result[] = $b;
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
usort(
|
||||||
|
$result,
|
||||||
|
static fn($a, $b) => $a->getStart() < $b->getStart() ? -1 : 1,
|
||||||
|
);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextDays() {
|
/**
|
||||||
|
* @return array<int,array>
|
||||||
|
*/
|
||||||
|
public function getNextDays(): array {
|
||||||
$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())) $index = self::TODAY;
|
if (self::isToday($event->getStart())) {
|
||||||
elseif (self::isTomorrow($event->getStart())) $index = self::TOMORROW;
|
$index = self::TODAY;
|
||||||
elseif (self::isThisWeek($event->getStart())) $index = self::THIS_WEEK;
|
} elseif (self::isTomorrow($event->getStart())) {
|
||||||
elseif (self::isNextWeek($event->getStart())) $index = self::NEXT_WEEK;
|
$index = self::TOMORROW;
|
||||||
elseif (self::isThisMonth($event->getStart())) $index = self::THIS_MONTH;
|
} elseif (self::isThisWeek($event->getStart())) {
|
||||||
|
$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) {
|
/**
|
||||||
$result = array_filter(array_map(
|
* @return array<Event>
|
||||||
function($a) use ($startDate){
|
*/
|
||||||
return $a->getNextEventFrom($startDate);
|
public function getNextOfEach(\DateTimeImmutable $startDate): array {
|
||||||
}, $this->activities
|
$result = array_filter(
|
||||||
), function($a){
|
array_map(
|
||||||
return isset($a);
|
static fn($a) => $a->getNextEventFrom($startDate),
|
||||||
});
|
$this->activities,
|
||||||
usort($result, function($a, $b) {
|
),
|
||||||
return ($a->getStart()->getTimeStamp() < $b->getStart()->getTimeStamp())
|
static fn($a) => isset($a),
|
||||||
|
);
|
||||||
|
usort(
|
||||||
|
$result,
|
||||||
|
static fn($a, $b) => $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): bool {
|
||||||
return $date->format('dmY') == date('dmY');
|
return $date->format('dmY') === date('dmY');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isTomorrow(DateTimeImmutable $date) {
|
public static function isTomorrow(\DateTimeImmutable $date): bool {
|
||||||
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): bool {
|
||||||
return $date->format('WY') == date('WY');
|
return $date->format('WY') === date('WY');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isNextWeek(DateTimeImmutable $date) {
|
public static function isNextWeek(\DateTimeImmutable $date): bool {
|
||||||
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): bool {
|
||||||
return $date->format('mY') == date('mY');
|
return $date->format('mY') === date('mY');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace pvv\side;
|
|
||||||
|
|
||||||
use \DateTimeImmutable;
|
declare(strict_types=1);
|
||||||
use \PDO;
|
|
||||||
|
namespace pvv\side;
|
||||||
|
|
||||||
class DBActivity implements Activity {
|
class DBActivity implements Activity {
|
||||||
private $pdo;
|
private $pdo;
|
||||||
|
|
||||||
public function __construct(PDO $pdo) {
|
public function __construct(\PDO $pdo) {
|
||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAllEvents() {
|
/**
|
||||||
|
* @return SimpleEvent[]
|
||||||
|
*/
|
||||||
|
public function getAllEvents(): array {
|
||||||
$query = 'SELECT * FROM events ORDER BY id DESC';
|
$query = 'SELECT * FROM events ORDER BY id DESC';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
@@ -21,11 +24,11 @@ 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'],
|
||||||
);
|
);
|
||||||
$events[] = $event;
|
$events[] = $event;
|
||||||
}
|
}
|
||||||
@@ -33,53 +36,58 @@ class DBActivity implements Activity {
|
|||||||
return $events;
|
return $events;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEventByID($id) {
|
public function getEventByID(int $id): SimpleEvent {
|
||||||
$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): ?Event {
|
||||||
|
$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): ?Event {
|
||||||
$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(
|
||||||
|
\DateTimeImmutable $date,
|
||||||
|
string $query,
|
||||||
|
): ?SimpleEvent {
|
||||||
$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)) {
|
||||||
$ev = new SimpleEvent(
|
return 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace pvv\side;
|
|
||||||
|
|
||||||
use \PDO;
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pvv\side;
|
||||||
|
|
||||||
class Door {
|
class Door {
|
||||||
private $pdo;
|
private $pdo;
|
||||||
|
|
||||||
public function __construct(PDO $pdo){
|
public function __construct(\PDO $pdo) {
|
||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAll() {
|
/**
|
||||||
|
* @return array{time: int, open: bool}[]
|
||||||
|
*/
|
||||||
|
public function getAll(): array {
|
||||||
$query = 'SELECT time, open FROM door ORDER BY time DESC';
|
$query = 'SELECT time, open FROM door ORDER BY time DESC';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
@@ -19,54 +23,62 @@ 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'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $doorEvents;
|
return $doorEvents;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEntriesAfter($startTime) {
|
/**
|
||||||
$query = 'SELECT time, open FROM door WHERE time > :startTime ORDER BY time DESC';
|
* @return array{time: int, open: bool}[]
|
||||||
|
*/
|
||||||
|
public function getEntriesAfter(\DateTimeImmutable $startTime): array {
|
||||||
|
$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'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $doorEvents;
|
return $doorEvents;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCurrent() {
|
/**
|
||||||
|
* @return array{time: int, open: bool}
|
||||||
|
*/
|
||||||
|
public function getCurrent(): array {
|
||||||
$query = 'SELECT time, open FROM door ORDER BY time DESC LIMIT 1';
|
$query = 'SELECT time, open FROM door ORDER BY time DESC LIMIT 1';
|
||||||
$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() {
|
private function removeOld(): void {
|
||||||
$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) {
|
public function createEvent(\DateTimeImmutable $time, bool $open): void {
|
||||||
$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,30 +1,32 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
use \DateTimeImmutable;
|
|
||||||
use \DateInterval;
|
|
||||||
|
|
||||||
abstract class Event {
|
abstract class Event {
|
||||||
|
private \DateTimeImmutable $start;
|
||||||
|
|
||||||
private $start;
|
public function __construct(\DateTimeImmutable $start) {
|
||||||
|
|
||||||
public function __construct(DateTimeImmutable $start) {
|
|
||||||
$this->start = $start;
|
$this->start = $start;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStart() {
|
public function getStart(): \DateTimeImmutable {
|
||||||
return $this->start;
|
return $this->start;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRelativeDate() {
|
public function getRelativeDate(): string {
|
||||||
if (Agenda::isToday($this->getStart())) {
|
if (Agenda::isToday($this->getStart())) {
|
||||||
return 'i dag';
|
return 'i dag';
|
||||||
}
|
}
|
||||||
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 (
|
||||||
return $this->getStart()->format("l");
|
Agenda::isThisWeek($this->getStart())
|
||||||
|
|| $this->getStart()->sub(new \DateInterval('P4D'))->getTimestamp() < time()
|
||||||
|
) {
|
||||||
|
return $this->getStart()->format('l');
|
||||||
}
|
}
|
||||||
if (Agenda::isNextWeek($this->getStart())) {
|
if (Agenda::isNextWeek($this->getStart())) {
|
||||||
return 'neste uke';
|
return 'neste uke';
|
||||||
@@ -32,22 +34,26 @@ abstract class Event {
|
|||||||
if (Agenda::isThisMonth($this->getStart())) {
|
if (Agenda::isThisMonth($this->getStart())) {
|
||||||
return 'denne måneden';
|
return 'denne måneden';
|
||||||
}
|
}
|
||||||
return $this->getStart()->format("j. F");
|
|
||||||
|
return $this->getStart()->format('j. F');
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract function getStop(); /* : DateTimeImmutable */
|
abstract public function getStop(): \DateTimeImmutable;
|
||||||
|
|
||||||
public abstract function getName();
|
abstract public function getName(): string;
|
||||||
|
|
||||||
public abstract function getLocation();
|
abstract public function getLocation(): string;
|
||||||
|
|
||||||
public abstract function getOrganiser();
|
abstract public function getOrganiser(): string;
|
||||||
|
|
||||||
public abstract function getURL(); /* : string */
|
abstract public function getURL(): string;
|
||||||
|
|
||||||
public abstract function getImageURL(); /* : string */
|
abstract public function getImageURL(): string;
|
||||||
|
|
||||||
public abstract function getDescription(); /* : string */
|
/**
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
abstract public function getDescription(): array;
|
||||||
|
|
||||||
public abstract function getColor(); /* : string */
|
abstract public function getColor(): string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +1,55 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace pvv\side;
|
|
||||||
|
|
||||||
use \PDO;
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pvv\side;
|
||||||
|
|
||||||
class MOTD {
|
class MOTD {
|
||||||
private $pdo;
|
private $pdo;
|
||||||
|
|
||||||
public function __construct($pdo){
|
public function __construct(\PDO $pdo) {
|
||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMOTD($title, $content) {
|
public function setMOTD(string $title, string $content): void {
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMOTD() {
|
/**
|
||||||
$query = 'SELECT motd.title, motd.content FROM motd ORDER BY motd.id DESC LIMIT 1';
|
* @return array{title: string, content: string[]}
|
||||||
|
*/
|
||||||
|
public function getMOTD(): array {
|
||||||
|
$query
|
||||||
|
= 'SELECT motd.title, motd.content FROM motd ORDER BY motd.id DESC LIMIT 1';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$data = $statement->fetch();
|
$data = $statement->fetch();
|
||||||
$motd = array("title" => $data[0], "content" => explode("\n", $data[1]));
|
|
||||||
|
|
||||||
return $motd;
|
return ['title' => $data[0], 'content' => explode("\n", $data[1])];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMOTD_history($limit = 5) {
|
/**
|
||||||
$query = 'SELECT motd.title, motd.content FROM motd ORDER BY motd.id DESC LIMIT :limit';
|
* @return array{title: string, content: string[]}
|
||||||
|
*/
|
||||||
|
public function getMOTD_history(int $limit = 5): array {
|
||||||
|
$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 $motd;
|
return ['title' => $data[0], 'content' => explode("\n", $data[1])];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,40 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
class Project {
|
class Project {
|
||||||
private $id, $name, $descr, $active;
|
private int $id;
|
||||||
|
private string $name;
|
||||||
|
private array $descr;
|
||||||
|
private bool $active;
|
||||||
|
|
||||||
public function __construct($id, $name, $descr, $active){
|
public function __construct(
|
||||||
|
int $id,
|
||||||
|
string $name,
|
||||||
|
string $descr,
|
||||||
|
bool $active,
|
||||||
|
) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->descr = explode("\n", $descr);
|
$this->descr = explode("\n", $descr);
|
||||||
$this->active = $active;
|
$this->active = $active;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getID(){
|
public function getID(): int {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(): string {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription(){
|
public function getDescription(): array {
|
||||||
return $this->descr;
|
return $this->descr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getActive(){
|
public function getActive(): bool {
|
||||||
return $this->active;
|
return $this->active;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace pvv\side;
|
|
||||||
|
|
||||||
use \PDO;
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pvv\side;
|
||||||
|
|
||||||
class ProjectManager {
|
class ProjectManager {
|
||||||
private $pdo;
|
private $pdo;
|
||||||
|
|
||||||
public function __construct(PDO $pdo){
|
public function __construct(\PDO $pdo) {
|
||||||
$this->pdo = $pdo;
|
$this->pdo = $pdo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAll() {
|
/**
|
||||||
|
* @return Project[]
|
||||||
|
*/
|
||||||
|
public function getAll(): array {
|
||||||
$query = 'SELECT * FROM projects ORDER BY id ASC';
|
$query = 'SELECT * FROM projects ORDER BY id ASC';
|
||||||
$statement = $this->pdo->prepare($query);
|
$statement = $this->pdo->prepare($query);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
@@ -21,7 +25,7 @@ class ProjectManager{
|
|||||||
$dbProj['id'],
|
$dbProj['id'],
|
||||||
$dbProj['name'],
|
$dbProj['name'],
|
||||||
$dbProj['description'],
|
$dbProj['description'],
|
||||||
$dbProj['active']
|
$dbProj['active'],
|
||||||
);
|
);
|
||||||
$projects[] = $project;
|
$projects[] = $project;
|
||||||
}
|
}
|
||||||
@@ -29,30 +33,32 @@ class ProjectManager{
|
|||||||
return $projects;
|
return $projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getByID($id){
|
public function getByID(int $id): ?Project {
|
||||||
$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 null;
|
||||||
}
|
}
|
||||||
$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){
|
/**
|
||||||
|
* @return Project[]
|
||||||
|
*/
|
||||||
|
public function getByOwner(string $uname): array {
|
||||||
$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 +68,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) {
|
||||||
@@ -70,7 +76,7 @@ class ProjectManager{
|
|||||||
$dbProj['id'],
|
$dbProj['id'],
|
||||||
$dbProj['name'],
|
$dbProj['name'],
|
||||||
$dbProj['description'],
|
$dbProj['description'],
|
||||||
$dbProj['active']
|
$dbProj['active'],
|
||||||
);
|
);
|
||||||
$projects[] = $project;
|
$projects[] = $project;
|
||||||
}
|
}
|
||||||
@@ -79,10 +85,13 @@ class ProjectManager{
|
|||||||
return $projects;
|
return $projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProjectMembers($id){
|
/**
|
||||||
|
* @return array<int,array>
|
||||||
|
*/
|
||||||
|
public function getProjectMembers(int $id): array {
|
||||||
$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,29 +102,31 @@ 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'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $members;
|
return $members;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProjectOwner($id){
|
/**
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
public function getProjectOwner(int $id): array {
|
||||||
$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,11 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pvv\side;
|
namespace pvv\side;
|
||||||
|
|
||||||
class SimpleEvent extends Event {
|
class SimpleEvent extends Event {
|
||||||
|
private int $id;
|
||||||
|
private string $name;
|
||||||
|
private array $descr;
|
||||||
|
private \DateTimeImmutable $start;
|
||||||
|
private \DateTimeImmutable $end;
|
||||||
|
private string $org;
|
||||||
|
private string $loc;
|
||||||
|
|
||||||
private $id, $name, $descr, $start, $end, $org, $loc;
|
public function __construct(
|
||||||
|
int $id,
|
||||||
public function __construct($id, $name,\DateTimeImmutable $start,\DateTimeImmutable $end,$org, $loc, $descr, $_isDBEvent = false){
|
string $name,
|
||||||
|
\DateTimeImmutable $start,
|
||||||
|
\DateTimeImmutable $end,
|
||||||
|
string $org,
|
||||||
|
string $loc,
|
||||||
|
string $descr,
|
||||||
|
bool $_isDBEvent = false,
|
||||||
|
) {
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->start = $start;
|
$this->start = $start;
|
||||||
@@ -15,44 +32,43 @@ class SimpleEvent extends Event {
|
|||||||
$this->descr = explode("\n", $descr);
|
$this->descr = explode("\n", $descr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getID(){
|
public function getID(): int {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStart(){
|
public function getStart(): \DateTimeImmutable {
|
||||||
return $this->start;
|
return $this->start;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStop(){
|
public function getStop(): \DateTimeImmutable {
|
||||||
return $this->end;
|
return $this->end;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser(){
|
public function getOrganiser(): string {
|
||||||
return $this->org;
|
return $this->org;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLocation(){
|
public function getLocation(): string {
|
||||||
return $this->loc;
|
return $this->loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(): string {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() {
|
public function getURL(): string {
|
||||||
return ('/hendelser/info.php?id=' . $this->id);
|
return '/hendelser/info.php?id=' . $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getImageURL() {
|
public function getImageURL(): string {
|
||||||
return null;
|
return '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription() {
|
public function getDescription(): array {
|
||||||
return $this->descr;
|
return $this->descr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor(): string {
|
||||||
return "#3b7";
|
return '#3b7';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,53 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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): \DateTimeImmutable {
|
||||||
public function nextDate(DateTimeImmutable $date) {
|
if (
|
||||||
if ($date->format('H') > 20 || $date->format('H') == 19 && $date->format('i') > 30)
|
(int) $date->format('H') > 20
|
||||||
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(19, 30, 0));
|
|| ((int) $date->format('H') === 19 && (int) $date->format('i') > 30)
|
||||||
|
) {
|
||||||
|
return $this->nextDate(
|
||||||
|
$date->add(new \DateInterval('P1D'))->setTime(19, 30, 0),
|
||||||
|
);
|
||||||
|
}
|
||||||
$date = $date->setTime(19, 30, 0);
|
$date = $date->setTime(19, 30, 0);
|
||||||
if ($date->format('N') != 5)
|
if ((int) $date->format('N') !== 5) {
|
||||||
return $this->nextDate($date->add(new DateInterval('P1D')));
|
return $this->nextDate($date->add(new \DateInterval('P1D')));
|
||||||
|
}
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prevDate(DateTimeImmutable $date) {
|
public function prevDate(\DateTimeImmutable $date): \DateTimeImmutable {
|
||||||
if ($date->format('H') < 19 || $date->format('H') == 20 && $date->format('i') < 30)
|
if (
|
||||||
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(19, 30, 0));
|
(int) $date->format('H') < 19
|
||||||
|
|| ((int) $date->format('H') === 20 && (int) $date->format('i') < 30)
|
||||||
|
) {
|
||||||
|
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 ($date->format('N') != 5)
|
if ((int) $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): AnimekveldEvent {
|
||||||
return new AnimekveldEvent($this->nextDate($date));
|
return new AnimekveldEvent($this->nextDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
public function getPreviousEventFrom(
|
||||||
|
\DateTimeImmutable $date,
|
||||||
|
): AnimekveldEvent {
|
||||||
return new AnimekveldEvent($this->prevDate($date));
|
return new AnimekveldEvent($this->prevDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,38 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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(): \DateTimeImmutable {
|
||||||
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(): string {
|
||||||
return "Koserommet";
|
/* : Location */
|
||||||
|
return 'Koserommet';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() /* : User */ {
|
public function getOrganiser(): string {
|
||||||
return "Christoffer Viken";
|
return 'Christoffer Viken';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() /* : string */ {
|
public function getURL(): string {
|
||||||
return '/anime/';
|
return '/anime/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getImageURL() {
|
public function getImageURL(): string {
|
||||||
return '/sosiale/animekveld.jpg';
|
return '/sosiale/animekveld.jpg';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription() {
|
public function getDescription(): array {
|
||||||
return [
|
return [
|
||||||
'Er du glad i japanske tegneserier eller bare nysgjerrig på hva anime er?',
|
'Er du glad i japanske tegneserier eller bare nysgjerrig på hva anime er?',
|
||||||
'Bli med oss hver fredag, der vi finner frem de nyeste episodene for sesongen!',
|
'Bli med oss hver fredag, der vi finner frem de nyeste episodene for sesongen!',
|
||||||
@@ -41,8 +42,7 @@ class AnimekveldEvent extends Event {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor(): string {
|
||||||
return "#35a";
|
return '#35a';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +1,59 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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): \DateTimeImmutable {
|
||||||
public function nextDate(DateTimeImmutable $date) {
|
if (
|
||||||
if ($date->format('H') > 17 || $date->format('H') == 16 && $date->format('i') > 15)
|
(int) $date->format('H') > 17
|
||||||
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(16, 15, 0));
|
|| ((int) $date->format('H') === 16 && (int) $date->format('i') > 15)
|
||||||
$date = $date->setTime(16, 15, 0);
|
) {
|
||||||
if ($date->format('N') != 7)
|
return $this->nextDate(
|
||||||
return $this->nextDate($date->add(new DateInterval('P1D')));
|
$date->add(new \DateInterval('P1D'))->setTime(16, 15, 0),
|
||||||
if ($date->format('W') % 2 - 1)
|
);
|
||||||
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);
|
$date = $date->setTime(16, 15, 0);
|
||||||
if ($date->format('N') != 7)
|
if ((int) $date->format('N') !== 7) {
|
||||||
return $this->prevDate($date->sub(new DateInterval('P1D')));
|
return $this->nextDate($date->add(new \DateInterval('P1D')));
|
||||||
if ($date->format('W') % 2 - 1)
|
}
|
||||||
return $this->prevDate($date->sub(new DateInterval('P7D')));
|
if (((int) $date->format('W') % 2) - 1) {
|
||||||
|
return $this->nextDate($date->add(new \DateInterval('P7D')));
|
||||||
|
}
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
|
public function prevDate(\DateTimeImmutable $date): \DateTimeImmutable {
|
||||||
|
if (
|
||||||
|
(int) $date->format('H') < 16
|
||||||
|
|| ((int) $date->format('H') === 17 && (int) $date->format('i') < 15)
|
||||||
|
) {
|
||||||
|
return $this->prevDate(
|
||||||
|
$date->sub(new \DateInterval('P1D'))->setTime(16, 15, 0),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$date = $date->setTime(16, 15, 0);
|
||||||
|
if ((int) $date->format('N') !== 7) {
|
||||||
|
return $this->prevDate($date->sub(new \DateInterval('P1D')));
|
||||||
|
}
|
||||||
|
if (((int) $date->format('W') % 2) - 1) {
|
||||||
|
return $this->prevDate($date->sub(new \DateInterval('P7D')));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNextEventFrom(\DateTimeImmutable $date): BrettspillEvent {
|
||||||
return new BrettspillEvent($this->nextDate($date));
|
return new BrettspillEvent($this->nextDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
public function getPreviousEventFrom(
|
||||||
|
\DateTimeImmutable $date,
|
||||||
|
): BrettspillEvent {
|
||||||
return new BrettspillEvent($this->prevDate($date));
|
return new BrettspillEvent($this->prevDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,65 +1,64 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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(): \DateTimeImmutable {
|
||||||
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(): string {
|
||||||
return "Programvareverkstedet";
|
return 'Programvareverkstedet';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() /* : User */ {
|
public function getOrganiser(): string {
|
||||||
return "Programvareverkstedet";
|
return 'Programvareverkstedet';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() /* : string */ {
|
public function getURL(): string {
|
||||||
return '/brettspill/';
|
return '/brettspill/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getImageURL() {
|
public function getImageURL(): string {
|
||||||
return '/sosiale/brettspill.jpg';
|
return '/sosiale/brettspill.jpg';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription() {
|
public function getDescription(): array {
|
||||||
return [
|
return [
|
||||||
'Er du en hardcore brettspillentusiast eller en nybegynner som har så vidt spilt ludo? '.
|
'Er du en hardcore brettspillentusiast eller en nybegynner som har så vidt spilt ludo? '
|
||||||
'Da er vår brettspillkveld noe for deg! ' .
|
. 'Da er vår brettspillkveld noe for deg! '
|
||||||
'Vi tar ut et par spill fra vårt samling of spiller så mye vi orker. Kom innom!',
|
. 'Vi tar ut et par spill fra vårt samling of spiller så mye vi orker. Kom innom!',
|
||||||
'',
|
'',
|
||||||
'## Vår samling',
|
'## Vår samling',
|
||||||
'',
|
'',
|
||||||
'* Dominion\*',
|
'* Dominion\\*',
|
||||||
'* Three cheers for master',
|
'* Three cheers for master',
|
||||||
'* Avalon',
|
'* Avalon',
|
||||||
'* Hanabi',
|
'* Hanabi',
|
||||||
'* Cards aginst humanity\*',
|
'* Cards aginst humanity\\*',
|
||||||
'* Citadels',
|
'* Citadels',
|
||||||
'* Munchkin\*\*',
|
'* Munchkin\\*\\*',
|
||||||
'* Exploding kittens\*\*',
|
'* Exploding kittens\\*\\*',
|
||||||
'* Aye dark overlord',
|
'* Aye dark overlord',
|
||||||
'* Settlers of catan\*',
|
'* Settlers of catan\\*',
|
||||||
'* Risk\*\*',
|
'* Risk\\*\\*',
|
||||||
'* og mange flere...',
|
'* og mange flere...',
|
||||||
'',
|
'',
|
||||||
'\* Vi har flere ekspansjoner til spillet',
|
'\\* Vi har flere ekspansjoner til spillet',
|
||||||
'',
|
'',
|
||||||
'\*\* Vi har flere varianter av spillet',
|
'\\*\\* Vi har flere varianter av spillet',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColor() {
|
public function getColor(): string {
|
||||||
return "#000";
|
return '#000';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +1,59 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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): \DateTimeImmutable {
|
||||||
public function nextDate(DateTimeImmutable $date) {
|
if (
|
||||||
if ($date->format('H') > 18 || $date->format('H') == 17 && $date->format('i') > 30)
|
(int) $date->format('H') > 18
|
||||||
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(18, 15, 0));
|
|| ((int) $date->format('H') === 17 && (int) $date->format('i') > 30)
|
||||||
|
) {
|
||||||
|
return $this->nextDate(
|
||||||
|
$date->add(new \DateInterval('P1D'))->setTime(18, 15, 0),
|
||||||
|
);
|
||||||
|
}
|
||||||
$date = $date->setTime(18, 15, 0);
|
$date = $date->setTime(18, 15, 0);
|
||||||
if ($date->format('N') != 6)
|
if ((int) $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 - 1)
|
}
|
||||||
return $this->nextDate($date->add(new DateInterval('P7D')));
|
if (((int) $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): \DateTimeImmutable {
|
||||||
if ($date->format('H') < 17 || $date->format('H') == 18 && $date->format('i') < 30)
|
if (
|
||||||
return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(18, 15, 0));
|
(int) $date->format('H') < 17
|
||||||
|
|| ((int) $date->format('H') === 18 && (int) $date->format('i') < 30)
|
||||||
|
) {
|
||||||
|
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 ($date->format('N') != 6)
|
if ((int) $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)
|
}
|
||||||
return $this->prevDate($date->sub(new DateInterval('P7D')));
|
if (((int) $date->format('W') % 2) - 1) {
|
||||||
|
return $this->prevDate($date->sub(new \DateInterval('P7D')));
|
||||||
|
}
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
|
public function getNextEventFrom(\DateTimeImmutable $date): DriftkveldEvent {
|
||||||
return new DriftkveldEvent($this->nextDate($date));
|
return new DriftkveldEvent($this->nextDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
public function getPreviousEventFrom(
|
||||||
|
\DateTimeImmutable $date,
|
||||||
|
): DriftkveldEvent {
|
||||||
return new DriftkveldEvent($this->prevDate($date));
|
return new DriftkveldEvent($this->prevDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +1,48 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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(): \DateTimeImmutable {
|
||||||
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(): string {
|
||||||
return "Terminalrommet / Discord / IRC";
|
return 'Terminalrommet / Discord / IRC';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() /* : User */ {
|
public function getOrganiser(): string {
|
||||||
return "Torstein Nordgård-Hansen";
|
return 'Torstein Nordgård-Hansen';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() /* : string */ {
|
public function getURL(): string {
|
||||||
return '/driftkveld/';
|
return '/driftkveld/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getImageURL() {
|
public function getImageURL(): string {
|
||||||
return '/sosiale/drift.jpg';
|
return '/sosiale/drift.jpg';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription() {
|
public function getDescription(): array {
|
||||||
return [
|
return [
|
||||||
'Vil du drifte?',
|
'Vil du drifte?',
|
||||||
'Vil du være kul kis TM?',
|
'Vil du være kul kis TM?',
|
||||||
'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(): string {
|
||||||
return "#35a";
|
return '#35a';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +1,47 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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): \DateTimeImmutable {
|
||||||
public function nextDate(DateTimeImmutable $date) {
|
if ((int) $date->format('H') > 18 || (int) $date->format('H') === 17 && (int) $date->format('i') > 30) {
|
||||||
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));
|
||||||
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 ($date->format('N') != 6)
|
if ((int) $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)
|
}
|
||||||
return $this->nextDate($date->add(new DateInterval('P7D')));
|
if ((int) $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): \DateTimeImmutable {
|
||||||
if ($date->format('H') < 17 || $date->format('H') == 18 && $date->format('i') < 30)
|
if ((int) $date->format('H') < 17 || (int) $date->format('H') === 18 && (int) $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 ($date->format('N') != 6)
|
if ((int) $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)
|
}
|
||||||
return $this->prevDate($date->sub(new DateInterval('P7D')));
|
if ((int) $date->format('W') % 2) {
|
||||||
|
return $this->prevDate($date->sub(new \DateInterval('P7D')));
|
||||||
|
}
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ {
|
public function getNextEventFrom(\DateTimeImmutable $date): HackekveldEvent {
|
||||||
return new HackekveldEvent($this->nextDate($date));
|
return new HackekveldEvent($this->nextDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ {
|
public function getPreviousEventFrom(\DateTimeImmutable $date): HackekveldEvent {
|
||||||
return new HackekveldEvent($this->prevDate($date));
|
return new HackekveldEvent($this->prevDate($date));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,45 +1,44 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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(): \DateTimeImmutable {
|
||||||
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(): string {
|
||||||
return "Terminalrommet / Discord / IRC";
|
return 'Terminalrommet / Discord / IRC';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() /* : User */ {
|
public function getOrganiser(): string {
|
||||||
return "PVV";
|
return 'PVV';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() /* : string */ {
|
public function getURL(): string {
|
||||||
return '#';
|
return '#';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getImageURL() {
|
public function getImageURL(): string {
|
||||||
return '/pvv-logo.png';
|
return '/pvv-logo.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription() {
|
public function getDescription(): array {
|
||||||
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(): string {
|
||||||
return "#35a";
|
return '#35a';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +1,48 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace pvv\side\social;
|
namespace pvv\side\social;
|
||||||
|
|
||||||
use \pvv\side\Activity;
|
use pvv\side\Activity;
|
||||||
use \DateTimeImmutable;
|
use pvv\side\Event;
|
||||||
use \DateInterval;
|
|
||||||
|
|
||||||
class NerdepitsaActivity implements Activity {
|
class NerdepitsaActivity implements Activity {
|
||||||
|
public function nextDate(\DateTimeImmutable $date): \DateTimeImmutable {
|
||||||
public function nextDate(DateTimeImmutable $date) {
|
if ((int) $date->format('H') > 19) {
|
||||||
if ($date->format('H') > 19)
|
return $this->nextDate($date->add(new \DateInterval('P1D'))->setTime(19, 0, 0));
|
||||||
return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(19, 0, 0));
|
}
|
||||||
$date = $date->setTime(19, 0, 0);
|
$date = $date->setTime(19, 0, 0);
|
||||||
if ($date->format('N') != 5)
|
if ((int) $date->format('N') !== 5) {
|
||||||
return $this->nextDate($date->add(new DateInterval('P1D')));
|
return $this->nextDate($date->add(new \DateInterval('P1D')));
|
||||||
if ($date->format('W') % 2)
|
}
|
||||||
return $this->nextDate($date->add(new DateInterval('P7D')));
|
if ((int) $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): \DateTimeImmutable {
|
||||||
if ($date->format('H') < 19)
|
if ((int) $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 ($date->format('N') != 5)
|
if ((int) $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)
|
}
|
||||||
return $this->prevDate($date->sub(new DateInterval('P7D')));
|
if ((int) $date->format('W') % 2) {
|
||||||
|
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,37 +1,37 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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(): \DateTimeImmutable {
|
||||||
public function getStop() {
|
return $this->getStart()->add(new \DateInterval('PT2H1800S'));
|
||||||
return $this->getStart()->add(new DateInterval('PT2H1800S'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName() {
|
public function getName(): string {
|
||||||
return "Nerdepitsa";
|
return 'Nerdepitsa';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLocation() /* : Location */ {
|
public function getLocation(): string {
|
||||||
return "Peppes Kjøpmansgata";
|
return 'Peppes Kjøpmansgata';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrganiser() /* : User */ {
|
public function getOrganiser(): string {
|
||||||
return "Anders Christensen";
|
return 'Anders Christensen';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getURL() /* : string */ {
|
public function getURL(): string {
|
||||||
return '/nerdepitsa/';
|
return '/nerdepitsa/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getImageURL() {
|
public function getImageURL(): string {
|
||||||
return '/sosiale/nerdepitsa.jpg';
|
return '/sosiale/nerdepitsa.jpg';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription() {
|
public function getDescription(): array {
|
||||||
return [
|
return [
|
||||||
'Hei, har du lyst til å bli med på pizzaspising annenhver fredag? Vi møtes på Peppes i Kjøpmannsgata fredag klokken 19.00 hver partallsuke!',
|
'Hei, har du lyst til å bli med på pizzaspising annenhver fredag? Vi møtes på Peppes i Kjøpmannsgata fredag klokken 19.00 hver partallsuke!',
|
||||||
'',
|
'',
|
||||||
@@ -39,12 +39,11 @@ 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(): string {
|
||||||
return "#c35";
|
return '#c35';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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(dirname(dirname(__DIR__))), '', '_autoload.php']);
|
require implode(\DIRECTORY_SEPARATOR, [\dirname(__DIR__, 3), '', '_autoload.php']);
|
||||||
|
|
||||||
$c = new AnimekveldActivity;
|
$c = new AnimekveldActivity();
|
||||||
die($c->nextDate(new \DateTimeImmutable)->format(DATE_RFC2822));
|
exit($c->nextDate(new \DateTimeImmutable())->format(\DATE_RFC2822));
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
<?php //declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
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(dirname(dirname(__DIR__))), '', '_autoload.php']);
|
require implode(\DIRECTORY_SEPARATOR, [\dirname(__DIR__, 3), '', '_autoload.php']);
|
||||||
|
|
||||||
$c = new NerdepitsaActivity;
|
$c = new NerdepitsaActivity();
|
||||||
die($c->prevDate(new \DateTimeImmutable)->format(DATE_RFC2822));
|
exit($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,21 +33,20 @@ if(isset($_GET['id'])){
|
|||||||
$eventID = $_GET['id'];
|
$eventID = $_GET['id'];
|
||||||
} elseif ($new == 0) {
|
} elseif ($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 {
|
||||||
else {
|
$event = new pvv\side\SimpleEvent(
|
||||||
$event = new \pvv\side\SimpleEvent(
|
|
||||||
0,
|
0,
|
||||||
'',
|
'',
|
||||||
$today,
|
$today,
|
||||||
@@ -86,26 +85,26 @@ else {
|
|||||||
<h2>Aktivietsadministrasjon</h2>
|
<h2>Aktivietsadministrasjon</h2>
|
||||||
<hr class="ruler">
|
<hr class="ruler">
|
||||||
|
|
||||||
<h2><?= ($new == 1 ? "Ny hendelse" : "Rediger hendelse"); ?></h2>
|
<h2><?php echo $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="<?= $event->getName() ?>" class="boxinput" required placeholder="En kul hendelse"><br>
|
<input type="text" name="title" value="<?php echo $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="<?= $event->getOrganiser() ?>" class="boxinput" required placeholder="<?= $name ?>"><br>
|
<input type="text" name="organiser" value="<?php echo $event->getOrganiser(); ?>" class="boxinput" required placeholder="<?php echo $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="<?= $event->getLocation() ?>" class="boxinput" required placeholder="Terminalrommet"><br>
|
<input type="text" name="location" value="<?php echo $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><?= implode("\n", $event->getDescription()); ?></textarea>
|
<textarea name="desc" rows="8" class="boxinput" placeholder="Beskrivelse" required><?php echo implode("\n", $event->getDescription()); ?></textarea>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -113,22 +112,22 @@ else {
|
|||||||
<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="<?= $event->getStart()->format('Y-m') ?>"><br>
|
<input name="start_mon" type="month" class="boxinput" required value="<?php echo $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="<?= $event->getStart()->format('d') ?>"><br>
|
<input name="start_day" type="number" min="1" max="31" required class="boxinput" value="<?php echo $event->getStart()->format('d'); ?>"><br>
|
||||||
<i>Klokkeslett:</i><br>
|
<i>Klokkeslett:</i><br>
|
||||||
<input name="start_time" type="time" class="boxinput" required value="<?= $event->getStart()->format('H:i:s') ?>"><br>
|
<input name="start_time" type="time" class="boxinput" required value="<?php echo $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="<?= $diff->h ?>"><br>
|
<input name="lasts_hours" type="number" min="0" class="boxinput" required value="<?php echo $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="<?= $diff->i ?>"><br>
|
<input name="lasts_minutes" type="number" min="0" max="59" class="boxinput" required value="<?php echo $diff->i; ?>"><br>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="id" value="<?= $event->getID() ?>" />
|
<input type="hidden" name="id" value="<?php echo $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,9 +41,7 @@ if(isset($_GET['organiser'])){
|
|||||||
// filter
|
// filter
|
||||||
$events = array_values(array_filter(
|
$events = array_values(array_filter(
|
||||||
$events,
|
$events,
|
||||||
function($event) use ($filterTitle, $filterOrganiser){
|
static fn($event) => (preg_match('/.*' . $filterTitle . '.*/i', $event->getName()) && preg_match('/.*' . $filterOrganiser . '.*/i', $event->getOrganiser()))
|
||||||
return (preg_match('/.*'.$filterTitle.'.*/i', $event->getName()) and preg_match('/.*'.$filterOrganiser.'.*/i', $event->getOrganiser()));
|
|
||||||
}
|
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -82,7 +80,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;
|
||||||
}
|
}
|
||||||
@@ -94,25 +92,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"><?= $event->getName() . " (ID: " . $eventID . ")"; ?></h3>
|
<h3 class="no-chin"><?php echo $event->getName() . ' (ID: ' . $eventID . ')'; ?></h3>
|
||||||
<p class="subnote">
|
<p class="subnote">
|
||||||
<?= $event->getStart()->format("(Y-m-d H:i:s)") . " - " . $event->getStop()->format("(Y-m-d H:i:s)"); ?>
|
<?php echo $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=<?= $eventID ?>">Rediger</a><br>
|
<a class="btn" href="edit.php?id=<?php echo $eventID; ?>">Rediger</a><br>
|
||||||
<a class="btn" href="delete.php?id=<?= $eventID ?>" onclick="return confirm('Knallsikker? (ID: <?= $eventID ?>)');">Slett</a>
|
<a class="btn" href="delete.php?id=<?php echo $eventID; ?>" onclick="return confirm('Knallsikker? (ID: <?php echo $eventID; ?>)');">Slett</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$counter++;
|
++$counter;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -122,7 +120,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) and (($pageLimit * $page) < count($events))){
|
if (($counter == $pageLimit) && (($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>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -134,9 +132,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>
|
||||||
<?= '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">' ?><br>
|
<?php echo '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">'; ?><br>
|
||||||
<p class="no-chin">Organisator</p>
|
<p class="no-chin">Organisator</p>
|
||||||
<?= '<input type="text" name="organiser" class="boxinput" value="' . $filterOrganiser . '">' ?><br>
|
<?php echo '<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']))
|
||||||
or (!isset($_POST['desc']))
|
|| (!isset($_POST['desc']))
|
||||||
or (!isset($_POST['organiser']))
|
|| (!isset($_POST['organiser']))
|
||||||
or (!isset($_POST['location']))
|
|| (!isset($_POST['location']))
|
||||||
or (!isset($_POST['start_mon']))
|
|| (!isset($_POST['start_mon']))
|
||||||
or (!isset($_POST['start_day']))
|
|| (!isset($_POST['start_day']))
|
||||||
or (!isset($_POST['start_time']))
|
|| (!isset($_POST['start_time']))
|
||||||
or (!isset($_POST['lasts_hours']))
|
|| (!isset($_POST['lasts_hours']))
|
||||||
or (!isset($_POST['lasts_minutes']))) {
|
|| (!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 (sizeof(explode(":", $date_part_start_time))==2) {
|
if (count(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 = array();
|
$users_to_update = [];
|
||||||
foreach ($users as $i => $data) {
|
foreach ($users as $i => $data) {
|
||||||
$uname = $data['name'];
|
$uname = $data['name'];
|
||||||
$groupFlag = $userManager->getUsergroups($uname);
|
$groupFlag = $userManager->getUsergroups($uname);
|
||||||
|
|
||||||
array_push($users_to_update, $uname);
|
$users_to_update[] = $uname;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $uname ?></td>
|
<td><?php echo $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,35 +1,36 @@
|
|||||||
<?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 = array();
|
$updatingUsers = [];
|
||||||
foreach ($_POST as $key => $value) { if ($key === "user_to_update") {
|
foreach ($_POST as $key => $value) {
|
||||||
array_push($updatingUsers, $value);
|
if ($key === 'user_to_update') {
|
||||||
|
$updatingUsers[] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($_POST['user_to_update']);
|
unset($_POST['user_to_update']);
|
||||||
@@ -43,7 +44,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(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . 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="<?= $motd['title'] ?>" class="boxinput" style="width:66%;"><br>
|
<input type="text" name="title" value="<?php echo $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"><?= implode("\n", $motd["content"]) ?></textarea>
|
<textarea name="content" style="width:100%" rows="8" class="boxinput"><?php echo implode("\n", $motd['content']); ?></textarea>
|
||||||
|
|
||||||
<div style="margin-top: 2em;">
|
<div style="margin-top: 2em;">
|
||||||
<hr class="ruler">
|
<hr class="ruler">
|
||||||
|
|
||||||
<?= '<input type="submit" class="btn" value="Lagre endringer"></a>'; ?>
|
<?php echo '<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']) or !isset($_POST['content'])){
|
if (!isset($_POST['title']) || !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'];
|
||||||
} elseif ($new == 0) {
|
} elseif ($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><?= ($new == 1 ? "Nytt prosjekt" : "Rediger prosjekt"); ?></h2>
|
<h2><?php echo $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>
|
||||||
<?= '<input type="text" name="title" value="' . $project->getName() . '" class="boxinput">' ?><br>
|
<?php echo '<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"><?= implode("\n", $project->getDescription()); ?></textarea>
|
<textarea name="desc" cols="40" rows="5" class="boxinput"><?php echo implode("\n", $project->getDescription()); ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="gridr noborder">
|
<div class="gridr noborder">
|
||||||
<p class="subtitle">Prosjektleder (Brukernavn)</p>
|
<p class="subtitle">Prosjektleder (Brukernavn)</p>
|
||||||
<?= '<input type="text" name="organiser" value="' . $owner['uname'] . '" class="boxinput">' ?><br>
|
<?php echo '<input type="text" name="organiser" value="' . $owner['uname'] . '" class="boxinput">'; ?><br>
|
||||||
|
|
||||||
<p class="subtitle">Prosjektleder (Navn)</p>
|
<p class="subtitle">Prosjektleder (Navn)</p>
|
||||||
<?= '<input type="text" name="organisername" value="' . $owner['name'] . '" class="boxinput">' ?>
|
<?php echo '<input type="text" name="organisername" value="' . $owner['name'] . '" class="boxinput">'; ?>
|
||||||
|
|
||||||
<p class="subtitle">Prosjektleder E-post</p>
|
<p class="subtitle">Prosjektleder E-post</p>
|
||||||
<?= '<input type="text" name="organiseremail" value="' . $owner['mail'] . '" class="boxinput">' ?><br>
|
<?php echo '<input type="text" name="organiseremail" value="' . $owner['mail'] . '" class="boxinput">'; ?><br>
|
||||||
|
|
||||||
<p class="subtitle">Aktiv</p>
|
<p class="subtitle">Aktiv</p>
|
||||||
<?= '<input type="checkbox" '. ($project->getActive() ? 'checked' : '') . ' name="active"/>' ?>
|
<?php echo '<input type="checkbox" ' . ($project->getActive() ? 'checked' : '') . ' name="active"/>'; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?= '<input type="hidden" name="id" value="' . $project->getID() . '" />' ?>
|
<?php echo '<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><?= $data['uname']; ?></td>
|
<td><?php echo $data['uname']; ?></td>
|
||||||
<td><?= $data['name']; ?></td>
|
<td><?php echo $data['name']; ?></td>
|
||||||
<td><?= $data['role']; ?></td>
|
<td><?php echo $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,9 +43,7 @@ if(isset($_POST['organiser'])){
|
|||||||
// filter
|
// filter
|
||||||
$projects = array_values(array_filter(
|
$projects = array_values(array_filter(
|
||||||
$projects,
|
$projects,
|
||||||
function($project) use ($filterTitle){
|
static fn($project) => preg_match('/.*' . $filterTitle . '.*/i', $project->getName())
|
||||||
return (preg_match('/.*'.$filterTitle.'.*/i', $project->getName()));
|
|
||||||
}
|
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -82,7 +80,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;
|
||||||
}
|
}
|
||||||
@@ -95,23 +93,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"><?= $project->getName() . " (ID: " . $projectID . ")"; ?></h3>
|
<h3 class="no-chin"><?php echo $project->getName() . ' (ID: ' . $projectID . ')'; ?></h3>
|
||||||
<p class="subnote"><?= 'Organisert av: ' . $owner['name']; ?></p>
|
<p class="subnote"><?php echo '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">
|
||||||
<?= '<a href="edit.php?id=' . $projectID . '">🖊</a>'; ?>
|
<?php echo '<a href="edit.php?id=' . $projectID . '">🖊</a>'; ?>
|
||||||
<?= '<a href="delete.php?id=' . $projectID . '" onclick="return confirm(\'Knallsikker? (ID: ' . $projectID . ')\');">🗑</a>'; ?>
|
<?php echo '<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>
|
||||||
@@ -121,7 +119,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) and (($pageLimit * $page) < count($projects))){
|
if (($counter == $pageLimit) && (($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>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -133,9 +131,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>
|
||||||
<?= '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">' ?><br>
|
<?php echo '<input type="text" name="title" class="boxinput" value="' . $filterTitle . '">'; ?><br>
|
||||||
<p class="no-chin">Leders brukernavn</p>
|
<p class="no-chin">Leders brukernavn</p>
|
||||||
<?= '<input type="text" name="organiser" class="boxinput" value="">' ?><br>
|
<?php echo '<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']) or !isset($_POST['desc']) or !isset($_POST['organisername']) or !isset($_POST['organiser'])){
|
if (!isset($_POST['title']) || !isset($_POST['desc']) || !isset($_POST['organisername']) || !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 = (isset($_POST['active']) ? $_POST['active'] : 0);
|
$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,12 +1,15 @@
|
|||||||
<?php namespace pvv\side;
|
<?php
|
||||||
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;
|
||||||
@@ -34,38 +37,43 @@ $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 (\pvv\side\Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
|
<?php if (Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
|
||||||
<em><?= $event->getRelativeDate() ?></em>
|
<em><?php echo $event->getRelativeDate(); ?></em>
|
||||||
<?php if (\pvv\side\Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
|
<?php if (Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
|
||||||
<?php if ($event->getURL()) { ?>
|
<?php if ($event->getURL()) { ?>
|
||||||
<a href="<?= $event->getURL() ?>"><?= $event->getName() ?></a>
|
<br>
|
||||||
|
<a href="<?php echo $event->getURL(); ?>"><?php echo $event->getName(); ?></a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<?= $event->getName() ?>
|
<?php echo $event->getName(); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if ($event->getImageURL()) { ?>
|
<?php if ($event->getImageURL()) { ?>
|
||||||
<img src="<?= $event->getImageURL() ?>">
|
<img src="<?php echo $event->getImageURL(); ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong></li>
|
<li>Tid: <strong><?php echo Agenda::getFormattedDate($event->getStart()); ?></strong></li>
|
||||||
<li>Sted: <strong><?= $event->getLocation() ?></strong></li>
|
<li>Sted: <strong><?php echo $event->getLocation(); ?></strong></li>
|
||||||
<li>Arrangør: <strong><?= $event->getOrganiser() ?></strong></li>
|
<li>Arrangør: <strong><?php echo $event->getOrganiser(); ?></strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<?php $description = $event->getDescription(); ?>
|
<?php $description = $event->getDescription(); ?>
|
||||||
<?php if ($limit) array_splice($description, $limit); ?>
|
<?php if ($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,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
use \pvv\side\Agenda;
|
use pvv\side\Agenda;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@@ -20,33 +21,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><?= $nextEvent->getRelativeDate()?></em> Animekveld
|
<h2><em><?php echo $nextEvent->getRelativeDate(); ?></em> Animekveld
|
||||||
<?php if ($nextEvent->getImageURL()) { ?>
|
<?php if ($nextEvent->getImageURL()) { ?>
|
||||||
<img src="<?= $nextEvent->getImageURL() ?>">
|
<img src="<?php echo $nextEvent->getImageURL(); ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid:
|
<li>Tid:
|
||||||
<strong>
|
<strong>
|
||||||
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
<?php echo Agenda::getFormattedDate($nextEvent->getStart()); ?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Sted:
|
<li>Sted:
|
||||||
<strong>
|
<strong>
|
||||||
<?= $nextEvent->getLocation();?>
|
<?php echo $nextEvent->getLocation(); ?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Arrangør:
|
<li>Arrangør:
|
||||||
<strong>
|
<strong>
|
||||||
<?= $nextEvent->getOrganiser();?>
|
<?php echo $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>
|
||||||
@@ -54,6 +55,6 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?= navbar(1, 'aktiviteter'); ?>
|
<?php echo navbar(1, 'aktiviteter'); ?>
|
||||||
<?= loginbar($sp, $pdo); ?>
|
<?php echo loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
use \pvv\side\Agenda;
|
use pvv\side\Agenda;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@@ -20,34 +21,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><?= $nextEvent->getRelativeDate()?></em> Brettspillkveld
|
<h2><em><?php echo $nextEvent->getRelativeDate(); ?></em> Brettspillkveld
|
||||||
<?php if ($nextEvent->getImageURL()) { ?>
|
<?php if ($nextEvent->getImageURL()) { ?>
|
||||||
<img src="<?= $nextEvent->getImageURL() ?>">
|
<img src="<?php echo $nextEvent->getImageURL(); ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid:
|
<li>Tid:
|
||||||
<strong>
|
<strong>
|
||||||
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
<?php echo Agenda::getFormattedDate($nextEvent->getStart()); ?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Sted:
|
<li>Sted:
|
||||||
<strong>
|
<strong>
|
||||||
<?= $nextEvent->getLocation();?>
|
<?php echo $nextEvent->getLocation(); ?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Arrangør:
|
<li>Arrangør:
|
||||||
<strong>
|
<strong>
|
||||||
<?= $nextEvent->getOrganiser();?>
|
<?php echo $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 +56,6 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?= navbar(1, 'aktiviteter'); ?>
|
<?php echo navbar(1, 'aktiviteter'); ?>
|
||||||
<?= loginbar($sp, $pdo); ?>
|
<?php echo loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ h2 em {
|
|||||||
font-size: .5em;
|
font-size: .5em;
|
||||||
line-height: 2em;
|
line-height: 2em;
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 1em;
|
|
||||||
border: .1em solid gray;
|
border: .1em solid gray;
|
||||||
padding: 0 1em;
|
padding: 0 1em;
|
||||||
border-radius: .25em;
|
border-radius: .25em;
|
||||||
@@ -107,7 +106,6 @@ p + .subtext {
|
|||||||
}
|
}
|
||||||
@media screen and (max-width: 50rem) {
|
@media screen and (max-width: 50rem) {
|
||||||
h2 {
|
h2 {
|
||||||
text-align: center;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
border-bottom-left-radius: 0.3em;
|
border-bottom-left-radius: 0.3em;
|
||||||
border-bottom-right-radius: 0.3em;
|
border-bottom-right-radius: 0.3em;
|
||||||
@@ -133,4 +131,8 @@ p + .subtext {
|
|||||||
article >.subtext {
|
article >.subtext {
|
||||||
margin-top: -1em !important;
|
margin-top: -1em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subtext li {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.categoryLabel {
|
.categoryLabel {
|
||||||
|
padding-top: 5px;
|
||||||
background-color: #002244;
|
background-color: #002244;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ main {
|
|||||||
|
|
||||||
.serviceContent {
|
.serviceContent {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
margin-right: 4%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.serviceTitle {
|
.serviceTitle {
|
||||||
@@ -91,3 +93,27 @@ main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.categoryContainer {
|
||||||
|
border-radius: unset;
|
||||||
|
border: unset;
|
||||||
|
box-shadow: unset;
|
||||||
|
margin-bottom: unset;
|
||||||
|
}
|
||||||
|
.serviceWrapper {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.serviceImage {
|
||||||
|
width: 25%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
.serviceContent {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 360px) {
|
||||||
|
.serviceContent {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ nav {
|
|||||||
height: 3em;
|
height: 3em;
|
||||||
display: table;
|
display: table;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
border: #024 0.1em solid;
|
|
||||||
}
|
}
|
||||||
nav #menu, nav #login {
|
nav #menu, nav #login {
|
||||||
display: table-cell;
|
display: table-cell;
|
||||||
|
|||||||
@@ -1,65 +1,67 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
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'])) {
|
||||||
list($type, $data) = explode(" ", $_SERVER["HTTP_AUTHORIZATION"], 2);
|
[$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"}';
|
||||||
die();
|
exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '{"status": "error", "message": "Invalid authentication method"}';
|
echo '{"status": "error", "message": "Invalid authentication method"}';
|
||||||
die();
|
exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '{"status": "error", "message": "Missing authentication"}';
|
echo '{"status": "error", "message": "Missing authentication"}';
|
||||||
die();
|
exit;
|
||||||
}
|
}
|
||||||
} 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);
|
||||||
} else if ($period == "week") {
|
} elseif ($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"}';
|
||||||
die();
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$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() {
|
function handleSetState(): void {
|
||||||
global $door;
|
global $door;
|
||||||
|
|
||||||
$jsonobj = file_get_contents('php://input');
|
$jsonobj = file_get_contents('php://input');
|
||||||
@@ -67,14 +69,14 @@ function handleSetState() {
|
|||||||
|
|
||||||
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"}';
|
||||||
die();
|
exit;
|
||||||
}
|
}
|
||||||
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"}';
|
||||||
die();
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$door->createEvent((int)($event->time), $event->isDoorOpen ? 1 : 0);
|
$door->createEvent((int) $event->time, $event->isDoorOpen ? 1 : 0);
|
||||||
echo '{"status": "OK"}';
|
echo '{"status": "OK"}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,9 +85,9 @@ function getChanges($items) {
|
|||||||
$res = [];
|
$res = [];
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if ($item["open"] !== $prevState) {
|
if ($item['open'] !== $prevState) {
|
||||||
array_push($res, $item);
|
$res[] = $item;
|
||||||
$prevState = $item["open"];
|
$prevState = $item['open'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
use \pvv\side\Agenda;
|
use pvv\side\Agenda;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@@ -20,33 +21,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><?= $nextEvent->getRelativeDate()?></em> Driftkveld
|
<h2><em><?php echo $nextEvent->getRelativeDate(); ?></em> Driftkveld
|
||||||
<?php if ($nextEvent->getImageURL()) { ?>
|
<?php if ($nextEvent->getImageURL()) { ?>
|
||||||
<img src="<?= $nextEvent->getImageURL() ?>">
|
<img src="<?php echo $nextEvent->getImageURL(); ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid:
|
<li>Tid:
|
||||||
<strong>
|
<strong>
|
||||||
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
<?php echo Agenda::getFormattedDate($nextEvent->getStart()); ?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Sted:
|
<li>Sted:
|
||||||
<strong>
|
<strong>
|
||||||
<?= $nextEvent->getLocation();?>
|
<?php echo $nextEvent->getLocation(); ?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Arrangør:
|
<li>Arrangør:
|
||||||
<strong>
|
<strong>
|
||||||
<?= $nextEvent->getOrganiser();?>
|
<?php echo $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>
|
||||||
@@ -54,6 +55,6 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?= navbar(1, 'aktiviteter'); ?>
|
<?php echo navbar(1, 'aktiviteter'); ?>
|
||||||
<?= loginbar($sp, $pdo); ?>
|
<?php echo loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . 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,39 +15,40 @@ $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 = array()) {
|
function getDirContents($dir, &$results = []) {
|
||||||
$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"])) {
|
if (in_array($ext, $GLOBALS['allowedExtensions'], true)) {
|
||||||
$results[] = $cleanPath;
|
$results[] = $cleanPath;
|
||||||
}
|
}
|
||||||
} else if ($value != "." && $value != ".." && $value != ".thumbnails") {
|
} elseif ($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);
|
||||||
@@ -61,7 +62,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">
|
||||||
@@ -77,7 +78,7 @@ $imageTemplate = '
|
|||||||
<p class="card-footer-item">%time</p>
|
<p class="card-footer-item">%time</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
'
|
';
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -101,12 +102,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;
|
||||||
@@ -114,12 +115,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,34 +1,36 @@
|
|||||||
<?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, [".", ".."])) {
|
if (in_array($value, ['.', '..'], true)) {
|
||||||
unset($filenames[$k]);
|
unset($filenames[$k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFullPath($fname) { return ($GLOBALS["serverPath"] . "/" . $fname ); }
|
function getFullPath($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,5 +1,8 @@
|
|||||||
<?php namespace pvv\side;
|
<?php
|
||||||
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'];
|
||||||
?>
|
?>
|
||||||
@@ -18,8 +21,8 @@ $translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden',
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<?= navbar(1, 'hendelser'); ?>
|
<?php echo navbar(1, 'hendelser'); ?>
|
||||||
<?= loginbar($sp, $pdo); ?>
|
<?php echo 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>
|
||||||
@@ -30,20 +33,22 @@ $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;"><?= $translation[$period] ?></h2>
|
<h2 style="text-align: left;"><?php echo $translation[$period]; ?></h2>
|
||||||
<ul class="events">
|
<ul class="events">
|
||||||
<?php foreach ($events as $event) {?>
|
<?php foreach ($events as $event) {?>
|
||||||
<li style="border-color: <?= $event->getColor() ?>">
|
<li style="border-color: <?php echo $event->getColor(); ?>">
|
||||||
<h4><strong>
|
<h4><strong>
|
||||||
<?php if ($event->getURL()) { ?>
|
<?php if ($event->getURL()) { ?>
|
||||||
<a href="<?= $event->getURL() ?>"><?= $event->getName() ?></a>
|
<a href="<?php echo $event->getURL(); ?>"><?php echo $event->getName(); ?></a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<?= $event->getName() ?>
|
<?php echo $event->getName(); ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</strong></h4>
|
</strong></h4>
|
||||||
|
|
||||||
<?php $description = $event->getDescription(); ?>
|
<?php $description = $event->getDescription(); ?>
|
||||||
<?php if ($description_paragraphs) array_splice($description, $description_paragraphs); ?>
|
<?php if ($description_paragraphs) {
|
||||||
|
array_splice($description, $description_paragraphs);
|
||||||
|
} ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$Parsedown = new \Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
@@ -51,9 +56,9 @@ $translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden',
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong></li>
|
<li>Tid: <strong><?php echo Agenda::getFormattedDate($event->getStart()); ?></strong></li>
|
||||||
<li>Sted: <strong><?= $event->getLocation() ?></strong></li>
|
<li>Sted: <strong><?php echo $event->getLocation(); ?></strong></li>
|
||||||
<li>Arrangør: <strong><?= $event->getOrganiser() ?></strong></li>
|
<li>Arrangør: <strong><?php echo $event->getOrganiser(); ?></strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -61,9 +66,5 @@ $translation = ['I dag', 'I morgen', 'Denne uka', 'Neste uke', 'Denne måneden',
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<div style="text-align: center; margin-bottom: 2em;">
|
|
||||||
<a style="padding-left: 2em; padding-right: 2em;" class="btn" style="" href="../kalender/">Kalender</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . 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 (\pvv\side\Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
|
<?php if (Agenda::isToday($event->getStart())) { ?><strong><?php } ?>
|
||||||
<em><?= $event->getRelativeDate() ?></em>
|
<em><?php echo $event->getRelativeDate(); ?></em>
|
||||||
<?php if (\pvv\side\Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
|
<?php if (Agenda::isToday($event->getStart())) { ?></strong><?php } ?>
|
||||||
|
<br>
|
||||||
<?= $event->getName() ?>
|
<?php echo $event->getName(); ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid: <strong><?= Agenda::getFormattedDate($event->getStart()) ?></strong></li>
|
<li>Tid: <strong><?php echo Agenda::getFormattedDate($event->getStart()); ?></strong></li>
|
||||||
<li>Sted: <strong><?= $event->getLocation() ?></strong></li>
|
<li>Sted: <strong><?php echo $event->getLocation(); ?></strong></li>
|
||||||
<li>Arrangør: <strong><?= $event->getOrganiser() ?></strong></li>
|
<li>Arrangør: <strong><?php echo $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,22 +1,25 @@
|
|||||||
<?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) { $doorStateText = "Døren er <b>åpen</b>";
|
if ($doorEntry->open) {
|
||||||
} else { $doorStateText = "Døren er <b>ikke åpen</b>"; }
|
$doorStateText = 'Døren er <b>å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">
|
||||||
@@ -41,7 +44,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">
|
||||||
@@ -52,9 +55,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>
|
||||||
@@ -66,22 +69,25 @@ $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) if ($events && $counter1 < 3 && $counter2 < 10) { $counter1++ ?>
|
<?php foreach ($agenda->getNextDays() as $period => $events) {
|
||||||
<p class="no-chin"><?= $translation[$period] ?></p>
|
if ($events && $counter1 < 3 && $counter2 < 10) {
|
||||||
|
$counter1++; ?>
|
||||||
|
<p class="no-chin"><?php echo $translation[$period]; ?></p>
|
||||||
<hr>
|
<hr>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach($events as $event) { $counter2++ ?>
|
<?php foreach ($events as $event) {
|
||||||
|
$counter2++; ?>
|
||||||
<li>
|
<li>
|
||||||
<?php if ($event->getURL()) { ?>
|
<?php if ($event->getURL()) { ?>
|
||||||
<a href="<?= htmlspecialchars($event->getURL()) ?>"><?= $event->getName(); ?></a>
|
<a href="<?php echo htmlspecialchars($event->getURL()); ?>"><?php echo $event->getName(); ?></a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<strong><?= $event->getName(); ?></strong>
|
<strong><?php echo $event->getName(); ?></strong>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<span class="datetime">
|
<span class="datetime">
|
||||||
<?php if ($period !== \pvv\side\Agenda::TODAY) {
|
<?php if ($period !== pvv\side\Agenda::TODAY) {
|
||||||
echo $event->getStart()->format('H:i') . " " ;
|
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 $event->getStart()->format('D');
|
echo $event->getStart()->format('D');
|
||||||
} else {
|
} else {
|
||||||
echo $event->getStart()->format('j. F');
|
echo $event->getStart()->format('j. F');
|
||||||
@@ -94,25 +100,28 @@ $doorTime = date("H:i", $doorEntry->time);
|
|||||||
</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,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
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');
|
||||||
$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) {$days_before_the_first = 6;}
|
if ($days_before_the_first == -1) {
|
||||||
$day_of_month = ($month == date("m"))
|
$days_before_the_first = 6;
|
||||||
? 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));
|
||||||
|
|
||||||
@@ -36,18 +38,25 @@ $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h2 style="text-align:center;">PVV Kalender for <?=$months_translations[$month-1]?> <?=$year?></h2>
|
<h2 style="text-align:center;">PVV Kalender for <?php echo $months_translations[$month - 1]; ?> <?php echo $year; ?></h2>
|
||||||
|
|
||||||
<div class="pagination_bar"><?php
|
<div class="pagination_bar">
|
||||||
|
<?php
|
||||||
$pmonth = $month - 1;
|
$pmonth = $month - 1;
|
||||||
$nmonth = $month + 1;
|
$nmonth = $month + 1;
|
||||||
$pyear = $year;
|
$pyear = $year;
|
||||||
$nyear = $year;
|
$nyear = $year;
|
||||||
if ($pmonth==0) {$pmonth=12; $pyear--;}
|
if ($pmonth == 0) {
|
||||||
if ($nmonth==13) {$nmonth=1; $nyear++;}
|
$pmonth = 12;
|
||||||
|
--$pyear;
|
||||||
|
}
|
||||||
|
if ($nmonth == 13) {
|
||||||
|
$nmonth = 1;
|
||||||
|
++$nyear;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<a class="btn noselect" href="../kalender?year=<?=$pyear?>&month=<?=$pmonth?>">Forrige måned</a>
|
<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=<?=$nyear?>&month=<?=$nmonth?>">Neste måned</a>
|
<a class="btn noselect" href="../kalender?year=<?php echo $nyear; ?>&month=<?php echo $nmonth; ?>">Neste måned</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<figure class="calendar">
|
<figure class="calendar">
|
||||||
@@ -61,30 +70,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/<?=$days_before_the_first+1?>;">
|
<li class="outOfMonth" style="grid-column: 1/<?php echo $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 (sizeof($events)!=0) { ?>
|
<?php if (count($events) != 0) { ?>
|
||||||
<a href="../aktiviteter/?<?="year=$year&month=$month&day=$day"?>"><div>
|
<a href="../aktiviteter/?<?php echo "year={$year}&month={$month}&day={$day}"; ?>"><div>
|
||||||
<span class="noselect day"><?= $day ?>.</span>
|
<span class="noselect day"><?php echo $day; ?>.</span>
|
||||||
<?php foreach ($events as $event) { ?>
|
<?php foreach ($events as $event) { ?>
|
||||||
<section style="background: <?=$event->getColor()?>"><?=$event->getName()?></section>
|
<section style="background: <?php echo $event->getColor(); ?>"><?php echo $event->getName(); ?></section>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div></a>
|
</div></a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<span class="noselect day"><?= $day ?>.</span>
|
<span class="noselect day"><?php echo $day; ?>.</span>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</figure>
|
</figure>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . implode(\DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
||||||
use \pvv\side\Agenda;
|
use pvv\side\Agenda;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="no">
|
<html lang="no">
|
||||||
@@ -34,28 +35,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><?= $nextEvent->getRelativeDate()?></em> Nerdepitsa
|
<h2><em><?php echo $nextEvent->getRelativeDate(); ?></em> Nerdepitsa
|
||||||
<?php if ($nextEvent->getImageURL()) { ?>
|
<?php if ($nextEvent->getImageURL()) { ?>
|
||||||
<img src="<?= $nextEvent->getImageURL() ?>">
|
<img src="<?php echo $nextEvent->getImageURL(); ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</h2>
|
</h2>
|
||||||
<ul class="subtext">
|
<ul class="subtext">
|
||||||
<li>Tid:
|
<li>Tid:
|
||||||
<strong>
|
<strong>
|
||||||
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
<?php echo Agenda::getFormattedDate($nextEvent->getStart()); ?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Sted:
|
<li>Sted:
|
||||||
<strong>
|
<strong>
|
||||||
<?= $nextEvent->getLocation();?>
|
<?php echo $nextEvent->getLocation(); ?>
|
||||||
</strong>
|
</strong>
|
||||||
<li>Arrangør:
|
<li>Arrangør:
|
||||||
<strong>
|
<strong>
|
||||||
<?= $nextEvent->getOrganiser();?>
|
<?php echo $nextEvent->getOrganiser(); ?>
|
||||||
</strong>
|
</strong>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -68,6 +69,6 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<?= navbar(1, 'aktiviteter'); ?>
|
<?php echo navbar(1, 'aktiviteter'); ?>
|
||||||
<?= loginbar($sp, $pdo); ?>
|
<?php echo loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . 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>
|
||||||
<?= navbar(1); ?>
|
<?php echo navbar(1); ?>
|
||||||
<?= loginbar($sp, $pdo); ?>
|
<?php echo loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . 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><?= htmlspecialchars($attrs['uid'][0]) ?></i>,
|
Du er nå logget in som <i><?php echo 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'];
|
||||||
} elseif ($new == 0) {
|
} elseif ($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="<?= $project->getName() ?>" class="boxinput"><br>
|
<input class="wide" type="text" name="title" value="<?php echo $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"><?= implode("\n", $project->getDescription()); ?></textarea>
|
<textarea class="tall" name="desc" style="width:100%" rows="8" class="boxinput"><?php echo implode("\n", $project->getDescription()); ?></textarea>
|
||||||
|
|
||||||
<?= '<input type="hidden" name="id" value="' . $project->getID() . '" />' ?>
|
<?php echo '<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="<?= ($new ? 'Opprett prosjekt' : 'Lagre endringer') ?>"></input>
|
<input type="submit" class="btn" value="<?php echo $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(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
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'];
|
||||||
$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=<?= $project->getID() ?>"><div class="project-card">
|
<a class="nostyle" href="info.php?id=<?php echo $project->getID(); ?>"><div class="project-card">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<h4 class="project-title"><?= $project->getName(); ?></h4>
|
<h4 class="project-title"><?php echo $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 <?= $owner['name']; ?></p>
|
<p class="project-organizer">Organisert av <?php echo $owner['name']; ?></p>
|
||||||
</div></a>
|
</div></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
|
require_once dirname(__DIR__, 2) . 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,17 +28,16 @@ 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) {
|
||||||
else if ($member['owner']==0){
|
$is_member = true;
|
||||||
$is_member = True;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,9 +65,9 @@ if ($attrs){
|
|||||||
|
|
||||||
<main class="contentsplit">
|
<main class="contentsplit">
|
||||||
<div class="gridr">
|
<div class="gridr">
|
||||||
<h2><?= $project->getName(); ?></h2>
|
<h2><?php echo $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>
|
||||||
@@ -82,27 +81,27 @@ if ($attrs){
|
|||||||
<?php foreach ($members as $i => $data) {
|
<?php foreach ($members as $i => $data) {
|
||||||
if ($data['lead']) {
|
if ($data['lead']) {
|
||||||
?>
|
?>
|
||||||
<p><?= $data['name']; ?></p>
|
<p><?php echo $data['name']; ?></p>
|
||||||
<p class="memberrole"><?= $data['role'] ?></p>
|
<p class="memberrole"><?php echo $data['role']; ?></p>
|
||||||
<p class="memberuname"><?= $data['uname']; ?></p>
|
<p class="memberuname"><?php echo $data['uname']; ?></p>
|
||||||
<p class="memberemail"><?= $data['mail']; ?></p>
|
<p class="memberemail"><?php echo $data['mail']; ?></p>
|
||||||
<?php }
|
<?php }
|
||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if(sizeof($normal_members) > 0){
|
if (count($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><?= $data['name']; ?></p>
|
<p><?php echo $data['name']; ?></p>
|
||||||
<p class="memberrole"><?= $data['role'] ? $data['role'] : 'Deltaker' ?></p>
|
<p class="memberrole"><?php echo $data['role'] ?: 'Deltaker'; ?></p>
|
||||||
<p class="memberuname"><?= $data['uname']; ?></p>
|
<p class="memberuname"><?php echo $data['uname']; ?></p>
|
||||||
<p class="memberemail"><?= $data['mail']; ?></p>
|
<p class="memberemail"><?php echo $data['mail']; ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,8 +115,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="<?= $projectID ?>"/>
|
<input type="hidden" name="id" value="<?php echo $projectID; ?>"/>
|
||||||
<input type="submit" class="btn" name="join_or_leave" value="<?= ($is_member ? 'Forlat' : 'Bli med!') ?>"></input>
|
<input type="submit" class="btn" name="join_or_leave" value="<?php echo $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,9 +28,7 @@ if(isset($_GET['filter'])){
|
|||||||
// filter
|
// filter
|
||||||
$projects = array_values(array_filter(
|
$projects = array_values(array_filter(
|
||||||
$projects,
|
$projects,
|
||||||
function($project) use ($filter){
|
static fn($project) => (preg_match('/.*' . $filter . '.*/i', $project->getName()) || preg_match('/.*' . $filter . '.*/i', implode(' ', $project->getDescription())))
|
||||||
return (preg_match('/.*'.$filter.'.*/i', $project->getName()) or preg_match('/.*'.$filter.'.*/i', implode(" ", $project->getDescription())));
|
|
||||||
}
|
|
||||||
));
|
));
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -50,8 +48,8 @@ $projects = array_values(array_filter(
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<?= navbar(1, 'prosjekt'); ?>
|
<?php echo navbar(1, 'prosjekt'); ?>
|
||||||
<?= loginbar(); ?>
|
<?php echo loginbar(); ?>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<main class="gridsplit">
|
<main class="gridsplit">
|
||||||
@@ -63,7 +61,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;
|
||||||
}
|
}
|
||||||
@@ -80,16 +78,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=<?= $project->getID() ?>">
|
<a href="edit.php?id=<?php echo $project->getID(); ?>">
|
||||||
<h3 class="no-chin"><?= $project->getName()?></h3>
|
<h3 class="no-chin"><?php echo $project->getName(); ?></h3>
|
||||||
</a>
|
</a>
|
||||||
<p style="text-decoration: none;"><?= implode("<br>", array_slice($project->getDescription(), 0, 4)); ?></p>
|
<p style="text-decoration: none;"><?php echo implode('<br>', array_slice($project->getDescription(), 0, 4)); ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$counter++;
|
++$counter;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -99,7 +97,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) and (($pageLimit * $page) < count($projects))){
|
if (($counter == $pageLimit) && (($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>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -111,7 +109,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>
|
||||||
<?= '<input type="text" name="filter" class="boxinput" value="' . $filter . '">' ?><br>
|
<?php echo '<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']) or !isset($_POST['desc']) or !isset($_POST['active'])){
|
if (!isset($_POST['title']) || !isset($_POST['desc']) || !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,31 +47,29 @@ if($id == 0){
|
|||||||
$statement->bindParam(':owneremail', $mail, PDO::PARAM_STR);
|
$statement->bindParam(':owneremail', $mail, PDO::PARAM_STR);
|
||||||
|
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
}
|
} else {
|
||||||
else {
|
$projectManager = new pvv\side\ProjectManager($pdo);
|
||||||
$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 and $member['owner']==0){
|
if ($member['uname'] == $uname && $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();
|
||||||
print("leave");
|
echo '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);
|
||||||
@@ -80,16 +78,16 @@ else {
|
|||||||
$statement->bindParam(':mail', $mail, PDO::PARAM_STR);
|
$statement->bindParam(':mail', $mail, PDO::PARAM_STR);
|
||||||
|
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
print("join");
|
echo '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();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
{
|
{
|
||||||
@@ -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,5 +1,8 @@
|
|||||||
<?php namespace pvv\side;
|
<?php
|
||||||
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">
|
||||||
@@ -16,8 +19,8 @@ require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc'
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav>
|
||||||
<?= navbar(1, 'tjenester'); ?>
|
<?php echo navbar(1, 'tjenester'); ?>
|
||||||
<?= loginbar($sp, $pdo); ?>
|
<?php echo loginbar($sp, $pdo); ?>
|
||||||
</nav>
|
</nav>
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
@@ -126,29 +129,29 @@ require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc'
|
|||||||
|
|
||||||
<div class="service">
|
<div class="service">
|
||||||
<div class="serviceContent">
|
<div class="serviceContent">
|
||||||
<h2 class="serviceTitle">Proxmox @joshua</h2>
|
<h2 class="serviceTitle">Proxmox @blossom</h2>
|
||||||
<p class="serviceDescription">Joshua er en av våre VM-tjenere, her kan du kjøre enten fulle VM-er eller konteinere. Bare Drift har tilgang på disse tjenerne.</p>
|
<p class="serviceDescription">Blossom er den sterkeste av våre VM-tjenere, her kan du kjøre enten fulle VM-er eller konteinere. Bare Drift har tilgang på disse tjenerne.</p>
|
||||||
<div class="serviceLink"><a href="https://joshua.pvv.ntnu.no:8006" target="_blank">Gå til joshua.pvv.ntnu.no</a></div>
|
<div class="serviceLink"><a href="https://blossom.pvv.ntnu.no:8006" target="_blank">Gå til blossom.pvv.ntnu.no</a></div>
|
||||||
</div>
|
</div>
|
||||||
<img class="serviceImage" src="img/proxmox.png" alt="Proxmox-logo">
|
<img class="serviceImage" src="img/proxmox.png" alt="Proxmox-logo">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="service">
|
<div class="service">
|
||||||
<div class="serviceContent">
|
<div class="serviceContent">
|
||||||
<h2 class="serviceTitle">Proxmox @andresbu</h2>
|
<h2 class="serviceTitle">Proxmox @bubbles</h2>
|
||||||
<p class="serviceDescription">Andresbu er en kraftigere VM-tjener, men har fortsatt en del rusk i maskineriet.</p>
|
<p class="serviceDescription">Bubbles er den svakeste av våre VM-tjenere.</p>
|
||||||
<div class="serviceLink"><a href="https://andresbu.pvv.ntnu.no:8006" target="_blank">Gå til andresbu.pvv.ntnu.no</a></div>
|
<div class="serviceLink"><a href="https://bubbles.pvv.ntnu.no:8006" target="_blank">Gå til bubbles.pvv.ntnu.no</a></div>
|
||||||
</div>
|
</div>
|
||||||
<img class="serviceImage" src="img/proxmox.png" alt="Proxmox-logo">
|
<img class="serviceImage" src="img/proxmox.png" alt="Proxmox-logo">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="service">
|
<div class="service">
|
||||||
<div class="serviceContent">
|
<div class="serviceContent">
|
||||||
<h2 class="serviceTitle">ESXI @asgore</h2>
|
<h2 class="serviceTitle">Proxmox @buttercup</h2>
|
||||||
<p class="serviceDescription">Asgore er vår eldste og største VM-tjener, og kjører ESXI.</p>
|
<p class="serviceDescription">Buttercup er en av våre VM-tjenere.</p>
|
||||||
<div class="serviceLink"><a href="https://asgore.pvv.ntnu.no" target="_blank">Gå til asgore.pvv.ntnu.no</a></div>
|
<div class="serviceLink"><a href="https://buttercup.pvv.ntnu.no:8006" target="_blank">Gå til buttercup.pvv.ntnu.no</a></div>
|
||||||
</div>
|
</div>
|
||||||
<img class="serviceImage" src="img/esxi.png" alt="ESXI-logo">
|
<img class="serviceImage" src="img/proxmox.png" alt="Proxmox-logo">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -161,7 +164,7 @@ require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc'
|
|||||||
<div class="serviceContent">
|
<div class="serviceContent">
|
||||||
<h2 class="serviceTitle">Minecraft</h2>
|
<h2 class="serviceTitle">Minecraft</h2>
|
||||||
<p class="serviceDescription">Vi har en egen Minecraft-server <b>for medlemmer</b>, som du kan koble til med IP-adressen <b>minecraft.pvv.ntnu.no</b>. Spør om whitelist på matrix/discord.</p>
|
<p class="serviceDescription">Vi har en egen Minecraft-server <b>for medlemmer</b>, som du kan koble til med IP-adressen <b>minecraft.pvv.ntnu.no</b>. Spør om whitelist på matrix/discord.</p>
|
||||||
<div class="serviceLink"><a href="https://isvegg.pvv.ntnu.no/kart/" target="_blank">Gå til verdenskartet vårt</a></div>
|
<div class="serviceLink"><a href="https://minecraft.pvv.ntnu.no" target="_blank">Gå til verdenskartet vårt</a></div>
|
||||||
</div>
|
</div>
|
||||||
<img class="serviceImage" src="img/minecraft.png" alt="Minecraft-logo">
|
<img class="serviceImage" src="img/minecraft.png" alt="Minecraft-logo">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user