Added support for Streamdeck Pedal and updated UI to better fit the Packed UI style
This commit is contained in:
29
pirp/public/expense_file.php
Normal file
29
pirp/public/expense_file.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../src/config.php';
|
||||
require_once __DIR__ . '/../src/auth.php';
|
||||
require_once __DIR__ . '/../src/expense_functions.php';
|
||||
require_login();
|
||||
|
||||
$id = (int)($_GET['id'] ?? 0);
|
||||
$expense = get_expense($id);
|
||||
|
||||
if (!$expense || empty($expense['attachment_path'])) {
|
||||
http_response_code(404);
|
||||
echo 'Datei nicht gefunden.';
|
||||
exit;
|
||||
}
|
||||
|
||||
$fsPath = __DIR__ . '/' . $expense['attachment_path'];
|
||||
|
||||
if (!is_readable($fsPath)) {
|
||||
http_response_code(404);
|
||||
echo 'Datei nicht gefunden.';
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-Type: application/pdf');
|
||||
header('Content-Disposition: inline; filename="Ausgabe-' . $id . '.pdf"');
|
||||
header('Content-Length: ' . filesize($fsPath));
|
||||
readfile($fsPath);
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user