forked from HAWK-Digital-Environments/HAWKI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
64 lines (52 loc) · 1.76 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
define('ROOT_PATH', __DIR__);
define('PRIVATE_PATH', ROOT_PATH . '/private');
define('BOOTSTRAP_PATH', PRIVATE_PATH . '/bootstrap.php');
require_once BOOTSTRAP_PATH;
// Get the requested URI from the query parameter
$request_uri = isset($_GET['url']) ? $_GET['url'] : $_SERVER['REQUEST_URI'] ?? '/';
$request_uri = str_replace('.php', '', $request_uri);
$request_path = parse_url($request_uri, PHP_URL_PATH);
if (file_exists(ENV_FILE_PATH)){
$env = parse_ini_file(ENV_FILE_PATH);
}
switch($request_path){
case('/login'):
include_once LOGIN_PAGE_PATH;
exit();
case('/interface'):
include_once INTERFACE_PAGE_PATH;
exit();
case('/logout'):
include_once LOGOUT_PAGE_PATH;
exit();
case('/oidc_login'):
include_once OIDC_LOGIN_PAGE_PATH;
exit();
case('/impressum'):
$imprintLocation = isset($env) ? $env["IMPRINT_LOCATION"] : getenv("IMPRINT_LOCATION");
header("Location: $imprintLocation");
exit;
case('/dataprotection'):
$dataProtectionLocation = isset($env) ? $env["PRIVACY_LOCATION"] : getenv("PRIVACY_LOCATION");
header("Location: $dataProtectionLocation");
exit;
case('/api/feedback_send'):
if($_SERVER["REQUEST_METHOD"] == "POST"){
include_once( LIBRARY_PATH . "feedback_send.php");
}
exit;
case('/api/submit_vote'):
if($_SERVER["REQUEST_METHOD"] == "POST"){
include_once( LIBRARY_PATH . "submit_vote.php");
}
exit;
case('/api/stream-api'):
if($_SERVER["REQUEST_METHOD"] == "POST"){
include_once( LIBRARY_PATH . "stream-api.php");
}
exit;
default:
header("Location: /login");
exit();
}