if ($topics_mode) { $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.
echo '<h4 class="section">Replies</h4>'; $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);
$pms=array(); while(list($id,$thread,$title,$date,$from,$flags)=$res->FetchRow()) { if(!array_key_exists($thread,$pms)) $pms[$thread]=array($date,$title); if($date>$pms[$thread][0]) $pms[$thread][0]=$date; if($thread==0) { $pms[$thread][1]=$title; $pms[$thread][2]=$from; } } $pt=new TablePrinter('tblPMs'); $pt->DefineColumns(array('Subject','From','Sent'),'Subject'); foreach($pms as $id=>$details) { //var_dump($pms); $pt->Row(array( '<a href="'.THISURL.'/private_messages.php/thread/'.$id.'/">'.htmlspecialchars($details[1]).'</a>', '<a href="'.THISURL.'/private_messages.php/compose/'.$details[2].'/">'.$details[2].'</a>', calculate_age($details[0]).' ago' )); } echo $pt->Output(); ?> <ul class="menu"><li><a href="<?=THISURL?>/private_messages.php/compose/">Compose New Message</a></li></ul> <? break; case 'compose':
<?php require 'includes/header.php'; update_activity('failed_postings'); $page_title = 'Failed postings'; Output::Assign('sidebar', $sidebar); Output::$tpl->display('dashhead.tpl.php'); $items_per_page = ITEMS_PER_PAGE; $res = DB::Execute('SELECT time, uid, reason, headline, body FROM {P}FailedPostings ORDER BY time DESC LIMIT ' . $items_per_page); $table = new TablePrinter('tblFail'); $columns = array('Error message', 'Poster', 'Age ▼'); if (isPowerUser()) { array_splice($columns, 1, 1); } $table->DefineColumns($columns, 'Error message'); while (list($fail_time, $fail_uid, $fail_reason, $fail_headline, $fail_body) = $res->FetchRow()) { if (strlen($fail_body) > 600) { $fail_body = substr($fail_body, 0, 600) . ' …'; } $tooltip = ''; if (empty($fail_headline)) { $tooltip = $fail_body; } else { if (!empty($fail_body)) { $tooltip = 'Headline: ' . $fail_headline . ' Body: ' . $fail_body; } } $fail_reasons = unserialize($fail_reason); $error_message = '<ul class="error_message'; if (!empty($tooltip)) { $error_message .= ' help';
function show_trash($uid, $silence = false) { $output = '<table><thead><tr> <th class="minimal">Headline</th> <th>Body</th> <th class="minimal">Time since deletion ▼</th> </tr></thead> <tbody>'; $trash = DB::GetAll('SELECT headline, body, time FROM {P}Trash WHERE uid = ' . DB::Q($uid) . ' ORDER BY time DESC'); $table = new TablePrinter('tblTrash'); $columns = array('Headline', 'Body', 'Time since deletion ▼'); $table->DefineColumns($columns, 'Body'); foreach ($trash as $row) { if (empty($row['headline'])) { $row['headline'] = '<span class="unimportant">(Reply.)</span>'; } else { $row['headline'] = htmlspecialchars($row['headline']); } $values = array($row['headline'], nl2br(htmlspecialchars($row['body'])), '<span class="help" title="' . format_date($row['time']) . '">' . calculate_age($row['time']) . '</span>'); $table->Row($values); } if ($table->num_rows_fetched === 0) { return false; } return $table; }
<table> <tr> <td> < +-----------------------------------+-------------------------------------------+ | +-------------------------------+ | | | | | | | | | | | | | +-------------------------------+ | | | [v Hurp a Derp] [x] Confirm | | +-----------------------------------+-------------------------------------------+ <? $t = new TablePrinter(); $t->DefineColumns(array('Confirm','Filter','Preview'),'Filter'); $i=0; $opts=''; foreach($this->Options as $optname=>$optvalue) { $opts='<option value="'.$optvalue.'">'.$optname.'</option>'; } if(!empty($_SESSION['2BFiltered'])) { foreach($_SESSION['2BFiltered'] as $filterstring) { $t->Row(array(
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';
DB::Q($_POST['reason'][$i]), 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;
if (isset($_POST['id'])) { DB::Execute('DELETE FROM {P}Pages WHERE id = ' . intval($id)); redirect('Page deleted.'); } break; case 'ban_uid': if (!$moderator && !$administrator) { add_error('You are not wise enough.', true); } if (!id_exists($_GET['id'])) { add_error('There is no such user.', true); } $uid = $_GET['id']; $page_title = 'Ban poster ' . $id; $slt = new TablePrinter('Bans'); $slt->DefineColumns(array('Confirm', 'UID', 'IP'), 'IP'); $i = 0; $slt->Row(array('<input type="hidden" name="uid[' . $i . ']" value="' . $uid . '"><input type="hidden" name="ip[' . $i . ']" value="-"><input type="checkbox" name="confirm[' . $i . ']" value="1" checked="checked" />', $uid, $ip)); Output::$tpl->display('controlpanel/banform.start.php'); echo $slt->Output('ban-ees'); Output::$tpl->display('controlpanel/banform.end.php'); include 'includes/footer.php'; exit; break; break; case 'unban_uid': if (!$moderator && !$administrator) { add_error('You are not wise enough.', true); } if (!id_exists($_GET['id'])) { add_error('There is no such user.', true);
"> Cite </a> </li> </ul> </div> <? // Store information for the next round. $c++; $prevtime=$reply->Time; endforeach; if(isPowerUser()):?> <h2>UID Dump</h2> <? $uidt=new TablePrinter('tblUIDs'); $uidt->DefineColumns(array('UID','Names'),'Names'); foreach($this->topic->UIDs as $uid=>$names) { if($uid!='admin') $uid=sprintf('<a href="%1$sprofile/%2$s">%2$s</a>',THISURL,$uid); $uidt->Row(array($uid,implode(', ',$names))); } echo $uidt; ?> <?endif;?> <ul class="menu"> <li> <a href="<?php echo rel2Abs('/new_reply/' . $_GET['id']); ?>
?> 's post count.</p> <?if(FALSE):?> <h2>Debugging Shit ($_SESSION)</h2> <? $table=new TablePrinter('tblSession'); $table->DefineColumns(array('Variable','Value'),'Value'); foreach($_SESSION as $k=>$v) $table->Row(array($k,$v)); echo $table; ?> <h2>Debugging Shit ($User)</h2> <? $table=new TablePrinter('tblUser'); $table->DefineColumns(array('Variable','Value'),'Value'); foreach($User as $k=>$v) { if(is_array($v)) $v='<pre>'.htmlentities(var_export($v,true)).'</pre>'; $table->Row(array($k,$v)); } echo $table; endif; Output::$tpl->display('dashfooter.tpl.php'); require('includes/footer.php'); ?>