diff options
author | Malf Furious <m@lfurio.us> | 2017-06-04 22:28:09 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2017-06-04 22:28:09 -0400 |
commit | 2376aabe74528b018189982224d61a643325b114 (patch) | |
tree | 3aa16bc3dd40b1a7dd1a1f524d71a6c16055e716 /app/df.php | |
parent | 6b69e5a8f85ebdf92b84e3330bea306d4a90a115 (diff) | |
parent | a8e79321426b1436f46ba5b7c5dee390c94bdb8b (diff) | |
download | scrott-2376aabe74528b018189982224d61a643325b114.tar.gz scrott-2376aabe74528b018189982224d61a643325b114.zip |
Merge branch 'feature/mesgs' into dev
Diffstat (limited to 'app/df.php')
-rw-r--r-- | app/df.php | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -13,6 +13,7 @@ */ require_once "class/user.class.php"; +require_once "class/mesg.class.php"; /* * This file is a proxy script for fetching resources from the /dynmic @@ -31,15 +32,19 @@ require_once "class/user.class.php"; * request. When finished, this function will exit PHP and terminate * this script. */ -function serveResource(string $uri) : void +function serveResource(string $uri, ?string $filename = NULL) : void { $f = fopen($uri, "rb"); if (!$f) exit; - header("Content-type: " . mime_content_type($uri)); - header("Content-length: " . filesize($uri)); + header("Content-Type: " . mime_content_type($uri)); + header("Content-Length: " . filesize($uri)); + + if ($filename) + header("Content-Disposition: attachment; filename=\"" . $filename . "\""); + fpassthru($f); fclose($f); @@ -89,6 +94,11 @@ function main(string $dir, string $guid) : void case "bgs": serveResource("dynmic/bgs/" . $guid); break; + + case "attach": + $mesg = new mesg($guid); + serveResource("dynmic/attach/" . $guid, $mesg->attachment); + break; } } catch (Exception $e) |