浏览代码

细节优化

tags/6.2.5
叙述、别离 2 年前
父节点
当前提交
9646cf7114
共有 7 个文件被更改,包括 28 次插入71 次删除
  1. +11
    -17
      src/system/archive/archives.class.php
  2. +0
    -10
      src/system/archive/freelist.class.php
  3. +3
    -6
      src/system/archive/listview.class.php
  4. +1
    -5
      src/system/archive/searchview.class.php
  5. +5
    -23
      src/system/archive/sglistview.class.php
  6. +3
    -3
      src/system/archive/specview.class.php
  7. +5
    -7
      src/system/archive/taglist.class.php

+ 11
- 17
src/system/archive/archives.class.php 查看文件

@@ -197,9 +197,7 @@ class Archives
unset($row);
//处理要分页显示的字段
$this->SplitTitles = array();
if ($this->SplitPageField != '' && $GLOBALS['cfg_arcsptitle'] = 'Y'
&& isset($this->Fields[$this->SplitPageField])
) {
if ($this->SplitPageField != '' && $GLOBALS['cfg_arcsptitle'] = 'Y' && isset($this->Fields[$this->SplitPageField])) {
$this->SplitFields = explode("#p#", $this->Fields[$this->SplitPageField]);
$i = 1;
foreach ($this->SplitFields as $k => $v) {
@@ -357,7 +355,7 @@ class Archives
$this->dtp->SaveTo($TRUEfilename);
}
}
$this->dsql->ExecuteNoneQuery("Update `#@__archives` SET ismake=1 WHERE id='".$this->ArcID."'");
$this->dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET ismake=1 WHERE id='".$this->ArcID."'");
return $this->GetTrueUrl($filename);
}
/**
@@ -483,7 +481,7 @@ class Archives
if ($GLOBALS['cfg_jump_once'] == 'N') {
$pageHtml = "<html>\r\n<head>\r\n<meta charset=".$GLOBALS['cfg_soft_lang']."\">\r\n<title>".$this->Fields['title']."</title>\r\n";
$pageHtml .= "<meta http-equiv=\"refresh\" content=\"3;URL=".$this->Fields['redirecturl']."\">\r\n</head>\r\n<body>\r\n";
$pageHtml .= "现在正在跳转:".$this->Fields['title'].",请稍候<br><br>\r\n跳转文档简介:".$this->Fields['description']."\r\n</body>\r\n</html>\r\n";
$pageHtml .= "正在跳转文档:".$this->Fields['title']."<br><br>\r\n文档描述:".$this->Fields['description']."\r\n</body>\r\n</html>\r\n";
echo $pageHtml;
} else {
header("location:{$this->Fields['redirecturl']}");
@@ -585,8 +583,7 @@ class Archives
else if ($ctag->GetName()=='prenextdiy')
{
$innertext = trim($ctag->GetInnerText());
if ($innertext)
{
if ($innertext) {
$get = $ctag->GetAtt('get');
$diys['diy'] = $this->GetPreNext('diy');
$revalue = '';
@@ -597,8 +594,7 @@ class Archives
{
foreach($dtp2->CTags as $tid=>$ctag2)
{
if (isset($row[$get][$ctag2->GetName()]))
{
if (isset($row[$get][$ctag2->GetName()])) {
$dtp2->Assign($tid,$row[$get][$ctag2->GetName()]);
}
}
@@ -656,10 +652,10 @@ class Archives
$this->Fields = '';
}
/**
* 获取上一篇下一篇链接
* 获取上一篇下一篇链接
*
* @access public
* @param string $gtype pre为上一篇 preimg为上一篇图片 next为下一篇 nextimg为下一篇图片
* @param string $gtype pre为上一篇,preimg为上一篇图片,next为下一篇,nextimg为下一篇图片
* @return string
*/
function GetPreNext($gtype = '')
@@ -734,12 +730,9 @@ class Archives
}
}
//二次开发上一篇下一篇
if ($gtype=='diy')
{
if ($gtype=='diy') {
return $this->PreNext['diy'];
}
if ($gtype=='pre')
{
} if ($gtype=='pre') {
$rs = $this->PreNext['pre'];
} else if ($gtype == 'preimg') {
$rs = $this->PreNext['preimg'];
@@ -997,7 +990,8 @@ class Archives
return $body;
}
}//End Archives
function _highlightkeywords($matches){
function _highlightkeywords($matches)
{
return _highlight($matches[2], $GLOBALS['_dd_karr'], $GLOBALS['_dd_kaarr'], $matches[1]);
}
//高亮专用,替换多次是可能不能达到最多次


+ 0
- 10
src/system/archive/freelist.class.php 查看文件

@@ -50,16 +50,6 @@ class FreeList
$this->pagesize = 30;
}
$channelid = $this->ListObj->GetAtt('channel');
/*
if (empty($channelid))
{
showmsg('必须指定栏目','-1');exit();
} else {
$channelid = intval($channelid);
$channelinfo = $this->dsql->getone("select maintable from #@__channeltype WHERE id='$channelid'");
$this->maintable = $channelinfo['maintable'];
}
*/
$channelid = intval($channelid);
$this->maintable = '#@__archives';
//全局模板解析器


