aboutsummaryrefslogtreecommitdiff
path: root/_site/rewrites/assets.php
diff options
context:
space:
mode:
authorMinteck <46352972+Minteck@users.noreply.github.com>2021-06-29 20:00:07 +0200
committerMinteck <46352972+Minteck@users.noreply.github.com>2021-06-29 20:00:07 +0200
commitd2733aa17b7932dfb78e97639e7d568ac41b9ee1 (patch)
tree1e77dbe51e192c42f993e79e53532d3558d36bcb /_site/rewrites/assets.php
parent9f3bd84cb82a7f57a49701018a7fb43eb77c65aa (diff)
downloadunchainedtech-d2733aa17b7932dfb78e97639e7d568ac41b9ee1.tar.gz
unchainedtech-d2733aa17b7932dfb78e97639e7d568ac41b9ee1.tar.bz2
unchainedtech-d2733aa17b7932dfb78e97639e7d568ac41b9ee1.zip
Let's finally commit stuff!
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