From 5589822afbb270c9287054540048139601f2ea50 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Fri, 8 Mar 2024 16:45:50 +0100 Subject: [PATCH] fix preview when no header fix search or tag with no param --- index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 8c2ce83..d8286d3 100644 --- a/index.php +++ b/index.php @@ -79,11 +79,11 @@ $pos = 0; if (str_starts_with($content, '---')) { - $pos = strpos($content, '---', 3); + $pos = strpos($content, '---', 3) + 3; } $Parsedown = new Parsedown(); $Parsedown->setBreaksEnabled(true); - echo $Parsedown->text('# ' . $title . "\r\n" . substr($content, $pos + 3)); + echo $Parsedown->text('# ' . $title . "\r\n" . substr($content, $pos)); $nextpage = ''; } else if (isset($_GET['open'])) @@ -165,7 +165,7 @@ $name = basename($path); if (!str_ends_with($name, '.del')) { - if (isset($_GET['search']) || isset($_GET['tags'])) + if ($_GET['param'] && (isset($_GET['search']) || isset($_GET['tags']))) { $content = file_get_contents($path); @@ -176,7 +176,7 @@ } } echo '
' . $name .''; - if (isset($_GET['tags'])) + if (isset($content) && isset($_GET['tags'])) { $tags = array(); $hastags = preg_match_all('/tags:(.*)/i', $content, $tags, PREG_SET_ORDER);