-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
54 lines (46 loc) · 1.42 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
<?php
include 'include/context.php';
$files = array_diff(scandir($storage), array('.', '..'));
foreach ($files as $file) {
$date = intval(substr($file, 0, -5));
$dates[$date] = filemtime($storage . $file);
$photos[$date] = $file;
}
if (isset($_GET['p']) and abs($_GET['p'])) {
$page = abs($_GET['p']);
} else {
$page = 1;
}
$limit = 10;
$offset = $limit * ($page - 1);
$count = count($photos);
$pages = ceil($count / $limit);
krsort($photos);
arsort($dates);
$lastDate = reset($dates);
$lastFile = key($dates);
$photos = array_slice($photos, $offset, $limit, true);
?>
<? include 'include/header.php'; ?>
<? include 'include/menu.php'; ?>
<div class="photos">
<div class="center">
<? foreach ($photos as $key => $photo): ?>
<div class="photo">
<div class="meta">
<a><?= date('l', $key) ?></a>
<span>⁄</span>
<b><?= date('M j, Y', $key) ?></b>
<span>⁄</span>
<? if($auth): ?>
<a href="/delete.php?id=<?= $key ?>">delete</a>
<? else: ?>
<b><?= date('H:m', $key) ?></b>
<? endif; ?>
</div>
<img src="/uploads/<?= $photo ?>" width="320" height="320" />
</div>
<? endforeach; ?>
</div>
</div>
<? include 'include/footer.php'; ?>