[PHP] 纯文本查看 复制代码
function articlelist($mark='',$ispage=true,$pagebtn=2,$auto=true,$bcat=0,$scat='',$lcat='',$size=0,$star=0,$word='',$order='',$searfie='title'){
global $web,$tcz;
if($mark=='special'){
if(!$size)$size=$web['list_size'];
$sql='select * from '.tabname('special_list').' where webid='.$web['id'].' and isdel=0 and special_id='.$tcz['id'].' order by dataid desc';
$spelist=db_getpage($sql,$size,$tcz['page'],'',goif($web['mobiletemp'],'mobile'),$pagebtn);
$list=array();
$web['list_record']=$spelist['num'];
$web['list_page']=$spelist['page'];
foreach($spelist['list'] as $spe){
$tname='article';
if($spe['modtype']>10)$tname.='_'.$web['id'].'_'.$spe['modtype'];
$art=db_getshow($tname,'*','webid='.$web['id'].' and isok=0 and dataid='.$spe['dataid']);
array_push($list,$art);
}
return $list;
}
$order_text='xu desc,sort desc,time_add desc,dataid desc';
if($order!='')$order_text=$order;
$tname='article';
$modtype=db_getone('module','modtype','webid='.$web['id'].goif($bcat,' and classid='.$bcat).goif($mark!='',' and mark="'.$mark.'"'));
if($modtype>10)$tname.='_'.$web['id'].'_'.$modtype;
$searsql='';
$seartype='title';
if($web['list_page']!='')$ispage=false;
if($ispage){
if($word=='')$word=$tcz['word'];
if($word!=''){
switch($tcz['seartype']){
case 'date':
$t1=strtotime($word.' 00:00:00');
$t2=strtotime($word.' 23:59:59');
if(empty($t1)){
tipmsg('非法的搜索关键词:'.$word,true);
}
$searsql=' and time_add>='.$t1.' and time_add<='.$t2;
break;
default:
if($tcz['seartype']!=''){
if(strstr(','.$searfie.',',','.$tcz['seartype'].','))$seartype=$tcz['seartype'];
}
if(strstr($word,',')){
$wlist=explode(',',$word);
foreach($wlist as $w)$searsql.=goif($searsql!='',' or ').'LOCATE("'.$w.'",`'.$seartype.'`)>0';
$searsql=' and ('.$searsql.')';
}else $searsql=' and LOCATE("'.$word.'",`'.$seartype.'`)>0';
break;
}
}
if(!$size)$size=$web['list_size'];
if(!$bcat&&$tcz['bcat']&&$mark==''&&$auto)$bcat=$tcz['bcat'];
if($scat==''&&$tcz['scat']&&$auto)$scat=$tcz['scat'];
if($lcat==''&&$tcz['lcat']&&$auto)$lcat=$tcz['lcat'];
$sql='select *,if(time_top>'.time().',1,0) as xu from '.tabname($tname).' where webid='.$web['id'].' and isok=0 and '.goif($web['mobiletemp'],'mobile','computer').'=0 and languages="'.$web['templang'].'"'.goif($star,goif($star==9,' and star>0',' and star='.$star)).goif($mark!='',' and mark="'.$mark.'"').goif($bcat,' and bcat='.$bcat).goif($scat!='',' and scat in('.$scat.')').goif($lcat!='',' and lcat in('.$lcat.')').goif($searsql!='',$searsql).' order by '.$order_text;
$list=db_getpage($sql,$size,$tcz['page'],'',goif($web['mobiletemp'],'mobile'),$pagebtn);
$web['list_record']=$list['num'];
$web['list_page']=$list['page'];
return $list['list'];
}else{
$sql='select *,if(time_top>'.time().',1,0) as xu from '.tabname($tname).' where webid='.$web['id'].' and isok=0 and '.goif($web['mobiletemp'],'mobile','computer').'=0 and languages="'.$web['templang'].'"'.goif($star,goif($star==9,' and star>0',' and star='.$star)).goif($mark!='',' and mark="'.$mark.'"').goif($bcat,' and bcat='.$bcat).goif($scat!='',' and scat in('.$scat.')').goif($lcat!='',' and lcat in('.$lcat.')').goif($word!='',' and LOCATE("'.$word.'",`'.$seartype.'`)>0').' order by '.$order_text;
$list=db_getlist($sql,$size);
return $list;
}
}