prepare("SELECT text FROM threads WHERE shadow = 'no' AND sub = '$sub' ORDER BY post_id ASC LIMIT 1"); $result = $statement->execute(); while ($row = $result->fetchArray(SQLITE3_NUM)) { $title = "{$row[0]}"; $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); } return $title; } // Show the form to edit a post, prefilled with the original post function show_edit_form($db, $sub, $post_id, $ip, $css, $settings) { if ( (check_free_space($db, $settings) == FALSE) ) { echo '

No editing possible, no space on filesystem

'; return; } if ( (post_block_user($db, $settings, $ip) != TRUE) ) { echo '

Max posts exhausted. Retry later.

'; return; } $statement = $db->prepare("SELECT text, original FROM threads WHERE sub = '$sub' AND shadow = 'no' AND post_id = '$post_id' "); $result = $statement->execute(); while ($row = $result->fetchArray(SQLITE3_NUM)) { $post_text = "{$row[0]}"; $original = "{$row[1]}"; } $html_string = "
" . "" . "" . "" . '" . "" . ""; $token = make_token(250, 'alnum'); $current = time(); $hash = hash('sha512', $token); $html_string .= ""; $html_string .= '
" . ""; if ($settings['enable_timestamps']) { $html_string .= "timestamp"; } $html_string .= "

'; $statement = $db->prepare("INSERT OR IGNORE INTO captchas(hash, unix_timestamp) VALUES ('$hash', '$current')"); $statement->execute(); echo "$html_string"; } // Show the postform with or without the captcha (according to setting), // if on main show also the field to create new subs function show_post_form($db, $msg, $sub, $settings, $org_id, $css, $quote, $ip) { if ( (check_free_space($db, $settings) == FALSE) ) { echo '

No posting possible, no space on filesystem

'; return; } if ( (post_block_user($db, $settings, $ip) != TRUE) ) { echo '

Max posts exhausted. Retry later.

'; return; } $html_string = "
" . "" . ""; if ( (!$org_id) && ($sub == 'main') && ($settings['enable_sub_creation'] == TRUE) ) { $html_string .= "'; } if ( (!empty($org_id)) ) { $html_string .= ""; } $token = make_token(250, 'alnum'); $current = time(); if ($settings['use_captcha']) { $math_one = rand(20,80); $math_two = rand(1,19); // the first number should be bigger than the next, to avoid // negative results. Also, results should be below 100. $math_type = rand(0,1); // 0 means +, 1 means - if ($math_type == 0) { $answer = $math_one + $math_two; $math_type = '+'; } elseif ($math_type == 1) { $answer = $math_one - $math_two; $math_type = '-'; } $summary = ($math_one . $math_two . $math_type . $answer . $token); $hash = hash('sha512', $summary); $html_string .= ""; $html_string .= '
"; } if ( ($sub != 'main') ) { $html_string .= ""; } $html_string .= '
" . "$math_one " . "$math_type $math_two "; } else { $hash = hash('sha512', $token); $html_string .= "
"; } if ( ($settings['enable_tripcodes']) ) { $combination = make_tripcode($settings); $html_string .= "" . ""; } if ( ($settings['enable_sage']) && (!empty($org_id)) ){ $html_string .= "sage"; } if ($settings['enable_timestamps']) { $html_string .= "timestamp"; } $html_string .= "

'; $statement = $db->prepare("INSERT OR IGNORE INTO captchas(hash, unix_timestamp) VALUES ('$hash', '$current')"); $statement->execute(); echo "$html_string"; } // Shows all versions of a specific post function show_post_history($db, $sub, $post_id, $settings) { $html_string = '
'; $statement = $db->prepare("SELECT original FROM threads WHERE sub = '$sub' AND post_id = '$post_id' "); $result = $statement->execute(); while ($row = $result->fetchArray(SQLITE3_NUM)) { $original = "{$row[0]}"; } $statement = $db->prepare("SELECT post_id, org_id, sub, text, timestamp, name, tripcode FROM threads WHERE sub = '$sub' AND original = '$original' ORDER BY post_id"); $result = $statement->execute(); $posts = array(); $counter = 0; while ($row = $result->fetchArray(SQLITE3_NUM)) { $counter++; $post = array(); $post_id = "{$row[0]}"; $org_id = "{$row[1]}"; $post_text = "{$row[3]}"; $post_text = break_text(bbcode_to_html($post_text, $settings, $sub), $settings); $id_text = make_id_text($post_id); $timestamp = "{$row[4]}"; $name = "{$row[5]}"; $tripcode = "{$row[6]}"; array_push($post, $post_id); array_push($post, $org_id); array_push($post, $post_text); array_push($post, $id_text); array_push($post, $timestamp); array_push($post, $name); array_push($post, $tripcode); array_push($posts, $post); } $display = array_reverse($posts); foreach ($display as $old_post) { $post_id = "$old_post[0]"; $org_id = "$old_post[1]"; $post_text = "$old_post[2]"; $id_text = $old_post[3]; $timestamp = "$old_post[4]"; $name = "$old_post[5]"; $tripcode = "$old_post[6]"; $html_string .= "

