Просмотр файла modules/forum/new_posts.php

Размер файла: 1.78Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
$locate	= 'in_forum';


$title = $lang->word('new_messages').' | '.$lang->word('forum');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('new_messages').' | '.$lang->word('forum'));
$topic_r = $db->query("SELECT * FROM `forum_pt` WHERE `time` > '". (time()-60*60*24) ."'")->rowCount();
$pages = new Paginator($topic_r, $ames);
if($topic_r == 0) {
	echo $tpl->div('menu', $lang->word('no_posts'));
} 
else {
		$topic_q = $db->query("SELECT * FROM `forum_pt` WHERE `time` > '". (time()-60*60*24) ."' ORDER BY time DESC LIMIT $start, $ames");
		while($topic = $topic_q->fetch()) {
		echo '<div class="menu">';
		$topic_u = $db->query("SELECT * FROM `forum_t` WHERE `id` = '". $topic['topic_id']."' LIMIT 1")->fetch();
		$topic_i = $db->query("SELECT * FROM `forum_pt` WHERE `id` = '". $topic['id']."' ORDER BY time ASC LIMIT 1")->fetch();
		$topic_a = $db->query("SELECT * FROM `forum_pt` WHERE `topic_id` = '". $topic_u['id']."' ORDER BY time DESC LIMIT 1")->fetch();
		echo ' '. output($topic['text']).'<br/> [<small class="gray">'. tnick($topic_i['user_id']).' / '. rtime($topic_i['time']).' / <a href="/forum/topic'. $topic['topic_id'] .'/?page=end">'. $topic_u['name'] .'</a> (<span class="green">+'. $db->query("SELECT id FROM `forum_pt` WHERE `topic_id` = '". $topic_u['id'] ."' AND `time` > '". (time()-60*60*24) ."'")->rowCount().'</span>)</small>]
		</div>';
	}
	$pages->view('/forum/new_posts/?');
}
$tpl->div('block', NAV . ' <a href="/forum/">'. $lang->word('forum') .'</a><br/>' . HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
?>