From b50664b861e98948df44472122f63f91b73e0a0a Mon Sep 17 00:00:00 2001 From: 53hornet Date: Wed, 22 Dec 2021 20:09:51 -0500 Subject: feat: automatic manpage links --- index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 14e5da2..3d0a8b3 100644 --- a/index.php +++ b/index.php @@ -5,7 +5,11 @@ $page = strtok(strtok($_SERVER['REQUEST_URI'], '/'), '?'); if (empty($page)) { include('./pages/index.php'); } else if (!empty($page) && $page[0] >= '0' && $page[0] <= '9' && is_readable("./posts/$page.php")) { - include("./posts/$page.php"); + $script = file_get_contents("./posts/$page.php"); + $re = '/([^\(<>\)]*)\(([0-9])\)<\/code>/m'; + $subst = '$1($2)'; + $script = preg_replace($re, $subst, $script); + eval("?>$script