diff --git a/imgboard.php b/imgboard.php index e197ebf..d4b0c3a 100644 --- a/imgboard.php +++ b/imgboard.php @@ -525,7 +525,7 @@ if (isset($_POST['message']) || isset($_POST['file'])) { } } elseif (isset($_GET["rawpost"])) { $onload = manageOnLoad("rawpost"); - $text .= manageRawPostForm(); + $text .= buildPostForm(0, true); } elseif (isset($_GET["logout"])) { $_SESSION['tinyib'] = ''; session_destroy(); diff --git a/inc/html.php b/inc/html.php index 452b8e9..2a58281 100644 --- a/inc/html.php +++ b/inc/html.php @@ -70,6 +70,202 @@ function makeLinksClickable($text) { return $text; } +function buildPostForm($parent, $raw_post = false) { + global $tinyib_uploads, $tinyib_embeds; + + $form_action = 'imgboard.php'; + $form_extra = ''; + $input_extra = ''; + $rules_extra = ''; + if ($raw_post) { + $form_action = '?'; + $form_extra = ''; + $input_extra = << + + Reply to + + +  0 to start a new thread + + +EOF; +$rules_extra = << +
  • Text entered in the Message field will be posted as is with no formatting applied.
  • +
  • Line-breaks must be specified with "<br>".
  • +
    +EOF; + } + + $max_file_size_input_html = ''; + $max_file_size_rules_html = ''; + $reqmod_html = ''; + $filetypes_html = ''; + $file_input_html = ''; + $embed_input_html = ''; + $unique_posts_html = ''; + + $captcha_html = ''; + if (TINYIB_CAPTCHA && !$raw_post) { + if (TINYIB_CAPTCHA === 'recaptcha') { + $captcha_inner_html = ' +
    +
    + +
    '; + } else { // Simple CAPTCHA + $captcha_inner_html = ' +  (enter the text below)
    +CAPTCHA'; + } + + $captcha_html = << + + CAPTCHA + + + $captcha_inner_html + + +EOF; + } + + if (!empty($tinyib_uploads)) { + if (TINYIB_MAXKB > 0) { + $max_file_size_input_html = ''; + $max_file_size_rules_html = '
  • Maximum file size allowed is ' . TINYIB_MAXKBDESC . '.
  • '; + } + + $filetypes_html = '
  • ' . supportedFileTypes() . '
  • '; + + $file_input_html = << + + File + + + + + +EOF; + } + + if (!empty($tinyib_embeds)) { + $embed_input_html = << + + Embed + + +   (paste a YouTube URL) + + +EOF; + } + + if (TINYIB_REQMOD == 'files' || TINYIB_REQMOD == 'all') { + $reqmod_html = '
  • All posts' . (TINYIB_REQMOD == 'files' ? ' with a file attached' : '') . ' will be moderated before being shown.
  • '; + } + + $thumbnails_html = ''; + if (isset($tinyib_uploads['image/jpeg']) || isset($tinyib_uploads['image/pjpeg']) || isset($tinyib_uploads['image/png']) || isset($tinyib_uploads['image/gif'])) { + $maxdimensions = TINYIB_MAXWOP . 'x' . TINYIB_MAXHOP; + if (TINYIB_MAXW != TINYIB_MAXWOP || TINYIB_MAXH != TINYIB_MAXHOP) { + $maxdimensions .= ' (new thread) or ' . TINYIB_MAXW . 'x' . TINYIB_MAXH . ' (reply)'; + } + + $thumbnails_html = "
  • Images greater than $maxdimensions will be thumbnailed.
  • "; + } + + $unique_posts = uniquePosts(); + if ($unique_posts > 0) { + $unique_posts_html = "
  • Currently $unique_posts unique user posts.
  • \n"; + } + + return << +
    + $max_file_size_input_html + $form_extra + + + $input_extra + + + + + + + + + + + + + + + + + $captcha_html + $file_input_html + $embed_input_html + + + + + + + + +
    + Name + + +
    + E-mail + + +
    + Subject + + + +
    + Message + + +
    + Password + +   (for post and file deletion) +
    + $rules_extra +
      + $reqmod_html + $filetypes_html + $max_file_size_rules_html + $thumbnails_html + $unique_posts_html +
    +
    +
    + +EOF; +} + function buildPost($post, $res) { $return = ""; $threadid = ($post['parent'] == TINYIB_NEWTHREAD) ? $post['id'] : $post['parent']; @@ -222,13 +418,7 @@ EOF; } function buildPage($htmlposts, $parent, $pages = 0, $thispage = 0) { - global $tinyib_uploads, $tinyib_embeds; - $managelink = basename($_SERVER['PHP_SELF']) . "?manage"; - $maxdimensions = TINYIB_MAXWOP . 'x' . TINYIB_MAXHOP; - if (TINYIB_MAXW != TINYIB_MAXWOP || TINYIB_MAXH != TINYIB_MAXHOP) { - $maxdimensions .= ' (new thread) or ' . TINYIB_MAXW . 'x' . TINYIB_MAXH . ' (reply)'; - } $postingmode = ""; $pagenavigator = ""; @@ -265,97 +455,7 @@ EOF; $postingmode = '[Return]
    Posting mode: Reply
    '; } - $max_file_size_input_html = ''; - $max_file_size_rules_html = ''; - $reqmod_html = ''; - $filetypes_html = ''; - $file_input_html = ''; - $embed_input_html = ''; - $unique_posts_html = ''; - - $captcha_html = ''; - if (TINYIB_CAPTCHA) { - if (TINYIB_CAPTCHA === 'recaptcha') { - $captcha_inner_html = ' -
    -
    - -
    '; - } else { // Simple CAPTCHA - $captcha_inner_html = ' -  (enter the text below)
    -CAPTCHA'; - } - - $captcha_html = << - - CAPTCHA - - - $captcha_inner_html - - -EOF; - } - - if (!empty($tinyib_uploads)) { - if (TINYIB_MAXKB > 0) { - $max_file_size_input_html = ''; - $max_file_size_rules_html = '
  • Maximum file size allowed is ' . TINYIB_MAXKBDESC . '.
  • '; - } - - $filetypes_html = '
  • ' . supportedFileTypes() . '
  • '; - - $file_input_html = << - - File - - - - - -EOF; - } - - if (!empty($tinyib_embeds)) { - $embed_input_html = << - - Embed - - -   (paste a YouTube URL) - - -EOF; - } - - if (TINYIB_REQMOD == 'files' || TINYIB_REQMOD == 'all') { - $reqmod_html = '
  • All posts' . (TINYIB_REQMOD == 'files' ? ' with a file attached' : '') . ' will be moderated before being shown.
  • '; - } - - $thumbnails_html = ''; - if (isset($tinyib_uploads['image/jpeg']) || isset($tinyib_uploads['image/pjpeg']) || isset($tinyib_uploads['image/png']) || isset($tinyib_uploads['image/gif'])) { - $thumbnails_html = "
  • Images greater than $maxdimensions will be thumbnailed.
  • "; - } - - $unique_posts = uniquePosts(); - if ($unique_posts > 0) { - $unique_posts_html = "
  • Currently $unique_posts unique user posts.
  • \n"; - } + $postform = buildPostForm($parent); $body = << @@ -368,71 +468,7 @@ EOF;
    $postingmode -
    -
    - $max_file_size_input_html - - - - - - - - - - - - - - - - - - - - $captcha_html - $file_input_html - $embed_input_html - - - - - - - - -
    - Name - - -
    - E-mail - - -
    - Subject - - - -
    - Message - - -
    - Password - -   (for post and file deletion) -
    -
      - $reqmod_html - $filetypes_html - $max_file_size_rules_html - $thumbnails_html - $unique_posts_html -
    -
    -
    -
    + $postform
    0) { - $max_file_size_input_html = ''; - } - - return << - - - $max_file_size_input_html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Reply to - -  0 to start a new thread -
    - Name - - -
    - E-mail - - -
    - Subject - - - -
    - Message - - -
    - File - - -
    - Password - -  (for post and file deletion) -
    -
      -
    • Text entered in the Message field will be posted as is with no formatting applied.
    • -
    • Line-breaks must be specified with "<br>".
    • -
    -
    - - -EOF; -} - function manageModeratePost($post) { global $isadmin; $ban = banByIP($post['ip']);