summaryrefslogtreecommitdiff
path: root/expand.php
diff options
context:
space:
mode:
authorJonas Kohl <gitlab@jonaskohl.de>2024-07-19 13:09:00 +0200
committerJonas Kohl <gitlab@jonaskohl.de>2024-07-19 13:09:00 +0200
commit3b9bb27ab9179334fe3c96ae8dbc249061649aff (patch)
treed7c612cbd9f0c3b337e0713c0507a1acae8e90c9 /expand.php
Initial commit
Diffstat (limited to 'expand.php')
-rw-r--r--expand.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/expand.php b/expand.php
new file mode 100644
index 0000000..41d4dc7
--- /dev/null
+++ b/expand.php
@@ -0,0 +1,17 @@
+<?php
+
+define("SRCDIR", realpath(__DIR__ . "/src/"));
+
+$__page = file_get_contents("php://stdin");
+$title = "";
+$__page = preg_replace_callback(';<title>(.*?)</title>;i', function(array $matches) use(&$title): string {
+ $title = $matches[1];
+ return "";
+}, $__page);
+$page = SRCDIR . "/pages/" . bin2hex(random_bytes(8)) . ".tmp";
+file_put_contents($page, $__page);
+unset($__page);
+
+include SRCDIR . "/template.php";
+
+unlink($page);