super_query("SELECT COUNT(*) as count FROM ".PREFIX."_torrents as torrents, ".PREFIX."_post as post WHERE torrents.news_id=post.id AND post.approve=1"); $posts = $count_all['count']; if($posts){ $page = intval( $_REQUEST['cstart'] ); $total = intval( ( ( $posts - 1 ) / $limit ) + 1 ); if( $page <= 0 ) $page = 1; if( $page > $total ) $page = $total; $start = $page * $limit - $limit; $i = $start; $result = $db->query("SELECT torrents.news_id, torrents.ctime, torrents.leechers, torrents.seeders, torrents.completed, torrents.size, post.category, post.alt_name, post.title FROM ".PREFIX."_torrents as torrents, ".PREFIX."_post as post WHERE torrents.news_id=post.id AND post.approve=1 ORDER BY post.date DESC LIMIT " . $start . "," . $limit); while($row = $db->get_row($result)){ $i ++; $cat = "".$cat_info[$row['category']]['name'].""; $news_link = "".$row['title'].""; $top_table .= "$cat$news_link".$row['seeders']."".$row['leechers']."".$row['completed']."".mksize($row['size'])."".date("j.m.Y", $row['ctime']).""; } $tpl->load_template('tracker.tpl'); $tpl->set('{list}', $top_table); $tpl->compile( 'content' ); $tpl->clear(); $nav = "/tracker/page/{page}"; CreateNavigation( $nav, $page, $total ); $db->free($result); } else { msgbox("Ошибка", "Загруженные торренты отсутвуют"); } ?>