+ 3
- 6
src/system/archive/listview.class.php 查看文件

@@ -254,7 +254,7 @@ class ListView
}
//创建封面模板文件
if ($this->TypeLink->TypeInfos['isdefault'] == -1) {
echo '这个栏目是动态栏目';
echo '这个是动态栏目';
return '../apps/list.php?tid='.$this->TypeLink->TypeInfos['id'];
}
//单独页面
@@ -650,11 +650,11 @@ class ListView
$addField = '';
$addJoin = '';
}
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢
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";
}
//普通情况先从arctiny表查出ID,然后按ID查询(速度非常快)
//普通情况先从arctiny表查出id,然后按di查询速度非常快
else {
$t1 = ExecTime();
$ids = array();
@@ -671,12 +671,10 @@ class ListView
$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();
//echo $t2-$t1;
}
$this->dsql->SetQuery($query);
$this->dsql->Execute('al');
$t2 = ExecTime();
//echo $t2-$t1;
$artlist = '';
$this->dtp2->LoadSource($innertext);
$GLOBALS['autoindex'] = 0;
@@ -775,7 +773,6 @@ class ListView
}
}//Loop Line
$t3 = ExecTime();
//echo ($t3-$t2);
$this->dsql->FreeResult('al');
return $artlist;
}


+ 1
- 5
src/system/archive/searchview.class.php 查看文件

@@ -169,7 +169,6 @@ class SearchView
}
$keywords = preg_replace("/[ ]{1,}/", " ", $keywords);
$client->Close();
//var_dump($keywords);exit;
} else {
$sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang);
$sp->SetSource($keyword, $cfg_soft_lang, $cfg_soft_lang);
@@ -186,7 +185,6 @@ class SearchView
$keywords .= ' '.$key;
}
$keywords = preg_replace("/[ ]{1,}/", " ", $keywords);
//var_dump($keywords);exit();
unset($sp);
}
} else {
@@ -296,7 +294,6 @@ class SearchView
*/
function GetRedKeyWord($fstr)
{
//echo $fstr;
$ks = explode(' ', $this->Keywords);
foreach ($ks as $k) {
$k = trim($k);
@@ -308,8 +305,7 @@ class SearchView
}
//这里不区分大小写进行关键词替换
$fstr = str_ireplace($k, "<span class='text-primary'>$k</span>", $fstr);
//速度更快,效率更高
//$fstr = str_replace($k, "<span class='text-primary'>$k</span>", $fstr);
//速度更快,效率更高$fstr = str_replace($k, "<span class='text-primary'>$k</span>", $fstr);
}
return $fstr;
}


+ 5
- 23
src/system/archive/sglistview.class.php 查看文件

