-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·165 lines (140 loc) · 5.62 KB
/
index.php
File metadata and controls
executable file
·165 lines (140 loc) · 5.62 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?php
// Include default dependencies
require_once("./php/conf.php");
// Handle session
require_once("php/session.php");
// Create app object
$app = new AppManager();
$app->authenticate(User::getUser());
$app->initiateRouter($validPagesPerUserType, $pageNames);
// Start output buffering to allow for response rewrite
ob_start();
if ($app->pageManager->isNormalRequest) { // Only for initial page load
$app->cssManager->require("reset", "fonts", "transitions", "dialog", "index", "phone");
$app->jsManager->require("ajax", "util", "index", "api", "transitions", "bind", "hunter");
?>
<!DOCTYPE html>
<html lang="cs">
<head>
<script defer src="https://logs.krychlic.com/script.js" id="analytics-src" data-website-id="7a923501-0597-4355-805e-90ed5bcb9005"></script>
<script>
const base_url = "<?= $prefix ?>";
const PUBLIC_KEY = "<?= PUBLIC_KEY ?>";
<?php
Validator::generateJsValues();
?>
<?php
if (SERVICE_WORKER_ENABLED) {
?>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register(base_url + '/serviceworker.js?base_url=<?= urlEncode($prefix) ?>&cacheId=<?= substr($v, 3) ?>&enabled=<?= SERVICE_WORKER_ENABLED ? "true" : "false" ?>');
const channel = new BroadcastChannel("notifications");
channel.addEventListener("message", (event) => {
createModal(event.data.title, event.data.body + '<br><button onclick="fadeTo(\'' + event.data.url + '\')">Otevřít</button>');
});
document.addEventListener("visibilitychange", () => {
navigator.serviceWorker.controller?.postMessage({
hidden: document.hidden,
});
});
}
<?php
}
?>
document.querySelector("#analytics-src").addEventListener("load", () => {
umami.identify('<?=session_id()?>', { name: '<?= escape($app->user?->name ?? "Anonymous") ?>' });
});
</script>
<title><?= $app->pageManager->pageTitle ?></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<link rel="manifest" href="<?= $prefix ?>/assets/manifest.json<?= $v ?>">
<meta name="theme-color" content="<?= COLOR ?>">
<meta name="description" content="<?= DESCRIPTION ?>">
<link rel="icon" href="<?= $prefix ?>/assets/icons/icon.png">
<?php
// Include main modules
$app->cssManager->fetch();
$app->jsManager->fetch();
?>
</head>
<body>
<?php
}
// Enable sort for future modules
$app->cssManager->sort();
$app->jsManager->sort();
$app->jsManager->passToJs(["whitelisted" => $app->authenticated]);
if ($app->pageManager->page == "panel") {
include($app->pageManager->pagePath);
} else {
if ($app->authenticated && $app->user->type != UserType::temp && !($_SESSION["subscription"] ?? null)) {
$app->jsManager->require("notifications");
}
if ($app->authenticated && !($_SESSION["fingerprint"] ?? null)) {
$app->jsManager->require("fingerprint");
}
?>
<header>
<img src="<?= $prefix ?>/assets/icons/icon.png" class="logo">
<?= NAME ?>
<?php
if ($app->authenticated && $app->user->type != UserType::temp) {
?>
<img src="<?= $prefix ?>/assets/images/hamburger.svg" class="hamburger onlyPHONE" id="hamburgerBtn">
<?php
}
?>
</header>
<div class="mainWrapper">
<?php
if ($app->authenticated && $app->user->type != UserType::temp) {
?>
<nav>
<?php
foreach ($app->pageManager->validPages as $pageIndex => $query) {
if ($pageIndex == "panel") continue;
?>
<a href="<?= $prefix ?>/<?= $pageIndex ?>" class="navBtn<?= ($pageIndex == $app->pageManager->page ? " active" : "") ?>">
<?= $pageNames[$pageIndex] ?>
<?php if ($pageIndex == "review" && ($count = Panel::countWaitingPanels()) > 0) { ?> <div class="notification"> <?= $count ?> </div> <?php } ?>
</a>
<?php
}
?>
</nav>
<?php
}
?>
<main <?= ($app->user && $app->user->type != UserType::temp ? "class=\"shrinkForNav\"" : "") ?>>
<?php
include($app->pageManager->pagePath);
?>
</main>
</div>
<footer>
<span>
Upozornění: Z důvodu zabránění spamu logujeme otisk Vašeho zařízení a v případě narušování běhu budeme jednat.
</span>
<span>
V případě problémů/dotazů prosím kontaktujte <a href="mailto:kostkaj@gytool.cz">kostkaj@gytool.cz</a>
</span>
</footer>
<?php
}
if ($app->pageManager->isNormalRequest) {
// Fetch dynamic modules (Initial load)
$app->cssManager->fetch();
$app->jsManager->fetch();
// Finish document
?>
</body>
</html>
<?php
} else {
// Fetch dynamic modules - using js (Hydration load)
$app->cssManager->fetch(false);
$app->jsManager->fetch(false);
}
$app->bind->handleEventHandlers();