diff --git a/src/dede/inc/inc_archives_all.php b/src/dede/inc/inc_archives_all.php index 2b196904..258b83bf 100755 --- a/src/dede/inc/inc_archives_all.php +++ b/src/dede/inc/inc_archives_all.php @@ -155,7 +155,7 @@ function GetFormItem($ctag) */ function GetFieldValue($dvalue,$dtype,$aid=0,$job='add',$addvar='') { - global $cfg_cookie_encode,$cfg_dir_purview; + global $cfg_cookie_encode,$cfg_dir_purview,$isUrlOpen; if($dtype=="int") { $dvalue = trim(preg_replace("#[^0-9]#", "", $dvalue)); @@ -242,7 +242,7 @@ function GetFieldValue($dvalue,$dtype,$aid=0,$job='add',$addvar='') $imgfile = $GLOBALS['cfg_basedir'].$iurl; if(is_file($imgfile)) { - $imginfos = GetImageSize($imgfile,&$info); + $imginfos = GetImageSize($imgfile); $imgurl = "{dede:img text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}"; } } diff --git a/src/dede/makehtml_taglist.php b/src/dede/makehtml_taglist.php index 177536ca..f5c3ff83 100644 --- a/src/dede/makehtml_taglist.php +++ b/src/dede/makehtml_taglist.php @@ -9,6 +9,7 @@ * @link http://www.dedecms.com */ require_once(dirname(__FILE__)."/config.php"); +$tid = isset($tid)? $tid : 0; include DedeInclude('templets/makehtml_taglist.htm'); ?> \ No newline at end of file diff --git a/src/dede/makehtml_taglist_action.php b/src/dede/makehtml_taglist_action.php index b33418e5..57a86fad 100644 --- a/src/dede/makehtml_taglist_action.php +++ b/src/dede/makehtml_taglist_action.php @@ -13,29 +13,39 @@ require_once(dirname(__FILE__) . "/config.php"); CheckPurview('sys_MakeHtml'); require_once(DEDEINC . "/arc.taglist.class.php"); -if (empty($total)) $total = 0; // TAGS总数 if (empty($pageno)) $pageno = 0; if (empty($mkpage)) $mkpage = 1; -if (empty($offset)) $offset = 0; // 当前位置 +if (empty($upall)) $upall = 0; // 是否更新全部 0为更新单个 1为更新全部 +if (empty($ctagid)) $ctagid = 0; // 当前处理的tagid if (empty($maxpagesize)) $maxpagesize = 50; $tagid = isset($tagid) ? intval($tagid) : 0; -if ($total == 0 && $tagid == 0) { - $total = $dsql->GetOne("SELECT count(*) as dd FROM `#@__tagindex`"); - $total = intval($total['dd']); +if ($tagid > 0) { + $upall = 0; // 更新单个模式 + $ctagid = $tagid; +} else { + $upall = 1; // 更新全部模式 } +$allfinish = false; // 是否全部完成 -$allfinish = false; +if ($upall == 1 && $ctagid == 0) { + $rr = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE mktime <> uptime LIMIT 1"); + if (!empty($rr) && count($rr) > 0) { + $ctagid = $rr['id']; + } else { + $allfinish = true; -if ($offset < ($total - 1)) { - $tt = $dsql->GetOne("SELECT * FROM `#@__tagindex` LIMIT " . $offset . ",1;"); - $tagid = $tt['id']; - $offset++; -} else { - $allfinish = true; + } } -$tag = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE id='$tagid' LIMIT 0,1;"); +if ($ctagid == 0 && $allfinish) { + $reurl = '../a/tags/'; + ShowMsg("完成TAG更新!浏览TAG首页", "javascript:;"); + exit; +} + + +$tag = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE id='$ctagid' LIMIT 0,1;"); MkdirAll($cfg_basedir . "/a/tags", $cfg_dir_purview); @@ -46,7 +56,7 @@ if (is_array($tag) && count($tag) > 0) { if ($ntotalpage <= $maxpagesize) { $dlist->MakeHtml('', ''); - $finishType = TRUE; + $finishType = TRUE; // 生成一个TAG完成 } else { $reurl = $dlist->MakeHtml($mkpage, $maxpagesize); $finishType = FALSE; @@ -55,27 +65,36 @@ if (is_array($tag) && count($tag) > 0) { } $nextpage = $pageno + 1; - if ($nextpage >= $ntotalpage && $finishType && !($offset < ($total - 1))) { + $onefinish = $nextpage >= $ntotalpage && $finishType; + if (($upall == 0 && $onefinish) || ($upall == 1 && $allfinish && $onefinish)) { $dlist = new TagList('', 'tag.htm'); $dlist->MakeHtml(1, 10); $reurl = '../a/tags/'; - if ($total > 0) { + if ($upall == 1) { ShowMsg("完成TAG更新!浏览TAG首页", "javascript:;"); } else { + $query = "UPDATE `#@__tagindex` SET mktime=uptime WHERE id='$ctagid' "; + $dsql->ExecuteNoneQuery($query); + $reurl .= GetPinyin($tag['tag']); ShowMsg("完成TAG更新:[" . $tag['tag'] . "]!浏览TAG首页", "javascript:;"); } exit(); } else { if ($finishType) { - if ($allfinish == true) { - $total = 0; + // 完成了一个跳到下一个 + if ($upall == 1) { + $query = "UPDATE `#@__tagindex` SET mktime=uptime WHERE id='$ctagid' "; + $dsql->ExecuteNoneQuery($query); + $ctagid = 0; + $nextpage = 0; } - $gourl = "makehtml_taglist_action.php?maxpagesize=$maxpagesize&tagid=$tagid&pageno=$nextpage&total=$total&offset=$offset"; + $gourl = "makehtml_taglist_action.php?maxpagesize=$maxpagesize&tagid=$tagid&pageno=$nextpage&upall=$upall&ctagid=$ctagid"; ShowMsg("成功生成TAG:[" . $tag['tag'] . "],继续进行操作!", $gourl, 0, 100); exit(); } else { - $gourl = "makehtml_taglist_action.php?mkpage=$mkpage&maxpagesize=$maxpagesize&tagid=$tagid&pageno=$pageno&total=$total&offset=$offset"; + // 继续当前这个 + $gourl = "makehtml_taglist_action.php?mkpage=$mkpage&maxpagesize=$maxpagesize&tagid=$tagid&pageno=$pageno&upall=$upall&ctagid=$ctagid"; ShowMsg("成功生成TAG:[" . $tag['tag'] . "],继续进行操作...", $gourl, 0, 100); exit(); } diff --git a/src/dede/tags_main.php b/src/dede/tags_main.php index 9bba3fc4..99e98573 100755 --- a/src/dede/tags_main.php +++ b/src/dede/tags_main.php @@ -40,6 +40,7 @@ function update() else if($action == 'update') { $tid = (empty($tid) ? 0 : intval($tid) ); + $count = (empty($count) ? 0 : intval($count) ); if(empty($tid)) { ShowMsg('没有选择要删除的tag!','-1'); @@ -91,7 +92,7 @@ else if($action == 'fetch') $where = array(); if(isset($startaid) && is_numeric($startaid) && $startaid > 0) { - $where[] = " id>$startaid "; + $where[] = " id>=$startaid "; } else { @@ -99,7 +100,7 @@ else if($action == 'fetch') } if(isset($endaid) && is_numeric($endaid) && $endaid > 0) { - $where[] = " id<$endaid "; + $where[] = " id<=$endaid "; } else { @@ -113,6 +114,7 @@ else if($action == 'fetch') $dsql->SetQuery($query); $dsql->Execute(); $complete = true; + $now = time(); while($row = $dsql->GetArray()) { $aid = $row['aid']; @@ -133,16 +135,20 @@ else if($action == 'fetch') if($keyword != '' && strlen($keyword)<13 ) { $keyword = addslashes($keyword); - $row = $dsql->GetOne("SELECT id FROM `#@__tagindex` WHERE tag LIKE '$keyword'"); + $row = $dsql->GetOne("SELECT id,total FROM `#@__tagindex` WHERE tag LIKE '$keyword'"); if(is_array($row)) { $tid = $row['id']; - $query = "UPDATE `#@__tagindex` SET `total`=`total`+1 WHERE id='$tid' "; - $dsql->ExecuteNoneQuery($query); + $trow = $dsql->GetOne("SELECT COUNT(*) as dd FROM `#@__taglist` WHERE tag LIKE '$keyword'"); + if (intval($trow['dd']) != $row['total'] ) { + + $query = "UPDATE `#@__tagindex` SET `total`=".$trow['dd'].",uptime=$now WHERE id='$tid' "; + $dsql->ExecuteNoneQuery($query); + } } else { - $query = " INSERT INTO `#@__tagindex`(`tag`,`count`,`total`,`weekcc`,`monthcc`,`weekup`,`monthup`,`addtime`) VALUES('$keyword','0','1','0','0','$timestamp','$timestamp','$timestamp');"; + $query = " INSERT INTO `#@__tagindex`(`tag`,`count`,`total`,`weekcc`,`monthcc`,`weekup`,`monthup`,`addtime`,`uptime`) VALUES('$keyword','0','1','0','0','$timestamp','$timestamp','$timestamp','$now');"; $dsql->ExecuteNoneQuery($query); $tid = $dsql->GetLastID(); } diff --git a/src/dede/templets/makehtml_taglist.htm b/src/dede/templets/makehtml_taglist.htm index ee5c5a7d..f12b7cab 100644 --- a/src/dede/templets/makehtml_taglist.htm +++ b/src/dede/templets/makehtml_taglist.htm @@ -15,6 +15,7 @@ 更新TAG HTML + TAG标签管理 @@ -26,10 +27,12 @@ Execute('al',$sql); - echo "\r\n"; + if($tid == 0) echo "\r\n"; + + while($row=$dsql->GetObject('al')){ + if($tid > 0 && $tid == $row->id) echo ""; + else echo ""; } echo ""; ?> @@ -43,14 +46,16 @@ 说明: - - * TAG首页模板文件://tag.htm
- * TAG列表页模板文件://taglist.htm
+ + 更新所有TAG将会智能更新在[TAG标签管理]中重新获取更新的内容
+ TAG首页模板文件://tag.htm
+ TAG列表页模板文件://taglist.htm
生成静态文件后,访问动态文件则直接跳转到静态文件,如果需要动态访问,删除对应文件即可。 + diff --git a/src/dede/templets/tags_main.htm b/src/dede/templets/tags_main.htm index 15d73f01..6945b688 100755 --- a/src/dede/templets/tags_main.htm +++ b/src/dede/templets/tags_main.htm @@ -1,127 +1,147 @@ - + + - -tags管理 - - + function UpdateOne(tid) { + location = "tags_main.php?action=update&count=" + document.getElementById('count' + tid).value + "&tid=" + tid; + } + function DeleteOne(tid) { + location = "tags_main.php?action=delete&ids=" + tid; + } + + -
-
-
Tags标签管理
-
-
-
- - - - - - - -
提取TAG
-开始id: - -结束id: - -  - -(tag以文档关键词为准) -
-
- - - - - - - - - - - - - -{dede:datalist} - +
+
Tags标签管理
+ +
+ +
- - - - - - - -
TAG维护
- 搜索: - - -  
标签点击文档数添加时间
+ + + + + + +
提取TAG
+ 开始id: + + 结束id: + +   + + (tag以文档关键词为准) +
+ + + + + + + + + + + + + + + + + {dede:datalist} + - - - - - - - - -{/dede:datalist} - - - - - - - - -
+ + + + + + + + +
TAG维护
+ 搜索: + + +   更新TAG HTML +
+
标签点击 + 文档数 + 添加时间 + 更新时间操作
- - - {dede:field.tag /} - - ' id='count' size='5' /> - - - - - - );'>[更新] -   - );'>[删] -
- - - {dede:pagelist /} -
- -
-
+ + + + + + {dede:field.tag + /} + + + ' + id='count' size='5' /> + + + + + + + + + + + + );'>[更新] + + '>[生成HTML] + );'>[删] + + + {/dede:datalist} + + + + + + {dede:pagelist /} + + + + + + + + + + + \ No newline at end of file diff --git a/src/include/common.func.php b/src/include/common.func.php index 962199e5..3f8c42fc 100755 --- a/src/include/common.func.php +++ b/src/include/common.func.php @@ -90,7 +90,7 @@ function dede_random_bytes($length) } if (is_readable('/dev/urandom') && ($fp = fopen('/dev/urandom', 'rb')) !== FALSE) { - is_php('5.4') && stream_set_chunk_size($fp, $length); + version_compare(PHP_VERSION, '5.4.0', '>=') && stream_set_chunk_size($fp, $length); $output = fread($fp, $length); fclose($fp); if ($output !== FALSE) diff --git a/src/install/sql-dftables.txt b/src/install/sql-dftables.txt index a9ee6c25..85968724 100755 --- a/src/install/sql-dftables.txt +++ b/src/install/sql-dftables.txt @@ -1146,6 +1146,8 @@ CREATE TABLE `#@__tagindex` ( `weekup` int(10) unsigned NOT NULL default '0', `monthup` int(10) unsigned NOT NULL default '0', `addtime` int(10) unsigned NOT NULL default '0', + `uptime` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `mktime` INT(10) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) TYPE=MyISAM; diff --git a/src/install/v57sp2_to_v58.txt b/src/install/v57sp2_to_v58.txt new file mode 100644 index 00000000..c066889c --- /dev/null +++ b/src/install/v57sp2_to_v58.txt @@ -0,0 +1,3 @@ +ALTER TABLE `#@__tagindex` + ADD COLUMN `uptime` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `addtime`, + ADD COLUMN `mktime` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `uptime`; \ No newline at end of file diff --git a/src/plus/vdimgck.php b/src/plus/vdimgck.php index c298df88..b126626d 100755 --- a/src/plus/vdimgck.php +++ b/src/plus/vdimgck.php @@ -67,7 +67,7 @@ function echo_validate_image( $config = array() ) $font_size = isset($config['font_size']) ? $config['font_size'] : 14; $img_height = isset($config['img_height']) ? $config['img_height'] : 24; $img_width = isset($config['img_width']) ? $config['img_width'] : 68; - $font_file = isset($config['font_file']) ? $config['font_file'] : PATH_DATA.'/data/font/'.mt_rand(1,3).'.ttf'; + $font_file = isset($config['font_file']) ? $config['font_file'] : DEDEINC.'/data/font/'.mt_rand(1,3).'.ttf'; $use_boder = isset($config['use_boder']) ? $config['use_boder'] : TRUE; $filter_type = isset($config['filter_type']) ? $config['filter_type'] : 0;