-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·436 lines (412 loc) · 16.7 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
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
<?php
use core\Config;
use core\FileViewerApplication;
use core\FileSystem;
use core\Translation;
use core\FileSort;
require_once("./core/autoload.php");
$app = FileViewerApplication::build();
$currentFolder = $app->getCurrentFolder();
$folders = $currentFolder->getFolderChildren();
$files = $currentFolder->getFileChildren();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title><?php echo $app->getName() ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Author" content="Matschieu" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex" />
<link rel="icon" type="image/png" href="<?php echo $app->getFavicon() ?>" />
<!--Bootstrap -->
<link rel="stylesheet" type="text/css" href="./lib/bootstrap-5.2.3-dist/css/bootstrap.min.css" />
<script src="./lib/bootstrap-5.2.3-dist/js/bootstrap.bundle.min.js"></script>
<!-- Glyphicons -->
<!-- Icons list: https://fontawesome.com -->
<link rel="stylesheet" type="text/css" href="./lib/fontawesome-6.6.0/css/fontawesome.min.css" />
<link rel="stylesheet" type="text/css" href="./lib/fontawesome-6.6.0/css/solid.min.css" />
<link rel="stylesheet" type="text/css" href="./lib/fontawesome-6.6.0/css/brands.min.css" />
<!-- Country flags -->
<link rel="stylesheet" type="text/css" href="./lib/flag-icons/flag-icons.min.css">
<!-- Application styles -->
<link rel="stylesheet" type="text/css" href="./styles/default.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?php echo $app->getCustomCss() ?>" media="screen" />
<script src="./js/functions.js"></script>
</head>
<body>
<div id="top" class="sticky-top bg-white">
<!-- HEADER -->
<div id="header">
<?php if ($app->getHeader() != null) include $app->getHeader() ?>
</div>
<!-- MENU -->
<?php if (Config::enableMenu()) { ?>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="<?php echo $app->getRootUrl() ?>" >
<span class="fa-solid fa-house"></span>
<?php echo Translation::get('menu.root') ?>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">>
<ul class="navbar-nav me-auto">
<?php if (Config::enableMenu("foldertree")) { ?>
<li class="nav-item">
<a class="nav-link" href="#" onclick="loadTree();return false;" data-bs-toggle="modal" data-bs-target="#folderTreeModal">
<span class="fa-solid fa-folder-tree"></span>
<?php echo Translation::get('menu.folderTree') ?>
</a>
</li>
<?php } ?>
<?php if (Config::enableMenu("refresh")) { ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $app->getUrl() ?>">
<span class="fa-solid fa-rotate-right"></span>
<?php echo Translation::get('menu.refresh') ?>
</a>
</li>
<?php } ?>
<?php if (Config::enableMenu("back")) { ?>
<li class="nav-item">
<a class="nav-link" href="#" onclick="javascript:window.history.back();">
<span class="fa-solid fa-left-long"></span>
<?php echo Translation::get('menu.back') ?>
</a>
</li>
<?php } ?>
<?php if (Config::enableMenu("next")) { ?>
<li class="nav-item">
<a class="nav-link" href="#" onclick="javascript:window.history.forward();">
<span class="fa-solid fa-right-long"></span>
<?php echo Translation::get('menu.next') ?>
</a>
</li>
<?php } ?>
<?php if (Config::enableMenu("showhidden")) { ?>
<li class="nav-item">
<?php if ($app->getAppContext()->getShowHidden()) { ?>
<a class="nav-link" href="<?php echo $app->getUrlWithShowHidden(false) ?>">
<span class="fa-solid fa-lock"></span>
<?php echo Translation::get('menu.hideHiddenFiles') ?>
</a>
<?php } else {?>
<a class="nav-link" href="<?php echo $app->getUrlWithShowHidden(true) ?>">
<span class="fa-solid fa-lock-open"></span>
<?php echo Translation::get('menu.showHiddenFiles') ?>
</a>
<?php } ?>
</li>
<?php } ?>
<?php if (Config::enableMenu("changeview")) { ?>
<li class="nav-item">
<?php if ($app->getAppContext()->getDisplayList()) { ?>
<a class="nav-link" href="<?php echo $app->getUrlWithDisplayList(false) ?>">
<span class="fa-solid fa-table-cells"></span>
<?php echo Translation::get('menu.gridView') ?>
</a>
<?php } else {?>
<a class="nav-link" href="<?php echo $app->getUrlWithDisplayList(true) ?>">
<span class="fa-solid fa-list"></span>
<?php echo Translation::get('menu.listView') ?>
</a>
<?php } ?>
</li>
<?php } ?>
<?php if (Config::enableMenu("sort")) { ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" class="dropdown-toggle" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa-solid fa-sort"></span>
<?php echo Translation::get('menu.sort') ?>
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDropdown">
<li>
<a class="dropdown-item" href="<?php echo $app->getUrlWithFileSort(FileSort::NameAscending) ?>">
<span class="fa-solid fa-arrow-down-a-z"></span>
<?php echo Translation::get('menu.sort.name.ascending') ?>
<?php if ($app->getAppContext()->getFileSort() === FileSort::NameAscending) { ?>
<span class="fa-solid fa-check"></span>
<?php } ?>
</a>
</li>
<li>
<a class="dropdown-item" href="<?php echo $app->getUrlWithFileSort(FileSort::NameDescending) ?>">
<span class="fa-solid fa-arrow-down-z-a"></span>
<?php echo Translation::get('menu.sort.name.descending') ?>
<?php if ($app->getAppContext()->getFileSort() === FileSort::NameDescending) { ?>
<span class="fa-solid fa-check"></span>
<?php } ?>
</a>
</li>
</ul>
</li>
<?php } ?>
</ul>
<ul class="navbar-nav ms-auto">
<?php if (Config::enableMenu("filter")) { ?>
<form class="d-flex" onreset="javascript:resetField('filterfield'); return false;">
<input id="filterfield" class="form-control me-2" type="search" placeholder="<?php echo Translation::get('menu.filter') ?>" aria-label="<?php echo Translation::get('menu.filter') ?>" onkeyup="javascript:filter(this.value)" />
<button class="btn btn-primary me-4" type="reset">
<?php echo Translation::get('menu.reset') ?>
</button>
</form>
<?php } ?>
<?php if (Config::enableMenu("changelanguage")) { ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" class="dropdown-toggle" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<span class="fa-solid fa-flag"></span>
<?php echo Translation::get('menu.language') ?>
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDropdown">
<li>
<a class="dropdown-item" href="<?php echo $app->getUrlWithLanguage("en") ?>">
<span class="fi fi-gb"></span>
<?php echo Translation::get('menu.english') ?>
<?php if ($app->isSelectedLanguage("en")) { ?>
<span class="fa-solid fa-check"></span>
<?php } ?>
</a>
</li>
<li>
<a class="dropdown-item" href="<?php echo $app->getUrlWithLanguage("fr") ?>">
<span class="fi fi-fr"></span>
<?php echo Translation::get('menu.french') ?>
<?php if ($app->isSelectedLanguage("fr")) { ?>
<span class="fa-solid fa-check"></span>
<?php } ?>
</a>
</li>
<li>
<a class="dropdown-item" href="<?php echo $app->getUrlWithLanguage("de") ?>">
<span class="fi fi-de"></span>
<?php echo Translation::get('menu.german') ?>
<?php if ($app->isSelectedLanguage("de")) { ?>
<span class="fa-solid fa-check"></span>
<?php } ?>
</a>
</li>
</ul>
</li>
<?php } ?>
<?php if (Config::enableMenu("close")) { ?>
<li class="nav-item">
<a class="nav-link" href="#" onclick="javascript:open(location, '_self').close(); return true;">
<span class="fa-solid fa-xmark"></span>
<?php echo Translation::get('menu.close') ?>
</a>
</li>
<?php } ?>
</ul>
</div>
</div>
</nav>
<?php } ?>
<!-- TOP STATE BAR -->
<div id="statebarTop" class="bg-primary p-1 text-white">
<span class="fa-solid fa-folder"></span>
<?php echo Translation::get('statebar.navigation') ?>
<?php echo $currentFolder->getLogicalPath() ?>
</div>
</div>
<!-- FILE EXPLORER CONTENT -->
<div id="content" class="container-fluid py-4 bg-white">
<?php if ($app->getAppContext()->getDisplayList()) { ?>
<!-- LIST VIEW -->
<div id="list">
<table class="table table-striped align-middle">
<thead>
<tr>
<th></th>
<th>
<?php if ($app->getAppContext()->getFileSort() === FileSort::NameAscending) { ?>
<a href="<?php echo $app->getUrlWithFileSort(FileSort::NameDescending) ?>">
<?php echo Translation::get('content.name') ?>
<span class="fa-solid fa-arrow-up"></span>
</a>
<?php } else if ($app->getAppContext()->getFileSort() === FileSort::NameDescending) { ?>
<a href="<?php echo $app->getUrlWithFileSort(FileSort::NameAscending) ?>">
<?php echo Translation::get('content.name') ?>
<span class="fa-solid fa-arrow-down"></span>
</a>
<?php } ?>
</th>
<th><?php echo Translation::get('content.type') ?></th>
<th><?php echo Translation::get('content.size') ?></th>
<th><?php echo Translation::get('content.date') ?></th>
</tr>
</thead>
<!-- FOLDERS -->
<?php foreach ($folders as $folder) { ?>
<tr class="folder text-break">
<td class="text-primary">
<div class="icon">
<span class="<?php echo $folder->getGlyphicon() ?>"></span>
</div>
</td>
<td>
<a href="<?php echo $app->getUrlWithFolder($folder) ?>" title="<?php echo Translation::get('content.openFolder') ?>">
<span class="filename"><?php echo $folder->getDisplayName() ?></span>
<span class="fa-solid fa-right-to-bracket p-2"></span>
</a>
</td>
<td></td>
<td>
<?php echo FileSystem::convertSize($folder->getSize()) ?>
</td>
<td>
<?php echo $folder->getDate() ?>
</td>
</tr>
<?php } ?>
<!--FILES -->
<?php foreach ($files as $file) { ?>
<tr class="file text-break">
<?php if (!$file->isImage()) { ?>
<td class="text-primary">
<div class="icon">
<span class="<?php echo $file->getGlyphicon() ?>"></span>
</div>
</td>
<?php } else { ?>
<td class="preview text-primary">
<img src="<?php echo $file->getUrl() ?>" class="logo img-fluid" />
</td>
<?php } ?>
<td>
<a href="<?php echo $file->getUrl() ?>" download="<?php echo $file->getName() ?>" title="<?php echo Translation::get('content.openFile') ?>">
<span class="filename"><?php echo $file->getName() ?></span>
<span class="fa-solid fa-up-right-from-square p-2"></span>
</a>
</td>
<td>
<div class="badge bg-primary <?php echo $file->getExtension() != null ? $file->getExtension() : "noext" ?>">
<?php echo $file->getExtension() ?>
</div>
</td>
<td>
<?php echo FileSystem::convertSize($file->getSize()) ?>
</td>
<td>
<?php echo $file->getDate() ?>
</td>
</tr>
<?php } ?>
</table>
</div>
<?php } else { ?>
<!-- BLOCK VIEW -->
<div id="list">
<!-- FOLDERS -->
<div class="row">
<?php foreach ($folders as $folder) { ?>
<div class="folder col-md-2">
<div class="row">
<div class="type col-3 text-primary text-center">
<div class="icon">
<span class="<?php echo $folder->getGlyphicon() ?>"></span>
</div>
</div>
<div class="info col-9 text-break">
<a href="<?php echo $app->getUrlWithFolder($folder) ?>" title="<?php echo Translation::get('content.openFolder') ?>">
<span class="filename"><?php echo $folder->getDisplayName() ?></span>
<span class="fa-solid fa-right-to-bracket p-2"></span>
</a><br />
<div><?php echo FileSystem::convertSize($folder->getSize()) ?></div>
<div><?php echo $folder->getDate() ?></div>
</div>
</div>
</div>
<?php } ?>
<!--FILES -->
<?php foreach ($files as $file) { ?>
<div class="file col-md-2">
<div class="row">
<div class="type col-3 text-primary text-center">
<?php if (!$file->isImage()) { ?>
<div class="icon">
<span class="<?php echo $file->getGlyphicon() ?>"></span>
</div>
<?php } else { ?>
<div class="preview">
<img src="<?php echo $file->getUrl() ?>" class="logo img-fluid" />
</div>
<?php } ?>
<div class="badge bg-primary mt-2 <?php echo $file->getExtension() != null ? $file->getExtension() : "noext" ?>">
<?php echo $file->getExtension() ?>
</div>
</div>
<div class="info col-9 text-break">
<a href="<?php echo $file->getUrl() ?>" download="<?php echo $file->getName() ?>" title="<?php echo Translation::get('content.openFile') ?>">
<span class="filename"><?php echo $file->getName() ?></span>
<span class="fa-solid fa-up-right-from-square p-2"></span>
</a><br />
<div><?php echo FileSystem::convertSize($file->getSize()) ?></div>
<div><?php echo $file->getDate() ?></div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
<?php if (count($folders) === 0 && count($files) === 0) { ?>
<!-- EMPTY CONTENT MESSAGE -->
<div id="noContent" class="row mt-3 ps-2 pe-2">
<div class="col-md">
<p class="fs-3">
<span class="fa-solid fa-ghost"></span>
<?php echo Translation::get('content.noContent') ?>
</p>
</div>
</div>
<?php } ?>
<div class="text-end">
<a href="#">
<span class="fa-solid fa-caret-up"></span>
<?php echo Translation::get('content.top') ?>
</a>
</div>
</div>
<div id="bottom" class="sticky-bottom bg-white text-primary">
<!-- BOTTOM STATE BAR -->
<div id="statebarBottom" class="bg-primary p-1 text-white">
<span class="fa-solid fa-chart-simple"></span>
<?php echo $currentFolder->getFolderChildrenCount() ?>
<?php echo Translation::get('statebar.folders') ?>
-
<?php echo $currentFolder->getFileChildrenCount() ?>
<?php echo Translation::get('statebar.files') ?>
-
<?php echo FileSystem::convertSize($currentFolder->getChildrenSize()) ?>
</div>
<!-- FOOTER -->
<div id="footer">
<?php if ($app->getFooter() != null) include $app->getFooter() ?>
</div>
</div>
<!-- Folder tree modal -->
<div class="modal fade" id="folderTreeModal" tabindex="-1" role="dialog" aria-labelledby="folderTreeModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header bg-primary text-white">
<h4 class="modal-title" id="myModalLabel"><?php echo Translation::get('modal.tree.title') ?></h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div id="folderTreeModalContent" class="modal-body" style="max-height: 400px; overflow-y: scroll">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden"><?php echo Translation::get('modal.tree.title') ?></span>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal"><?php echo Translation::get('modal.close') ?></button>
</div>
</div>
</div>
</div>
</body>
</html>
<?php $app->postLoad() ?>