' : ''; $return = << EOF; $return .= TINYIB_BOARDDESC . <<<EOF $js_captcha EOF; return $return; } function pageFooter() { // If the footer link is removed from the page, please link to TinyIB somewhere on the site. // This is all I ask in return for the free software you are using. return << - futaba + futallaby + tinyib - EOF; } function supportedFileTypes() { global $tinyib_uploads; if (empty($tinyib_uploads)) { return ""; } $types_allowed = array_map('strtoupper', array_unique(array_column($tinyib_uploads, 0))); $types_last = array_pop($types_allowed); $types_formatted = $types_allowed ? implode(', ', $types_allowed) . ' and ' . $types_last : $types_last; return "Supported file type" . (count($tinyib_uploads) != 1 ? "s are " : " is ") . $types_formatted . "."; } function makeLinksClickable($text) { $text = preg_replace('!(((f|ht)tp(s)?://)[-a-zA-Zа-яА-Я()0-9@:%\!_+.,~#?&;//=]+)!i', '$1', $text); $text = preg_replace('/\(\(.*)\)\<\/a>/i', '($2)', $text); $text = preg_replace('/\(.*)\.\<\/a>/i', '$2.', $text); $text = preg_replace('/\(.*)\,\<\/a>/i', '$2,', $text); return $text; } function buildPostForm($parent, $raw_post = false) { global $tinyib_hidefieldsop, $tinyib_hidefields, $tinyib_uploads, $tinyib_embeds; $hide_fields = $parent == TINYIB_NEWTHREAD ? $tinyib_hidefieldsop : $tinyib_hidefields; $postform_extra = array('name' => '', 'email' => '', 'subject' => '', 'footer' => ''); $input_submit = ''; if ($raw_post || !in_array('subject', $hide_fields)) { $postform_extra['subject'] = $input_submit; } else if (!in_array('email', $hide_fields)) { $postform_extra['email'] = $input_submit; } else if (!in_array('name', $hide_fields)) { $postform_extra['name'] = $input_submit; } else if (!in_array('email', $hide_fields)) { $postform_extra['email'] = $input_submit; } else { $postform_extra['footer'] = $input_submit; } $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) && ($raw_post || !in_array('file', $hide_fields))) { 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) && ($raw_post || !in_array('embed', $hide_fields))) { $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"; } $output = <<
    $max_file_size_input_html $form_extra $input_extra EOF; if ($raw_post || !in_array('name', $hide_fields)) { $output .= << EOF; } if ($raw_post || !in_array('email', $hide_fields)) { $output .= << EOF; } if ($raw_post || !in_array('subject', $hide_fields)) { $output .= << EOF; } if ($raw_post || !in_array('message', $hide_fields)) { $output .= << EOF; } $output .= << EOF; } if ($postform_extra['footer'] != '') { $output .= << EOF; } $output .= <<
    Name {$postform_extra['name']}
    E-mail {$postform_extra['email']}
    Subject {$postform_extra['subject']}
    Message
    Password   (for post and file deletion)
      {$postform_extra['footer']}
    $rules_extra
      $reqmod_html $filetypes_html $max_file_size_rules_html $thumbnails_html $unique_posts_html
    EOF; return $output; } function buildPost($post, $res) { $return = ""; $threadid = ($post['parent'] == TINYIB_NEWTHREAD) ? $post['id'] : $post['parent']; if ($res == TINYIB_RESPAGE) { $reflink = "No.{$post['id']}"; } else { $reflink = "No.{$post['id']}"; } if ($post["stickied"] == 1) { $reflink .= ' Stickied'; } if (!isset($post["omitted"])) { $post["omitted"] = 0; } $filehtml = ''; $filesize = ''; $expandhtml = ''; $direct_link = isEmbed($post["file_hex"]) ? "#" : (($res == TINYIB_RESPAGE ? "../" : "") . "src/" . $post["file"]); if ($post['parent'] == TINYIB_NEWTHREAD && $post["file"] != '') { $filesize .= isEmbed($post['file_hex']) ? 'Embed: ' : 'File: '; } if (isEmbed($post["file_hex"])) { $expandhtml = $post['file']; } else if (substr($post['file'], -5) == '.webm' || substr($post['file'], -4) == '.mp4') { $dimensions = 'width="500" height="50"'; if ($post['image_width'] > 0 && $post['image_height'] > 0) { $dimensions = 'width="' . $post['image_width'] . '" height="' . $post['image_height'] . '"'; } $expandhtml = << EOF; } else if (in_array(substr($post['file'], -4), array('.jpg', '.png', '.gif'))) { $expandhtml = ""; } $thumblink = ""; $expandhtml = rawurlencode($expandhtml); if (isEmbed($post["file_hex"])) { $filesize .= "${post['file_original']}–(${post['file_hex']})"; } else if ($post["file"] != '') { $filesize .= $thumblink . "${post["file"]}–(${post["file_size_formatted"]}"; if ($post["image_width"] > 0 && $post["image_height"] > 0) { $filesize .= ", " . $post["image_width"] . "x" . $post["image_height"]; } if ($post["file_original"] != "") { $filesize .= ", " . $post["file_original"]; } $filesize .= ")"; } if ($filesize != '') { $filesize = '' . $filesize . ''; } if ($filesize != '') { if ($post['parent'] != TINYIB_NEWTHREAD) { $filehtml .= '
    '; } $filehtml .= $filesize . '
    '; if ($post["thumb_width"] > 0 && $post["thumb_height"] > 0) { $filehtml .= << EOF; } $filehtml .= '
    '; if ($expandhtml != '') { $filehtml .= <<