国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.9KB

  1. <?php
  2. /**
  3. * 生成Tag操作
  4. *
  5. * @version $Id: makehtml_taglist_action.php 1 11:17 2020年8月19日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2020, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.com
  10. */
  11. require_once(dirname(__FILE__) . "/config.php");
  12. CheckPurview('sys_MakeHtml');
  13. require_once(DEDEINC . "/arc.taglist.class.php");
  14. if (empty($total)) $total = 0; // TAGS总数
  15. if (empty($pageno)) $pageno = 0;
  16. if (empty($mkpage)) $mkpage = 1;
  17. if (empty($offset)) $offset = 0; // 当前位置
  18. if (empty($maxpagesize)) $maxpagesize = 50;
  19. $tagid = isset($tagid) ? intval($tagid) : 0;
  20. if ($total == 0 && $tagid == 0) {
  21. $total = $dsql->GetOne("SELECT count(*) as dd FROM `#@__tagindex`");
  22. $total = intval($total['dd']);
  23. }
  24. $allfinish = false;
  25. if ($offset < ($total - 1)) {
  26. $tt = $dsql->GetOne("SELECT * FROM `#@__tagindex` LIMIT " . $offset . ",1;");
  27. $tagid = $tt['id'];
  28. $offset++;
  29. } else {
  30. $allfinish = true;
  31. }
  32. $tag = $dsql->GetOne("SELECT * FROM `#@__tagindex` WHERE id='$tagid' LIMIT 0,1;");
  33. MkdirAll($cfg_basedir . "/a/tags", $cfg_dir_purview);
  34. if (is_array($tag) && count($tag) > 0) {
  35. $dlist = new TagList($tag['tag'], 'taglist.htm');
  36. $dlist->CountRecord();
  37. $ntotalpage = $dlist->TotalPage;
  38. if ($ntotalpage <= $maxpagesize) {
  39. $dlist->MakeHtml('', '');
  40. $finishType = TRUE;
  41. } else {
  42. $reurl = $dlist->MakeHtml($mkpage, $maxpagesize);
  43. $finishType = FALSE;
  44. $mkpage = $mkpage + $maxpagesize;
  45. if ($mkpage >= ($ntotalpage + 1)) $finishType = TRUE;
  46. }
  47. $nextpage = $pageno + 1;
  48. if ($nextpage >= $ntotalpage && $finishType && !($offset < ($total - 1))) {
  49. $dlist = new TagList('', 'tag.htm');
  50. $dlist->MakeHtml(1, 10);
  51. $reurl = '../a/tags/';
  52. if ($total > 0) {
  53. ShowMsg("完成TAG更新!<a href='$reurl' target='_blank'>浏览TAG首页</a>", "javascript:;");
  54. } else {
  55. $reurl .= GetPinyin($tag['tag']);
  56. ShowMsg("完成TAG更新:[" . $tag['tag'] . "]!<a href='$reurl' target='_blank'>浏览TAG首页</a>", "javascript:;");
  57. }
  58. exit();
  59. } else {
  60. if ($finishType) {
  61. if ($allfinish == true) {
  62. $total = 0;
  63. }
  64. $gourl = "makehtml_taglist_action.php?maxpagesize=$maxpagesize&tagid=$tagid&pageno=$nextpage&total=$total&offset=$offset";
  65. ShowMsg("成功生成TAG:[" . $tag['tag'] . "],继续进行操作!", $gourl, 0, 100);
  66. exit();
  67. } else {
  68. $gourl = "makehtml_taglist_action.php?mkpage=$mkpage&maxpagesize=$maxpagesize&tagid=$tagid&pageno=$pageno&total=$total&offset=$offset";
  69. ShowMsg("成功生成TAG:[" . $tag['tag'] . "],继续进行操作...", $gourl, 0, 100);
  70. exit();
  71. }
  72. }
  73. }