forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
56 lines (52 loc) · 1.45 KB
/
index.php
File metadata and controls
56 lines (52 loc) · 1.45 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
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
$TAB = "BACKUP";
// Main include
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
function getTransByType($type) {
switch ($type) {
case "dir":
echo _("Directory");
break;
case "file":
echo _("File");
break;
case "symlink":
echo _("Symlink");
break;
default:
echo _("Unknown");
}
}
// Data & Render page
if (empty($_GET["snapshot"])) {
exec(HESTIA_CMD . "v-list-user-backups-restic $user json", $output, $return_var);
$data = json_decode(implode("", $output), true);
if (is_array($data)) {
$data = array_reverse($data);
} else {
$data = "";
}
render_page($user, $TAB, "list_backup_incremental");
} else {
if (empty($_GET["browse"])) {
$snapshot = quoteshellarg($_GET["snapshot"]);
exec(HESTIA_CMD . "v-list-user-backup-restic $user $snapshot json", $output, $return_var);
$data = json_decode(implode("", $output), true);
render_page($user, $TAB, "list_backup_detail_incremental");
} else {
if (empty($_GET["folder"])) {
$_GET["folder"] = "/home/" . $user_plain;
}
$folder = quoteshellarg($_GET["folder"]);
$snapshot = quoteshellarg($_GET["snapshot"]);
exec(HESTIA_CMD . "v-list-user-files-restic $user $snapshot $folder", $output, $return_var);
$info = json_decode($output[0], true);
unset($output[0]);
$files = [];
foreach ($output as $value) {
$files[] = json_decode($value, true);
}
render_page($user, $TAB, "list_files_incremental");
}
}