function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250, $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc') { global $cfg_list_son; $t1 = ExecTime(); $getrow = ($row=="" ? 10 : $row); if($limitstart=="") $limitstart = 0; if($titlelen=="") $titlelen = 100; if($infolen=="") $infolen = 250; if($imgwidth=="") $imgwidth = 120; if($imgheight=="") $imgheight = 120; if($listtype=="") $listtype = "all"; if($orderby=="") $orderby="default"; else $orderby=strtolower($orderby); if($orderWay=='') $orderWay = 'desc'; $tablewidth = str_replace("%","",$tablewidth); if($tablewidth=="") $tablewidth=100; if($col=="") $col=1; $colWidth = ceil(100/$col); $tablewidth = $tablewidth."%"; $colWidth = $colWidth."%"; $innertext = trim($innertext); if($innertext=="") $innertext = GetSysTemplets("list_fulllist.htm"); $idlists = ''; $this->dsql->SetQuery("Select aid From #@__tag_list where tid='{$this->TagID}' And arcrank>-1 limit $limitstart,$getrow"); //echo "Select aid From #@__tag_list where tid='{$this->TagID}' And arcrank>-1 limit $limitstart,$getrow"; $this->dsql->Execute(); while($row=$this->dsql->GetArray()){ $idlists .= ($idlists=='' ? $row['aid'] : ','.$row['aid']); } if($idlists=='') return ''; //按不同情况设定SQL条件 $orwhere = " se.aid in($idlists) "; //排序方式 $ordersql = ""; if($orderby=="uptime") $ordersql = " order by se.uptime $orderWay"; else $ordersql=" order by se.aid $orderWay"; //---------------------------- $query = "Select se.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl from `#@__full_search` se left join `#@__arctype` tp on se.typeid=tp.ID where $orwhere $ordersql "; $this->dsql->SetQuery($query); $this->dsql->Execute('al'); echo $this->dsql->GetError(); $artlist = ""; if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n"; $this->dtp2->LoadSource($innertext); if(!is_array($this->dtp2->CTags)) return ''; $GLOBALS['autoindex'] = 0; for($i=0;$i<$getrow;$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 = $this->dsql->GetArray('al',MYSQL_ASSOC)) { $GLOBALS['autoindex']++; //处理一些特殊字段 $row['id'] = $row['aid']; $row['arcurl'] = $row['url']; $row['typeurl'] = $this->GetListUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],"abc"); if($ismake==0 && $GLOBALS['cfg_multi_site']=='Y') { if($row['litpic']==''){ $row['litpic'] = $GLOBALS['cfg_mainsite'].$GLOBALS['cfg_plus_dir']."/img/dfpic.gif"; } else if(!eregi("^http://",$row['picname'])){ $row['litpic'] = $row['siteurl'].$row['litpic']; } $row['picname'] = $row['litpic']; }else { if($row['litpic']=='') $row['litpic'] = $GLOBALS['cfg_plus_dir']."/img/dfpic.gif"; } $row['description'] = cnw_left($row['addinfos'],$infolen); $row['picname'] = $row['litpic']; $row['info'] = $row['description']; $row['filename'] = $row['arcurl']; $row['uptime'] = GetDateMK($row['uptime']); $row['typelink'] = "<a href='".$row['typeurl']."'>[".$row['typename']."]</a>"; $row['imglink'] = "<a href='".$row['filename']."'><img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'></a>"; $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'>"; $row['title'] = cn_substr($row['title'],$titlelen); $row['textlink'] = "<a href='".$row['filename']."' title='".str_replace("'","",$row['title'])."'>".$row['title']."</a>"; foreach($this->dtp2->CTags as $k=>$ctag) { if(isset($row[$ctag->GetName()])) $this->dtp2->Assign($k,$row[$ctag->GetName()]); else $this->dtp2->Assign($k,""); } $artlist .= $this->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"; $this->dsql->FreeResult("al"); return $artlist; }
function GetList($limitstart,$ismake=1) { global $cfg_list_son; $col = $this->ListObj->GetAtt('col'); if(empty($col)) $col = 1; $titlelen = $this->ListObj->GetAtt('titlelen'); $infolen = $this->ListObj->GetAtt('infolen'); $imgwidth = $this->ListObj->GetAtt('imgwidth'); $imgheight = $this->ListObj->GetAtt('imgheight'); $titlelen = AttDef($titlelen,60); $infolen = AttDef($infolen,250); $imgwidth = AttDef($imgwidth,80); $imgheight = AttDef($imgheight,80); $innertext = trim($this->ListObj->GetInnerText()); if(empty($innertext)) $innertext = GetSysTemplets("list_fulllist.htm"); $tablewidth=100; if($col=="") $col=1; $colWidth = ceil(100/$col); $tablewidth = $tablewidth."%"; $colWidth = $colWidth."%"; //按不同情况设定SQL条件 $orwhere = " arc.arcrank > -1 And channel>-1 "; $typeid = $this->ListObj->GetAtt('typeid'); $subday = $this->ListObj->GetAtt('subday'); $listtype = $this->ListObj->GetAtt('type'); $att = $this->ListObj->GetAtt('att'); $channelid = $this->ListObj->GetAtt('channel'); if(empty($channelid)) $channelid = 0; //是否指定栏目条件 if(!empty($typeid)){ if($cfg_list_son=='N') $orwhere .= " And (arc.typeid='$typeid' or arc.typeid2='$typeid') "; else $orwhere .= " And (".$this->TypeLink->GetSunID($typeid,"arc",$this->Fields['channeltype'])." Or arc.typeid2='$typeid') "; } //自定义属性条件 if($att!="") $orwhere .= "And arc.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 "; if(!empty($subday)){ $starttime = time() - $subday; $orwhere .= " And arc.senddate > $starttime "; } $keyword = $this->ListObj->GetAtt('keyword'); if(!empty($keyword)) $orwhere .= " And CONCAT(arc.title,arc.keywords) REGEXP '$keyword' "; $orderby = $this->ListObj->GetAtt('orderby'); $orderWay = $this->ListObj->GetAtt('orderway'); //排序方式 $ordersql = ""; if($orderby=="senddate") $ordersql=" order by arc.senddate $orderWay"; else if($orderby=="pubdate") $ordersql=" order by arc.pubdate $orderWay"; else if($orderby=="id") $ordersql=" order by arc.ID $orderWay"; else if($orderby=="hot"||$orderby=="click") $ordersql = " order by arc.click $orderWay"; else if($orderby=="lastpost") $ordersql = " order by arc.lastpost $orderWay"; else if($orderby=="postnum") $ordersql = " order by arc.postnum $orderWay"; else if($orderby=="rand") $ordersql = " order by rand()"; else $ordersql=" order by arc.sortrank $orderWay"; //获得附加表的相关信息 //----------------------------- $addField = ""; $addJoin = ""; if(is_object($this->ChannelUnit)){ $addtable = $this->ChannelUnit->ChannelInfos['addtable']; if($addtable!=""){ $addJoin = " left join $addtable on arc.ID = ".$addtable.".aid "; $addField = ""; $fields = explode(",",$this->ChannelUnit->ChannelInfos['listadd']); foreach($fields as $k=>$v){ $nfields[$v] = $k; } foreach($this->ChannelUnit->ChannelFields as $k=>$arr){ if(isset($nfields[$k])){ if($arr['rename']!="") $addField .= ",".$addtable.".".$k." as ".$arr['rename']; else $addField .= ",".$addtable.".".$k; } } } } // //---------------------------- $query = "Select arc.ID,arc.title,arc.iscommend,arc.color, arc.typeid,arc.ismake,arc.money,arc.description,arc.shorttitle, arc.memberid,arc.writer,arc.postnum,arc.lastpost, arc.pubdate,arc.senddate,arc.arcrank,arc.click,arc.litpic, tp.typedir,tp.typename,tp.isdefault,tp.defaultname, tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl $addField from {$this->maintable} arc left join #@__arctype tp on arc.typeid=tp.ID $addJoin where $orwhere $ordersql limit $limitstart,".$this->PageSize; $this->dsql->SetQuery($query); $this->dsql->Execute("al"); $artlist = ""; if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n"; $indtp = new DedeTagParse(); $indtp->SetNameSpace("field","[","]"); $indtp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; for($i=0;$i<$this->PageSize;$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 = $this->dsql->GetArray("al")) { $GLOBALS['autoindex']++; //处理一些特殊字段 $row['id'] = $row['ID']; $row['arcurl'] = $this->GetArcUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money']); $row['typeurl'] = $this->GetListUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],"abc"); if($ismake==0 && $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['description'] = cnw_left($row['description'],$infolen); if($row['litpic']=="") $row['litpic'] = $GLOBALS['cfg_plus_dir']."/img/dfpic.gif"; $row['picname'] = $row['litpic']; $row['info'] = $row['description']; $row['filename'] = $row['arcurl']; $row['stime'] = GetDateMK($row['pubdate']); $row['textlink'] = "<a href='".$row['filename']."' title='".str_replace("'","",$row['title'])."'>".$row['title']."</a>"; $row['typelink'] = "<a href='".$row['typeurl']."'>[".$row['typename']."]</a>"; $row['imglink'] = "<a href='".$row['filename']."'><img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'></a>"; $row['image'] = "<img src='".$row['picname']."' border='0' width='$imgwidth' height='$imgheight' alt='".str_replace("'","",$row['title'])."'>"; $row['phpurl'] = $GLOBALS['cfg_plus_dir']; $row['plusurl'] = $GLOBALS['cfg_plus_dir']; $row['templeturl'] = $GLOBALS['cfg_templets_dir']; $row['memberurl'] = $GLOBALS['cfg_member_dir']; $row['title'] = cn_substr($row['title'],$titlelen); 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>"; //编译附加表里的数据 if(is_object($this->ChannelUnit)){ foreach($row as $k=>$v){ if(ereg("[A-Z]",$k)) $row[strtolower($k)] = $v; } foreach($this->ChannelUnit->ChannelFields as $k=>$arr){ if(isset($row[$k])) $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]); } } //--------------------------- //解析单条记录 //------------------------- if(is_array($indtp->CTags)){ foreach($indtp->CTags as $k=>$ctag){ $_f = $ctag->GetName(); if(isset($row[$_f])) $indtp->Assign($k,$row[$_f]); else $indtp->Assign($k,""); } } $artlist .= $indtp->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"; $this->dsql->FreeResult("al"); return $artlist; }
function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250, $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100") { $typeid=$this->TypeID; if($row=="") $row = 10; if($limitstart=="") $limitstart = 0; if($titlelen=="") $titlelen = 30; if($infolen=="") $infolen = 250; if($imgwidth=="") $imgwidth = 120; if($imgheight=="") $imgheight = 120; if($listtype=="") $listtype = "all"; if($orderby=="") $orderby="default"; else $orderby=strtolower($orderby); $tablewidth = str_replace("%","",$tablewidth); if($tablewidth=="") $tablewidth=100; if($col=="") $col=1; $colWidth = ceil(100/$col); $tablewidth = $tablewidth."%"; $colWidth = $colWidth."%"; $innertext = trim($innertext); if($innertext=="") $innertext = GetSysTemplets("spec_list.htm"); //按不同情况设定SQL条件 $orwhere = " arcs.arcrank > -1 And arcs.channel = -1 "; if($this->StartTime>0) $orwhere .= " And arcs.senddate>'".$this->StartTime."'"; //排序方式 $ordersql = ""; if($orderby=="senddate") $ordersql=" order by arcs.senddate desc"; else if($orderby=="pubdate") $ordersql=" order by arcs.pubdate desc"; else if($orderby=="id") $ordersql=" order by arcs.ID desc"; else $ordersql=" order by arcs.sortrank desc"; // //---------------------------- $query = "Select arcs.ID,arcs.title,arcs.typeid,arcs.ismake, arcs.description,arcs.pubdate,arcs.senddate,arcs.arcrank, arcs.click,arcs.postnum,arcs.lastpost,arcs.money,arcs.litpic,t.typedir,t.typename,t.isdefault, t.defaultname,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl from `#@__archivesspec` arcs left join #@__arctype t on arcs.typeid=t.ID where $orwhere $ordersql limit $limitstart,$row"; $this->dsql->SetQuery($query); $this->dsql->Execute("al"); $artlist = ""; if($col>1) $artlist = "<table width='$tablewidth' border='0' cellspacing='0' cellpadding='0'>\r\n"; $this->dtp2->LoadSource($innertext); for($i=0;$i<$row;$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 = $this->dsql->GetArray("al")) { //处理一些特殊字段 $row["description"] = cnw_left($row["description"],$infolen); $row["title"] = cnw_left($row["title"],$titlelen); $row["id"] = $row["ID"]; if($row["litpic"]=="") $row["litpic"] = $GLOBALS["cfg_plus_dir"]."/img/dfpic.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"] = $this->GetListUrl($row["typeid"],$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["textlink"] = "<a href='".$row["filename"]."'>".$row["title"]."</a>"; $row["typelink"] = "[<a href='".$row["typeurl"]."'>".$row["typename"]."</a>]"; $row["imglink"] = "<a href='".$row["filename"]."'><img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'></a>"; $row["image"] = "<img src='".$row["picname"]."' border='0' width='$imgwidth' height='$imgheight'>"; $row["phpurl"] = $GLOBALS["cfg_plus_dir"]; $row["templeturl"] = $GLOBALS["cfg_templets_dir"]; $row["memberurl"] = $GLOBALS["cfg_member_dir"]; //编译附加表里的数据 foreach($this->ChannelUnit->ChannelFields as $k=>$arr){ if(isset($row[$k])) $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]); } //--------------------------- if(is_array($this->dtp2->CTags)){ foreach($this->dtp2->CTags as $k=>$ctag){ if(isset($row[$ctag->GetName()])) $this->dtp2->Assign($k,$row[$ctag->GetName()]); else $this->dtp2->Assign($k,""); } } $artlist .= $this->dtp2->GetResult(); }//if hasRow else{ $artlist .= ""; } if($col>1) $artlist .= "</td>\r\n"; }//Loop Col if($col>1) $artlist .= "</tr>\r\n"; }//Loop Line if($col>1) $artlist .= "</table>\r\n"; $this->dsql->FreeResult("al"); return $artlist; }