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…
Reference in New Issue