<?php /*$Id: collapsed.php 812 2012-10-15 23:22:28Z dmitriy $*/ require_once 'head_inc.php'; require_once 'html_head_inc.php'; $cur_page = $page_collapsed; $max_thread_id = 1; $max_page = get_max_pages_collapsed($max_thread_id); $min_page = 1; ?> <script language="JavaScript" src="<?php echo autoversion('js/autoload.js'); ?> "></script> <base target="contents"> </head> <body id="html_body"> <!--<table width="95%"><tr> <td>--> <!--</td> </td></tr></table> --> <?php require 'menu_inc.php'; $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;
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); }