Ejemplo n.º 1
0
function api_get_threads($max_thread_id, $count = 50)
{
    if ($max_thread_id == -1) {
        get_max_pages_collapsed($max_thread_id);
    }
    $min_thread_id = $max_thread_id - $count;
    $threads = array();
    $count = 0;
    $result = get_thread_starts($min_thread_id, $max_thread_id);
    while ($row = mysql_fetch_assoc($result)) {
        $threads[] = array('id' => intval($row['thread_id']), 'counter' => intval($row['counter']), 'closed' => filter_var($row['thread_closed'], FILTER_VALIDATE_BOOLEAN), 'status' => intval($row['thread_status']), 'message' => array('id' => intval($row['msg_id']), 'status' => intval($row['status']), 'subject' => api_get_subject($row['subject'], $row['status']), 'author' => array('id' => intval($row['user_id']), 'name' => $row['username']), 'chars' => intval($row['chars']), 'created' => $row['created'], 'views' => intval($row['views']), 'likes' => intval($row['likes']), 'dislikes' => intval($row['dislikes'])));
        $count++;
    }
    return array('count' => $count, 'threads' => $threads);
}
Ejemplo n.º 2
0
$show_hidden = 2;
$ignored = array();
get_show_hidden_and_ignored();
print '<a id="up" name="up"></a>';
print_pages($max_page, $page, 'contents', $cur_page);
$max_thread_id = $max_thread_id - 50 * ($page - 1);
$min_thread_id = $max_thread_id - 50;
if ($max_thread_id < 2) {
    die('No such page');
}
if ($min_thread_id < 1) {
    $min_thread_id = 1;
}
$limit = 1000;
$min_thread = $max_thread_id - $limit;
$result = get_thread_starts($min_thread_id, $max_thread_id);
print "<P>";
print '<div id="threads">';
$content = array();
$last_thread = -1;
$msgs = print_threads_ex($result, $content, $last_thread, $limit);
print_msgs($content, $msgs);
print '</div>';
print_pages($max_page, $page, 'contents', $cur_page);
print '<BR><a href="#up" target="contents">Up</a>';
print '&nbsp;&nbsp;<a href="javascript:load_threads(document.getElementById(\'threads\'), ' . $last_thread . ',\'yes\');" target="contents">More</a>';
autoload_threads($last_thread, "yes");
?>
<table cellpadding=1 cellspacing=0 width="90%">
  <tr>
    <td align="left">
Ejemplo n.º 3
0
<?php

/*$Id: top.php 944 2013-09-02 00:46:16Z dmitriy $*/
require_once 'head_inc.php';
require_once 'mysql_log.php';
if (isset($msg_id)) {
    get_show_hidden_and_ignored();
    $result = null;
    $last_thread = $msg_id;
    $content = array();
    $collapsed = isset($custom) && $custom == 'yes';
    if ($collapsed) {
        $limit = 50;
        // 50
        $min_thread = $last_thread - $limit;
        $result = get_thread_starts($min_thread, $last_thread - 1);
    } else {
        $limit = isset($custom) && is_numeric($custom) ? intval($custom) : 100;
        // 100
        $result = get_threads_ex($limit, $last_thread);
    }
    $msgs = print_threads_ex($result, $content, $last_thread, $limit, $collapsed);
    print "id={$last_thread}";
    print_msgs($content, $msgs);
}
require_once 'tail_inc.php';