classes expanded

This commit is contained in:
mattpass
2020-05-10 15:47:26 +01:00
parent 7ee3032f37
commit 46f1a1c319
2 changed files with 12 additions and 17 deletions

View File

@@ -1,26 +1,17 @@
<?php
include "headers.php";
include "settings.php";
require "icecoder.php";
use ICEcoder\File;
// Establish the real absolute path to the file
$file = realpath($docRoot . $iceRoot . str_replace("|", "/", $_GET['file']));
$filePath = realpath($docRoot . $iceRoot . str_replace("|", "/", $_GET['file']));
// If it doesn't exist, or doesn't start with the $docRoot, stop here
if (false === file_exists($file) || 0 !== strpos(str_replace("\\", "/", $file), $docRoot)) {
if (false === file_exists($filePath) || 0 !== strpos(str_replace("\\", "/", $filePath), $docRoot)) {
die("<script>ICEcoder.message('Sorry, that file doesn\'t appear to exist');</script>");
}
if (true === file_exists($file)) {
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header('Content-Description: File Transfer');
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; filename=' . basename($file));
// header("Content-Transfer-Encoding: binary");
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
if (true === file_exists($filePath)) {
$file = new File();
$file->download($filePath);
exit;
}

View File

@@ -1,7 +1,11 @@
<?php
// Classes
require_once "../classes/_ExtraProcesses.php";
require_once "../classes/Backup.php";
require_once "../classes/File.php";
require_once "../classes/FTP.php";
require_once "../classes/System.php";
require_once "../classes/URL.php";
// Headers & Settings
require_once "headers.php";