login/pass: error messages below page title
[minimedit.git] / upload.inc.php
index 77fa846aebd59057df1dd9c7caf7445d17a3ef0e..22db140cd27351543f12682ab41eae4b74d05348 100644 (file)
@@ -63,6 +63,7 @@ function messagehtml($input)
                '{<([^>\s|]+)[\s|]([^>]+)>}'   => '<a href="$1">$2</a>', # hyperlink
                "/\r\n?/" => "\n",        # unix newlines
                "/  +\n/" => "<br />",    # trailing spaces for hard line break
+               '{^(/data/.*\.jpe?g)\z}m'      => '<img src="/thumb/640x/\1" />', # image reference
                "/^[-*] (.*)$\n?/m"            => '<li>$1</li>',         # list item
                "/^(.+)$\n?/m"                 => "<p>$1</p>\n",         # paragraph
                "{^<p>(<li>.*</li>)(?:</p>\n)?}m" => "<ul>$1</ul>\n",    # list container
@@ -84,9 +85,6 @@ function createcomment($input, &$Issue = NULL)
                $reply['raw'] = $body;
                $reply['message'] = messagehtml($body);
        }
-       if (isset($input['announce'])) {
-               $reply['announced'] = !!$input['announce'];
-       }
        if ($_FILES and !empty($_FILES['image'])) {
                $target = 'data/upload';
                if (!file_exists($target)) {
@@ -107,6 +105,15 @@ function createcomment($input, &$Issue = NULL)
                        }
                }
        }
+       if (!$reply) {
+               throw new Exception("lege inhoud");
+       }
+       if (isset($input['announce'])) {
+               $reply['announced'] = !!$input['announce'];
+       }
+       if (isset($input['page'])) {
+               $reply['page'] = $input['page'];
+       }
 
        if (isset($input['id'])) {
                $newcomment = $input['id'];