main
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* PiStar-Keeper logbook download.
|
||||
*
|
||||
* Sends /var/pistar-keeper/pistar-keeper.log as a binary download.
|
||||
* Linked from /admin/admin.php's PiStar-Keeper Logbook panel
|
||||
* (which only renders if pistar-keeper is running).
|
||||
*
|
||||
* NOTE for the security pass: no setSecurityHeaders() call, no auth
|
||||
* check, no PHP_SELF guard. Coverage gap.
|
||||
*/
|
||||
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/config/security_headers.php');
|
||||
setSecurityHeaders();
|
||||
|
||||
$file = '/var/pistar-keeper/pistar-keeper.log';
|
||||
|
||||
if (file_exists($file)) {
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="'.basename($file). '"');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize($file));
|
||||
flush();
|
||||
readfile($file);
|
||||
exit;
|
||||
}
|
||||
Reference in New Issue
Block a user