<?php 
defined('IN_TS') or die('Access Denied.'); 

function newtopic(){
	global $db;
	//这里不应该显示最新帖子，这里应该显示干货好让，蜘蛛爬
	$page = isset($_GET['newtopic_page']) ? intval($_GET['newtopic_page']) : 1;
	$url = SITE_URL.'index.php?newtopic_page=';
	$lstart = $page*20-20;
	$topicNum = aac('group')->findCount('group_topic');
	$pageUrl = pagination($topicNum, 20, $page, $url);
	$arrTopic = aac('group')->findAll('group_topic',array(
		'isaudit'=>0,
	),'addtime desc','topicid,userid,groupid,title,gaiyao,label,count_comment,count_view,uptime',$lstart.',20');
	
	foreach($arrTopic as $key=>$item){
			$arrTopic[$key]['title']=tsTitle($item['title']);
			$arrTopic[$key]['gaiyao']=tsTitle($item['gaiyao']);
			$arrTopic[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
			$arrTopic[$key]['group'] = aac('group')->getOneGroup($item['groupid']);
			$arrTopic[$key]['photos'] = aac('group')->getTopicPhoto($item['topicid'],3);
	}

	include template('newtopic','newtopic');
	
}

function newtopic_css(){

	echo '<link href="'.SITE_URL.'plugins/home/newtopic/style.css?v=201812251839" rel="stylesheet" type="text/css" />';

}

addAction('home_index_left','newtopic');
addAction('pub_header_top','newtopic_css');
