@@ -69,8 +69,7 @@ function viewArchives(){ } | |||||
else if ($dopost == "viewArchives") { | else if ($dopost == "viewArchives") { | ||||
$aid = preg_replace("#[^0-9]#", '', $aid); | $aid = preg_replace("#[^0-9]#", '', $aid); | ||||
//获取主表信息 | //获取主表信息 | ||||
$query = "SELECT arc.*,ch.maintable,ch.addtable,ch.issystem,ch.editcon, | |||||
tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl | |||||
$query = "SELECT arc.*,ch.maintable,ch.addtable,ch.issystem,ch.editcon,tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl | |||||
FROM `#@__arctiny` arc | FROM `#@__arctiny` arc | ||||
LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid | LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid | ||||
LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype | LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype | ||||
@@ -141,8 +141,7 @@ if ($arcrank != '') { | |||||
} | } | ||||
$orderby = empty($orderby) ? 'id' : preg_replace("#[^a-z0-9]#", "", $orderby); | $orderby = empty($orderby) ? 'id' : preg_replace("#[^a-z0-9]#", "", $orderby); | ||||
$orderbyField = 'arc.'.$orderby; | $orderbyField = 'arc.'.$orderby; | ||||
$query = "SELECT arc.id,arc.typeid,arc.senddate,arc.flag,arc.ismake, | |||||
arc.channel,arc.arcrank,arc.click,arc.title,arc.color,arc.litpic,arc.pubdate,arc.mid | |||||
$query = "SELECT arc.id,arc.typeid,arc.senddate,arc.flag,arc.ismake,arc.channel,arc.arcrank,arc.click,arc.title,arc.color,arc.litpic,arc.pubdate,arc.mid | |||||
FROM `$maintable` arc | FROM `$maintable` arc | ||||
$whereSql | $whereSql | ||||
ORDER BY $orderbyField DESC"; | ORDER BY $orderbyField DESC"; | ||||
@@ -675,13 +675,12 @@ class ListView | |||||
} | } | ||||
//如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢) | //如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢) | ||||
if (preg_match('/hot|click|lastpost/', $orderby)) { | if (preg_match('/hot|click|lastpost/', $orderby)) { | ||||
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname, | |||||
tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath | |||||
$addField | |||||
FROM `#@__archives` arc | |||||
LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | |||||
$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 | |||||
$addField | |||||
FROM `#@__archives` arc | |||||
LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | |||||
$addJoin | |||||
WHERE {$this->addSql} $filtersql $ordersql LIMIT $limitstart,$row"; | |||||
} | } | ||||
//普通情况先从arctiny表查出ID,然后按ID查询(速度非常快) | //普通情况先从arctiny表查出ID,然后按ID查询(速度非常快) | ||||
else { | else { | ||||
@@ -697,12 +696,11 @@ class ListView | |||||
if ($idstr == '') { | if ($idstr == '') { | ||||
return ''; | return ''; | ||||
} else { | } 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 | |||||
$addField | |||||
FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | |||||
$addJoin | |||||
WHERE arc.id in($idstr) $ordersql "; | |||||
$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 | |||||
$addField | |||||
FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | |||||
$addJoin | |||||
WHERE arc.id in($idstr) $ordersql "; | |||||
} | } | ||||
$t2 = ExecTime(); | $t2 = ExecTime(); | ||||
//echo $t2-$t1; | //echo $t2-$t1; | ||||
@@ -886,7 +884,9 @@ class ListView | |||||
} | } | ||||
for ($j; $j <= $total_list; $j++) { | for ($j; $j <= $total_list; $j++) { | ||||
if ($j == $this->PageNo) { | if ($j == $this->PageNo) { | ||||
$listdd .= "<li class='page-item active'><span class='page-link'>$j</span></li>\r\n"; | |||||
//$listdd .= "<li class='page-item active'><span class='page-link'>$j</span></li>\r\n"; | |||||
$listdd .= "<li class='page-item'><a class='page-link' href='".$typedir."'>'.$j.'</a></li>\r\n"; | |||||
} else { | } else { | ||||
$listdd .= "<li class='page-item'><a class='page-link' href='".str_replace("{page}", $j, $tnamerule)."'>".$j."</a></li>\r\n"; | $listdd .= "<li class='page-item'><a class='page-link' href='".str_replace("{page}", $j, $tnamerule)."'>".$j."</a></li>\r\n"; | ||||
} | } | ||||
@@ -128,8 +128,7 @@ class RssView | |||||
$orwhere = " arc.arcrank > -1 "; | $orwhere = " arc.arcrank > -1 "; | ||||
$orwhere .= " AND (arc.typeid in (".GetSonIds($this->TypeID, $this->TypeFields['channeltype']).") ) "; | $orwhere .= " AND (arc.typeid in (".GetSonIds($this->TypeID, $this->TypeFields['channeltype']).") ) "; | ||||
$ordersql = " ORDER BY arc.id desc"; | $ordersql = " ORDER BY arc.id desc"; | ||||
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault, | |||||
tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath | |||||
$query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath | |||||
FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | ||||
WHERE $orwhere $ordersql LIMIT 0,".$this->MaxRow; | WHERE $orwhere $ordersql LIMIT 0,".$this->MaxRow; | ||||
$this->dsql->SetQuery($query); | $this->dsql->SetQuery($query); | ||||
@@ -537,11 +537,9 @@ class SearchView | |||||
} | } | ||||
} | } | ||||
//搜索 | //搜索 | ||||
$query = "SELECT arc.*,act.typedir,act.typename,act.isdefault,act.defaultname,act.namerule, | |||||
act.namerule2,act.ispart,act.moresite,act.siteurl,act.sitepath | |||||
FROM `{$this->AddTable}` arc LEFT JOIN `#@__arctype` act ON arc.typeid=act.id | |||||
WHERE {$this->AddSql} $ordersql LIMIT $limitstart,$row"; | |||||
$query = "SELECT arc.*,act.typedir,act.typename,act.isdefault,act.defaultname,act.namerule,act.namerule2,act.ispart,act.moresite,act.siteurl,act.sitepath | |||||
FROM `{$this->AddTable}` arc LEFT JOIN `#@__arctype` act ON arc.typeid=act.id | |||||
WHERE {$this->AddSql} $ordersql LIMIT $limitstart,$row"; | |||||
$this->dsql->SetQuery($query); | $this->dsql->SetQuery($query); | ||||
$this->dsql->Execute("al"); | $this->dsql->Execute("al"); | ||||
$artlist = ""; | $artlist = ""; | ||||
@@ -275,8 +275,7 @@ function lib_arclistDone (&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlele | |||||
$addfieldsSqlJoin = " LEFT JOIN `$addtable` addf ON addf.aid = arc.id "; | $addfieldsSqlJoin = " LEFT JOIN `$addtable` addf ON addf.aid = arc.id "; | ||||
} | } | ||||
} | } | ||||
$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 | |||||
$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 | |||||
$addfieldsSql | $addfieldsSql | ||||
FROM `$maintable` arc LEFT JOIN `#@__arctype` tp on arc.typeid=tp.id | FROM `$maintable` arc LEFT JOIN `#@__arctype` tp on arc.typeid=tp.id | ||||
$addfieldsSqlJoin | $addfieldsSqlJoin | ||||
@@ -43,18 +43,16 @@ function lib_relation(&$ctag, &$refObj) | |||||
$odb = " ORDER BY arc.click DESC"; | $odb = " ORDER BY arc.click DESC"; | ||||
} | } | ||||
if ($channelid > 0) { | if ($channelid > 0) { | ||||
$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 | |||||
FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | |||||
where arc.arcrank>-1 AND arc.id IN (".$refObj->Fields[$name].") $odb"; | |||||
$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 | |||||
FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | |||||
where arc.arcrank>-1 AND arc.id IN (".$refObj->Fields[$name].") $odb"; | |||||
} else { | } else { | ||||
$gquery = "SELECT addtable,listfields FROM `#@__channeltype` WHERE id='$channelid' "; | $gquery = "SELECT addtable,listfields FROM `#@__channeltype` WHERE id='$channelid' "; | ||||
$grow = $dsql->GetOne($gquery); | $grow = $dsql->GetOne($gquery); | ||||
$maintable = trim($grow['addtable']); | $maintable = trim($grow['addtable']); | ||||
$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 | |||||
FROM `{$maintable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | |||||
where arc.arcrank>-1 AND arc.aid IN (".$refObj->Fields[$name].") $odb"; | |||||
$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 | |||||
FROM `{$maintable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id | |||||
where arc.arcrank>-1 AND arc.aid IN (".$refObj->Fields[$name].") $odb"; | |||||
} | } | ||||
$innertext = trim($ctag->GetInnerText()); | $innertext = trim($ctag->GetInnerText()); | ||||
if ($innertext == '') $innertext = GetSysTemplets('part_arclist.htm'); | if ($innertext == '') $innertext = GetSysTemplets('part_arclist.htm'); | ||||
@@ -24,8 +24,8 @@ function _ShowForm(){ } | |||||
if (empty($dopost)) { | if (empty($dopost)) { | ||||
//读取归档信息 | //读取归档信息 | ||||
$arcQuery = "SELECT arc.*,ch.addtable,ch.fieldset,arc.mtype as mtypeid,ch.arcsta | $arcQuery = "SELECT arc.*,ch.addtable,ch.fieldset,arc.mtype as mtypeid,ch.arcsta | ||||
FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel | |||||
WHERE arc.id='$aid' And arc.mid='".$cfg_ml->M_ID."'; "; | |||||
FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel | |||||
WHERE arc.id='$aid' And arc.mid='".$cfg_ml->M_ID."'; "; | |||||
$row = $dsql->GetOne($arcQuery); | $row = $dsql->GetOne($arcQuery); | ||||
if (!is_array($row)) { | if (!is_array($row)) { | ||||
ShowMsg("读取文档信息出错!", "-1"); | ShowMsg("读取文档信息出错!", "-1"); | ||||
@@ -24,8 +24,8 @@ function _ShowForm(){ } | |||||
if (empty($dopost)) { | if (empty($dopost)) { | ||||
//读取归档信息 | //读取归档信息 | ||||
$arcQuery = "SELECT arc.*,ch.addtable,ch.fieldset,arc.mtype as mtypeid,ch.arcsta | $arcQuery = "SELECT arc.*,ch.addtable,ch.fieldset,arc.mtype as mtypeid,ch.arcsta | ||||
FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel | |||||
WHERE arc.id='$aid' And arc.mid='".$cfg_ml->M_ID."'; "; | |||||
FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel | |||||
WHERE arc.id='$aid' And arc.mid='".$cfg_ml->M_ID."'; "; | |||||
$row = $dsql->GetOne($arcQuery); | $row = $dsql->GetOne($arcQuery); | ||||
if (!is_array($row)) { | if (!is_array($row)) { | ||||
ShowMsg("读取文章信息出错!", "-1"); | ShowMsg("读取文章信息出错!", "-1"); | ||||