织梦dedecms修改include/arc.listview.class.php,以下是修改后的文件
代码如下:
require_once(DEDEINC.’/arc.partview.class.php’);
require_once(DEDEINC.’/ftp.class.php’);
helper(‘cache’);
@set_time_limit(0);
class ListView
{
var $dsql;
var $dtp;
var $dtp2;
var $TypeID;
var $Typelink;
var $PageNo;
var $TotalPage;
var $TotalResult;
var $PageSize;
var $ChannelUnit;
var $ListType;
var $Fields;
var $PartView;
var $upPageType;
var $addSql;
var $IsError;
var $CrossID;
var $IsReplace;
var $ftp;
var $remoteDir;
var $Noflag;
function __construct($typeid, $uppage=1)
{
global $dsql,$ftp;
$this->TypeID = $typeid;
$this->dsql = &$dsql;
$this->CrossID = ”;
$this->IsReplace = false;
$this->IsError = false;
$this->dtp = new DedeTagParse();
$this->dtp->SetRefObj($this);
$this->dtp->SetNameSpace(“dede”, “{“, “}”);
$this->dtp2 = new DedeTagParse();
$this->dtp2->SetNameSpace(“field”,”[“,”]”);
$this->Typelink = new Typelink($typeid);
$this->upPageType = $uppage;
$this->ftp = &$ftp;
$this->remoteDir = ”;
$this->TotalResult = is_numeric($this->TotalResult)? $this->TotalResult : “”;
if(!is_array($this->Typelink->TypeInfos))
{
$this->IsError = true;
}
if(!$this->IsError)
{
$this->ChannelUnit = new ChannelUnit($this->Typelink->TypeInfos[‘channeltype’]);
$this->Fields = $this->Typelink->TypeInfos;
$this->Fields[‘id’] = $typeid;
$this->Fields[‘position’] = $this->Typelink->GetPositionlink(true);
$this->Fields[‘title’] = preg_replace(“/[<>]/”, ” / “, $this->Typelink->GetPositionlink(false));
//设置一些全局参数的值
foreach($GLOBALS[‘PubFields’] as $k=>$v) $this->Fields[$k] = $v;
$this->Fields[‘rsslink’] = $GLOBALS[‘cfg_cmsurl’].”/data/rss/”.$this->TypeID.”.xml”;
//设置环境变量
SetSysEnv($this->TypeID,$this->Fields[‘typename’],0,”,’list’);
$this->Fields[‘typeid’] = $this->TypeID;
//获得交叉栏目ID
if($this->Typelink->TypeInfos[‘cross’]>0 && $this->Typelink->TypeInfos[‘ispart’]==0)
{
$selquery = ”;
if($this->Typelink->TypeInfos[‘cross’]==1)
{
$selquery = “SELECT id,topid FROM `dede_arctype` WHERe typename LIKE ‘{$this->Fields[‘typename’]}’ AND id<>'{$this->TypeID}’ AND topid<>'{$this->TypeID}’ “;
}
else
{
$this->Fields[‘crossid’] = preg_replace(‘/[^0-9,]/’, ”, trim($this->Fields[‘crossid’]));
if($this->Fields[‘crossid’]!=”)
{
$selquery = “SELECT id,topid FROM `dede_arctype` WHERe id in({$this->Fields[‘crossid’]}) AND id<>{$this->TypeID} AND topid<>{$this->TypeID} “;
}
}
if($selquery!=”)
{
$this->dsql->SetQuery($selquery);
$this->dsql->Execute();
while($arr = $this->dsql->GetArray())
{
$this->CrossID .= ($this->CrossID==” ? $arr[‘id’] : ‘,’.$arr[‘id’]);
}
}
}
}//!error
}
//php4构造函数
function ListView($typeid,$uppage=0){
$this->__construct($typeid,$uppage);
}
//关闭相关资源
function Close()
{ }
function CountRecord()
{
global $cfg_list_son,$cfg_need_typeid2,$cfg_cross_sectypeid;
if(empty($cfg_need_typeid2)) $cfg_need_typeid2 = ‘N’;
//统计数据库记录
$this->TotalResult = -1;
if(isset($GLOBALS[‘TotalResult’])) $this->TotalResult = $GLOBALS[‘TotalResult’];
if(isset($GLOBALS[‘PageNo’])) $this->PageNo = $GLOBALS[‘PageNo’];
else $this->PageNo = 1;
$this->addSql = ” arc.arcrank > -1 “;
$typeid2like = ” ‘%,{$this->TypeID},%’ “;
if($cfg_list_son==’N’)
{
if($cfg_need_typeid2==’N’)
{
if($this->CrossID==”) $this->addSql .= ” AND (arc.typeid='”.$this->TypeID.”‘) “;
else $this->addSql .= ” AND (arc.typeid in({$this->CrossID},{$this->TypeID})) “;
}
else
{
if($this->CrossID==”)
{
$this->addSql .= ” AND ( (arc.typeid='”.$this->TypeID.”‘) OR CONCAt(‘,’, arc.typeid2, ‘,’) LIKE $typeid2like) “;
} else {
if($cfg_cross_sectypeid == ‘Y’)
{
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)