fix preview when no header

fix search or tag with no param
This commit is contained in:
quenousimporte 2024-03-08 16:45:50 +01:00
parent f9a4005d11
commit 5589822afb
1 changed files with 4 additions and 4 deletions

View File

@ -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 '<div><a href=index.php?open=true&param=' . urlencode($name) . '>' . $name .'</a>';
if (isset($_GET['tags']))
if (isset($content) && isset($_GET['tags']))
{
$tags = array();
$hastags = preg_match_all('/tags:(.*)/i', $content, $tags, PREG_SET_ORDER);