$sql = "SELECT id, time, replies, visits, headline, body, last_post FROM {P}Topics ORDER BY id DESC LIMIT {$start_listing_at}, {$items_per_page}"; } else { $sql = "SELECT id, time, replies, visits, headline, body, last_post FROM {P}Topics ORDER BY last_post DESC LIMIT {$start_listing_at}, {$items_per_page}"; } $res = DB::Execute($sql); //$stmt->bind_result($topic_id, $topic_time, $topic_replies, $topic_visits, $topic_headline, $topic_body, $topic_last_post); // Print the {P}Topics we just fetched in a table. $table = new TablePrinter('tblBumps'); $order_name = $topics_mode ? 'Age' : 'Last bump'; $columns = array('Headline', 'Snippet', 'Replies', 'Visits', $order_name . ' ▼'); if ($_COOKIE['spoiler_mode'] != 1) { // If spoiler mode is disabled, remove the snippet column. array_splice($columns, 1, 1); } $table->DefineColumns($columns, 'Headline'); $table->SetTDClass('Headline', 'topic_headline'); $table->SetTDClass('Snippet', 'snippet'); if ($res) { while (list($topic_id, $topic_time, $topic_replies, $topic_visits, $topic_headline, $topic_body, $topic_last_post) = $res->FetchRow()) { // Should we even bother? if ($_COOKIE['ostrich_mode'] == 1) { foreach ($ignored_phrases as $ignored_phrase) { if (stripos($topic_headline, $ignored_phrase) !== false || stripos($topic_body, $ignored_phrase) !== false) { // We've encountered an ignored phrase, so skip the rest of this while() iteration. $table->num_rows_fetched++; continue 2; } } } // Decide what to use for the last seen marker and the age/last bump column. if ($topics_mode) {
$sql=DB::Prepare('SELECT replies.id, replies.parent_id, replies.time, replies.body, replies.author_ip, topics.headline, topics.time FROM {P}Replies as replies INNER JOIN {P}Topics as topics ON replies.parent_id = topics.id WHERE replies.author = ? ORDER BY id DESC'); $res=DB::Execute($sql,array($_GET['uid'])); $stmt->bind_result; $replies = new TablePrinter('tblReplies'); $columns = array ( 'Reply snippet', 'Topic', 'IP address', 'Age ▼' ); $replies->DefineColumns($columns, 'Topic'); $replies->SetTDClass('Topic', 'topic_headline'); $replies->SetTDClass('Reply snippet', 'reply_body_snippet'); while($row=$res->FetchRow()) { list($reply_id, $parent_id, $reply_time, $reply_body, $reply_ip_address, $topic_headline, $topic_time)=$row; $values = array ( '<a href="/topic/' . $parent_id . '#reply_' . $reply_id . '">' . snippet($reply_body) . '</a>', '<a href="/topic/' . $parent_id . '">' . htmlspecialchars($topic_headline) . '</a> <span class="help unimportant" title="' . format_date($topic_time) . '">(' . calculate_age($topic_time) . ' old)</span>', '<a href="/IP_address/' . $reply_ip_address . '">' . $reply_ip_address . '</a>', '<span class="help" title="' . format_date($reply_time) . '">' . calculate_age($reply_time) . '</span>' ); $replies->Row($values); }
foreach ($_POST['rejects'] as $reject_id) { if ($i > 0) { $sql .= ' OR '; } $sql .= '(uid = \'' . $User->UID . '\' AND topic_id = ' . intval($reject_id) . ')'; } DB::Execute($sql); $_SESSION['notice'] = 'Selected topics unwatched.'; } echo '<form name="fuck_off" action="" method="post">'; $topics = new TablePrinter('watchlist'); $topic_column = '<script type="text/javascript"> document.write(\'<input type="checkbox" name="master_checkbox" class="inline" onclick="checkOrUncheckAllCheckboxes()" title="Check/uncheck all" /> \');</script>Topic'; $columns = array($topic_column, 'Replies', 'Visits', 'Age', 'Last Post'); $db_columns = array('t.headline', 't.replies', 't.visits', 't.time', 'last_post'); $topics->DefaultSorting('last_post', SORT_DESC, $db_columns); $topics->DefineColumns($columns, $topic_column); $topics->SetTDClass($topic_column, 'topic_headline'); DB::ToggleDebug(); $res = DB::Execute('SELECT w.topic_id, t.headline, t.replies, t.visits, t.time, last_post FROM {P}Watchlists as w INNER JOIN {P}Topics as t ON w.topic_id = t.id WHERE w.uid = \'' . $User->ID . '\' ' . $topics->GetOrderSQL()); DB::ToggleDebug(); while (list($topic_id, $topic_headline, $topic_replies, $topic_visits, $topic_time, $last_post) = $res->FetchRow()) { $values = array('<input type="checkbox" name="rejects[]" value="' . $topic_id . '" class="inline" /> <a href="/topic/' . $topic_id . '">' . htmlspecialchars($topic_headline) . '</a>', replies($topic_id, $topic_replies), format_number($topic_visits), '<span class="help" title="' . format_date($topic_time) . '">' . calculate_age($topic_time) . '</span>', '<span class="help" title="' . format_date($last_post) . '">' . calculate_age($last_post) . '</span>'); $topics->Row($values); } $num_topics_fetched = $topics->num_rows_fetched; echo $topics; if ($num_topics_fetched !== 0) { echo '<div class="row"><input type="submit" value="Unwatch selected" onclick="return confirm(\'Really remove selected topic(s) from your watchlist?\');" class="inline" /></div>'; } echo '</form>'; require 'includes/footer.php';
<?php require 'includes/header.php'; $page_title = "Hot topics"; $res = DB::Execute('SELECT headline, id, time, replies FROM {P}Topics ORDER BY replies DESC LIMIT 0, 100'); $t = new TablePrinter('hot_topics'); $t->DefineColumns(array('#', 'Topic', 'Replies'), 'Topic'); $t->SetTDClass('Topic', 'topic_headline'); $i = 0; while (list($hot_headline, $hot_id, $hot_time, $hot_replies) = $res->FetchRow()) { $t->Row(array(++$i, '<a href="/topic/' . $hot_id . '">' . $hot_headline . '</a>', $hot_replies)); } echo $t; require 'includes/footer.php';
intval($_POST['type'][$i]), ParseExpiry($_POST['duration'][$i]), DB::Q($_POST['replace'][$i])); $c++; } if($c>0)DB::Execute($sql); } redirect('Done.'); break; case 'read_appeals': $page_title="Appeals"; echo '<form action="/controlpanel/process_appeals/" method="post">'; $slt=new TablePrinter('UIDAppeals'); $slt->DefineColumns(array('Unban/Deny Appeal','UID','IP Address','Banned For','Appeal'),'UID/IP'); $slt->SetTDClass('Appeal','appeal'); $i=0; $res=DB::Execute("SELECT uid, ip, reason, appeal FROM {P}Bans WHERE appeal!=''"); while(list($uid,$reason,$appeal)=$res->FetchRow()) { $slt->Row(array( '<input type="checkbox" name="unban_uid[]" value="'.$uid.'" /><input type="checkbox" name="deny_appeal[]" value="'.$uid.'" />', $uid,$ip, $reason, htmlspecialchars($appeal))); } echo $slt.'<input type="submit" value="Unban"></forms>'; break; case 'process_appeals':
if (!ctype_digit($_GET['p']) || $_GET['p'] < 2) { $current_page = 1; $page_title = 'Latest replies'; update_activity('latest_replies'); } else { $current_page = $_GET['p']; $page_title = 'Replies, page #' . number_format($current_page); update_activity('replies', $current_page); } // Print out the appropriate replies. $items_per_page = ITEMS_PER_PAGE; $start_listing_replies_at = $items_per_page * ($current_page - 1); $sql = 'SELECT {P}Replies.id, {P}Replies.parent_id, {P}Replies.time, {P}Replies.body, {P}Topics.headline, {P}Topics.time FROM {P}Replies INNER JOIN {P}Topics ON {P}Replies.parent_id = {P}Topics.id ORDER BY id DESC LIMIT %d, %d'; $sql = sprintf($sql, $start_listing_replies_at, $items_per_page); $res = DB::Execute($sql); $replies = new TablePrinter('tblReplies'); $columns = array('Snippet', 'Topic', 'Age ▼'); $replies->DefineColumns($columns, 'Topic'); $replies->SetTDClass('Topic', 'topic_headline'); $replies->SetTDClass('Snippet', 'snippet'); if ($res) { while (list($reply_id, $parent_id, $reply_time, $reply_body, $topic_headline, $topic_time) = $res->FetchRow()) { $values = array('<a href="/topic/' . $parent_id . '#reply_' . $reply_id . '">' . snippet($reply_body) . '</a>', '<a href="/topic/' . $parent_id . '">' . htmlspecialchars($topic_headline) . '</a> <span class="help unimportant" title="' . format_date($topic_time) . '">(' . calculate_age($topic_time) . ' old)</span>', '<span class="help" title="' . format_date($reply_time) . '">' . calculate_age($reply_time) . '</span>'); $replies->Row($values); } } $num_replies_fetched = $replies->num_rows_fetched; echo $replies; // Navigate backward or forward ... page_navigation('replies', $current_page, $num_replies_fetched); require 'includes/footer.php';