mirror of
https://tildegit.org/sbgodin/HtmGem.git
synced 2023-08-25 13:53:12 +02:00
Forces download when using "source" as a style
This commit is contained in:
parent
cdbc9614de
commit
212c503bfb
@ -301,7 +301,14 @@ $page_title = @$matches[1];
|
||||
**/
|
||||
|
||||
if ("source" == $style) {
|
||||
echo $fileContents;
|
||||
$basename = basename($filePath);
|
||||
header("Cache-Control: public");
|
||||
header("Content-Disposition: attachment; filename=$basename");
|
||||
header("Content-Type: text/plain");
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
header('Content-Length: ' . filesize($filePath));
|
||||
readfile($filePath);
|
||||
exit();
|
||||
} elseif ("pre" == $style) {
|
||||
$fileContents = htmlspecialchars($fileContents, ENT_HTML5|ENT_NOQUOTES, "UTF-8", false);
|
||||
echo <<<EOL
|
||||
|
Loading…
x
Reference in New Issue
Block a user