|
1 | 1 | <?php |
2 | 2 | session_start(); |
3 | 3 |
|
4 | | -require_once('lib/config.php'); |
5 | | -require_once('lib/db.php'); |
6 | | -require_once('lib/filter.php'); |
7 | | - |
8 | | -if ($config['database']['enabled']) { |
9 | | - $images = getImagesFromDB(); |
10 | | -} else { |
11 | | - $images = getImagesFromDirectory($config['foldersAbs']['images']); |
| 4 | +require_once 'lib/config.php'; |
| 5 | +if ($config['live_keying']['enabled']) { |
| 6 | + header('location: livechroma.php'); |
12 | 7 | } |
13 | 8 |
|
14 | | -$imagelist = ($config['gallery']['newest_first'] === true) ? array_reverse($images) : $images; |
15 | | - |
16 | | -if ($config['ui']['style'] === 'modern') { |
17 | | - $btnClass1 = 'round-btn'; |
18 | | - $btnClass2 = 'round-btn'; |
19 | | - $galleryIcon = 'fa-picture-o'; |
| 9 | +// Login / Authentication check |
| 10 | +if ( |
| 11 | + !$config['login']['enabled'] || |
| 12 | + (!$config['protect']['localhost_index'] && $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR']) || |
| 13 | + ((isset($_SESSION['auth']) && $_SESSION['auth'] === true) || !$config['protect']['index']) |
| 14 | +) { |
| 15 | + require_once 'lib/db.php'; |
| 16 | + require_once 'lib/filter.php'; |
| 17 | + |
| 18 | + if ($config['database']['enabled']) { |
| 19 | + $images = getImagesFromDB(); |
| 20 | + } else { |
| 21 | + $images = getImagesFromDirectory($config['foldersAbs']['images']); |
| 22 | + } |
| 23 | + |
| 24 | + $imagelist = $config['gallery']['newest_first'] === true ? array_reverse($images) : $images; |
| 25 | + |
| 26 | + if ($config['ui']['style'] === 'modern') { |
| 27 | + $btnClass1 = 'round-btn'; |
| 28 | + $btnClass2 = 'round-btn'; |
| 29 | + $galleryIcon = 'fa-picture-o'; |
| 30 | + } else { |
| 31 | + $btnClass1 = 'btn'; |
| 32 | + $btnClass2 = ''; |
| 33 | + $galleryIcon = 'fa-th'; |
| 34 | + } |
20 | 35 | } else { |
21 | | - $btnClass1 = 'btn'; |
22 | | - $btnClass2 = ''; |
23 | | - $galleryIcon = 'fa-th'; |
| 36 | + header('location: login'); |
| 37 | + exit(); |
24 | 38 | } |
25 | | - |
26 | | -if ($config['live_keying']['enabled']): |
27 | | -header("location: livechroma.php"); |
28 | | -endif; |
29 | 39 | ?> |
30 | 40 | <!DOCTYPE html> |
31 | 41 | <html> |
|
65 | 75 | <video id="video--preview" autoplay playsinline></video> |
66 | 76 | <body class="deselect"> |
67 | 77 | <div id="wrapper"> |
68 | | - <?php if( !$config['login']['enabled'] || !$config['protect']['localhost_index'] && $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR'] || (isset($_SESSION['auth']) && $_SESSION['auth'] === true || !$config['protect']['index'])): ?> |
69 | | - |
70 | 78 | <?php include('template/' . $config['ui']['style'] . '.template.php'); ?> |
71 | 79 |
|
72 | 80 | <!-- image Filter Pane --> |
|
184 | 192 | <div style="position:absolute; bottom:0; right:0;"> |
185 | 193 | <img src="resources/img/spacer.png" alt="adminsettings" ondblclick="adminsettings()" /> |
186 | 194 | </div> |
187 | | - <?php else: |
188 | | - header("location: login"); |
189 | | - exit; |
190 | | - endif; ?> |
191 | 195 | </div> |
192 | 196 |
|
193 | 197 | <script src="node_modules/whatwg-fetch/dist/fetch.umd.js"></script> |
|
0 commit comments