mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-21 05:44:07 -07:00
Integrated new api interface.
This commit is contained in:
parent
4a9bfc94ad
commit
4306a4fb4f
116 changed files with 10371 additions and 0 deletions
26
web/api/v1/download/backup/index.php
Normal file
26
web/api/v1/download/backup/index.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
session_start();
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
$backup = basename($_GET['backup']);
|
||||
|
||||
// Check if the backup exists
|
||||
if (!file_exists('/backup/'.$backup)) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Data
|
||||
if ($_SESSION['user'] == 'admin') {
|
||||
header('Content-type: application/gzip');
|
||||
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
|
||||
header("X-Accel-Redirect: /backup/" . $backup);
|
||||
}
|
||||
|
||||
if ((!empty($_SESSION['user'])) && ($_SESSION['user'] != 'admin')) {
|
||||
if (strpos($backup, $user.'.') === 0) {
|
||||
header('Content-type: application/gzip');
|
||||
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
|
||||
header("X-Accel-Redirect: /backup/" . $backup);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue