'; } if (TINYIB_CAPTCHA === 'recaptcha' || TINYIB_MANAGECAPTCHA === 'recaptcha') { $js_captcha .= ''; } $stylesheets = pageStylesheets(); return << $title $stylesheets $js_captcha EOF; } function pageStylesheets() { global $tinyib_stylesheets; // Global stylesheet $return = ''; // Default stylesheet $return .= ''; // Additional stylesheets foreach($tinyib_stylesheets as $filename => $title) { if ($filename === TINYIB_DEFAULTSTYLE) { continue; } $return .= ''; } 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))); if (count($types_allowed) == 1) { return sprintf(__('Supported file type is %s'), $types_allowed[0]); } $last_type = array_pop($types_allowed); return sprintf(__('Supported file types are %1$s and %2$s.'), implode(', ', $types_allowed), $last_type); } function _makeLinksClickable($matches) { if (!isset($matches[1])) { return ''; } $url = htmlentities($matches[1], ENT_QUOTES); return '' . $url . ''; } function makeLinksClickable($text) { $text = preg_replace_callback('!(((f|ht)tp(s)?://)[-a-zA-Zа-яА-Я()0-9@:%\!_+.,~#?&;\'/=]+)!i', '_makeLinksClickable', $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 = ''; $maxlen_name = -1; $maxlen_email = -1; $maxlen_subject = -1; $maxlen_message = -1; if (TINYIB_MAXNAME > 0) { $maxlen_name = TINYIB_MAXNAME; } if (TINYIB_MAXEMAIL > 0) { $maxlen_email = TINYIB_MAXEMAIL; } if (TINYIB_MAXSUBJECT > 0) { $maxlen_subject = TINYIB_MAXSUBJECT; } if (TINYIB_MAXMESSAGE > 0) { $maxlen_message = TINYIB_MAXMESSAGE; } if ($raw_post) { $txt_reply_to = __('Reply to'); $txt_new_thread = __('0 to start a new thread'); $txt_info_1 = __('Text entered in the Message field will be posted as is with no formatting applied.'); $txt_info_2 = __('Line-breaks must be specified with "<br>".'); $form_action = '?'; $form_extra = ''; $input_extra = << $txt_reply_to  $txt_new_thread EOF; $rules_extra = <<
  • $txt_info_1
  • $txt_info_2

  • EOF; $maxlen_name = -1; $maxlen_email = -1; $maxlen_subject = -1; $maxlen_message = -1; } $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 === 'hcaptcha') { $captcha_inner_html = '
    '; } else if (TINYIB_CAPTCHA === 'recaptcha') { $captcha_inner_html = '
    '; } else { // Simple CAPTCHA $captcha_inner_html = '   ' . __('(enter the text below)') . '
    CAPTCHA'; } $txt_captcha = __('CAPTCHA'); $captcha_html = << $txt_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 = '
  • ' . sprintf(__('Maximum file size allowed is %s.'), TINYIB_MAXKBDESC) . '
  • '; } $filetypes_html = '
  • ' . supportedFileTypes() . '
  • '; $txt_file = __('File'); $spoiler_html = ''; if (TINYIB_SPOILERIMAGE) { $spoiler_html = ''; } $file_input_html = << $txt_file $spoiler_html EOF; } $embeds_enabled = (!empty($tinyib_embeds) || TINYIB_UPLOADVIAURL) && ($raw_post || !in_array('embed', $hide_fields)); if ($embeds_enabled) { $txt_embed = __('Embed'); $txt_embed_help = ''; if ($embeds_enabled) { $txt_embed_help = __('(paste a YouTube URL)'); } $embed_input_html = << $txt_embed   $txt_embed_help EOF; } if (TINYIB_REQMOD == 'all') { $reqmod_html = '
  • ' . __('All posts are moderated before being shown.') . '
  • '; } else if (TINYIB_REQMOD == 'files') { $reqmod_html = '
  • ' . __('All posts with a file attached are 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 = '
  • ' . sprintf(__('Images greater than %s will be thumbnailed.'), $maxdimensions) . '
  • '; } $unique_posts = uniquePosts(); if ($unique_posts > 0) { $unique_posts_html = '
  • ' . sprintf(__('Currently %s unique user posts.'), $unique_posts) . '
  • ' . "\n"; } $output = <<
    $max_file_size_input_html $form_extra $input_extra EOF; if ($raw_post || !in_array('name', $hide_fields)) { $txt_name = __('Name'); $output .= << EOF; } if ($raw_post || !in_array('email', $hide_fields)) { $txt_email = __('E-mail'); $output .= << EOF; } if ($raw_post || !in_array('subject', $hide_fields)) { $txt_subject = __('Subject'); $output .= << EOF; } if ($raw_post || !in_array('message', $hide_fields)) { $txt_message = __('Message'); $output .= << EOF; } $output .= << EOF; } if ($postform_extra['footer'] != '') { $output .= << EOF; } $output .= <<
    $txt_name {$postform_extra['name']}
    $txt_email {$postform_extra['email']}
    $txt_subject {$postform_extra['subject']}
    $txt_message
    $txt_password   $txt_password_help
      {$postform_extra['footer']}
    $rules_extra
      $reqmod_html $filetypes_html $max_file_size_rules_html $thumbnails_html $unique_posts_html
    EOF; return $output; } function backlinks($post) { if (!TINYIB_BACKLINKS) { return ''; } global $thread_cache; $parent_id = getParent($post); if (!isset($thread_cache[$parent_id])) { $thread_cache[$parent_id] = postsInThreadByID($parent_id); } $needle = '>>' . $post['id']; $return = ''; foreach ($thread_cache[$parent_id] as $reply) { if (strpos($reply['message'], $needle) !== false) { if ($return != '') { $return .= ', '; } $return .= postLink('>>' . $reply['id']); } } if ($return != '') { $return = ' ' . $return; } return ' ' . $return . ''; } function buildPost($post, $res, $compact=false) { $return = ""; $threadid = ($post['parent'] == TINYIB_NEWTHREAD) ? $post['id'] : $post['parent']; if (TINYIB_REPORT) { $reflink = 'R '; } else { $reflink = ''; } if ($res == TINYIB_RESPAGE) { $reflink .= "No.{$post['id']}"; } else { $reflink .= "No.{$post['id']}"; } if ($post["stickied"] == 1) { $reflink .= ' ' . __('Stickied') . ''; } if ($post["locked"] == 1) { $reflink .= ' ' . __('Locked') . ''; } 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:')) . ' '; } $w = TINYIB_EXPANDWIDTH; 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 .= <<