aboutsummaryrefslogtreecommitdiff
path: root/_site/rewrites/assets.php
diff options
context:
space:
mode:
Diffstat (limited to '_site/rewrites/assets.php')
-rw-r--r--_site/rewrites/assets.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/_site/rewrites/assets.php b/_site/rewrites/assets.php
new file mode 100644
index 0000000..bd2baac
--- /dev/null
+++ b/_site/rewrites/assets.php
@@ -0,0 +1,25 @@
+<?php
+
+if (!isset($_GET['i'])) {
+ die();
+}
+
+if (strpos($_GET['i'], ".") !== false && strpos($_GET['i'], "\\") !== false) {
+ die();
+}
+
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/../_posts/assets/" . $_GET['i']) || !is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/assets/" . $_GET['i'])) {
+ die();
+}
+
+$file = $_SERVER['DOCUMENT_ROOT'] . "/../_posts/assets/" . $_GET['i'];
+
+header('Content-Type: ' . mime_content_type($file));
+header('Content-Transfer-Encoding: binary');
+header('Expires: 0');
+header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+header('Pragma: public');
+ob_clean();
+flush();
+readfile($file);
+exit; \ No newline at end of file