Compare commits
	
		
			1 Commits
		
	
	
		
			calendar-d
			...
			nixify
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7712419e9b | 
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,5 @@
 | 
				
			|||||||
/result
 | 
					/sql_config.php
 | 
				
			||||||
/config.php
 | 
					/dataporten_config.php
 | 
				
			||||||
*.sqlite
 | 
					*.sqlite
 | 
				
			||||||
/test.sql
 | 
					/test.sql
 | 
				
			||||||
/vendor/
 | 
					/vendor/
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +1,16 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	"name": "programvareverkstedet/nettsiden",
 | 
						"name": "programvareverkstedet/nettsiden",
 | 
				
			||||||
    "description": "Programvareverkstedets nettside",
 | 
						"description": "Programvareverkstedets public website",
 | 
				
			||||||
    "license": "proprietary",
 | 
						"require": {
 | 
				
			||||||
 | 
							"simplesamlphp/simplesamlphp": "~1",
 | 
				
			||||||
 | 
							"erusev/parsedown": "^1.7"
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						"require-dev": {
 | 
				
			||||||
 | 
							"ext-pdo_sqlite": "*"
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
	"config": {
 | 
						"config": {
 | 
				
			||||||
		"allow-plugins": {
 | 
							"allow-plugins": {
 | 
				
			||||||
			"simplesamlphp/composer-module-installer": true
 | 
								"simplesamlphp/composer-module-installer": true
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "require": {
 | 
					 | 
				
			||||||
        "simplesamlphp/simplesamlphp": "^2.2",
 | 
					 | 
				
			||||||
        "erusev/parsedown": "^1.7"
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3392
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3392
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										11
									
								
								dev.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								dev.bat
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					REM php og sqlite3 må være tilgjengelig i PATH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					IF EXIST "sql_config.php" goto config_end
 | 
				
			||||||
 | 
					cp sql_config_example.php sql_config.php 
 | 
				
			||||||
 | 
					:config_end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					IF EXIST "pvv.sqlite" goto sqlite_end
 | 
				
			||||||
 | 
					sqlite3 pvv.sqlite < pvv.sql
 | 
				
			||||||
 | 
					:sqlite_end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					php -S [::1]:1080 -t www/ -c php.ini
 | 
				
			||||||
							
								
								
									
										25
									
								
								dev.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								dev.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					which sqlite3 > /dev/null 2>&1 || (echo ERROR: sqlite not found; false) || exit 1
 | 
				
			||||||
 | 
					test ! -e pvv.sqlite && sqlite3 pvv.sqlite < dist/pvv.sql
 | 
				
			||||||
 | 
					test ! -e sql_config.php && cp -v dist/sql_config_example.php sql_config.php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test ! -e dataporten_config.php && cp -v dist/dataporten_config.php dataporten_config.php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test -e composer.phar || curl -O https://getcomposer.org/composer.phar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if test ! -f lib/OAuth2-Client/OAuth2Client.php ; then
 | 
				
			||||||
 | 
						echo Missing git submodules. Installing...
 | 
				
			||||||
 | 
						(set -x; git submodule update --init --recursive) || exit $?
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if test ! -d vendor; then
 | 
				
			||||||
 | 
						php composer.phar install || exit $?
 | 
				
			||||||
 | 
						cp -v dist/authsources_example.php vendor/simplesamlphp/simplesamlphp/config/authsources.php
 | 
				
			||||||
 | 
						cp -v dist/saml20-idp-remote.php vendor/simplesamlphp/simplesamlphp/metadata/saml20-idp-remote.php
 | 
				
			||||||
 | 
						cp -v vendor/simplesamlphp/simplesamlphp/config-templates/config.php vendor/simplesamlphp/simplesamlphp/config/config.php
 | 
				
			||||||
 | 
						sed -e "s/'trusted.url.domains' => array()/'trusted.url.domains' => array('localhost:1080')/g" < vendor/simplesamlphp/simplesamlphp/config-templates/config.php > vendor/simplesamlphp/simplesamlphp/config/config.php
 | 
				
			||||||
 | 
						ln -s ../vendor/simplesamlphp/simplesamlphp/www/ www/simplesaml
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					php -S ${DOCKER_HOST:-[::1]}:${DOCKER_PORT:-1080} -d error_reporting=E_ALL -d display_errors=1 -t www/
 | 
				
			||||||
							
								
								
									
										24
									
								
								dist/config.local.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								dist/config.local.php
									
									
									
									
										vendored
									
									
								
							@@ -1,24 +0,0 @@
 | 
				
			|||||||
<?php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$DB_DSN = 'sqlite:'.__DIR__.DIRECTORY_SEPARATOR.'pvv.sqlite';
 | 
					 | 
				
			||||||
$DB_USER = null;
 | 
					 | 
				
			||||||
$DB_PASS = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$DOOR_SECRET = "changeme";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$GALLERY_DIR = __DIR__.DIRECTORY_SEPARATOR.'www'.DIRECTORY_SEPARATOR.'galleri'.DIRECTORY_SEPARATOR.'bilder'.DIRECTORY_SEPARATOR.'gallery';
 | 
					 | 
				
			||||||
$GALLERY_SERVER_PATH = '/images/gallery/';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$SLIDESHOW_DIR = __DIR__.DIRECTORY_SEPARATOR.'www'.DIRECTORY_SEPARATOR.'galleri'.DIRECTORY_SEPARATOR.'bilder'.DIRECTORY_SEPARATOR.'slideshow';
 | 
					 | 
				
			||||||
$SLIDESHOW_SERVER_PATH = '/images/slideshow/';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$SAML_COOKIE_SALT = 'changeme';
 | 
					 | 
				
			||||||
$SAML_COOKIE_SECURE = false;
 | 
					 | 
				
			||||||
$SAML_TRUSTED_DOMAINS = array("localhost:1080");
 | 
					 | 
				
			||||||
$SAML_ADMIN_PASSWORD = "changeme";
 | 
					 | 
				
			||||||
$SAML_ADMIN_NAME = 'PVV Drift';
 | 
					 | 
				
			||||||
$SAML_ADMIN_EMAIL = 'drift@pvv.ntnu.no';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$CACHE_DIRECTORY = __DIR__.DIRECTORY_SEPARATOR.'cache';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
							
								
								
									
										6
									
								
								dist/config.source-env.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/config.source-env.php
									
									
									
									
										vendored
									
									
								
							@@ -1,6 +0,0 @@
 | 
				
			|||||||
<?php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$configFile = getenv('PVV_CONFIG_FILE');
 | 
					 | 
				
			||||||
require_once($configFile);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
							
								
								
									
										21
									
								
								dist/dataporten_config.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								dist/dataporten_config.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# go to https://auth.dataporten.no/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$dataportenConfig = [
 | 
				
			||||||
 | 
						'client_id' => "",
 | 
				
			||||||
 | 
						'client_secret' => "",
 | 
				
			||||||
 | 
						//'redirect_uri' => "https://pvv.ntnu.no/paamelding/",
 | 
				
			||||||
 | 
						'redirect_uri' => "http://localhost:1080/paamelding/",
 | 
				
			||||||
 | 
						'auth' => "https://auth.dataporten.no/oauth/authorization",#Authorization endpoint
 | 
				
			||||||
 | 
						'token' => "https://auth.dataporten.no/oauth/token",#Token endpoint
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						/* OPTIONAL */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						# 'authorization_type' => "Bearer",
 | 
				
			||||||
 | 
						# 'session' => false,
 | 
				
			||||||
 | 
						# 'verify' => 1,
 | 
				
			||||||
 | 
						# 'grant_type' => "authorization_code",
 | 
				
			||||||
 | 
						# 'response_type' => "code",
 | 
				
			||||||
 | 
						# 'scope' => "",
 | 
				
			||||||
 | 
					];
 | 
				
			||||||
							
								
								
									
										4
									
								
								dist/pvv.sql
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/pvv.sql
									
									
									
									
										vendored
									
									
								
							@@ -36,7 +36,7 @@ CREATE TABLE "motd" (
 | 
				
			|||||||
"content" TEXT
 | 
					"content" TEXT
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
INSERT INTO motd (title, content)
 | 
					INSERT INTO motd (title, content)
 | 
				
			||||||
VALUES ('MOTD ./dev.sh', 'du kan endre motd i admin panelet');
 | 
					VALUES ("MOTD ./dev.sh", "du kan endre motd i admin panelet");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CREATE TABLE "door" (
 | 
					CREATE TABLE "door" (
 | 
				
			||||||
"time" INTEGER PRIMARY KEY,
 | 
					"time" INTEGER PRIMARY KEY,
 | 
				
			||||||
@@ -47,4 +47,4 @@ VALUES (0, FALSE);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INSERT INTO users (uname, groups)
 | 
					INSERT INTO users (uname, groups)
 | 
				
			||||||
VALUES ('min_test_bruker', 1);
 | 
					VALUES ("min_test_bruker", 1);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1301
									
								
								dist/simplesamlphp-config.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1301
									
								
								dist/simplesamlphp-config.php
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										6
									
								
								dist/sql_config_example.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								dist/sql_config_example.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					$dbDsn = 'sqlite:'.__DIR__.DIRECTORY_SEPARATOR.'pvv.sqlite';
 | 
				
			||||||
 | 
					$dbUser = null;
 | 
				
			||||||
 | 
					$dbPass = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$doorSensorSecret = "OGJiZTdjZDctMmFkNy00ZjZjLTk3OGItOTA3NzU3ZDM2Yjlm";
 | 
				
			||||||
							
								
								
									
										6
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							@@ -2,11 +2,11 @@
 | 
				
			|||||||
  "nodes": {
 | 
					  "nodes": {
 | 
				
			||||||
    "nixpkgs": {
 | 
					    "nixpkgs": {
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1707939175,
 | 
					        "lastModified": 1695978539,
 | 
				
			||||||
        "narHash": "sha256-D1xan0lgxbmXDyzVqXTiSYHLmAMrMRdD+alKzEO/p3w=",
 | 
					        "narHash": "sha256-lta5HToBZMWZ2hl5CautNSUgIZViR41QxN7JKbMAjgQ=",
 | 
				
			||||||
        "owner": "NixOS",
 | 
					        "owner": "NixOS",
 | 
				
			||||||
        "repo": "nixpkgs",
 | 
					        "repo": "nixpkgs",
 | 
				
			||||||
        "rev": "f7e8132daca31b1e3859ac0fb49741754375ac3d",
 | 
					        "rev": "bd9b686c0168041aea600222be0805a0de6e6ab8",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										66
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										66
									
								
								flake.nix
									
									
									
									
									
								
							@@ -12,30 +12,60 @@
 | 
				
			|||||||
      "aarch64-linux"
 | 
					      "aarch64-linux"
 | 
				
			||||||
      "aarch64-darwin"
 | 
					      "aarch64-darwin"
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
    forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let
 | 
					    forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
 | 
				
			||||||
      pkgs = nixpkgs.legacyPackages.${system};
 | 
					 | 
				
			||||||
    in f system pkgs);
 | 
					 | 
				
			||||||
  in {
 | 
					  in {
 | 
				
			||||||
    packages = forAllSystems (system: pkgs: {
 | 
					    packages = forAllSystems (system: rec {
 | 
				
			||||||
      default = self.packages.${system}.pvv-nettsiden;
 | 
					        pkgs = import nixpkgs { inherit system; };
 | 
				
			||||||
      pvv-nettsiden = pkgs.callPackage ./nix/package.nix { php = pkgs.php82; };
 | 
						default = pkgs.callPackage ./package.nix { php = pkgs.php82; };
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					    devShells = forAllSystems (system: rec {
 | 
				
			||||||
 | 
					      pkgs = import nixpkgs { inherit system; };
 | 
				
			||||||
 | 
					      default = pkgs.mkShellNoCC {
 | 
				
			||||||
 | 
					        buildInputs = with pkgs; [
 | 
				
			||||||
 | 
					          php82
 | 
				
			||||||
 | 
					          (with php82Extensions; [
 | 
				
			||||||
 | 
					            iconv
 | 
				
			||||||
 | 
					            mbstring
 | 
				
			||||||
 | 
					            pdo_mysql
 | 
				
			||||||
 | 
					            pdo_sqlite
 | 
				
			||||||
 | 
					          ])
 | 
				
			||||||
 | 
					          sqlite
 | 
				
			||||||
 | 
					          git
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					        shellHook = ''
 | 
				
			||||||
 | 
					          export PHPHOST=localhost
 | 
				
			||||||
 | 
					          export PHPPORT=1080
 | 
				
			||||||
 | 
					          alias runDev='php -S $PHPHOST:$PHPPORT -d error_reporting=E_ALL -d display_errors=1 -t www/'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    overlays.default = final: prev: {
 | 
					          # Prepare dev environment with sqlite and config files
 | 
				
			||||||
      inherit (self.packages.${final.system}) pvv-nettsiden;
 | 
					          test -e pvv.sqlite || sqlite3 pvv.sqlite < dist/pvv.sql
 | 
				
			||||||
      formats = prev.formats // {
 | 
					          test -e sql_config.php || cp -v dist/sql_config_example.php sql_config.php
 | 
				
			||||||
        php = import ./nix/php-generator.nix { pkgs = prev; lib = prev.lib; };
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    nixosModules.default = nix/module.nix;
 | 
					          test -e dataporten_config.php || cp -v dist/dataporten_config.php dataporten_config.php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    devShells = forAllSystems (system: pkgs: {
 | 
					          test -e composer.phar || curl -O https://getcomposer.org/composer.phar
 | 
				
			||||||
      default = pkgs.callPackage ./nix/shell.nix { inherit pkgs; };
 | 
					
 | 
				
			||||||
    });
 | 
					          if [ ! -f lib/OAuth2-Client/OAuth2Client.php ] ; then
 | 
				
			||||||
 | 
					            echo Missing git submodules. Installing...
 | 
				
			||||||
 | 
					            (set -x; git submodule update --init --recursive) || exit $?
 | 
				
			||||||
 | 
					          fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          if [ ! -d vendor ] ; then
 | 
				
			||||||
 | 
					            php composer.phar install || exit $?
 | 
				
			||||||
 | 
					            cp -v dist/authsources_example.php vendor/simplesamlphp/simplesamlphp/config/authsources.php
 | 
				
			||||||
 | 
					            cp -v dist/saml20-idp-remote.php vendor/simplesamlphp/simplesamlphp/metadata/saml20-idp-remote.php
 | 
				
			||||||
 | 
					            cp -v vendor/simplesamlphp/simplesamlphp/config-templates/config.php vendor/simplesamlphp/simplesamlphp/config/config.php
 | 
				
			||||||
 | 
					            sed -e "s/'trusted.url.domains' => array()/'trusted.url.domains' => array(\"$PHPHOST:$PHPPORT\")/g" < vendor/simplesamlphp/simplesamlphp/config-templates/config.php > vendor/simplesamlphp/simplesamlphp/config/config.php
 | 
				
			||||||
 | 
					            ln -s ../vendor/simplesamlphp/simplesamlphp/www/ www/simplesaml
 | 
				
			||||||
 | 
					          fi
 | 
				
			||||||
 | 
					        '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # TODO:
 | 
					        # TODO:
 | 
				
			||||||
    # - Relicense the project to GPL or something
 | 
					        # - Integrate with docker config
 | 
				
			||||||
    # - Write a module for the project
 | 
					        # - Make "trusted.url.domains" dynamic based on the current host:port
 | 
				
			||||||
 | 
					        # - Do not download composer.phar with curl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
require __DIR__ . '/../src/_autoload.php';
 | 
					require __DIR__ . '/../src/_autoload.php';
 | 
				
			||||||
require __DIR__ . '/../config.php';
 | 
					require __DIR__ . '/../sql_config.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,10 @@
 | 
				
			|||||||
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, ['', 'lib', 'OAuth2-Client', 'OAuth2Client.php']);
 | 
				
			||||||
 | 
					require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'dataporten_config.php']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'sql_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']);
 | 
				
			||||||
@@ -13,20 +16,20 @@ require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'vendor', 'sim
 | 
				
			|||||||
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($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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 \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\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),
 | 
				
			||||||
]);
 | 
					]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,9 +8,9 @@ function navbar($depth, $active = NULL) {
 | 
				
			|||||||
		//'Aktiviteter' => 'aktiviteter',
 | 
							//'Aktiviteter' => 'aktiviteter',
 | 
				
			||||||
		'Prosjekter' => 'prosjekt',
 | 
							'Prosjekter' => 'prosjekt',
 | 
				
			||||||
		'Kontakt' => 'kontakt',
 | 
							'Kontakt' => 'kontakt',
 | 
				
			||||||
		'Webmail' => 'https://webmail.pvv.ntnu.no/roundcube/',
 | 
							'Webmail' => 'mail',
 | 
				
			||||||
		'Galleri' => 'galleri',
 | 
							'Galleri' => 'galleri',
 | 
				
			||||||
		'Wiki' => 'https://wiki.pvv.ntnu.no/',
 | 
							'Wiki' => 'pvv',
 | 
				
			||||||
		'Git' => 'https://git.pvv.ntnu.no/',
 | 
							'Git' => 'https://git.pvv.ntnu.no/',
 | 
				
			||||||
                'Tjenester' => 'tjenester',
 | 
					                'Tjenester' => 'tjenester',
 | 
				
			||||||
	];
 | 
						];
 | 
				
			||||||
@@ -35,7 +35,7 @@ function loginBar($sp = null, $pdo = null) {
 | 
				
			|||||||
	if (is_null($sp)) $sp = 'default-sp';
 | 
						if (is_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" />
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										35
									
								
								inc/ticker.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								inc/ticker.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					<ul id="ticker">
 | 
				
			||||||
 | 
					<?php
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						require __DIR__ . '/../src/_autoload.php';
 | 
				
			||||||
 | 
						require __DIR__ . '/../sql_config.php';
 | 
				
			||||||
 | 
						$translation = ['i dag', 'i morgen', 'denne uken', 'neste uke', 'denne måneden', 'neste måned'];
 | 
				
			||||||
 | 
						$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
 | 
						$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 | 
				
			||||||
 | 
						$agenda = new \pvv\side\Agenda([
 | 
				
			||||||
 | 
								new \pvv\side\social\NerdepitsaActivity,
 | 
				
			||||||
 | 
								new \pvv\side\social\AnimekveldActivity,
 | 
				
			||||||
 | 
								new \pvv\side\DBActivity($pdo),
 | 
				
			||||||
 | 
							]);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						$test = true;
 | 
				
			||||||
 | 
						foreach($agenda->getNextDays() as $period => $events) {
 | 
				
			||||||
 | 
							if (!$events) continue;
 | 
				
			||||||
 | 
							$i = 0;
 | 
				
			||||||
 | 
							$n = count($events);
 | 
				
			||||||
 | 
							foreach($events as $event){
 | 
				
			||||||
 | 
								if ($i == 0){
 | 
				
			||||||
 | 
									echo '<li style="text-align: center;"><span style="text-transform: uppercase;">' . $translation[$period] . '</span>: ';
 | 
				
			||||||
 | 
								} else if ($i < $n-1) {
 | 
				
			||||||
 | 
									echo '<i style="opacity:0.7;">, </i>';
 | 
				
			||||||
 | 
								} else{
 | 
				
			||||||
 | 
									echo '<i style="opacity:0.7;"> og </i>';
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								echo '<a href="' . $event->getURL() . '">' . $event->getName() . '</a>';
 | 
				
			||||||
 | 
								$i = $i + 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
							
								
								
									
										1
									
								
								lib/OAuth2-Client
									
									
									
									
									
										Submodule
									
								
							
							
								
								
								
								
								
							
						
						
									
										1
									
								
								lib/OAuth2-Client
									
									
									
									
									
										Submodule
									
								
							 Submodule lib/OAuth2-Client added at 7b2dc91100
									
								
							
							
								
								
									
										254
									
								
								nix/module.nix
									
									
									
									
									
								
							
							
						
						
									
										254
									
								
								nix/module.nix
									
									
									
									
									
								
							@@ -1,254 +0,0 @@
 | 
				
			|||||||
{ config, lib, pkgs, ... }:
 | 
					 | 
				
			||||||
let
 | 
					 | 
				
			||||||
  cfg = config.services.pvv-nettsiden;
 | 
					 | 
				
			||||||
  inherit (lib) mkDefault mkEnableOption mkPackageOption mkIf mkOption types mdDoc;
 | 
					 | 
				
			||||||
  format = pkgs.formats.php { };
 | 
					 | 
				
			||||||
in
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  options.services.pvv-nettsiden = {
 | 
					 | 
				
			||||||
    enable = mkEnableOption (lib.mdDoc "Enable pvv-nettsiden");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    package = mkPackageOption pkgs "pvv-nettsiden" { };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    user = mkOption {
 | 
					 | 
				
			||||||
      type = types.str;
 | 
					 | 
				
			||||||
      default = "pvv-nettsiden";
 | 
					 | 
				
			||||||
      description = mdDoc "User to run php-fpm and own the image directories";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    group = mkOption {
 | 
					 | 
				
			||||||
      type = types.str;
 | 
					 | 
				
			||||||
      default = "pvv-nettsiden";
 | 
					 | 
				
			||||||
      description = mdDoc "Group to run php-fpm and own the image directories";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    domainName = mkOption {
 | 
					 | 
				
			||||||
      type = types.str;
 | 
					 | 
				
			||||||
      default = "www.pvv.no";
 | 
					 | 
				
			||||||
      description = mdDoc "Domain name for the website";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    enableNginx = mkEnableOption "nginx" // { default = true; };
 | 
					 | 
				
			||||||
    useSSL = mkEnableOption "secure cookies" // { default = true; };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    settings = mkOption {
 | 
					 | 
				
			||||||
      description = "Settings for the website";
 | 
					 | 
				
			||||||
      default = { };
 | 
					 | 
				
			||||||
      type = types.submodule {
 | 
					 | 
				
			||||||
        freeformType = format.type;
 | 
					 | 
				
			||||||
        options = lib.mapAttrsRecursiveCond
 | 
					 | 
				
			||||||
          (attrs: !(attrs ? "type"))
 | 
					 | 
				
			||||||
          (_: option: option // { type = types.either option.type format.lib.types.raw; })
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          DOOR_SECRET = mkOption {
 | 
					 | 
				
			||||||
            type = types.str;
 | 
					 | 
				
			||||||
            description = mdDoc "Secret for the door sensor API";
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          GALLERY = {
 | 
					 | 
				
			||||||
            DIR = mkOption {
 | 
					 | 
				
			||||||
              type = types.path;
 | 
					 | 
				
			||||||
              default = "/var/lib/pvv-nettsiden/gallery";
 | 
					 | 
				
			||||||
              description = mdDoc "Directory where the gallery is located. See documentation at TODO";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SERVER_PATH = mkOption {
 | 
					 | 
				
			||||||
              type = types.str;
 | 
					 | 
				
			||||||
              default = "/static/gallery";
 | 
					 | 
				
			||||||
              description = mdDoc "Path to the gallery on the server";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          SLIDESHOW = {
 | 
					 | 
				
			||||||
            DIR = mkOption {
 | 
					 | 
				
			||||||
              type = types.path;
 | 
					 | 
				
			||||||
              default = "/var/lib/pvv-nettsiden/slideshow";
 | 
					 | 
				
			||||||
              description = mdDoc "Directory where the slideshow is located. See documentation at TODO";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            SERVER_PATH = mkOption {
 | 
					 | 
				
			||||||
              type = types.str;
 | 
					 | 
				
			||||||
              default = "/static/slideshow";
 | 
					 | 
				
			||||||
              description = mdDoc "Path to the slideshow on the server";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          DB = {
 | 
					 | 
				
			||||||
            DSN = mkOption {
 | 
					 | 
				
			||||||
              type = types.str;
 | 
					 | 
				
			||||||
              default = "sqlite:/var/lib/pvv-nettsiden/pvv-nettsiden.db";
 | 
					 | 
				
			||||||
              example = "pgsql:host=localhost;port=5432;dbname=testdb;user=bruce;password=mypass";
 | 
					 | 
				
			||||||
              description = mdDoc "Database connection string, see https://www.php.net/manual/en/pdo.construct.php";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            USER = mkOption {
 | 
					 | 
				
			||||||
              type = with types; nullOr str;
 | 
					 | 
				
			||||||
              default = null;
 | 
					 | 
				
			||||||
              example = "pvv-nettsiden";
 | 
					 | 
				
			||||||
              description = mdDoc "Database user";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            PASS = mkOption {
 | 
					 | 
				
			||||||
              type = with types; nullOr str;
 | 
					 | 
				
			||||||
              default = null;
 | 
					 | 
				
			||||||
              description = mdDoc "Database password. Recommends: null, set in extraConfig";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          SAML = {
 | 
					 | 
				
			||||||
            COOKIE_SALT = mkOption {
 | 
					 | 
				
			||||||
              type = types.str;
 | 
					 | 
				
			||||||
              description = mdDoc "Salt for the SAML cookies";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            COOKIE_SECURE = mkOption {
 | 
					 | 
				
			||||||
              type = types.bool;
 | 
					 | 
				
			||||||
              default = true;
 | 
					 | 
				
			||||||
              description = mdDoc "Whether to set the secure flag on the SAML cookies";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            ADMIN_NAME = mkOption {
 | 
					 | 
				
			||||||
              type = types.str;
 | 
					 | 
				
			||||||
              description = mdDoc "Name for the admin user";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            ADMIN_EMAIL = mkOption {
 | 
					 | 
				
			||||||
              type = types.str;
 | 
					 | 
				
			||||||
              description = mdDoc "Email for the admin user";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            ADMIN_PASSWORD = mkOption {
 | 
					 | 
				
			||||||
              type = types.str;
 | 
					 | 
				
			||||||
              description = mdDoc "Password for the admin user";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            TRUSTED_DOMAINS = mkOption {
 | 
					 | 
				
			||||||
              type = types.listOf types.str;
 | 
					 | 
				
			||||||
              default = [ cfg.domainName ];
 | 
					 | 
				
			||||||
              description = mdDoc "List of trusted domains for the SAML service";
 | 
					 | 
				
			||||||
            };
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          CACHE_DIRECTORY = mkOption {
 | 
					 | 
				
			||||||
            type = types.path;
 | 
					 | 
				
			||||||
            default = "/var/cache/pvv-nettsiden/simplesamlphp";
 | 
					 | 
				
			||||||
            description = mdDoc "List of trusted domains for the SAML service";
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  config = mkIf cfg.enable (let
 | 
					 | 
				
			||||||
    # NOTE: This should absolutely not be necessary, but for some reason this file refuses to import
 | 
					 | 
				
			||||||
    #       the toplevel configuration file.
 | 
					 | 
				
			||||||
    # NOTE: Nvm, don't this this was the problem after all?
 | 
					 | 
				
			||||||
    finalPackage = cfg.package.overrideAttrs (_: _: {
 | 
					 | 
				
			||||||
      postInstall = let
 | 
					 | 
				
			||||||
        f = x: lib.escapeShellArg (format.lib.valueToString x);
 | 
					 | 
				
			||||||
      in cfg.package.postInstall + ''
 | 
					 | 
				
			||||||
        substituteInPlace $out/${cfg.package.passthru.simplesamlphpPath}/config/config.php \
 | 
					 | 
				
			||||||
          --replace '$SAML_COOKIE_SECURE'   ${f cfg.settings.SAML.COOKIE_SECURE} \
 | 
					 | 
				
			||||||
          --replace '$SAML_COOKIE_SALT'     ${f cfg.settings.SAML.COOKIE_SALT} \
 | 
					 | 
				
			||||||
          --replace '$SAML_ADMIN_PASSWORD'  ${f cfg.settings.SAML.ADMIN_PASSWORD} \
 | 
					 | 
				
			||||||
          --replace '$SAML_ADMIN_NAME'      ${f cfg.settings.SAML.ADMIN_NAME} \
 | 
					 | 
				
			||||||
          --replace '$SAML_ADMIN_EMAIL'     ${f cfg.settings.SAML.ADMIN_EMAIL} \
 | 
					 | 
				
			||||||
          --replace '$SAML_TRUSTED_DOMAINS' ${f cfg.settings.SAML.TRUSTED_DOMAINS} \
 | 
					 | 
				
			||||||
          --replace '$CACHE_DIRECTORY'      ${f cfg.settings.CACHE_DIRECTORY}
 | 
					 | 
				
			||||||
      '';
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  in {
 | 
					 | 
				
			||||||
    users.users = mkIf (cfg.user == "pvv-nettsiden") {
 | 
					 | 
				
			||||||
      "pvv-nettsiden" = {
 | 
					 | 
				
			||||||
        description = "PVV Website Service User";
 | 
					 | 
				
			||||||
        group = cfg.group;
 | 
					 | 
				
			||||||
        createHome = false;
 | 
					 | 
				
			||||||
        isSystemUser = true;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    users.groups = mkIf (cfg.group == "pvv-nettsiden") {
 | 
					 | 
				
			||||||
      "pvv-nettsiden" = { };
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    systemd.tmpfiles.settings."10-pvv-nettsiden".${cfg.settings.CACHE_DIRECTORY}.d = {
 | 
					 | 
				
			||||||
      inherit (cfg) user group;
 | 
					 | 
				
			||||||
      mode = "0770";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    services.nginx = mkIf cfg.enableNginx {
 | 
					 | 
				
			||||||
      enable = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      recommendedGzipSettings = mkDefault true;
 | 
					 | 
				
			||||||
      recommendedProxySettings = mkDefault true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      virtualHosts."${cfg.domainName}" = {
 | 
					 | 
				
			||||||
        forceSSL = mkDefault cfg.useSSL;
 | 
					 | 
				
			||||||
        enableACME = mkDefault true;
 | 
					 | 
				
			||||||
        locations = {
 | 
					 | 
				
			||||||
          "/" = {
 | 
					 | 
				
			||||||
            root = "${finalPackage}/share/php/pvv-nettsiden/www/";
 | 
					 | 
				
			||||||
            index = "index.php";
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          "~ \\.php$".extraConfig = ''
 | 
					 | 
				
			||||||
            include ${pkgs.nginx}/conf/fastcgi_params;
 | 
					 | 
				
			||||||
            fastcgi_param SCRIPT_FILENAME ${finalPackage}/share/php/pvv-nettsiden/www$fastcgi_script_name;
 | 
					 | 
				
			||||||
            fastcgi_pass unix:${config.services.phpfpm.pools."pvv-nettsiden".socket};
 | 
					 | 
				
			||||||
          '';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          # based on https://simplesamlphp.org/docs/stable/simplesamlphp-install.html#configuring-nginx
 | 
					 | 
				
			||||||
          "^~ /simplesaml/" = {
 | 
					 | 
				
			||||||
            alias = "${finalPackage}/${finalPackage.passthru.simplesamlphpPath}/public/";
 | 
					 | 
				
			||||||
            index = "index.php";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            extraConfig = ''
 | 
					 | 
				
			||||||
              location ~ ^/simplesaml/(?<phpfile>.+?\.php)(?<pathinfo>/.*)?$ {
 | 
					 | 
				
			||||||
                include ${pkgs.nginx}/conf/fastcgi_params;
 | 
					 | 
				
			||||||
                fastcgi_pass unix:${config.services.phpfpm.pools."pvv-nettsiden".socket};
 | 
					 | 
				
			||||||
                fastcgi_param SCRIPT_FILENAME ${finalPackage}/${finalPackage.passthru.simplesamlphpPath}/public/$phpfile;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                # Must be prepended with the baseurlpath
 | 
					 | 
				
			||||||
                fastcgi_param SCRIPT_NAME /simplesaml/$phpfile;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                fastcgi_param PATH_INFO $pathinfo if_not_empty;
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            '';
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          "^~ ${cfg.settings.GALLERY.SERVER_PATH}" = {
 | 
					 | 
				
			||||||
            root = cfg.settings.GALLERY.DIR;
 | 
					 | 
				
			||||||
            extraConfig = ''
 | 
					 | 
				
			||||||
              rewrite ^${cfg.settings.GALLERY.SERVER_PATH}/(.*)$ /$1 break;
 | 
					 | 
				
			||||||
            '';
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          "^~ ${cfg.settings.SLIDESHOW.SERVER_PATH}" = {
 | 
					 | 
				
			||||||
            root = cfg.settings.SLIDESHOW.DIR;
 | 
					 | 
				
			||||||
            extraConfig = ''
 | 
					 | 
				
			||||||
              rewrite ^${cfg.settings.SLIDESHOW.SERVER_PATH}/(.*)$ /$1 break;
 | 
					 | 
				
			||||||
            '';
 | 
					 | 
				
			||||||
          };
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    services.phpfpm.pools.pvv-nettsiden = {
 | 
					 | 
				
			||||||
      user = cfg.user;
 | 
					 | 
				
			||||||
      group = cfg.group;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      phpEnv.PVV_CONFIG_FILE = toString (format.generate "pvv-nettsiden-conf.php" cfg.settings);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      settings = {
 | 
					 | 
				
			||||||
        "listen.owner" = config.services.nginx.user;
 | 
					 | 
				
			||||||
        "listen.group" = config.services.nginx.group;
 | 
					 | 
				
			||||||
        "pm" = mkDefault "ondemand";
 | 
					 | 
				
			||||||
        "pm.max_children" = mkDefault 32;
 | 
					 | 
				
			||||||
        "pm.process_idle_timeout" = mkDefault "10s";
 | 
					 | 
				
			||||||
        "pm.max_requests" = mkDefault 500;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,28 +0,0 @@
 | 
				
			|||||||
{ lib
 | 
					 | 
				
			||||||
, php
 | 
					 | 
				
			||||||
, extra_files ? { }
 | 
					 | 
				
			||||||
}:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
php.buildComposerProject rec {
 | 
					 | 
				
			||||||
  src = ./..;
 | 
					 | 
				
			||||||
  pname = "pvv-nettsiden";
 | 
					 | 
				
			||||||
  version = "0.0.1";
 | 
					 | 
				
			||||||
  vendorHash = "sha256-sWC5E60toa95re2NugvHVPT+vKYXc1I6Z3rSqXxTUu0=";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  passthru.simplesamlphpPath = "share/php/pvv-nettsiden/vendor/simplesamlphp/simplesamlphp";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  postInstall = ''
 | 
					 | 
				
			||||||
    install -Dm644 dist/simplesamlphp-config.php      $out/${passthru.simplesamlphpPath}/config/config.php
 | 
					 | 
				
			||||||
    install -Dm644 dist/simplesamlphp-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/config.source-env.php         $out/share/php/pvv-nettsiden/config.php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    ${lib.pipe extra_files [
 | 
					 | 
				
			||||||
      (lib.mapAttrsToList (target_path: source_path: ''
 | 
					 | 
				
			||||||
        mkdir -p $(dirname "$out/${target_path}")
 | 
					 | 
				
			||||||
	cp -r "${source_path}" "$out/${target_path}"
 | 
					 | 
				
			||||||
      ''))
 | 
					 | 
				
			||||||
      (lib.concatStringsSep "\n")
 | 
					 | 
				
			||||||
    ]}
 | 
					 | 
				
			||||||
  '';
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,62 +0,0 @@
 | 
				
			|||||||
{ pkgs, lib }:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
with lib;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{ }: let
 | 
					 | 
				
			||||||
  valueToString = val:
 | 
					 | 
				
			||||||
    if val == null then
 | 
					 | 
				
			||||||
      "null"
 | 
					 | 
				
			||||||
    else if isString val then
 | 
					 | 
				
			||||||
      builtins.toJSON val
 | 
					 | 
				
			||||||
    else if isBool val then
 | 
					 | 
				
			||||||
      boolToString val
 | 
					 | 
				
			||||||
    else if isInt val || isFloat val then
 | 
					 | 
				
			||||||
      toString val
 | 
					 | 
				
			||||||
    else if isList val then
 | 
					 | 
				
			||||||
      "array(${concatMapStringsSep ", " valueToString val})"
 | 
					 | 
				
			||||||
    else if isAttrs val && val ? value && (val._type or "") == "raw" then
 | 
					 | 
				
			||||||
      val.value
 | 
					 | 
				
			||||||
    else if isAttrs val then
 | 
					 | 
				
			||||||
      throw "Found unexpected attrs, that were not created by mkRaw. Have you put attrs in an array?\n${val}"
 | 
					 | 
				
			||||||
    else throw "unsupported :')";
 | 
					 | 
				
			||||||
in {
 | 
					 | 
				
			||||||
  inherit (pkgs.formats.json { }) type;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  generate = name: value: let
 | 
					 | 
				
			||||||
    flattenStructuredSettings = attrs: let
 | 
					 | 
				
			||||||
      partitionAttrs = pred: attrs: lib.pipe attrs [
 | 
					 | 
				
			||||||
        attrsToList
 | 
					 | 
				
			||||||
        (partition ({ name, value }: pred name value))
 | 
					 | 
				
			||||||
        (mapAttrs (_: listToAttrs))
 | 
					 | 
				
			||||||
      ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      partitionedAttrs = partitionAttrs (_: v: isAttrs v && !(v ? value && (v._type or "") == "raw")) attrs;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      flattenedAttrs = lib.pipe partitionedAttrs.right [
 | 
					 | 
				
			||||||
        (mapAttrs (n1: mapAttrs' (n2: v2: nameValuePair "${n1}_${n2}" v2)))
 | 
					 | 
				
			||||||
        attrValues
 | 
					 | 
				
			||||||
        (map flattenStructuredSettings)
 | 
					 | 
				
			||||||
        (foldl recursiveUpdate { })
 | 
					 | 
				
			||||||
      ];
 | 
					 | 
				
			||||||
    in recursiveUpdate flattenedAttrs partitionedAttrs.wrong;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    content = lib.pipe value [
 | 
					 | 
				
			||||||
      flattenStructuredSettings
 | 
					 | 
				
			||||||
      (mapAttrs (_: valueToString))
 | 
					 | 
				
			||||||
      (mapAttrsToList (n: v: ''''$${n} = ${v};''))
 | 
					 | 
				
			||||||
      (concatStringsSep "\n")
 | 
					 | 
				
			||||||
      (content: "<?php\n${content}\n?>")
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
  in pkgs.writeText name content;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  lib = {
 | 
					 | 
				
			||||||
    inherit valueToString;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mkRaw = value: {
 | 
					 | 
				
			||||||
      inherit value;
 | 
					 | 
				
			||||||
      _type = "raw";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    types.raw = lib.types.attrs;
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,35 +0,0 @@
 | 
				
			|||||||
{ pkgs }:
 | 
					 | 
				
			||||||
let
 | 
					 | 
				
			||||||
  phpEnv = pkgs.php82.buildEnv {
 | 
					 | 
				
			||||||
    extensions = { enabled, all }: enabled ++ (with all; [ iconv mbstring pdo_mysql pdo_sqlite ]);
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
in
 | 
					 | 
				
			||||||
pkgs.mkShellNoCC {
 | 
					 | 
				
			||||||
  buildInputs = with pkgs; [
 | 
					 | 
				
			||||||
    phpEnv
 | 
					 | 
				
			||||||
    php82Packages.composer
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    sqlite
 | 
					 | 
				
			||||||
    git
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
  shellHook = ''
 | 
					 | 
				
			||||||
    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
 | 
					 | 
				
			||||||
    test -e pvv.sqlite || sqlite3 pvv.sqlite < dist/pvv.sql
 | 
					 | 
				
			||||||
    test -e config.php || cp -v dist/config.local.php config.php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if [ ! -d vendor ] ; then
 | 
					 | 
				
			||||||
      composer install || exit $?
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      cp dist/simplesamlphp-authsources.php vendor/simplesamlphp/simplesamlphp/config/authsources.php
 | 
					 | 
				
			||||||
      cp dist/simplesamlphp-idp.php vendor/simplesamlphp/simplesamlphp/metadata/saml20-idp-remote.php
 | 
					 | 
				
			||||||
      cp dist/simplesamlphp-config.php vendor/simplesamlphp/simplesamlphp/config/config.php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      cp dist/config.local.php config.php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      ln -s ../vendor/simplesamlphp/simplesamlphp/www/ www/simplesaml
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
  '';
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										12
									
								
								package.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								package.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					{ lib, php }:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					php.buildComposerProject (finalAttrs: {
 | 
				
			||||||
 | 
					  pname = "pvv-nettsiden";
 | 
				
			||||||
 | 
					  version = "1.0.0";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  patchPhase = ''ls -la'';
 | 
				
			||||||
 | 
					  src = ./.; # TODO: Use builtins.filterSource or similar to clean the source dir
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  vendorHash = "sha256-APKvVTr7AeCfA1WAzvh6Ex5l8f4Oy46eUoM80vCWMgk=";
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
@@ -1,12 +1,12 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
require __DIR__ . '/../../../src/_autoload.php';
 | 
					require __DIR__ . '/../../../src/_autoload.php';
 | 
				
			||||||
require __DIR__ . '/../../../config.php';
 | 
					require __DIR__ . '/../../../sql_config.php';
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,14 +3,14 @@ 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__ . '/../../../sql_config.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,14 +3,14 @@ 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__ . '/../../../sql_config.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,13 +2,13 @@
 | 
				
			|||||||
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__ . '/../../../sql_config.php';
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,17 +5,17 @@ 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__ . '/../../../sql_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($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,13 +4,13 @@ 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__ . '/../../../sql_config.php';
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,11 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
 | 
					require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,17 +5,17 @@ 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__ . '/../../../sql_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($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,13 +4,13 @@ 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__ . '/../../../sql_config.php';
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,12 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
require __DIR__ . '/../../../src/_autoload.php';
 | 
					require __DIR__ . '/../../../src/_autoload.php';
 | 
				
			||||||
require __DIR__ . '/../../../config.php';
 | 
					require __DIR__ . '/../../../sql_config.php';
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,14 +3,14 @@ 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__ . '/../../../sql_config.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,14 +3,14 @@ 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__ . '/../../../sql_config.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,13 +2,13 @@
 | 
				
			|||||||
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__ . '/../../../sql_config.php';
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,9 +51,11 @@ main {
 | 
				
			|||||||
    font-size: 1.5em;
 | 
					    font-size: 1.5em;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* #region modal */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.modal-target:hover {opacity: 0.7;}
 | 
					.modal-target:hover {opacity: 0.7;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Modal Background */
 | 
					/* The Modal (background) */
 | 
				
			||||||
.modal {
 | 
					.modal {
 | 
				
			||||||
    display: none; /* Hidden by default */
 | 
					    display: none; /* Hidden by default */
 | 
				
			||||||
    position: fixed; /* Stay in place */
 | 
					    position: fixed; /* Stay in place */
 | 
				
			||||||
@@ -68,12 +70,14 @@ main {
 | 
				
			|||||||
    background-color: rgba(0,0,0,0.8); /* Black w/ opacity */
 | 
					    background-color: rgba(0,0,0,0.8); /* Black w/ opacity */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Modal Content (image) */
 | 
				
			||||||
.modal-content {
 | 
					.modal-content {
 | 
				
			||||||
    margin: auto;
 | 
					    margin: auto;
 | 
				
			||||||
    display: block;
 | 
					    display: block;
 | 
				
			||||||
    object-fit: scale-down;
 | 
					    object-fit: scale-down;
 | 
				
			||||||
    overflow: visible;
 | 
					    overflow: visible;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    /* yolo, it all goes down from here */
 | 
				
			||||||
    min-width: 60vw;
 | 
					    min-width: 60vw;
 | 
				
			||||||
    max-width: 90vw !important;
 | 
					    max-width: 90vw !important;
 | 
				
			||||||
    min-height: 60vh;
 | 
					    min-height: 60vh;
 | 
				
			||||||
@@ -84,6 +88,7 @@ main {
 | 
				
			|||||||
    opacity: 1 !important;
 | 
					    opacity: 1 !important;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Caption of Modal Image */
 | 
				
			||||||
.modal-caption {
 | 
					.modal-caption {
 | 
				
			||||||
    margin: auto;
 | 
					    margin: auto;
 | 
				
			||||||
    display: block;
 | 
					    display: block;
 | 
				
			||||||
@@ -128,7 +133,9 @@ main {
 | 
				
			|||||||
    text-decoration: none;
 | 
					    text-decoration: none;
 | 
				
			||||||
    cursor: pointer;
 | 
					    cursor: pointer;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					/* #endregion modal */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* #region screen-size media-rules */
 | 
				
			||||||
@media only screen and (min-width:320px)  {
 | 
					@media only screen and (min-width:320px)  {
 | 
				
			||||||
    .gallery-container { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
 | 
					    .gallery-container { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
 | 
				
			||||||
    main { padding: 1em; }
 | 
					    main { padding: 1em; }
 | 
				
			||||||
@@ -143,3 +150,4 @@ main {
 | 
				
			|||||||
@media only screen and (min-width: 1281px) {
 | 
					@media only screen and (min-width: 1281px) {
 | 
				
			||||||
    .gallery-container { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
 | 
					    .gallery-container { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					/* #endregion */
 | 
				
			||||||
@@ -88,6 +88,16 @@ img.float-right {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.calendar-events a,
 | 
					.calendar-events a,
 | 
				
			||||||
 | 
					#ticker a {
 | 
				
			||||||
 | 
					    text-decoration: none;
 | 
				
			||||||
 | 
					    font-weight: bold;
 | 
				
			||||||
 | 
					    color: black;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.calendar-events a:hover,
 | 
				
			||||||
 | 
					#ticker a:hover {
 | 
				
			||||||
 | 
					    text-decoration: underline;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.calendar-events ul .time {
 | 
					.calendar-events ul .time {
 | 
				
			||||||
    color: rgba(0, 0, 0, 0.5);
 | 
					    color: rgba(0, 0, 0, 0.5);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ if($_SERVER['REQUEST_METHOD'] === 'POST') {
 | 
				
			|||||||
    if (isset($_SERVER["HTTP_AUTHORIZATION"])) {
 | 
					    if (isset($_SERVER["HTTP_AUTHORIZATION"])) {
 | 
				
			||||||
        list($type, $data) = explode(" ", $_SERVER["HTTP_AUTHORIZATION"], 2);
 | 
					        list($type, $data) = explode(" ", $_SERVER["HTTP_AUTHORIZATION"], 2);
 | 
				
			||||||
        if (strcasecmp($type, "Bearer") == 0) {
 | 
					        if (strcasecmp($type, "Bearer") == 0) {
 | 
				
			||||||
            if (hash_equals($data, $DOOR_SECRET)) {
 | 
					            if (hash_equals($data, $doorSensorSecret)) {
 | 
				
			||||||
                handleSetState();
 | 
					                handleSetState();
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                echo '{"status": "error", "message": "Invalid authentication key"}';
 | 
					                echo '{"status": "error", "message": "Invalid authentication key"}';
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										0
									
								
								www/galleri/bilder/slideshow/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								www/galleri/bilder/slideshow/.gitkeep
									
									
									
									
									
										Normal file
									
								
							@@ -2,12 +2,12 @@
 | 
				
			|||||||
error_reporting(0);
 | 
					error_reporting(0);
 | 
				
			||||||
require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
 | 
					require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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];
 | 
				
			||||||
@@ -18,24 +18,23 @@ if(!$loginname) {
 | 
				
			|||||||
	exit();
 | 
						exit();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Sourced from config.php through include.php
 | 
					 | 
				
			||||||
$galleryDir = $GALLERY_DIR;
 | 
					 | 
				
			||||||
$serverPath = $GALLERY_SERVER_PATH;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$unamefile = __DIR__ . '/usernames.txt';
 | 
				
			||||||
 | 
					$relativePath = "/bilder/pvv-photos/";
 | 
				
			||||||
$allowedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp'];
 | 
					$allowedExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp'];
 | 
				
			||||||
$unamefile = $galleryDir . "/usernames.txt";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
$unamepairs = file($unamefile);
 | 
					$unamepairs = file($unamefile);
 | 
				
			||||||
 | 
					$fullPath = getcwd() . $relativePath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getDirContents($dir, &$results = array()) {
 | 
					function getDirContents($dir, &$results = array()) {
 | 
				
			||||||
    $files = scandir($dir);
 | 
					    $files = scandir($dir);
 | 
				
			||||||
    foreach ($files as $key => $value) {
 | 
					    foreach ($files as $key => $value) {
 | 
				
			||||||
        $path = realpath($dir . DIRECTORY_SEPARATOR . $value);
 | 
					        $path = realpath($dir . DIRECTORY_SEPARATOR . $value);
 | 
				
			||||||
        if (!is_dir($path)) {
 | 
					        if (!is_dir($path)) {
 | 
				
			||||||
            //Remove the full path on disk, keep username and relative path to image.
 | 
					            //Remove the full path on disk, keep username and relative path to image. ( $results[] = str_replace($GLOBALS["fullPath"], "", $path); is insecure.)
 | 
				
			||||||
            $pos = strpos($path, $GLOBALS["galleryDir"]);
 | 
					            $pos = strpos($path, $GLOBALS["fullPath"]);
 | 
				
			||||||
            if ($pos !== false) {
 | 
					            if ($pos !== false) {
 | 
				
			||||||
                $cleanPath = substr_replace($path, "", $pos, strlen($GLOBALS["galleryDir"]));
 | 
					                $cleanPath = substr_replace($path, "", $pos, strlen($GLOBALS["fullPath"]));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //Check if the file is an image
 | 
					            //Check if the file is an image
 | 
				
			||||||
@@ -43,30 +42,19 @@ function getDirContents($dir, &$results = array()) {
 | 
				
			|||||||
            if (in_array($ext, $GLOBALS["allowedExtensions"])) {
 | 
					            if (in_array($ext, $GLOBALS["allowedExtensions"])) {
 | 
				
			||||||
                $results[] = $cleanPath;
 | 
					                $results[] = $cleanPath;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else if ($value != "." && $value != ".." && $value != ".thumbnails") {
 | 
					        } else if ($value != "." && $value != "..") {
 | 
				
			||||||
            //recursively scan directories
 | 
					            //recursively scan directories
 | 
				
			||||||
            getDirContents($path, $results);
 | 
					            getDirContents($path, $results);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return $results;
 | 
					    return $results;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
$images = getDirContents($galleryDir);
 | 
					$images = getDirContents($fullPath);
 | 
				
			||||||
 | 
					 | 
				
			||||||
function cmpModifyTime($a, $b) {
 | 
					 | 
				
			||||||
	global $galleryDir;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $mtime_a = filemtime($galleryDir . $a);
 | 
					 | 
				
			||||||
        $mtime_b = filemtime($galleryDir . $b);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return ($mtime_a > $mtime_b) ? -1 : 1;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
usort($images, "cmpModifyTime");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
$imageTemplate = '
 | 
					$imageTemplate = '
 | 
				
			||||||
<div class="card">
 | 
					<div class="card">
 | 
				
			||||||
    <div class="card-image-div">
 | 
					    <div class="card-image-div">
 | 
				
			||||||
        <img src="%thumbnail" data-fullsrc="%path" alt="%name" class="card-image modal-target">
 | 
					        <img src="%path" alt="%name" class="card-image modal-target">
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div class="card-body">
 | 
					    <div class="card-body">
 | 
				
			||||||
        <p class="card-title">%realname</p>
 | 
					        <p class="card-title">%realname</p>
 | 
				
			||||||
@@ -101,9 +89,9 @@ $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($fullPath . $value));
 | 
				
			||||||
            $imguser = explode("/", $value)[1];
 | 
					            $imguser = explode("/", $value)[0];
 | 
				
			||||||
            $displaypath = implode("/", array_slice(explode("/", $value), 2));
 | 
					            $displaypath = substr($value, strpos($value, "/")+1);
 | 
				
			||||||
            $realname = "Ukjent";
 | 
					            $realname = "Ukjent";
 | 
				
			||||||
            foreach ($unamepairs as $unamepair) {
 | 
					            foreach ($unamepairs as $unamepair) {
 | 
				
			||||||
                $unamepair = explode(":", $unamepair);
 | 
					                $unamepair = explode(":", $unamepair);
 | 
				
			||||||
@@ -116,9 +104,9 @@ $imageTemplate = '
 | 
				
			|||||||
            $vars = [
 | 
					            $vars = [
 | 
				
			||||||
                "%user"         =>  htmlspecialchars($imguser),
 | 
					                "%user"         =>  htmlspecialchars($imguser),
 | 
				
			||||||
                "%time"         =>  $modTime,
 | 
					                "%time"         =>  $modTime,
 | 
				
			||||||
 | 
					                "%timestamp"    =>  filemtime($fullPath . $value),
 | 
				
			||||||
                "%name"         =>  htmlspecialchars($displaypath),
 | 
					                "%name"         =>  htmlspecialchars($displaypath),
 | 
				
			||||||
                "%path"         =>  $serverPath . $value,
 | 
					                "%path"         =>  "/galleri/" . $relativePath .$value,
 | 
				
			||||||
		"%thumbnail"    =>  $serverPath . "/.thumbnails" . $value . ".png",
 | 
					 | 
				
			||||||
                "%realname"     =>  htmlspecialchars($realname)
 | 
					                "%realname"     =>  htmlspecialchars($realname)
 | 
				
			||||||
            ];
 | 
					            ];
 | 
				
			||||||
            echo strtr($imageTemplate, $vars);
 | 
					            echo strtr($imageTemplate, $vars);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,23 +1,20 @@
 | 
				
			|||||||
<?php 
 | 
					<?php 
 | 
				
			||||||
 | 
					//Short path to search folder, full to display in <img>
 | 
				
			||||||
require __DIR__ . '/../../config.php';
 | 
					$relativePath = "/bilder/slideshow/";
 | 
				
			||||||
 | 
					$absolutePath = "/galleri" . $relativePath;
 | 
				
			||||||
$searchDir = $SLIDESHOW_DIR;
 | 
					//Path to first image in slideshow and fallback image if no others are present
 | 
				
			||||||
$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
 | 
					$filenames = sCaNdIr(__DIR__ . $relativePath);
 | 
				
			||||||
$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, [".gitkeep", ".", ".."])) {
 | 
				
			||||||
        unset($filenames[$k]);
 | 
					        unset($filenames[$k]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getFullPath($fname) { return ($GLOBALS["serverPath"] . "/" . $fname );	}
 | 
					function getFullPath($fname) { return ($GLOBALS["absolutePath"] . $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);
 | 
				
			||||||
@@ -30,5 +27,4 @@ eChO('<img class="slideshowimg slideshowactive" id="slideshowImage1" src="' . $s
 | 
				
			|||||||
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>"); 
 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
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($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,17 +1,22 @@
 | 
				
			|||||||
const modal = document.getElementById('modal');
 | 
					// #region Modal
 | 
				
			||||||
const modalImg = document.getElementById("modal-content");
 | 
					var modal = document.getElementById('modal');
 | 
				
			||||||
const captionText = document.getElementById("modal-caption");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// global handler
 | 
				
			||||||
document.addEventListener('click', function (e) { 
 | 
					document.addEventListener('click', function (e) { 
 | 
				
			||||||
    if (e.target.className.indexOf('modal-target') !== -1) {
 | 
					    if (e.target.className.indexOf('modal-target') !== -1) {
 | 
				
			||||||
        // Open modal
 | 
					        var img = e.target;
 | 
				
			||||||
        const img = e.target;
 | 
					        var modalImg = document.getElementById("modal-content");
 | 
				
			||||||
 | 
					        var captionText = document.getElementById("modal-caption");
 | 
				
			||||||
        modal.style.display = "block";
 | 
					        modal.style.display = "block";
 | 
				
			||||||
        modalImg.src = img.dataset.fullsrc;
 | 
					        modalImg.src = img.src;
 | 
				
			||||||
        captionText.innerHTML = img.alt;
 | 
					        captionText.innerHTML = img.alt;
 | 
				
			||||||
    } else if (modal.style.display != "none") {
 | 
					    } else if (modal.style.display != "none") {
 | 
				
			||||||
        // Close modal
 | 
					 | 
				
			||||||
        modal.style.display = "none";
 | 
					        modal.style.display = "none";
 | 
				
			||||||
        modalImg.src = "";
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					// #endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #region sorting
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// #endregion
 | 
				
			||||||
@@ -21,7 +21,7 @@ function stepSlideshow(imgs) {
 | 
				
			|||||||
        //Change source to next picture after it is faded out
 | 
					        //Change source to next picture after it is faded out
 | 
				
			||||||
        slideshowIndex = (slideshowIndex + 1) % imgs.length; 
 | 
					        slideshowIndex = (slideshowIndex + 1) % imgs.length; 
 | 
				
			||||||
        ssi2.src = slideshowFnames[slideshowIndex];
 | 
					        ssi2.src = slideshowFnames[slideshowIndex];
 | 
				
			||||||
    }, 1000);
 | 
					    }, 800);  
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Initialize slideshow, start interval
 | 
					//Initialize slideshow, start interval
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										35
									
								
								www/mail/index.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								www/mail/index.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					<?php 
 | 
				
			||||||
 | 
					require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					<html lang="no">
 | 
				
			||||||
 | 
					<style>
 | 
				
			||||||
 | 
					p {hyphens: auto;}
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
 | 
					<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 | 
				
			||||||
 | 
					<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
 | 
				
			||||||
 | 
					<link rel="shortcut icon" href="favicon.ico">
 | 
				
			||||||
 | 
					<link rel="stylesheet" href="../css/normalize.css">
 | 
				
			||||||
 | 
					<link rel="stylesheet" href="../css/style.css">
 | 
				
			||||||
 | 
					<link rel="stylesheet" href="../css/mail.css">
 | 
				
			||||||
 | 
					<meta name="theme-color" content="#024" />
 | 
				
			||||||
 | 
					<title>Mailverkstedet</title>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<header>Mail­verk­stedet</header>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<main>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<ul id="webmail">
 | 
				
			||||||
 | 
						<li id="afterlogic"><div><a href="https://webmail.pvv.ntnu.no/afterlogic_lite/"><span class="mailname" style="user-select: none"> </span></a>
 | 
				
			||||||
 | 
						<li id="rainloop"><div><a href="https://webmail.pvv.ntnu.no/rainloop/"><span class="mailname">RainLoop</span></a>
 | 
				
			||||||
 | 
						<li id="squirrelmail"><div><a href="https://webmail.pvv.ntnu.no/squirrelmail/"><span class="mailname">SquirrelMail</span></a>
 | 
				
			||||||
 | 
						<li id="roundcube"><div><a href="https://webmail.pvv.ntnu.no/roundcube/"><span class="mailname">Roundcube</span></a>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</main>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<nav>
 | 
				
			||||||
 | 
						<?= navbar(1, "mail"); ?>
 | 
				
			||||||
 | 
						<?= loginbar($sp, $pdo); ?>
 | 
				
			||||||
 | 
					</nav>
 | 
				
			||||||
@@ -66,7 +66,7 @@ p {hyphens: auto;}
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	<p>PVV har også en del brettspill du kan prøve.
 | 
						<p>PVV har også en del brettspill du kan prøve.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	<p><a href="https://wiki.pvv.ntnu.no/wiki/Dokumentasjon">Her</a> er en oversikt over hva du kan gjøre når du har fått PVV bruker.
 | 
						<p><a href="../pvv/Dokumentasjon">Her</a> er en oversikt over hva du kan gjøre når du har fått PVV bruker.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</article>
 | 
					</article>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,25 @@ session_start();
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
$attrs = $as->getAttributes();
 | 
					$attrs = $as->getAttributes();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$oauth2 = new Kasperrt\Oauth2($dataportenConfig);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (isset($_GET['logout'])) {
 | 
				
			||||||
 | 
						session_destroy();
 | 
				
			||||||
 | 
						header('Location: ' . $dataportenConfig["redirect_uri"]);
 | 
				
			||||||
 | 
						die();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					if (isset($_GET['login'])) {
 | 
				
			||||||
 | 
						$oauth2 -> redirect();
 | 
				
			||||||
 | 
						die();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					if (isset($_GET['code'])) {
 | 
				
			||||||
 | 
						$token = $oauth2 -> get_access_token(htmlspecialchars($_GET['state']), htmlspecialchars($_GET['code']));
 | 
				
			||||||
 | 
						$_SESSION['userdata'] = $oauth2 -> get_identity($token, 'https://auth.dataporten.no/userinfo');
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						header('Location: ' . $dataportenConfig["redirect_uri"]);
 | 
				
			||||||
 | 
						die();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
<html lang="no">
 | 
					<html lang="no">
 | 
				
			||||||
@@ -31,7 +50,7 @@ $attrs = $as->getAttributes();
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		<p>
 | 
							<p>
 | 
				
			||||||
			Første steg for å bli medlem i PVV er å betale
 | 
								Første steg for å bli medlem i PVV er å betale
 | 
				
			||||||
			<a href="https://wiki.pvv.ntnu.no/wiki/Medlemskontingent">medlemskontingent</a> på 50kr per år.
 | 
								<a href="../pvv/Medlemskontingent">medlemskontingent</a> på 50kr per år.
 | 
				
			||||||
			Disse pengene brukes for å drifte PVV. Se lenken for kontonummeret.
 | 
								Disse pengene brukes for å drifte PVV. Se lenken for kontonummeret.
 | 
				
			||||||
		</p>
 | 
							</p>
 | 
				
			||||||
		<p>
 | 
							<p>
 | 
				
			||||||
@@ -42,7 +61,7 @@ $attrs = $as->getAttributes();
 | 
				
			|||||||
			å man møte opp på lokalene slik at man får satt passord.
 | 
								å man møte opp på lokalene slik at man får satt passord.
 | 
				
			||||||
		</p>
 | 
							</p>
 | 
				
			||||||
		<p>
 | 
							<p>
 | 
				
			||||||
			Mer informasjon om medlemskap finner du <a href="https://wiki.pvv.ntnu.no/wiki/Medlem">her</a>.
 | 
								Mer informasjon om medlemskap finner du <a href="../pvv/Medlem">her</a>.
 | 
				
			||||||
		</p>
 | 
							</p>
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		<h2>Registrer deg som bruker</h2>
 | 
							<h2>Registrer deg som bruker</h2>
 | 
				
			||||||
@@ -51,7 +70,7 @@ $attrs = $as->getAttributes();
 | 
				
			|||||||
			PVV har for øyeblikket et manuelt system for å legge til nye brukere.
 | 
								PVV har for øyeblikket et manuelt system for å legge til nye brukere.
 | 
				
			||||||
			Se lenkene over for mer informasjon.
 | 
								Se lenkene over for mer informasjon.
 | 
				
			||||||
			Vi foretrekker at du kommer inn på besøk på <a href="https://link.mazemap.com/aKDz8eu8">våre lokaler i Oppredning/Gruvedrift, rom 247</a>
 | 
								Vi foretrekker at du kommer inn på besøk på <a href="https://link.mazemap.com/aKDz8eu8">våre lokaler i Oppredning/Gruvedrift, rom 247</a>
 | 
				
			||||||
			for å sette sette opp din PVV bruker. Hvis du ikke har mulighet til det, kan du <a href="https://wiki.pvv.ntnu.no/wiki/Kontaktinformasjon">finne oss her</a> og sende en epost.
 | 
								for å sette sette opp din PVV bruker. Hvis du ikke har mulighet til det, kan du <a href="../pvv/Kontaktinformasjon">finne oss her</a> og sende en epost.
 | 
				
			||||||
			For å aktivere din brukerkonto på PVV, må du alikevell møte opp på
 | 
								For å aktivere din brukerkonto på PVV, må du alikevell møte opp på
 | 
				
			||||||
			lokalene våre slik at vi kan få satt ditt passord.
 | 
								lokalene våre slik at vi kan få satt ditt passord.
 | 
				
			||||||
		</p>
 | 
							</p>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,14 +3,14 @@ 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__ . '/../../sql_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($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ if(isset($_GET['id'])){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,14 +3,14 @@ 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__ . '/../../sql_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($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,8 +2,8 @@
 | 
				
			|||||||
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__ . '/../../sql_config.php';
 | 
				
			||||||
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
 | 
					$pdo = new \PDO($dbDsn, $dbUser, $dbPass);
 | 
				
			||||||
$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']) or !isset($_POST['desc']) or !isset($_POST['active'])){
 | 
				
			||||||
@@ -12,7 +12,7 @@ if(!isset($_POST['title']) or !isset($_POST['desc']) or !isset($_POST['active'])
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 26 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								www/tjenester/img/gogs.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								www/tjenester/img/gogs.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 40 KiB  | 
@@ -27,15 +27,6 @@ require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc'
 | 
				
			|||||||
            <div class="categoryLabel">Versjonskontroll og utvikling</div>
 | 
					            <div class="categoryLabel">Versjonskontroll og utvikling</div>
 | 
				
			||||||
            <div class="categoryContent">
 | 
					            <div class="categoryContent">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              <div class="service">
 | 
					 | 
				
			||||||
                <div class="serviceContent">
 | 
					 | 
				
			||||||
                  <h2 class="serviceTitle">Gitea</h2>
 | 
					 | 
				
			||||||
                  <p class="serviceDescription">Vår interne git-tjener, åpen for alle medlemmer</p>
 | 
					 | 
				
			||||||
                  <div class="serviceLink"><a href="https://git.pvv.ntnu.no" target="_blank">Gå til git.pvv.ntnu.no</a></div>
 | 
					 | 
				
			||||||
                </div>
 | 
					 | 
				
			||||||
                <img class="serviceImage" src="img/gitea.png" alt="Gitea-logo">
 | 
					 | 
				
			||||||
              </div>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
              <div class="service">
 | 
					              <div class="service">
 | 
				
			||||||
                <div class="serviceContent">
 | 
					                <div class="serviceContent">
 | 
				
			||||||
                  <h2 class="serviceTitle">GitHub</h2>
 | 
					                  <h2 class="serviceTitle">GitHub</h2>
 | 
				
			||||||
@@ -45,6 +36,24 @@ require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc'
 | 
				
			|||||||
                <img class="serviceImage" src="img/github.png" alt="GitHub-logo">
 | 
					                <img class="serviceImage" src="img/github.png" alt="GitHub-logo">
 | 
				
			||||||
              </div>
 | 
					              </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					              <div class="service">
 | 
				
			||||||
 | 
					                <div class="serviceContent">
 | 
				
			||||||
 | 
					                  <h2 class="serviceTitle">Gogs</h2>
 | 
				
			||||||
 | 
					                  <p class="serviceDescription">Vår interne git-tjener, åpen for alle medlemmer</p>
 | 
				
			||||||
 | 
					                  <div class="serviceLink"><a href="https://git.pvv.ntnu.no" target="_blank">Gå til git.pvv.ntnu.no</a></div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <img class="serviceImage" src="img/gogs.png" alt="Gogs-logo">
 | 
				
			||||||
 | 
					              </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					              <div class="service">
 | 
				
			||||||
 | 
					                <div class="serviceContent">
 | 
				
			||||||
 | 
					                  <h2 class="serviceTitle">Dev og Trac</h2>
 | 
				
			||||||
 | 
					                  <p class="serviceDescription">Trac er vårt gamle prosjektsystem. Her kan du lage og dele prosjekter om du er for hipster for github.</p>
 | 
				
			||||||
 | 
					                  <div class="serviceLink"><a href="https://dev.pvv.ntnu.no/projects/pvv-dev/" target="_blank">Gå til dev.pvv.ntnu.no</a></div>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <img class="serviceImage" src="img/trac.png" alt="Trac-logo">
 | 
				
			||||||
 | 
					              </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -83,7 +92,7 @@ require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc'
 | 
				
			|||||||
                    <a href="https://www.pvv.ntnu.no/mail/" target="_blank">Gå til Webmail</a>
 | 
					                    <a href="https://www.pvv.ntnu.no/mail/" target="_blank">Gå til Webmail</a>
 | 
				
			||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
                  <div class="serviceLink">
 | 
					                  <div class="serviceLink">
 | 
				
			||||||
                    <a href="https://wiki.pvv.ntnu.no/wiki/Drift/Mail/IMAP_POP3" target="_blank">IMAP/POP/SMTP-innstillinger</a>
 | 
					                    <a href="https://www.pvv.ntnu.no/pvv/Drift/Mail/IMAP_POP3/" target="_blank">IMAP/POP/SMTP-innstillinger</a>
 | 
				
			||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                <img class="serviceImage" src="img/email.png" alt="Epost-ikon">
 | 
					                <img class="serviceImage" src="img/email.png" alt="Epost-ikon">
 | 
				
			||||||
@@ -110,7 +119,7 @@ require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc'
 | 
				
			|||||||
                <div class="serviceContent">
 | 
					                <div class="serviceContent">
 | 
				
			||||||
                  <h2 class="serviceTitle">Brukernettsider</h2>
 | 
					                  <h2 class="serviceTitle">Brukernettsider</h2>
 | 
				
			||||||
                  <p class="serviceDescription">Alle brukere får automatisk en egen side for html og php. Denne er offentlig på pvv.ntnu.no/~brukernavn.</p>
 | 
					                  <p class="serviceDescription">Alle brukere får automatisk en egen side for html og php. Denne er offentlig på pvv.ntnu.no/~brukernavn.</p>
 | 
				
			||||||
                  <div class="serviceLink"><a href="https://wiki.pvv.ntnu.no/wiki/Hjemmesider" target="_blank">Gå til dokumentasjon på wiki</a></div>
 | 
					                  <div class="serviceLink"><a href="https://www.pvv.ntnu.no/pvv/Hjemmesider" target="_blank">Gå til dokumentasjon på wiki</a></div>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                <img class="serviceImage" src="img/php.png" alt="En elephpant">
 | 
					                <img class="serviceImage" src="img/php.png" alt="En elephpant">
 | 
				
			||||||
              </div>
 | 
					              </div>
 | 
				
			||||||
@@ -183,7 +192,7 @@ require_once dirname(dirname(__DIR__)) . implode(DIRECTORY_SEPARATOR, ['', 'inc'
 | 
				
			|||||||
                    <a href="https://www.pvv.ntnu.no/galleri/" target="_blank">Se galleriet</a>
 | 
					                    <a href="https://www.pvv.ntnu.no/galleri/" target="_blank">Se galleriet</a>
 | 
				
			||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
                  <div class="serviceLink">
 | 
					                  <div class="serviceLink">
 | 
				
			||||||
                    <a href="https://wiki.pvv.ntnu.no/wiki/Bildedeling" target="_blank">Opplasting</a>
 | 
					                    <a href="https://www.pvv.ntnu.no/pvv/Bildedeling" target="_blank">Opplasting</a>
 | 
				
			||||||
                  </div>
 | 
					                  </div>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                <img class="serviceImage" src="img/gallery.png" alt="RSS-Ikon">
 | 
					                <img class="serviceImage" src="img/gallery.png" alt="RSS-Ikon">
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user