git.shiar.nl
/
minimedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
edit/page: rename and append editor style options
[minimedit.git]
/
upload.inc.php
diff --git
a/upload.inc.php
b/upload.inc.php
index ed9ee772eccf99f8595f69efd67ee16d57432b1d..6175fe20a685b1b1df707ccba8e74f4bad2564f1 100644
(file)
--- a/
upload.inc.php
+++ b/
upload.inc.php
@@
-41,10
+41,17
@@
function userupload($input, $target = NULL, $filename = NULL)
function messagehtml($input)
{
# convert user textarea post to formatted html
function messagehtml($input)
{
# convert user textarea post to formatted html
+ global $User;
if (empty($input)) {
return;
}
if (empty($input)) {
return;
}
- $html = htmlspecialchars($input);
- $html = nl2br($html);
+ if ($User->admin and preg_match('/\A<[a-z][^>]*>/', $input)) {
+ return $input; # allow html input as is if privileged
+ }
+ $html = preg_replace(
+ ["/\r?\n/", "'(?:<br />\n?){2}'"],
+ ["<br />\n", "</p>\n\n<p>"],
+ htmlspecialchars($input)
+ );
return "<p>$html</p>";
}
return "<p>$html</p>";
}