@@ -213,7 +213,7 @@ class SgListView
}
//创建封面模板文件
if ($this->TypeLink->TypeInfos['isdefault'] == -1) {
echo '这个栏目是动态栏目';
echo '这个是动态栏目';
return '';
}
//单独页面
@@ -537,11 +537,11 @@ class SgListView
$ordersql = " ORDER BY arc.aid $orderWay";
}
$addField = 'arc.'.join(',arc.', $this->ListFields);
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢
//如果不用默认的sortrank或id排序,使用联合查询数据量大时非常缓慢
if (preg_match('/hot|click/', $orderby) || $this->sAddTable) {
$query = "SELECT tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,arc.aid,arc.aid AS id,arc.typeid,$addField FROM `{$this->AddTable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row";
}
//普通情况先从arctiny表查出ID,然后按ID查询(速度非常快)
//普通情况先从arctiny表查出id,然后按id查询速度非常快
else {
$t1 = ExecTime();
$ids = array();
@@ -559,12 +559,10 @@ class SgListView
$query = "SELECT tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,arc.aid,arc.aid AS id,arc.typeid,$addField FROM `{$this->AddTable}` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE arc.aid IN($idstr) AND arc.arcrank >-1 $ordersql";
}
$t2 = ExecTime();
//echo $t2-$t1;
}
$this->dsql->SetQuery($query);
$this->dsql->Execute('al');
$t2 = ExecTime();
//echo $t2-$t1;
$artlist = '';
$this->dtp2->LoadSource($innertext);
$GLOBALS['autoindex'] = 0;
@@ -649,14 +647,13 @@ class SgListView
}
$artlist .= $this->dtp2->GetResult();
} //if hasRow
} //Loop Col
}//Loop Col
if ($col > 1) {
$i += $col - 1;
$artlist .= "</div>\r\n";
}
} //Loop Line
}//Loop Line
$t3 = ExecTime();
//echo ($t3-$t2);
$this->dsql->FreeResult('al');
return $artlist;
}
@@ -704,21 +701,6 @@ class SgListView
}
//option链接
$optionlist = "";
/*
$optionlen = strlen($totalpage);
$optionlen = $optionlen*10+18;
$optionlist = "<li><select name='sldd' style='width:{$optionlen}px' onchange='location.href=this.options[this.selectedIndex].value;'>\r\n";
for ($mjj=1;$mjj<=$totalpage;$mjj++)
{
if ($mjj==$this->PageNo)
{
$optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."' selected>$mjj</option>\r\n";
} else {
$optionlist .= "<option value='".str_replace("{page}",$mjj,$tnamerule)."'>$mjj</option>\r\n";
}
}
$optionlist .= "</select><li>";
*/
//获得数字链接
$listdd = "";
$total_list = $list_len * 2 + 1;


+ 3
- 3
src/system/archive/specview.class.php 查看文件

@@ -399,18 +399,18 @@ class SpecView
}
}
$artlist .= $this->dtp2->GetResult();
} //if hasRow
}//if hasRow
else {
$artlist .= "";
}
if ($col > 1) {
$artlist .= "</td>\r\n";
}
} //Loop Col
}//Loop Col
if ($col > 1) {
$artlist .= "</tr>\r\n";
}
} //Loop Line
}//Loop Line
if ($col > 1) {
$artlist .= "</table>\r\n";
}


+ 5
- 7
src/system/archive/taglist.class.php 查看文件

@@ -61,7 +61,7 @@ class TagList
if (!empty($this->Tag)) {
$this->TagInfos = $this->dsql->GetOne("SELECT * FROM `#@__tagindex` where id = '{$this->Tag}' ");
if (!is_array($this->TagInfos)) {
$msg = "系统无此标签,可能已经移除";
$msg = "系统无此标签,已经移除标签";
ShowMsg($msg, "-1");
exit();
}
@@ -165,7 +165,6 @@ class TagList
$this->ParseDMFields($this->PageNo, 0);
}
$this->dtp->Display();
//$this->Close();
}
/**
* 解析模板,对固定的标记进行初始给值
@@ -223,7 +222,6 @@ class TagList
if ($list_len == "") {
$list_len = 3;
}
//var_dump($ismake);
if ($ismake == 0) {
$this->dtp->Assign($tagid, $this->GetPageListDM($list_len, $listitem));
} else {
@@ -380,13 +378,13 @@ class TagList
}
}
$artlist .= $this->dtp2->GetResult();
} //if hasRow
} //Loop Col
}//if hasRow
}//Loop Col
if ($col > 1) {
$i += $col - 1;
$artlist .= "</div>\r\n";
}
} //Loop Line
}//Loop Line
$this->dsql->FreeResult('al');
return $artlist;
}
@@ -452,7 +450,7 @@ class TagList
$listdd .= "<li class='page-item'><a class='page-link' href='".$purl."/$j/'>".$j."</a></li>\r\n";
}
}
$plist = '';
$plist = '';
if (preg_match('/info/i', $listitem)) {
$plist .= $maininfo.' ';
}


正在加载...
取消
保存