-
-
Notifications
You must be signed in to change notification settings - Fork 390
Expand file tree
/
Copy pathbackups.blade.php
More file actions
129 lines (114 loc) · 4.24 KB
/
backups.blade.php
File metadata and controls
129 lines (114 loc) · 4.24 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
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
<style>
button {
border-style: none;
background-color: #0085ff;
color: #fff;
border-radius: 5px;
}
button:hover {
background-color: #0065c1;
color: #FFF;
box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.6);
}
.buttondm {
display: inline-block;
text-decoration: none;
height: 48px;
text-align: center;
vertical-align: middle;
font-size: 18px;
width: 300px;
font-weight: 700;
line-height: 48px;
letter-spacing: .1px;
white-space: wrap;
border-radius: 8px;
cursor: pointer
}
.button-hover,
.credit-hover {
display: inline-block;
-webkit-transform: perspective(1px) translateZ(0);
transform: perspective(1px) translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-transition-duration: .3s;
transition-duration: .3s;
-webkit-transition-property: transform;
transition-property: transform
}
.button-hover:active,
.credit-hover:active,
.button-hover:focus,
.credit-hover:focus,
.button-hover:hover,
.credit-hover:hover {
-webkit-transform: scale(1.06);
transform: scale(1.06)
}
.container {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
height: 50%;
width: 100%
}
</style>
<!-- Custom icons font-awesome -->
<script src="{{ asset('assets/external-dependencies/fontawesome.js') }}" crossorigin="anonymous"></script>
@if (file_exists(base_path('backups/updater-backups/')) and is_dir(base_path('backups/updater-backups/')))
@if ($_SERVER['QUERY_STRING'] != '')
<?php
if (isset($_GET['file'])) {
$filename = $_GET['file'];
if (str_contains($filename, '/') || str_contains($filename, '\\') || !preg_match('/^[A-Za-z0-9._-]+$/', $filename)) {
http_response_code(400);
exit('Invalid filename.');
}
$baseDir = base_path('backups/updater-backups');
$filepath = $baseDir . DIRECTORY_SEPARATOR . $filename;
$realBaseDir = realpath($baseDir);
$realPath = realpath($filepath);
if ($realBaseDir === false || $realPath === false || !is_file($realPath)) {
http_response_code(404);
exit('File not found.');
}
if (strpos($realPath, $realBaseDir . DIRECTORY_SEPARATOR) !== 0) {
http_response_code(403);
exit('Access denied.');
}
while (ob_get_level()) {
ob_end_clean();
}
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
header('Content-Length: ' . filesize($realPath));
readfile($realPath);
exit();
}
?>
@endif
<div class="container">
<br><br>
<h3>{{ __('messages.Download your updater backups:') }}</h3>
<hp>{{ __('messages.The server will never store more that two backups at a time') }}</hp><br><br><br>
<?php
$test = 'test';
if ($handle = opendir('backups/updater-backups')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != '.' && $entry != '..') {
$entrys = substr($entry, 17);
echo '<div class="button-entrance"><a class="buttondm button-hover icon-hover" style="color:#ffffff; background-color:#000;" href="' . url('admin/backups') . '?file=' . $entry . '"><i style="color: " class="icon hvr-icon fa fa-download"></i> ';
print_r($entrys);
echo '</a></div><br>';
}
}
} ?>
</div>
@else
<div class="container">
<h3>{{ __('messages.No backups found') }}</h3>
</div>
@endif
<center><a data-toggle="tab" href="#3"><button class="btn btn-primary" style="padding:10px"><i
class="fa-solid fa-floppy-disk"></i> {{ __('messages.Backup your instance') }}</button></a></center>