| 12345678910111213141516171819202122 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- namespace App;
- use RuntimeException;
- /**
- * @var string $type
- * @var string $id
- */
- switch($type) {
- case "ticket-comment-attachment":
- $attachment = TicketCommentAttachment::get($id);
- if(!$attachment) {
- throw new RuntimeException(__("Attachment not found."));
- }
- header("Content-Type: $attachment->mime_type");
- readfile($attachment->getPath());
- exit(0);
- }
|