Example #1
0
// it finds the threads with the highest message_ids (i.e. the threads that have most recently been replied to)
$query = "FROM {$db->threads} INNER JOIN {$db->messages} ON {$db->messages}.thread_id={$db->threads}.thread_id {$where} AND {$db->messages}.message_id=(SELECT MAX(m2.message_id) FROM {$db->messages} m2 WHERE m2.thread_id={$db->threads}.thread_id) ORDER BY {$db->messages}.dt DESC";
$recent = $db->get_results("SELECT *, {$db->threads}.email as t_email {$query} LIMIT {$offset}, 20");
if (!empty($db->last_error)) {
    var_dump($db->last_error, $db->last_query);
}
$i = 0;
$total = $db->get_var("SELECT COUNT(*) {$query}");
foreach ((array) $recent as $t) {
    $class = $i % 2 ? ' class="alt"' : '';
    $excerpt = '';
    $parts = mime_split($t->content);
    if ($part = find_first_part($parts)) {
        $excerpt = substr(message_meat($part->content), 0, 300);
    }
    echo "<tr {$class} id='tr{$t->thread_id}'>\r\n\t<td><input type='checkbox' name='thread_ids[]' value='{$t->thread_id}' class='mcheck' id='mcheck{$t->thread_id}' /></td>\r\n\t<td><a href='index.php?email={$t->email}'>{$t->t_email}</a></td><td><a title='" . htmlspecialchars($excerpt, ENT_QUOTES) . "' href='thread.php?t={$t->thread_id}&amp;replies={$t->messages}'>" . htmlspecialchars($t->subject ? mime_header_decode($t->subject) : '-') . "</a></td>\r\n\t<td>" . thread_tags($t->thread_id) . "</td>\r\n\t<td>" . short_time_diff($t->dt) . "</td>\r\n\t<td>{$t->messages}</td>\r\n\t</tr>";
    ++$i;
}
?>

<tr>
<td colspan="2">
<label>With checked:</label>
<input type="submit" name="status-close" value="Close" class="enablewhenselected" />
</td>
<td colspan="3" align="right">
<?php 
$page_links = paginate_links(array('base' => add_query_arg('apage', '%#%'), 'total' => ceil($total / 20), 'current' => $page));
if ($page_links) {
    echo "<p class='pagenav'>{$page_links}</p>";
}
Example #2
0
<?php

$js = '<script src="js/thread.js" type="text/javascript"></script>';
include 'header.php';
include 'includes/mime.php';
$thread_id = (int) $_GET['t'];
$thread = get_thread($thread_id);
if (!$thread) {
    die('Thread not found.');
}
?>

<h2><?php 
echo mime_header_decode($thread->subject);
?>
</h2>

<form action="thread-tags.php" method="post" id="newtags" class="<?php 
if (isset($_GET['updated']) && 'tags' == $_GET['updated']) {
    echo "fade";
}
?>
">
<p>Tags: 
<input type="text" size="50" name="tags" value="<?php 
echo thread_tags_form($thread->thread_id);
?>
"  class="padme" /> 
<input type="submit" value="Update &raquo;" name="submit" />
<input type="hidden" name="thread_id" value="<?php 
echo $thread_id;