Parcourir la source

Update listview.class.php

tags/6.5.6
tianya il y a 3 jours
Parent
révision
5e24fee439
1 fichiers modifiés avec 15 ajouts et 50 suppressions
  1. +15
    -50
      src/system/archive/listview.class.php

+ 15
- 50
src/system/archive/listview.class.php Voir le fichier

@@ -72,14 +72,6 @@ class ListView
$this->Fields['id'] = $typeid;
$this->Fields['position'] = $this->TypeLink->GetPositionLink(true);
$this->Fields['title'] = preg_replace("/[<>]/", "-", $this->TypeLink->GetPositionLink(false));
//添加联动单筛选
if (isset($_REQUEST['tid'])) {
foreach($_GET as $key => $value) {
if (!in_array($key,$this->_parms)) {
$this->Fields[$key] = RemoveXSS(urldecode($value));
}
}
}
//设置一些全局参数的值
foreach ($GLOBALS['PubFields'] as $k => $v) $this->Fields[$k] = $v;
//api相关逻辑处理
@@ -147,7 +139,7 @@ class ListView
*
* @access public
* @param string
* @return string
* @return void
*/
function CountRecord()
{
@@ -176,11 +168,6 @@ class ListView
}
}
}
if (isset($_REQUEST['tid'])) {
foreach ($_GET as $key => $value) {
$filtersql .= (!in_array($key,$this->_parms)) ? " AND $addtable.".HtmlReplace($key, -1)." = '".HtmlReplace(urldecode($value), -1)."'" : '';
}
}
} else {
$addField = '';
$addJoin = '';
@@ -233,7 +220,7 @@ class ListView
}
if ($this->TotalResult==-1) {
//添加联动单筛选
$cquery = "SELECT COUNT(*) AS dd FROM `#@__arctiny` arc $addJoin WHERE ".$this->addSql.$filtersql;
$cquery = "SELECT COUNT(*) AS dd FROM `#@__arctiny` arc $addJoin WHERE ".$this->addSql;
$row = $this->dsql->GetOne($cquery);
if (is_array($row)) {
$this->TotalResult = $row['dd'];
@@ -462,20 +449,13 @@ class ListView
}
}
}
//添加联动单筛选
if (isset($_REQUEST['tid'])) {
foreach($_GET as $key => $value)
{
$filtersql .= (!in_array($key,$this->_parms)) ? " AND $addtable.".HtmlReplace($key, -1)." = '".HtmlReplace(urldecode($value), -1)."'" : '';
}
}
} else {
$addField = '';
$addJoin = '';
}
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢
if (preg_match('/senddate|pubdate|senddate|hot|click|weight|lastpost|rand/', $orderby)) {
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb ON arc.mid=mb.mid $addJoin WHERE {$this->addSql} $filtersql $ordersql LIMIT $limitstart,$row";
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb ON arc.mid=mb.mid $addJoin WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row";
}
//普通情况先从arctiny表查出id,然后按id查询速度非常快
else {
@@ -489,7 +469,7 @@ class ListView
}
$idstr = join(',', $ids);
if ($idstr == '') {
return '';
return array();
} else {
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb ON arc.mid=mb.mid $addJoin WHERE arc.id in($idstr) $ordersql ";
}
@@ -505,7 +485,6 @@ class ListView
$ids[$row['id']] = $row['id'];
//处理一些特殊字段
$row['infos'] = cn_substr($row['description'], $infolen);
$row['id'] = $row['id'];
if ($row['corank'] > 0 && $row['arcrank'] == 0) {
$row['arcrank'] = $row['corank'];
}
@@ -619,7 +598,7 @@ class ListView
*
* @access public
* @param string
* @return string
* @return void
*/
function DisplayPartTemplets()
{
@@ -689,7 +668,7 @@ class ListView
* 解析模板,对固定的标记进行初始给值
*
* @access public
* @return string
* @return void
*/
function ParseTempletsFirst()
{
@@ -707,7 +686,7 @@ class ListView
* @access public
* @param int $PageNo 页数
* @param int $ismake 是否编译
* @return string
* @return void
*/
function ParseDMFields($PageNo, $ismake = 1)
{
@@ -888,20 +867,13 @@ class ListView
}
}
}
//添加联动单筛选
if (isset($_REQUEST['tid'])) {
foreach($_GET as $key => $value)
{
$filtersql .= (!in_array($key,$this->_parms)) ? " AND $addtable.".HtmlReplace($key, -1)." = '".HtmlReplace(urldecode($value), -1)."'" : '';
}
}
} else {
$addField = '';
$addJoin = '';
}
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢
if (preg_match('/senddate|pubdate|senddate|hot|click|weight|lastpost|rand/', $orderby)) {
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb ON arc.mid=mb.mid $addJoin WHERE {$this->addSql} $filtersql $ordersql LIMIT $limitstart,$row";
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,mb.uname,mb.face,mb.userid $addField FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id LEFT JOIN `#@__member` mb ON arc.mid=mb.mid $addJoin WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row";
}
//普通情况先从arctiny表查出id,然后按di查询速度非常快
else {
@@ -937,7 +909,6 @@ class ListView
$ids[$row['id']] = $row['id'];
//处理一些特殊字段
$row['infos'] = cn_substr($row['description'], $infolen);
$row['id'] = $row['id'];
if ($row['corank'] > 0 && $row['arcrank'] == 0) {
$row['arcrank'] = $row['corank'];
}
@@ -1037,7 +1008,6 @@ class ListView
*/
function GetPageListST($list_len, $listitem = "index,end,pre,next,pageno")
{
global $cfg_cmspath;
$prepage = $nextpage = '';
$prepagenum = $this->PageNo - 1;
$nextpagenum = $this->PageNo + 1;
@@ -1126,7 +1096,7 @@ class ListView
*/
function GetPageListDM($list_len, $listitem = "index,end,pre,next,pageno")
{
global $cfg_cmspath, $cfg_rewrite;
global $cfg_rewrite;
$prepage = $nextpage = '';
$prepagenum = $this->PageNo - 1;
$nextpagenum = $this->PageNo + 1;
@@ -1145,28 +1115,23 @@ class ListView
//开启伪静态对规则替换
if ($cfg_rewrite == 'Y') {
$purl = str_replace("/apps", "", $purl);
$nowurls = preg_replace("/", ".php?", $purl);
$nowurls = str_replace("/", ".php?", $purl);
$nowurls = explode("?", $nowurls);
$purl = $nowurls[0];
}
$geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&";
$purl .= '?'.$geturl;
$optionlist = '';
//添加联动单筛选
$pageaddurl = '';
foreach ($_GET as $key => $value) {
$pageaddurl .= ($key!="tid" && $key!="TotalResult" && $key!="PageNo" && $key!="PageSize" && $key!="mod") ? "&".RemoveXSS($key)."=".RemoveXSS($value) : '';
}
//获得上页和下页的链接
if ($this->PageNo != 1) {
$prepage .= "<li class='page-item'><a href='".$purl."PageNo=$prepagenum".$pageaddurl."' class='page-link'>上页</a></li>";
$indexpage = "<li class='page-item'><a href='".$purl."PageNo=1".$pageaddurl."' class='page-link'>首页</a></li>";
$prepage .= "<li class='page-item'><a href='".$purl."PageNo=$prepagenum"."' class='page-link'>上页</a></li>";
$indexpage = "<li class='page-item'><a href='".$purl."PageNo=1"."' class='page-link'>首页</a></li>";
} else {
$indexpage = "<li class='page-item'><span class='page-link'>首页</span></li>";
}
if ($this->PageNo != $totalpage && $totalpage > 1) {
$nextpage .= "<li class='page-item'><a href='".$purl."PageNo=$nextpagenum".$pageaddurl."' class='page-link'>下页</a></li>";
$endpage = "<li class='page-item'><a href='".$purl."PageNo=$totalpage".$pageaddurl."' class='page-link'>末页</a></li>";
$nextpage .= "<li class='page-item'><a href='".$purl."PageNo=$nextpagenum"."' class='page-link'>下页</a></li>";
$endpage = "<li class='page-item'><a href='".$purl."PageNo=$totalpage"."' class='page-link'>末页</a></li>";
} else {
$endpage = "<li class='page-item'><span class='page-link'>末页</span></li>";
}
@@ -1189,7 +1154,7 @@ class ListView
if ($j == $this->PageNo) {
$listdd .= "<li class='page-item active'><span class='page-link'>$j</span></li>";
} else {
$listdd .= "<li class='page-item'><a href='".$purl."PageNo=$j".$pageaddurl."' class='page-link'>$j</a></li>";
$listdd .= "<li class='page-item'><a href='".$purl."PageNo=$j"."' class='page-link'>$j</a></li>";
}
}
$plist = '';


Chargement…
Annuler
Enregistrer