summaryrefslogtreecommitdiff
path: root/expand.php
blob: 41d4dc7013fc8d9dfa5b0333835f756e3ff30ab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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);