Move duplicate code from issue and reply pages.
}
if ($_POST) {
- $html = nl2br(htmlspecialchars($_POST['body']));
- $html = empty($html) ? NULL : "<p>$html</p>";
+ require_once 'upload.inc.php';
$query = $Db->set('issues', [
'page' => $Page,
'subject' => $_POST['subject'],
- 'body' => $html,
+ 'body' => messagehtml($_POST['body']),
'author' => $User->login,
]);
if (!$query->rowCount()) {
}
return $target;
}
+
+function messagehtml($input)
+{
+ # convert user textarea post to formatted html
+ if (empty($input)) {
+ return;
+ }
+ $html = htmlspecialchars($input);
+ $html = nl2br($html);
+ return "<p>$html</p>";
+}
];
if ($_POST) {
+ require_once 'upload.inc.php';
try {
- $html = nl2br(htmlspecialchars($_POST['reply']));
- $html = empty($html) ? NULL : "<p>$html</p>";
$query = $Db->set('comments', [
'page' => $Page,
- 'message' => $html,
+ 'message' => messagehtml($_POST['reply']),
'author' => $User->login,
]);
if (!$query->rowCount()) {