" . "
#$id_text

" . "$post_text


"; } $html_string .= '
'; echo "$html_string"; } // Show the existing subs to a user, including their count // Differentiates between subs with > 10 posts (high-traffic) // and lower (low-traffic). Also shows the last ten subs that // were posted to. function show_subs_count($db, $css, $settings) { $out = ''; if ( (!empty($settings['no_overboard'])) ) { $last = array_pop($settings['no_overboard']); foreach($settings['no_overboard'] as $no_overboard) { $str = "'" . $no_overboard . "', "; $out .= $str; } $out .= "'" . $last . "'"; } $statement = $db->prepare("SELECT post_id FROM threads WHERE sub NOT IN ($out) AND shadow = 'no'"); $result = $statement->execute(); $counter = 0; while ($row = $result->fetchArray(SQLITE3_NUM)) { $counter++; } $statement = $db->prepare("SELECT post_id FROM threads WHERE sub NOT IN ($out) AND shadow = 'no' AND post_id = org_id"); $result = $statement->execute(); $counter_org = 0; while ($row = $result->fetchArray(SQLITE3_NUM)) { $counter_org++; } $replies = $counter - $counter_org; $title = $settings['hover_title_overboard']; $html_string = "

Subs with some traffic:

" . "overboard" . "($counter_org/$replies)"; $statement = $db->prepare("SELECT DISTINCT sub FROM threads WHERE shadow = 'no' ORDER BY sub COLLATE NOCASE"); $result = $statement->execute(); $high_traffic_subs = array(); $low_traffic_subs = array(); while ($row = $result->fetchArray(SQLITE3_NUM)) { $display_sub = array(); $sub = "{$row[0]}"; $total_posts = give_total_posts($db, $sub, FALSE, $settings); $total_org_posts = give_total_posts($db, $sub, TRUE, $settings); $replies = $total_posts - $total_org_posts; array_push($display_sub, $sub); array_push($display_sub, $total_org_posts); array_push($display_sub, $replies); $title = get_first_post_text($db, $sub, $settings); array_push($display_sub, $title); if ( ($total_posts > 10) ) { // we define any sub with more than ten messages as high traffic // anything below as low traffic array_push($high_traffic_subs, $display_sub); } else { array_push($low_traffic_subs, $display_sub); } } foreach($high_traffic_subs as $display_sub) { $title = $display_sub[3]; $html_string .= " | $display_sub[0]" . "($display_sub[1]/$display_sub[2])"; } $html_string .= '




Other subs:

'; $temp = array_reverse($low_traffic_subs); $first_display_sub = array_pop($temp); $low_traffic_subs = array_reverse($temp); $title = $first_display_sub[3]; $html_string .= "$first_display_sub[0]" . "($first_display_sub[1]/$first_display_sub[2])"; foreach($low_traffic_subs as $display_sub) { $title = $display_sub[3]; $html_string .= " | $display_sub[0]" . "($display_sub[1]/$display_sub[2])"; } $statement = $db->prepare("SELECT DISTINCT sub FROM threads WHERE shadow = 'no' ORDER BY ROWID DESC LIMIT 10"); $result = $statement->execute(); $html_string .= '


' . '

Subs with recent posts:

'; while ($row = $result->fetchArray(SQLITE3_NUM)) { $sub = "{$row[0]}"; $title = get_first_post_text($db, $sub, $settings); $html_string .= "$sub "; } $html_string .= '

'; echo "$html_string"; } // Show the existing subs to a user, without the count function show_subs_no_count($db, $css, $settings) { $title = $settings['hover_title_overboard']; $html_string = "

overboard"; $statement = $db->prepare("SELECT DISTINCT sub FROM threads WHERE shadow = 'no' ORDER BY sub COLLATE NOCASE"); $result = $statement->execute(); while ($row = $result->fetchArray(SQLITE3_NUM)) { $sub = "{$row[0]}"; if ( ($sub != '') ) { $title = get_first_post_text($db, $sub, $settings); $html_string .= " | $sub"; } } $html_string .= '

'; echo "$html_string"; } // Show the form that allows to set individual feeds. function show_set_feeds_form($db, $settings, $css) { $html_string = '


Set your multifeed:

' . '

' . '

' . '' . '
Show everything except: ' . '' . '
OR Show nothing but: ' . '' . '' . '
' . '

'; echo "$html_string"; } // EOF