@@ -46,4 +46,4 @@ src/data/sqlite_error_trace.inc | |||
src/static/soft/*/ | |||
src/static/userup/*/ | |||
src/static/js/*.js | |||
src/apps/special/*.html | |||
src/apps/special/*.html |
@@ -27,6 +27,7 @@ if ($action == "search") { | |||
"data" => $result, | |||
); | |||
echo json_encode($result); | |||
exit; | |||
} | |||
$result = array( | |||
"code" => 200, | |||
@@ -18,7 +18,8 @@ if (empty($upall)) $upall = 0; //是否更新全部 0为更新单个 1为更新 | |||
if (empty($ctagid)) $ctagid = 0; //当前处理的tagid | |||
if (empty($maxpagesize)) $maxpagesize = 50; | |||
$tagid = isset($tagid) ? intval($tagid) : 0; | |||
$tagsdir = str_replace("{cmspath}", $cfg_cmspath, $cfg_tags_dir); | |||
// 生成 | |||
if ($tagid > 0) { | |||
$upall = 0; //更新单个模式 | |||
$ctagid = $tagid; | |||
@@ -26,33 +27,30 @@ if ($tagid > 0) { | |||
$upall = 1; //更新全部模式 | |||
} | |||
$allfinish = false; //是否全部完成 | |||
// 判断生成模式 | |||
if ($upall == 1 && $ctagid == 0) { | |||
$rr = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE mktime <> uptime LIMIT 1"); | |||
$rr = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE mktime <> uptime OR mktime = 0 LIMIT 1"); | |||
if (!empty($rr) && count($rr) > 0) { | |||
$ctagid = $rr['id']; | |||
} else { | |||
$allfinish = true; | |||
} | |||
} | |||
if ($ctagid == 0 && $allfinish) { | |||
$dlist = new TagList('', 'tag.htm'); | |||
$dlist->SetTagsDir($tagsdir); | |||
$dlist->MakeHtml(1, 10); | |||
$reurl = '../a/tags/'; | |||
$reurl = '..'.$tagsdir; | |||
ShowMsg("完成TAG更新<a href='$reurl' target='_blank'>浏览TAG首页</a>", "javascript:;"); | |||
exit; | |||
} | |||
$tag = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE id='$ctagid' LIMIT 0,1;"); | |||
MkdirAll($cfg_basedir."/a/tags", $cfg_dir_purview); | |||
// 创建TAGS目录 | |||
MkdirAll($cfg_basedir.$cfg_tags_dir, $cfg_dir_purview); | |||
if (is_array($tag) && count($tag) > 0) { | |||
$dlist = new TagList($tag['tag'], 'taglist.htm'); | |||
$dlist = new TagList($tag['id'], 'taglist.htm'); | |||
$dlist->CountRecord(); | |||
$dlist->SetTagsDir($tagsdir); | |||
$ntotalpage = $dlist->TotalPage; | |||
if ($ntotalpage <= $maxpagesize) { | |||
@@ -69,19 +67,15 @@ if (is_array($tag) && count($tag) > 0) { | |||
$onefinish = $nextpage >= $ntotalpage && $finishType; | |||
if (($upall == 0 && $onefinish) || ($upall == 1 && $allfinish && $onefinish)) { | |||
$dlist = new TagList('', 'tag.htm'); | |||
$dlist->SetTagsDir($tagsdir); | |||
$dlist->MakeHtml(1, 10); | |||
$reurl = '../a/tags/'; | |||
$reurl = '..'.$tagsdir; | |||
if ($upall == 1) { | |||
ShowMsg("完成TAG更新<a href='$reurl' target='_blank'>浏览TAG首页</a>", "javascript:;"); | |||
} else { | |||
$query = "UPDATE `#@__tagindex` SET mktime=uptime WHERE id='$ctagid' "; | |||
$dsql->ExecuteNoneQuery($query); | |||
if (empty($tag['tag_pinyin'])) { | |||
$tag = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE id='$ctagid' LIMIT 0,1;"); | |||
} | |||
$reurl .= $tag['tag_pinyin']; | |||
$reurl .= '/'.$ctagid; | |||
ShowMsg("完成TAG更新:[".$tag['tag']."]<a href='$reurl' target='_blank'>浏览TAG首页</a>", "javascript:;"); | |||
} | |||
exit(); | |||
@@ -89,6 +83,9 @@ if (is_array($tag) && count($tag) > 0) { | |||
if ($finishType) { | |||
//完成了一个跳到下一个 | |||
if ($upall == 1) { | |||
$now = time(); | |||
$query = "UPDATE `#@__tagindex` SET uptime={$now} WHERE id='$ctagid' "; | |||
$dsql->ExecuteNoneQuery($query); | |||
$query = "UPDATE `#@__tagindex` SET mktime=uptime WHERE id='$ctagid' "; | |||
$dsql->ExecuteNoneQuery($query); | |||
$ctagid = 0; | |||
@@ -78,7 +78,8 @@ else if ($action == 'delete') { | |||
$title = empty($title) ? "" : HtmlReplace($title, 0); | |||
$kw = empty($kw) ? "" : HtmlReplace($kw, 0); | |||
$des = empty($des) ? "" : HtmlReplace($des, 0); | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__tagindex` SET title='{$title}',keywords='{$kw}',`description`='{$des}' WHERE id = {$tid}"); | |||
$now = time(); | |||
$dsql->ExecuteNoneQuery("UPDATE `#@__tagindex` SET title='{$title}',keywords='{$kw}',`description`='{$des}',`uptime`='{$now}' WHERE id = {$tid}"); | |||
echo json_encode(array('code' => 200, 'result' => true)); | |||
} | |||
/* | |||
@@ -13,6 +13,8 @@ | |||
$(function(){ | |||
$('#tagid').select2({ | |||
language: "zh-CN", | |||
allowClear: true, | |||
placeholder:"请选择一个标签", | |||
ajax: { | |||
url: 'makehtml_taglist.php?action=search', | |||
delay: 500, | |||
@@ -48,12 +50,32 @@ | |||
</table> | |||
</td> | |||
</tr> | |||
<?php | |||
if($tagid > 0) { | |||
$row = $dsql->GetOne("Select tag From `#@__tagindex` where id = '$tagid' "); | |||
?> | |||
<tr> | |||
<td width="300" valign="top" bgcolor="#FFFFFF">输入标签:</td> | |||
<td width="377" valign="top" bgcolor="#FFFFFF"> | |||
<input type="hidden" name="tagid" value="<?php echo $tagid;?>"><?php echo $row['tag'];?> <a class="text-success" href="makehtml_taglist.php">重新选择</a> | |||
</td> | |||
</tr> | |||
<?php | |||
} else { | |||
?> | |||
<tr> | |||
<td width="300" valign="top" bgcolor="#FFFFFF">输入标签:</td> | |||
<td width="377" valign="top" bgcolor="#FFFFFF"> | |||
<select id='tagid' name='tagid' style='width:300px'></select>(请输入标签搜索) | |||
</td> | |||
</tr> | |||
<?php | |||
} | |||
?> | |||
<tr> | |||
<td height="26" valign="top" bgcolor="#FFFFFF">生成位置:</td> | |||
<td height="26" valign="top" bgcolor="#FFFFFF"><input name="tagsdir" type="text" id="tagsdir" value="<?php echo $cfg_tags_dir;?>" size="30" disabled> <a href="sys_info.php" class="text-success">【系统设置】</a>-【其他选项】中“TAGS生成目录”项进行调整</td> | |||
</tr> | |||
<tr> | |||
<td height="26" valign="top" bgcolor="#FFFFFF">每次最大创建页数:</td> | |||
<td height="26" valign="top" bgcolor="#FFFFFF"><input name="maxpagesize" type="text" id="maxpagesize" value="50" size="10"> 个文件</td> | |||
@@ -105,7 +105,7 @@ | |||
</form> | |||
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable table-bordered"> | |||
<tr> | |||
<td height="26" colspan="7" bgcolor="#f8f8f8"> | |||
<td height="26" colspan="8" bgcolor="#f8f8f8"> | |||
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-borderless"> | |||
<tr> | |||
<td align="left" style="padding-left:10px">标签维护</td> | |||
@@ -122,6 +122,7 @@ | |||
</tr> | |||
<tr height="26" align="center" bgcolor="#FBFCE2"> | |||
<td width="8%">选择</td> | |||
<td width="5%">ID</td> | |||
<td width="30%">标签</td> | |||
<td width="10%"><a href="tags_main.php?tag=<?php echo $tag; ?>&orderby=count&orderway=<?php echo $neworderway; ?>">点击</a></td> | |||
<td width="10%"><a href="tags_main.php?tag=<?php echo $tag; ?>&orderby=total&orderway=<?php echo $neworderway; ?>">文档数</a></td> | |||
@@ -138,13 +139,14 @@ | |||
?> | |||
<tr align="center" bgcolor="#FFFFFF" onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';"> | |||
<td><input type="checkbox" name="ids[]" value="<?php echo $fields['id']; ?>" class='np' /></td> | |||
<td>{dede:field.id/}</td> | |||
<td><a href="../apps/tags.php?/<?php echo urlencode($fields['tag']); ?>/" target="_blank">{dede:field.tag/}</a></td> | |||
<td><input type="text" value="<?php echo $fields['count']; ?>" id="count<?php echo $fields['id']; ?>" size='5' /></td> | |||
<td><?php echo $fields['total']; ?></td> | |||
<td><?php echo $fields['addtime']; ?></td> | |||
<td><?php echo $fields['uptime']; ?></td> | |||
<td> | |||
<a href='javascript:UpdateKwDes(<?php echo $fields['id']; ?>,"<?php echo $fields['tag']; ?>");' class="btn btn-success btn-sm">关键词描述</a> | |||
<a href='javascript:UpdateKwDes(<?php echo $fields['id']; ?>,"<?php echo $fields['tag']; ?>");' class="btn btn-success btn-sm">设置</a> | |||
<a href="javascript:UpdateOne(<?php echo $fields['id']; ?>);" class="btn btn-success btn-sm">更新</a> | |||
<a href="makehtml_taglist.php?tagid=<?php echo $fields['id']; ?>" class="btn btn-success btn-sm">生成</a> | |||
<a href="javascript:DeleteOne(<?php echo $fields['id']; ?>);" class="btn btn-success btn-sm">删除</a> | |||
@@ -156,7 +158,7 @@ | |||
<input type="checkbox" onclick="checkall(this.form,'ids')" name="all" class="np"> 全选 | |||
<button type="button" onclick="document.form3.submit()" class="btn btn-success">删除</button> | |||
</td> | |||
<td colspan="6" align="center">{dede:pagelist/}</td> | |||
<td colspan="7" align="center">{dede:pagelist/}</td> | |||
</tr> | |||
</form> | |||
</table> | |||
@@ -100,6 +100,7 @@ $cfg_allsearch_limit = '1'; | |||
$cfg_rewrite = 'N'; | |||
$cfg_delete = 'Y'; | |||
$cfg_keywords = ''; | |||
$cfg_tags_dir = '{cmspath}/a/tags'; | |||
$cfg_description = ''; | |||
$cfg_beian = ''; | |||
$cfg_need_typeid2 = 'Y'; | |||
@@ -142,4 +143,9 @@ $cfg_mb_msgischeck = 'N'; | |||
$cfg_mb_reginfo = 'Y'; | |||
$cfg_title_site = 'N'; | |||
$cfg_mysql_type = 'mysqli'; | |||
$cfg_memcache_enable = 'N'; | |||
$cfg_memcache_enable = 'N'; | |||
$cfg_auth_code = ''; | |||
$cfg_bizcore_hostname = '127.0.0.1'; | |||
$cfg_bizcore_port = 8181; | |||
$cfg_bizcore_appid = ''; | |||
$cfg_bizcore_key = ''; |
@@ -4090,8 +4090,8 @@ INSERT INTO `#@__sysconfig` VALUES('1','cfg_basehost','站点网址(http://域 | |||
('764', 'cfg_bizcore_hostname', 'DedeBIZ Core地址', 1, 'string', '127.0.0.1'), | |||
('765', 'cfg_bizcore_port', 'DedeBIZ Core端口', 1, 'number', '8181'), | |||
('766', 'cfg_bizcore_appid', 'DedeBIZ Core应用ID', 1, 'string', ''), | |||
('767', 'cfg_bizcore_key', 'DedeBIZ Core通信密钥', 1, 'string', '') | |||
; | |||
('767', 'cfg_bizcore_key', 'DedeBIZ Core通信密钥', 1, 'string', ''), | |||
('710', 'cfg_tags_dir', 'TAGS生成目录', 7, 'string', '{cmspath}/a/tags'); | |||
INSERT INTO `#@__sys_module` VALUES (1, '0cce60bc0238aa03804682c801584991', '百度新闻', '', '', 0, ''), | |||
(2, '1f35620fb42d452fa2bdc1dee1690f92', '文件管理器', '', '', 0, ''), | |||
@@ -1,3 +1,7 @@ | |||
-- 6.1.8 | |||
INSERT INTO `#@__sysconfig` VALUES ('710', 'cfg_tags_dir', 'TAGS生成目录', 7, 'string', '{cmspath}/a/tags'); | |||
ALTER TABLE `#@__tagindex` DROP COLUMN `tag_pinyin`; | |||
-- 6.1.7 | |||
DROP TABLE IF EXISTS `#@__statistics`; | |||
CREATE TABLE `#@__statistics` ( | |||
@@ -35,6 +35,7 @@ class TagList | |||
var $Templet; | |||
var $TagInfos; | |||
var $TempletsFile; | |||
var $tagsDir; | |||
/** | |||
* php5构造函数 | |||
* | |||
@@ -47,7 +48,7 @@ class TagList | |||
{ | |||
global $dsql,$envs; | |||
$this->Templet = $templet; | |||
$this->Tag = $keyword; | |||
$this->Tag = (int)$keyword; | |||
$this->dsql = $dsql; | |||
$this->dtp = new DedeTagParse(); | |||
$this->dtp->SetRefObj($this); | |||
@@ -65,19 +66,13 @@ class TagList | |||
//设置一些全局参数的值 | |||
foreach ($GLOBALS['PubFields'] as $k => $v) $this->Fields[$k] = $v; | |||
//读取Tag信息 | |||
if ($this->Tag != '') { | |||
$this->TagInfos = $this->dsql->GetOne("Select * From `#@__tagindex` where tag like '{$this->Tag}' "); | |||
if (!empty($this->Tag)) { | |||
$this->TagInfos = $this->dsql->GetOne("Select * From `#@__tagindex` where id = '{$this->Tag}' "); | |||
if (!is_array($this->TagInfos)) { | |||
$fullsearch = $GLOBALS['cfg_phpurl']."/search.php?keyword=".$this->Tag."&searchtype=titlekeyword"; | |||
$msg = "系统无此标签,可能已经移除<br><br>您还可以尝试通过搜索程序去搜索这个关键词:<a href='$fullsearch'>前往搜索></a>"; | |||
$msg = "系统无此标签,可能已经移除"; | |||
ShowMsg($msg, "-1"); | |||
exit(); | |||
} | |||
//确定是否存在tag_pinyin | |||
if (empty($this->TagInfos['tag_pinyin'])) { | |||
$this->TagInfos['tag_pinyin'] = $this->TagPinyinExists($this->Tag) ? GetPinyin($this->Tag).$this->TagInfos['id'] : GetPinyin($this->Tag); | |||
$this->dsql->ExecNoneQuery("UPDATE `#@__tagindex` SET tag_pinyin = '{$this->TagInfos['tag_pinyin']}' WHERE tag LIKE '{$this->Tag}'"); | |||
} | |||
$this->Fields['title'] = empty($this->TagInfos['title']) ? $this->Fields['title'] : $this->TagInfos['title']; | |||
$this->Fields['keywords'] = empty($this->TagInfos['keywords']) ? $this->Fields['keywords'] : $this->TagInfos['keywords']; | |||
$this->Fields['description'] = empty($this->TagInfos['description']) ? $this->Fields['description'] : $this->TagInfos['description']; | |||
@@ -93,12 +88,6 @@ class TagList | |||
$envs['url_type'] = 4; | |||
$envs['value'] = $keyword; | |||
} | |||
function TagPinyinExists($tag) | |||
{ | |||
$tag_py = GetPinyin($tag); | |||
$row = $this->dsql->GetOne("Select count(*) as dd From `#@__tagindex` where tag_pinyin like '{$tag_py}' "); | |||
return $row['dd'] > 0; | |||
} | |||
//php4构造函数 | |||
function TagList($keyword, $templet) | |||
{ | |||
@@ -170,13 +159,15 @@ class TagList | |||
*/ | |||
function Display() | |||
{ | |||
$makeDir = empty($this->Tag) ? $this->GetTruePath()."/a/tags/index.html" : $this->GetTruePath()."/a/tags/".GetPinyin($this->Tag)."/index.html"; | |||
global $cfg_cmspath,$cfg_tags_dir; | |||
$tagsDir = str_replace("{cmspath}",$cfg_cmspath,$cfg_tags_dir); | |||
$makeDir = empty($this->Tag) ? $this->GetTruePath().$tagsDir."/index.html" : $this->GetTruePath().$tagsDir."/".$this->Tag."/index.html"; | |||
if (file_exists($makeDir)) { | |||
header('HTTP/1.1 301 Moved Permanently'); | |||
if (!empty($this->Tag)) { | |||
header('Location:../a/tags/'.GetPinyin($this->Tag)."/"); | |||
header('Location:..'.$tagsDir.'/'.GetPinyin($this->Tag)."/"); | |||
} else { | |||
header('Location:../a/tags/'); | |||
header('Location:..'.$tagsDir.'/'); | |||
} | |||
exit; | |||
} | |||
@@ -578,6 +569,14 @@ class TagList | |||
$truepath = $GLOBALS["cfg_basedir"]; | |||
return $truepath; | |||
} | |||
function SetTagsDir($dir = '') | |||
{ | |||
global $cfg_tags_dir,$cfg_cmspath; | |||
if ($dir == "") $dir = str_replace("{cmspath}",$cfg_cmspath,$cfg_tags_dir); | |||
$this->tagsDir = $dir; | |||
} | |||
//生成静态Tag | |||
function MakeHtml($startpage = 1, $makepagesize = 0) | |||
{ | |||
@@ -587,8 +586,8 @@ class TagList | |||
//初步给固定值的标记赋值 | |||
$this->ParseTempletsFirst(); | |||
if ($this->Tag == "") { | |||
MkdirAll($this->GetTruePath()."/a/tags/", $cfg_dir_purview); | |||
$this->dtp->SaveTo($this->GetTruePath()."/a/tags/index.html"); | |||
MkdirAll($this->GetTruePath().$this->tagsDir, $cfg_dir_purview); | |||
$this->dtp->SaveTo($this->GetTruePath().$this->tagsDir."/index.html"); | |||
} else { | |||
$totalpage = ceil($this->TotalResult / $this->PageSize); | |||
if ($totalpage == 0) { | |||
@@ -605,7 +604,7 @@ class TagList | |||
if ($endpage == 1) { | |||
$endpage = 2; | |||
} | |||
$makeDir = $this->GetTruePath()."/a/tags/".$this->TagInfos['tag_pinyin']."/"; | |||
$makeDir = $this->GetTruePath().$this->tagsDir.'/'.$this->TagInfos['id']."/"; | |||
MkdirAll($makeDir, $cfg_dir_purview); | |||
for ($this->PageNo = $startpage; $this->PageNo < $endpage; $this->PageNo++) { | |||
$this->ParseDMFields($this->PageNo, 1); | |||
@@ -10,7 +10,7 @@ | |||
*/ | |||
function lib_tag(&$ctag, &$refObj) | |||
{ | |||
global $dsql, $envs, $cfg_cmsurl; | |||
global $dsql, $envs, $cfg_cmsurl,$cfg_tags_dir; | |||
//属性处理 | |||
$attlist = "row|30,sort|new,getall|0,typeid|0"; | |||
FillAttsDefault($ctag->CAttribute->Items, $attlist); | |||
@@ -20,11 +20,8 @@ function lib_tag(&$ctag, &$refObj) | |||
$revalue = ''; | |||
$ltype = $sort; | |||
$num = $row; | |||
$dd = $dsql->GetOne("SELECT ROUND(AVG(total)) as tt FROM `#@__tagindex`"); //取一个平均 | |||
if (!$dd['tt']) { | |||
$dd['tt'] = 0; | |||
} | |||
$addsql = "WHERE 1=1 AND total >= {$dd['tt']}"; | |||
$addsql = "WHERE 1=1"; | |||
$tagsdir = str_replace("{cmspath}", $cfg_cmspath, $cfg_tags_dir); | |||
if ($getall == 0 && isset($refObj->Fields['tags']) && !empty($refObj->Fields['aid'])) { | |||
$dsql->SetQuery("SELECT tid FROM `#@__taglist` WHERE aid = '{$refObj->Fields['aid']}' "); | |||
$dsql->Execute(); | |||
@@ -56,9 +53,9 @@ function lib_tag(&$ctag, &$refObj) | |||
$row['keyword'] = $row['tag']; | |||
$row['tag'] = dede_htmlspecialchars($row['tag']); | |||
if (isset($envs['makeTag']) && $envs['makeTag'] == 1) { | |||
$row['link'] = $cfg_cmsurl."/a/tags/".GetPinyin($row['keyword'])."/"; | |||
$row['link'] = $cfg_cmsurl.$tagsdir."/".$row['id']."/"; | |||
} else { | |||
$row['link'] = $cfg_cmsurl."/apps/tags.php?/".urlencode($row['keyword'])."/"; | |||
$row['link'] = $cfg_cmsurl."/apps/tags.php?/".$row['id']."/"; | |||
} | |||
$row['highlight'] = mt_rand(1, 10); | |||
foreach ($ctp->CTags as $tagid => $ctag) { | |||