-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.php
57 lines (48 loc) · 1.42 KB
/
list.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
<?php
require_once(__DIR__ . '/includes/loader.php');
if (isset($_GET['uuid']) === false || $_GET['uuid'] === '')
{
echo 'No `uuid` provided.';
exit(1);
}
$UUID = $_GET['uuid']; //***** VALIDATE UUID
$database = DBDatabase::lookupDatabaseUUID($UUID);
$backupFiles = getDatabaseBackupFiles($database->uuid);
require_once(__DIR__ . '/templates/header.php');
$tableData = '';
foreach ($backupFiles as $fileInfo)
{
$fileSize = humanReadableBytes($fileInfo['size_bytes']);
$tableData .= <<<HTML
<tr>
<td>{$fileInfo['filename']}</td>
<td>{$fileInfo['modification_time']->format(DATETIME_FORMAT)}</td>
<td>{$fileInfo['change_time']->format(DATETIME_FORMAT)}</td>
<td>{$fileInfo['access_time']->format(DATETIME_FORMAT)}</td>
<td>{$fileSize}</td>
<td><a href="download.php?uuid={$database->uuid}&file-name={$fileInfo['filename']}.{$fileInfo['extension']}">Download</a></td>
</tr>
HTML;
}
$backupCount = count($backupFiles);
echo <<<HTML
<main>
<h2><a href="browse.php" hx-get="browse.php">Database</a> Backups ({$backupCount}): {$database->name}</h2>
<table>
<thead>
<tr>
<th>Database</th>
<th>Modification Time</th>
<th>Change Time</th>
<th>Access Time</th>
<th>Size</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{$tableData}
</tbody>
</table>
</main>
HTML;
require_once(__DIR__ . '/templates/footer.php');