diff --git a/download.php b/download.php index 644d733..0fcaf91 100644 --- a/download.php +++ b/download.php @@ -72,15 +72,15 @@ function get_mime_type($filename) { if (isset($_POST['ext'])) { $ext = $_POST['ext']; } if (isset($_POST['name'])) { $name = $_POST['name']; } - if (isset($_POST['file'])) { - $file = str_replace('..', '', isset($_POST['file'])?$_POST['file']:''); - $filename = basename($name); + if (isset($_POST['file'])) { + $file = sys_get_temp_dir() . '/' . basename($_POST['file']); + $filename = htmlspecialchars(basename($name)); if ($ext != 'plain') $filename .= '.' . $ext; if(!is_file($file)) - exit(); + exit('File not found'); header('Pragma: public'); header('Expires: 0'); @@ -96,12 +96,15 @@ function get_mime_type($filename) { } else { header('Last-Modified: ' . gmdate ('D, d M Y H:i:s', filemtime ($file)).' GMT'); header('Cache-Control: private', false); - if ($ext == "plain") { + + if ($ext == 'plain') { $mime = get_mime_type($filename); + header('Content-Type: ' . $mime); } else { header('Content-Type: application/zip'); } + header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($file)); header('Content-Disposition: attachment; filename=" ' . $filename . '"'); @@ -110,8 +113,6 @@ function get_mime_type($filename) { readfile($file); unlink($file); - - } else { header('Location: index.php'); } diff --git a/exchange.php b/exchange.php index 6661fce..a2a1916 100644 --- a/exchange.php +++ b/exchange.php @@ -10,8 +10,8 @@ exit('Please modify the configuration file first and configure the Veeam Backup for Microsoft Office 365 host, port and RESTful API version settings.'); } -if (!preg_match('/v[3-4]/', $version)) { - exit('Invalid API version found. Please modify the configuration file and configure the Veeam Backup for Microsoft Office 365 RESTful API version setting. Only version 3 and 4 are supported.'); +if (!preg_match('/v[3-5]/', $version)) { + exit('Invalid API version found. Please modify the configuration file and configure the Veeam Backup for Microsoft Office 365 RESTful API version setting. Only version 3, 4 and 5 are supported.'); } ?> @@ -21,7 +21,7 @@
The provided username or password is incorrect.
'; + if ($login == 0) { + echo '