diff --git a/src/dede/inc/inc_archives_all.php b/src/dede/inc/inc_archives_all.php index 2b19690..258b83b 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 177536c..f5c3ff8 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 b33418e..57a86fa 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 9bba3fc..99e9857 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 ee5c5a7..f12b7ca 100644 --- a/src/dede/templets/makehtml_taglist.htm +++ b/src/dede/templets/makehtml_taglist.htm @@ -15,6 +15,7 @@