X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/cc9044a1aa3f79cda743040573d49bc71fb7805f..83209975037c6fadba1fd0555e37e95c17fe6099:/upload.inc.php
diff --git a/upload.inc.php b/upload.inc.php
index 0ee432b..e270b76 100644
--- a/upload.inc.php
+++ b/upload.inc.php
@@ -48,7 +48,7 @@ function messagehtml($input)
if (empty($input)) {
return;
}
- if ($User->admin and preg_match('/\A<[a-z][^>]*>/', $input)) {
+ if ($User and $User->admin and preg_match('/\A<[a-z][^>]*>/', $input)) {
return $input; # allow html input as is if privileged
}
$markup = [
@@ -57,10 +57,13 @@ function messagehtml($input)
'{<([^>\s|]+)[\s|]([^>]+)>}' => '$2', # hyperlink
"/\r\n?/" => "\n", # unix newlines
"/ +\n/" => "
", # trailing spaces for hard line break
- "/\n/" => "
", # newlines start paragraphs + "/^[-*] (.*)$\n?/m" => '
$1
\n", # paragraph + "{^(
$1
', # monospace
];
- $html = preg_replace(array_keys($markup), array_values($markup), htmlspecialchars($input));
- return "$html
"; + return preg_replace(array_keys($markup), array_values($markup), htmlspecialchars($input)); }