Beispiel #1
0
            header("Location: " . $_SERVER['PHP_SELF']);
            exit;
        }
    } else {
        //set response message
        $_SESSION["message"] = $text['message-backup_failed_paths'];
        header("Location: " . $_SERVER['PHP_SELF']);
        exit;
    }
}
//script a backup (cron)
if ($_GET['a'] == "script" && permission_exists('backup_download')) {
    $file_format = $_GET['file_format'];
    $target_type = "script";
    $backup = new backup();
    $command = $backup->command("backup", $file_format);
}
//restore a backup
if ($_POST['a'] == "restore" && permission_exists('backup_upload')) {
    $backup_path = $_SESSION['server']['backup']['path'] != '' ? $_SESSION['server']['backup']['path'] : '/tmp';
    $backup_file = $_FILES['backup_file']['name'];
    if (is_uploaded_file($_FILES['backup_file']['tmp_name'])) {
        //move temp file to backup path
        move_uploaded_file($_FILES['backup_file']['tmp_name'], $backup_path . '/' . $backup_file);
        //determine file format and restore backup
        $file_format = pathinfo($_FILES['backup_file']['name'], PATHINFO_EXTENSION);
        $valid_format = true;
        switch ($file_format) {
            case "rar":
                $cmd = 'rar x -ow -o+ ' . $backup_path . '/' . $backup_file . ' /';
                break;