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 '
";
$html_string .= "";
echo "$html_string";
$statement = $db->prepare("INSERT OR IGNORE
INTO captchas(hash, unix_timestamp)
VALUES ('$hash', '$current')");
$statement->execute();
}
// 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 '
';
return;
}
$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, $css)
{
$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, $css));
$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 a part of the settings, if enabled
function show_settings($settings){
if ( $settings['show_settings'] != TRUE ) {
return;
}
echo "Settings";
echo "
";
echo "";
}
// 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"
. "
";
$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 .= "
";
$html_string .= ""
. "Other subs"
. "
";
$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 .= "
";
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. Same as show_subs_count, but showing the subs in
// the navigation menu
function show_subs_navigation($db, $css, $settings)
{
if ( $settings['enable_menu'] != TRUE ) {
return;
}
$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 = "";
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 full text searches.
function show_search_form($db, $settings, $css)
{
if ( ($settings['enable_search'] != TRUE) ) {
return;
}
$html_string = ""
. "Search"
. "
";
$html_string .= '
Do a fulltext search:
'
. '
'
. '
';
$html_string .= "
";
echo "$html_string";
}
// Show the form that allows full text searches.
function show_search_form_navigation($db, $settings, $css)
{
if ( ($settings['enable_search'] != TRUE) ) {
return;
}
$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 individual feed"
. "
";
$html_string .= '
Set your multifeed:
'
. '
'
. '
';
$html_string .= "
";
echo "$html_string";
}
// Show the form that allows to set individual feeds.
function show_set_feeds_navigation($db, $settings, $css)
{
$html_string = "';
$html_string .= "";
echo "$html_string";
}
// EOF