www.gusucode.com > 08CMS空白站群系统 3.3 繁体 UTF-8 > upload/include/parse/context.php

    <?php
!defined('M_COM') && exit('No Permission');
function context(&$tag,$temparr=array()){
	global $cotypes,$db,$tblprefix;
	if(empty($temparr['aid'])) return '';
	$sqlstr = "SELECT * FROM {$tblprefix}archives WHERE aid".(empty($tag['next']) ? "<" : ">").$temparr['aid']." AND checked=1";
	$vararr = array('chid' => 'chid','caid' => 'caid','mid' => 'mid');
	foreach($cotypes as $coid => $cotype){
		$cotype['sortable'] && $vararr['ccid'.$coid] = "cotype$coid";
	}
	foreach($vararr as $k => $v){
		if(!empty($tag[$k]) && !empty($temparr[$k])) $sqlstr .= " AND $v=".$temparr[$k];
	}
	if(!$item = $db->fetch_one($sqlstr." ORDER BY aid ".(empty($tag['next']) ? "DESC" : "ASC")." LIMIT 0,1")) return '';
	//需要处理arcurl
	$item['arcurl'] = view_arcurl($item);
	$template = $tag['template'];
	nreplace($template,'c',$temparr);
	nreplace($template,'u',$item);
	nreplace($template,'b',$item);
	return $template;
}
?>