function GetSunID($typeid=-1,$tb="#@__archives",$channel=0,$idlist=false){ $ids = TypeGetSunID($typeid,$this->dsql,$tb,$channel,$idlist); return $ids; }
} if ($enddate != '') { $endtime = strtotime($enddate); } else { $endtime = 0; } $where = ' WHERE main.arcrank>-1 '; if ($q != '') { $where .= " AND main.title LIKE '%{$q}%' "; } if ($iscommend == 1) { $where .= " AND FIND_IN_SET('c', main.flag)>0 "; } if (!empty($typeid)) { if ($includesons == 1) { $tids = TypeGetSunID($typeid, $dsql, '', $mid, TRUE); $where .= " AND main.typeid IN ({$tids}) "; } else { $where .= " AND main.typeid={$typeid} "; } } else { $where .= " AND main.channel = {$mid} "; } if ($writer != '') { $writer = stripslashes($writer); $writer = preg_replace("#[\\|\"\r\n\t%\\*\\?\\(\\)\$;,'%<>]#", "", trim($writer)); $writer = addslashes($writer); $where .= " AND main.writer='{$writer}' "; } if ($source != '') { $source = stripslashes($source);
header("Content-Type: text/html; charset={$cfg_ver_lang}"); $dsql = new DedeSql(false); //获取条件 //------------------------ $gwhere = " where arcrank=0 "; if($startid>0) $gwhere .= " And aid >= $startid "; if($endid > $startid) $gwhere .= " And aid <= $endid "; /* if(!empty($onlymake)){ $gwhere .= " and ismake=0 "; } */ if($typeid!=0){ $typeids = TypeGetSunID($typeid,$dsql,"",0,true); $gwhere .= " And typeid in ($typeids)"; } if($uptype=='time'){ $gwhere .= " And uptime >= '$mkvalue' "; } //统计记录总数 //------------------------ if($totalnum==0) { $row = $dsql->GetOne("Select count(*) as dd From `#@__full_search` $gwhere"); $totalnum = $row['dd']; } //获取记录,并生成HTML
function SpGetArcList($dsql,$typeid=0,$row=10,$col=1,$titlelen=30,$infolen=160, $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$keyword="",$innertext="", $tablewidth="100",$arcid=0,$idlist="",$channelid=0,$limit="",$att=0,$order="desc",$subday=0) { global $PubFields; $row = AttDef($row,10); $titlelen = AttDef($titlelen,30); $infolen = AttDef($infolen,160); $imgwidth = AttDef($imgwidth,120); $imgheight = AttDef($imgheight,120); $listtype = AttDef($listtype,"all"); $arcid = AttDef($arcid,0); $channelid = AttDef($channelid,0); $orderby = AttDef($orderby,"default"); $orderWay = AttDef($order,"desc"); $subday = AttDef($subday,0); $line = $row; $orderby=strtolower($orderby); $tablewidth = str_replace("%","",$tablewidth); if($tablewidth=="") $tablewidth=100; if($col=="") $col = 1; $colWidth = ceil(100/$col); $tablewidth = $tablewidth."%"; $colWidth = $colWidth."%"; $keyword = trim($keyword); $innertext = trim($innertext); if($innertext=="") $innertext = GetSysTemplets("part_arclist.htm"); //按不同情况设定SQL条件 排序方式 $orwhere = " arc.arcrank > -1 "; //时间限制(用于调用最近热门文章、热门评论之类) if($subday>0){ $limitday = time() - ($oneday * 24 * 3600); $orwhere .= " And arc.senddate > $limitday "; } //文档的自定义属性 if($att!="") $orwhere .= "And arcatt='$att' "; //文档的频道模型 if($channelid>0 && !eregi("spec",$listtype)) $orwhere .= " And arc.channel = '$channelid' "; //是否为推荐文档 if(eregi("commend",$listtype)) $orwhere .= " And arc.iscommend > 10 "; //是否为带缩略图图片文档 if(eregi("image",$listtype)) $orwhere .= " And arc.litpic <> '' "; //是否为专题文档 if(eregi("spec",$listtype) || $channelid==-1) $orwhere .= " And arc.channel = -1 "; //是否指定相近ID if($arcid!=0) $orwhere .= " And arc.ID<>'$arcid' "; //文档排序的方式 $ordersql = ""; if($orderby=="hot"||$orderby=="click") $ordersql = " order by arc.click $orderWay"; else if($orderby=="pubdate") $ordersq = " order by arc.pubdate $orderWay"; else if($orderby=="sortrank") $ordersq = " order by arc.sortrank $orderWay"; else if($orderby=="id") $ordersql = " order by arc.ID $orderWay"; else if($orderby=="near") $ordersql = " order by ABS(arc.ID - ".$arcid.")"; else if($orderby=="lastpost") $ordersql = " order by arc.lastpost $orderWay"; else if($orderby=="postnum") $ordersql = " order by arc.postnum $orderWay"; else $ordersql=" order by arc.senddate $orderWay"; //类别ID的条件,如果用 "," 分开,可以指定特定类目 //------------------------------ if($typeid!=0) { $reids = explode(",",$typeid); $ridnum = count($reids); if($ridnum>1){ $tpsql = ""; for($i=0;$i<$ridnum;$i++){ if($tpsql=="") $tpsql .= " And (".TypeGetSunID($reids[$i],$dsql,'arc'); else $tpsql .= " Or ".TypeGetSunID($reids[$i],$dsql,'arc'); } $tpsql .= ") "; $orwhere .= $tpsql; unset($tpsql); } else{ $orwhere .= " And ".TypeGetSunID($typeid,$dsql,'arc'); } unset($reids); } //指定的文档ID列表 //---------------------------------- if($idlist!="") { $reids = explode(",",$idlist); $ridnum = count($reids); $idlistSql = ""; for($i=0;$i<$ridnum;$i++){ if($idlistSql=="") $idlistSql .= " And ( arc.ID='".$reids[$i]."' "; else $idlistSql .= " Or arc.ID='".$reids[$i]."' "; } $idlistSql .= ") "; $orwhere .= $idlistSql; unset($idlistSql); unset($reids); $row = $ridnum; } //关键字条件 if($keyword!="") { $keywords = explode(",",$keyword); $ridnum = count($keywords); $orwhere .= " And (arc.keywords like '%".trim($keywords[0])." %' "; for($i=1;$i<$ridnum;$i++){ if($keywords[$i]!="") $orwhere .= " Or arc.keywords like '%".trim($keywords[$i])." %' "; } $orwhere .= ")"; unset($keywords); } $limit = trim(eregi_replace("limit","",$limit)); if($limit!="") $limitsql = " limit $limit "; else $limitsql = " limit 0,$line "; ////////////// $query = "Select arc.ID,arc.title,arc.iscommend,arc.color,arc.typeid,arc.ismake, arc.description,arc.pubdate,arc.senddate,arc.arcrank,arc.click,arc.money, arc.litpic,tp.typedir,tp.typename,tp.isdefault, tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl from #@__archives arc left join #@__arctype tp on arc.typeid=tp.ID where $orwhere $ordersql $limitsql"; $dsql->SetQuery($query); $dsql->Execute("al"); $artlist = ""; if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n"; $dtp2 = new DedeTagParse(); $dtp2->SetNameSpace("field","[","]"); $dtp2->LoadString($innertext); $GLOBALS['autoindex'] = 0; for($i=0;$i<$line;$i++) { if($col>1) $artlist .= "<tr>\r\n"; for($j=0;$j<$col;$j++) { if($col>1) $artlist .= " <td width='$colWidth'>\r\n"; if($row = $dsql->GetArray("al")) { //处理一些特殊字段 $row['description'] = cn_substr($row['description'],$infolen); $row['id'] = $row['ID']; file_put_contents("c:/ttt.txt",$row['id']); if($row['litpic']=="") $row['litpic'] = $PubFields['templeturl']."/img/default.gif"; $row['picname'] = $row['litpic']; $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'], $row['title'],$row['ismake'],$row['arcrank'],$row['namerule'], $row['typedir'],$row['money'],true,$row['siteurl']); $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']); $row['info'] = $row['description']; $row['filename'] = $row['arcurl']; $row['stime'] = GetDateMK($row['pubdate']); $row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>"; $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."'>"; $row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>"; $row['title'] = cn_substr($row['title'],$titlelen); $row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>"; if($row['color']!="") $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>"; if($row['iscommend']==5||$row['iscommend']==16) $row['title'] = "<b>".$row['title']."</b>"; $row['phpurl'] = $PubFields['phpurl']; $row['templeturl'] = $PubFields['templeturl']; if(is_array($dtp2->CTags)){ foreach($dtp2->CTags as $k=>$ctag){ if(isset($row[$ctag->GetName()])) $dtp2->Assign($k,$row[$ctag->GetName()]); else $dtp2->Assign($k,""); } $GLOBALS['autoindex']++; } $artlist .= $dtp2->GetResult()."\r\n"; }//if hasRow else{ $artlist .= ""; } if($col>1) $artlist .= " </td>\r\n"; }//Loop Col if($col>1) $i += $col - 1; if($col>1) $artlist .= " </tr>\r\n"; }//Loop Line if($col>1) $artlist .= " </table>\r\n"; $dsql->FreeResult("al"); return $artlist; }
function SpGetFullList(&$dsql,$typeid=0,$channelid=0,$row=10,$titlelen=30,$infolen=160, $keyword='',$innertext='',$idlist='',$limitv='',$ismember=0,$orderby='',$imgwidth=120,$imgheight=120) { global $cfg_maxsearch,$cfg_al_cachetime; $row = AttDef($row,10); $line = $row; $titlelen = AttDef($titlelen,30); $infolen = AttDef($infolen,160); $channelid = AttDef($channelid,0); $ismember = AttDef($ismember,0); $limitv = AttDef($limitv,''); $keyword = trim($keyword); $typeid = AttDef($typeid,''); $innertext = trim($innertext); $imgwidth = AttDef($imgwidth,120); $imgheight = AttDef($imgheight,120); $orderby = trim($orderby); if($innertext=="") $innertext = GetSysTemplets("part_arclist.htm"); if(empty($idlist)) $idlist = ''; else $idlist = ereg_replace("[^,0-9]","",$idlist); $orwhere = ''; $mintime = time() - ($cfg_al_cachetime * 3600); //指定的文档ID列表,通常是专题和相关文章,使用了idlist将不启用后面任何条件 $idlist = trim($idlist); if($idlist!='') { $orwhere .= " arcf.aid in ($idlist) And arcf.arcrank > -1 "; } //没使用idlist才启用这些条件 else { //按不同情况设定SQL条件 排序方式 $orwhere .= " arcf.arcrank > -1 "; //文档的频道模型 if(!empty($channelid)) $orwhere .= " And arcf.channelid = '$channelid' "; //是否为会员文档 if($ismember==1) $orwhere .= " And arcf.memberid>0 "; //指定栏目条件,如果用 "," 分开,可以指定特定类目 if(!empty($typeid) && empty($idlist)) { $reids = explode(",",$typeid); $ridnum = count($reids); if($ridnum>1){ $tpsql = ""; for($i=0;$i<$ridnum;$i++) { $sonids = TypeGetSunID($reids[$i],$dsql,'arc',0,true); $tpsql .= ($tpsql=='' ? $sonids : ','.$sonids); } $tpsql = " And arcf.typeid in ($tpsql) "; $orwhere .= $tpsql; unset($tpsql); }else{ $sonids = TypeGetSunID($typeid,$dsql,'arc',0,true); if(ereg(',',$sonids)) $orwhere .= " And arcf.typeid in ($sonids) "; else $orwhere .= " And arcf.typeid=$sonids "; } unset($reids); } //指定了关键字条件 if($keyword!="") { $keywords = explode(",",$keyword); $ridnum = count($keywords); $rstr = trim($keywords[0]); if($ridnum>4) $ridnum = 4; for($i=1;$i < $ridnum;$i++){ $keywords[$i] = trim($keywords[$i]); if($keywords[$i]!="") $rstr .= "|".$keywords[$i]; } if($rstr!="") $orwhere .= " And CONCAT(arcf.title,arcf.keywords) REGEXP '$rstr' "; unset($keywords); } }//没使用idlist才启用这些条件 //文档排序的方式 $ordersql = ""; if($orderby=='rand') $ordersql = " order by rand()"; else if($orderby=='click'||$orderby=='hot') $ordersql = " order by arcf.click desc"; else if($orderby=='digg') $ordersql = " order by arcf.digg desc"; else if($orderby=='diggtime') $ordersql = " order by arcf.diggtime desc"; else $ordersql=" order by arcf.aid desc"; //返回结果条数 if(!empty($limit)) $limitsql = " limit $limitv "; else $limitsql = " limit 0,$line "; //载入底层模板 $dtp2 = new DedeTagParse(); $dtp2->SetNameSpace("field","[","]"); $dtp2->LoadString($innertext); if(!is_array($dtp2->CTags)) return ''; //执行SQL查询 $query = "Select arcf.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl from `#@__full_search` arcf left join `#@__arctype` tp on arcf.typeid=tp.ID where $orwhere $ordersql $limitsql "; $md5hash = md5($query); $artlist = ''; $ids = ''; $needup = false; if($idlist=='' && $cfg_al_cachetime>0) { $ids = SpGetArclistDateCacheF($dsql,$md5hash); if($ids=='-1') $needup = true; else if($ids!='') { $query = "Select arcf.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl from `#@__full_search` arcf left join `#@__arctype` tp on arcf.typeid=tp.ID where arcf.aid in($ids) $ordersql $limitsql "; }else { return ''; } } $nids = array(); $t1 = ExecTime(); $dsql->SetQuery($query); $dsql->Execute("alf"); $GLOBALS['autoindex'] = 0; while($row = $dsql->GetArray("alf")) { //处理一些特殊字段 $row['description'] = cn_substr($row['addinfos'],$infolen); $nids[] = $row['id'] = $row['aid']; if(!isset($row['picname'])) $row['picname'] = ''; if($row['url']=='') $row['url'] = $GLOBALS['cfg_phpurl'].'/view.php?aid='.$row['aid']; $row['filename'] = $row['arcurl'] = $row['url']; $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']); if($row['litpic']=="") $row['litpic'] = $GLOBALS['PubFields']['templeturl']."/img/default.gif"; $row['picname'] = $row['litpic']; if($GLOBALS['cfg_multi_site']=='Y') { if($row['siteurl']=="") $row['siteurl'] = $GLOBALS['cfg_mainsite']; if(!eregi("^http://",$row['picname'])){ $row['litpic'] = $row['siteurl'].$row['litpic']; $row['picname'] = $row['litpic']; } } $row['stime'] = GetDateMK($row['uptime']); $row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>"; $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."' />"; $row['imglink'] = "<a href='".$row['arcurl']."'>".$row['image']."</a>"; $row['fulltitle'] = $row['title']; $row['title'] = cn_substr($row['title'],$titlelen); $row['textlink'] = "<a href='".$row['arcurl']."'>".$row['title']."</a>"; foreach($dtp2->CTags as $k=>$ctag) { if(isset($row[$ctag->GetName()])){ $dtp2->Assign($k,$row[$ctag->GetName()]); } else $dtp2->Assign($k,''); } $GLOBALS['autoindex']++; $artlist .= $dtp2->GetResult(); }//Loop Line $dsql->FreeResult("alf"); if($needup) { $ids = join(',',$nids); $inquery = "INSERT INTO `#@__arccache_full`(`md5hash`,`uptime`,`cachedata`) VALUES ('".$md5hash."', '".time()."', '$ids'); "; $dsql->ExecuteNoneQuery("Delete From `#@__arccache_full` where md5hash='".$md5hash."' or uptime < $mintime "); $dsql->ExecuteNoneQuery($inquery); } $t2 = ExecTime(); //echo "<hr>".($t2-$t1)." $query<hr>"; return $artlist; }
function SpGetArcList(&$dsql,$templets,$typeid=0,$row=10,$col=1,$titlelen=30,$infolen=160, $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$keyword="",$innertext="", $tablewidth="100",$arcid=0,$idlist="",$channelid=0,$limitv="",$att="",$order="desc", $subday=0,$ismember=0,$maintable='#@__archives',$ctag='',$isUpCache=true) { global $PubFields,$cfg_keyword_like,$cfg_arc_all,$cfg_needsontype,$cfg_maxsearch,$cfg_al_cachetime; $row = AttDef($row,10); $titlelen = AttDef($titlelen,30); $infolen = AttDef($infolen,160); $imgwidth = AttDef($imgwidth,120); $imgheight = AttDef($imgheight,120); $listtype = AttDef($listtype,"all"); $arcid = AttDef($arcid,0); //$att = AttDef($att,0); $channelid = AttDef($channelid,0); $ismember = AttDef($ismember,0); $orderby = AttDef($orderby,"default"); $orderWay = AttDef($order,"desc"); $maintable = AttDef($maintable,"#@__archives"); $subday = AttDef($subday,0); $line = $row; $orderby=strtolower($orderby); $tablewidth = str_replace("%","",$tablewidth); if($tablewidth=="") $tablewidth=100; if($col=="") $col = 1; $colWidth = ceil(100/$col); $tablewidth = $tablewidth."%"; $colWidth = $colWidth."%"; $keyword = trim($keyword); $innertext = trim($innertext); if($innertext=="") $innertext = GetSysTemplets("part_arclist.htm"); if(!empty($idlist) && ereg("[^0-9,]",$idlist)) $idlist = ''; $mintime = time() - ($cfg_al_cachetime * 3600); $orwhere = ''; //对于文章列表等地方的调用,限定为最新文档 $idlist = ereg_replace("[^,0-9]","",$idlist); if($idlist!='') $orwhere .= " arc.ID in ($idlist) And "; $t1 = ExecTime(); //按不同情况设定SQL条件 排序方式 $orwhere .= " arc.arcrank > -1 "; $addField = ""; $addJoin = ""; $channelinfos = ''; //获取主表 if(eregi('spec',$listtype)) $channelid = -1; if(!empty($typeid)) $reids = explode(',',$typeid); if(!empty($channelid)) { $channelinfos = $dsql->GetOne("Select ID,maintable,addtable,listadd From `#@__channeltype` where ID='$channelid' "); $maintable = $channelinfos['maintable']; }else if(!empty($typeid)) { $channelinfos = $dsql->GetOne("select c.ID,c.maintable,c.addtable,c.listadd from `#@__arctype` a left join #@__channeltype c on c.ID=a.channeltype where a.ID='".$reids[0]."' "); if(is_array($channelinfos)) { $maintable = $channelinfos['maintable']; $channelid = $channelinfos['ID']; } } if(trim($maintable)=='') $maintable = "#@__archives"; //时间限制(用于调用最近热门文章、热门评论之类) if($subday>0){ $limitvday = time() - ($subday * 24 * 3600); $orwhere .= " And arc.senddate > $limitvday "; } //文档的自定义属性 if($att!="") $orwhere .= " And arc.arcatt='$att' "; //文档的频道模型 if(!empty($channelid) && !eregi("spec",$listtype)) $orwhere .= " And arc.channel = '$channelid' "; //echo $orwhere.$channelid ; //是否为推荐文档 if(eregi("commend",$listtype)) $orwhere .= " And arc.iscommend > 10 "; //是否为带缩略图图片文档 if(eregi("image",$listtype)) $orwhere .= " And arc.litpic <> '' "; //是否为专题文档 if(eregi("spec",$listtype) || $channelid==-1) $orwhere .= " And arc.channel = -1 "; //是否指定相近ID if($arcid!=0) $orwhere .= " And arc.ID<>'$arcid' "; //是否为会员文档 if($ismember==1) $orwhere .= " And arc.memberid>0 "; if($cfg_keyword_like=='N'){ $keyword=""; } //类别ID的条件,如果用 "," 分开,可以指定特定类目 //------------------------------ if(!empty($typeid)) { $ridnum = count($reids); if($ridnum>1) { $sonids = ''; for($i=0;$i<$ridnum;$i++){ $sonids .= ($sonids=='' ? TypeGetSunID($reids[$i],$dsql,'arc',0,true) : ','.TypeGetSunID($reids[$i],$dsql,'arc',0,true)); } $orwhere .= " And arc.typeid in ($sonids) "; }else{ $sonids = TypeGetSunID($typeid,$dsql,'arc',0,true); $orwhere .= " And arc.typeid in ($sonids) "; } unset($reids); } //关键字条件 if($keyword!='') { $keywords = explode(",",$keyword); $ridnum = count($keywords); $rstr = trim($keywords[0]); if($ridnum>4) $ridnum = 4; for($i=0;$i<$ridnum;$i++){ $keywords[$i] = trim($keywords[$i]); if($keywords[$i]!="") $rstr .= "|".$keywords[$i]; } if($rstr!="") $orwhere .= " And CONCAT(arc.title,arc.keywords) REGEXP '$rstr' "; unset($keywords); } //获得附加表的相关信息 //----------------------------- if(is_array($channelinfos)) { $channelinfos['listadd'] = trim($channelinfos['listadd']); if($cfg_arc_all=='Y' && is_array($channelinfos) && $channelinfos['listadd']!='') { $addField = ''; $fields = explode(',',$channelinfos['listadd']); foreach($fields as $v) $addField .= ",addt.{$v}"; if($addField!='') $addJoin = " left join `{$channelinfos['addtable']}` addt on addt.aid = arc.ID "; } } //文档排序的方式 $ordersql = ""; if($orderby=='hot'||$orderby=='click') $ordersql = " order by arc.click $orderWay"; else if($orderby=='pubdate') $ordersql = " order by arc.pubdate $orderWay"; else if($orderby=='sortrank') $ordersql = " order by arc.sortrank $orderWay"; else if($orderby=='id') $ordersql = " order by arc.ID $orderWay"; else if($orderby=='near') $ordersql = " order by ABS(arc.ID - ".$arcid.")"; else if($orderby=='lastpost') $ordersql = " order by arc.lastpost $orderWay"; else if($orderby=='postnum') $ordersql = " order by arc.postnum $orderWay"; else if($orderby=='digg') $ordersql = " order by arc.digg $orderWay"; else if($orderby=='diggtime') $ordersql = " order by arc.diggtime $orderWay"; else if($orderby=='rand') $ordersql = " order by rand()"; else $ordersql=" order by arc.ID $orderWay"; if(!empty($limitv)) $limitvsql = " limit $limitv "; else $limitvsql = " limit 0,$line "; ////////////// $query = "Select arc.ID,arc.title,arc.iscommend,arc.color,arc.typeid,arc.channel, arc.ismake,arc.description,arc.pubdate,arc.senddate,arc.arcrank,arc.click,arc.digg,arc.diggtime, arc.money,arc.litpic,arc.writer,arc.shorttitle,arc.memberid,arc.postnum,arc.lastpost, tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule, tp.namerule2,tp.ispart,tp.moresite,tp.siteurl{$addField} from `$maintable` arc left join `#@__arctype` tp on arc.typeid=tp.ID $addJoin where $orwhere $ordersql $limitvsql "; //echo $query; //exit(); $md5hash = md5($query); $ids = ''; $needup = false; if($idlist=='' && $isUpCache && $cfg_al_cachetime>0) { $ids = SpGetArclistDateCache($dsql,$md5hash); if($ids=='-1') $needup = true; else if($ids!='') { $query = "Select arc.ID,arc.title,arc.iscommend,arc.color,arc.typeid,arc.channel, arc.ismake,arc.description,arc.pubdate,arc.senddate,arc.arcrank,arc.click,arc.digg,arc.diggtime, arc.money,arc.litpic,arc.writer,arc.shorttitle,arc.memberid,arc.postnum,arc.lastpost, tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule, tp.namerule2,tp.ispart,tp.moresite,tp.siteurl{$addField} from `$maintable` arc left join `#@__arctype` tp on arc.typeid=tp.ID $addJoin where arc.ID in($ids) $ordersql "; }else { return ''; } } $artlist = ""; $dsql->SetQuery($query); $dsql->Execute("al"); $dtp2 = new DedeTagParse(); $dtp2->SetNameSpace("field","[","]"); $dtp2->LoadString($innertext); $nids = array(); if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n"; $GLOBALS['autoindex'] = 0; for($i=0;$i<$line;$i++) { if($col>1) $artlist .= "<tr>\r\n"; for($j=0;$j<$col;$j++) { if($col>1) $artlist .= " <td width='$colWidth'>\r\n"; if($row = $dsql->GetArray("al",MYSQL_ASSOC)) { //处理一些特殊字段 $row['description'] = cn_substr($row['description'],$infolen); $nids[] = $row['id'] = $row['ID']; $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'], $row['title'],$row['ismake'],$row['arcrank'],$row['namerule'], $row['typedir'],$row['money'],true,$row['siteurl']); $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']); if($row['litpic']=="") $row['litpic'] = $PubFields['templeturl']."/img/default.gif"; $row['picname'] = $row['litpic']; if($GLOBALS['cfg_multi_site']=='Y'){ if($row['siteurl']=="") $row['siteurl'] = $GLOBALS['cfg_mainsite']; if(!eregi("^http://",$row['picname'])){ $row['litpic'] = $row['siteurl'].$row['litpic']; $row['picname'] = $row['litpic']; } } $row['info'] = $row['description']; $row['filename'] = $row['arcurl']; $row['stime'] = GetDateMK($row['pubdate']); $row['typelink'] = "<a href='".$row['typeurl']."'>".$row['typename']."</a>"; $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".ereg_replace("['><]","",$row['title'])."'>"; $row['imglink'] = "<a href='".$row['filename']."'>".$row['image']."</a>"; $row['title'] = cn_substr($row['title'],$titlelen); $row['textlink'] = "<a href='".$row['filename']."'>".$row['title']."</a>"; if($row['color']!="") $row['title'] = "<font color='".$row['color']."'>".$row['title']."</font>"; if($row['iscommend']==5||$row['iscommend']==16) $row['title'] = "<b>".$row['title']."</b>"; $row['phpurl'] = $PubFields['phpurl']; $row['templeturl'] = $PubFields['templeturl']; foreach($dtp2->CTags as $k=>$ctag){ @$dtp2->Assign($k,$row[$ctag->GetName()]); } $GLOBALS['autoindex']++; $artlist .= $dtp2->GetResult(); }//if hasRow else{ $artlist .= ''; } if($col>1) $artlist .= " </td>\r\n"; }//Loop Col if($col>1) $i += $col - 1; if($col>1) $artlist .= " </tr>\r\n"; }//Loop Line if($col>1) $artlist .= " </table>\r\n"; $dsql->FreeResult("al"); if($needup) { $ids = join(',',$nids); $inquery = "INSERT INTO `#@__arccache`(`md5hash`,`uptime`,`cachedata`) VALUES ('".$md5hash."', '".time()."', '$ids'); "; $dsql->ExecuteNoneQuery("Delete From `#@__arccache` where md5hash='".$md5hash."' or uptime < $mintime "); $dsql->ExecuteNoneQuery($inquery); } $t2 = ExecTime(); //echo ($t2-$t1).$query; //$debug = trim($artlist).'<li>'.($t2-$t1)." $query</li>"; return trim($artlist); }
} if ($enddate != '') { $endtime = strtotime($enddate); } else { $endtime = 0; } $where = ' where main.arcrank>-1 '; if ($q != '') { $where .= " and main.title like '%{$q}%' "; } if ($iscommend == 1) { $where .= " and FIND_IN_SET('c', main.flag)>0 "; } if (!empty($typeid)) { if ($includesons == 1) { $tids = TypeGetSunID($typeid, $dsql, '', $mid, true); $where .= " and main.typeid in ({$tids}) "; } else { $where .= " and main.typeid={$typeid} "; } } else { $where .= " and main.channel={$mid} "; } if ($writer != '') { $writer = stripslashes($writer); $writer = ereg_replace("[\\|\"\r\n\t%\\*\\?\\(\\)\$;,'%<>]", "", trim($writer)); $writer = addslashes($writer); $where .= " and main.writer='{$writer}' "; } if ($source != '') { $source = stripslashes($source);