} echo '.)</p>'; } if ($_GET['deep_search']) { $sql = DB::Prepare('SELECT replies.id, replies.parent_id, replies.time, replies.body, topics.headline, topics.time FROM {P}Replies as replies INNER JOIN {P}Topics as topics ON replies.parent_id = topics.id WHERE replies.body LIKE ? ORDER BY id DESC LIMIT 50'); $res = DB::Execute($sql, array($search_query)); if ($res->RecordCount() > 0) { $search_replies->bind_result; $replies = new table(); $columns = array('Reply snippet', 'Topic', 'Age ▼'); $replies->define_columns($columns, 'Topic'); $replies->add_td_class('Topic', 'topic_headline'); $replies->add_td_class('Reply snippet', 'reply_body_snippet'); while ($row = $res->FetchRow()) { list($reply_id, $parent_id, $reply_time, $reply_body, $topic_headline, $topic_time) = $row; $values = array('<a href="/topic/' . $parent_id . '#reply_' . $reply_id . '">' . str_ireplace($_GET['q'], '<em class="marked">' . htmlspecialchars($_GET['q']) . '</em>', 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->output('', true); if ($num_replies_fetched == 50) { echo '<p class="unimportant">(Tons of results found; stopping here.)</p>'; } } else { echo '<p>(No matching replies.)</p>'; } } } } print_errors(); require 'includes/footer.php';
if ($uid == $_SESSION['UID']) { $uid = 'You!'; } else { if (isPowerUser()) { $uid = '<a href="/profile/' . $uid . '">' . $uid . '</a>'; } else { $uid = '?'; } } $bump = calculate_age($age, $_SERVER['REQUEST_TIME']); $headline = htmlspecialchars($headline); $action = $actions[$action]; // Unknown or unrecorded actions are bypassed if ($action == null) { continue; } // Repeated actions are listed as (See above) if ($action == $old_action) { $temp = '<span class="unimportant">(See above)</span>'; } else { $old_action = $action; $temp = $action; } $values = array($action, $uid, '<span class="help" title="' . format_date($age) . '">' . calculate_age($age) . '</span>'); $table->row($values); } echo $table->output(); if ($count > 100) { echo '<p class="unimportant">(There are <b>a lot</b> of people active right now. Not all are shown here.)</p>'; } require 'includes/footer.php';
public function makeTable ($fields = false) { if (! $fields) { $fields[] = 'id'; foreach ($this->definitions as $k => $v) { if ($v['ontable']) { $fields[] = $k; } if ($v['linkfield']) { $linkfield = $k; } } } $fields2['id'] = "ID"; foreach ($fields as $v) { $fields2[$v] = $this->definitions[$v]['title']; } $fields2['delete'] = ""; $table = new table($fields2, array ( 'class' => 'span-16' )); $fieldsList = metaclass::getItems($this->table, $fields, $this->keyField); foreach ($fieldsList as $k => $v) { $v['delete'] = text::get('form/delete'); $table->addRow($v, array ( $linkfield => array ( 'type' => 'link' , 'href' => $this->urlbase . '?id=' . $v['id'] ) , 'delete' => array ( 'type' => 'link' , 'href' => 'javascript:deleteitem(\'' . $v['id'] . '\',\'' . janitor::cleanData( $v['title']) . '\',\'' . $this->urlbase . '\')' ) )); } return $table->output(); }