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 '
';
$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 = "'
. '