国内流行的内容管理系统(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.

141 lines
5.7KB

  1. <?php
  2. /**
  3. * 任务操作
  4. *
  5. * @version $id:task_do.php 23:07 2010年7月20日 tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2022 DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require(dirname(__FILE__).'/config.php');
  12. $dopost = (!isset($dopost) ? '' : $dopost);
  13. //返回到下一任务链接,特殊变量,除非知道作用,否则不能在任务传递中占用:f临时,仅为了方便网址结构,dopost当前任务指向下一个任务,由会员自行处理或在nextdo中自动获得,del上一次任务删除的变量,morejob设定后,表示当前任务需请求多次,会把 dopost和nextdo处理后转为doposttmp和nextdotmp,然后由会员自行处理
  14. function GetNextUrl($notallowArr = array('dopost', 'f', 'del'))
  15. {
  16. $reurl = "task_do.php?f=0";
  17. foreach ($_GET as $k => $v) {
  18. if ($k == 'nextdo') {
  19. $nextdo = '';
  20. $nextdos = explode(',', $GLOBALS[$k]);
  21. if (isset($nextdos[1])) {
  22. for ($i = 1; $i < count($nextdos); $i++) {
  23. if (trim($nextdos[$i]) == '') continue;
  24. $nextdo .= ($nextdo == '' ? $nextdos[$i] : ','.$nextdos[$i]);
  25. }
  26. }
  27. //如果系统有多重任务,把下一任务和任务列表参数提交给程序处理
  28. if (in_array('morejob', $notallowArr)) {
  29. $reurl .= "&doposttmp=".$nextdos[0];
  30. if ($nextdo != '') $reurl .= "&nextdotmp=$nextdo";
  31. } else {
  32. $reurl .= "&dopost=".$nextdos[0];
  33. if ($nextdo != '') $reurl .= "&nextdo=$nextdo";
  34. }
  35. } else if (in_array($k, $notallowArr)) {
  36. continue;
  37. } else {
  38. $reurl .= "&{$k}=".urlencode($GLOBALS[$k]);
  39. }
  40. }
  41. return $reurl;
  42. }
  43. //更新上一篇和下一篇
  44. if ($dopost == 'makeprenext') {
  45. require_once(DEDEINC.'/archive/archives.class.php');
  46. $aid = intval($aid);
  47. $preRow = $dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id<$aid AND arcrank>-1 AND typeid='$typeid' ORDER BY id DESC");
  48. $nextRow = $dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id>$aid AND arcrank>-1 AND typeid='$typeid' ORDER BY id ASC");
  49. if (is_array($preRow)) {
  50. $envs['aid'] = $preRow['id'];
  51. $arc = new Archives($preRow['id']);
  52. $arc->MakeHtml();
  53. }
  54. if (is_array($nextRow)) {
  55. $envs['aid'] = $nextRow['id'];
  56. $arc = new Archives($nextRow['id']);
  57. $arc->MakeHtml();
  58. }
  59. if (empty($nextdo)) {
  60. ShowMsg("完成上下篇文档更新任务完成所有更新任务", "close::tgtable");
  61. exit();
  62. } else {
  63. $jumpurl = GetNextUrl();
  64. ShowMsg("完成下篇文档更新任务 继续执行其它任务", $jumpurl, 0, 500);
  65. exit();
  66. }
  67. }
  68. //更新首页的任务
  69. if ($dopost == 'makeindex') {
  70. require_once(DEDEINC.'/archive/partview.class.php');
  71. $envs = $_sys_globals = array();
  72. $envs['aid'] = 0;
  73. $pv = new PartView();
  74. $row = $pv->dsql->GetOne('SELECT * FROM `#@__homepageset`');
  75. $templet = str_replace("{style}", $cfg_df_style, $row['templet']);
  76. $homeFile = dirname(__FILE__).'/'.$row['position'];
  77. $homeFile = str_replace("//", "/", str_replace("\\", "/", $homeFile));
  78. $fp = fopen($homeFile, 'w') or die("无法更新网站首页到:$homeFile 位置");
  79. fclose($fp);
  80. $tpl = $cfg_basedir.$cfg_templets_dir.'/'.$templet;
  81. if (!file_exists($tpl)) {
  82. $tpl = $cfg_basedir.$cfg_templets_dir.'/default/index.htm';
  83. if (!file_exists($tpl)) exit("无法找到首页模板:$tpl ");
  84. }
  85. $GLOBALS['_arclistEnv'] = 'index';
  86. $pv->SetTemplet($tpl);
  87. $pv->SaveToHtml($homeFile);
  88. $pv->Close();
  89. if (empty($nextdo)) {
  90. ShowMsg("完成首页更新任务完成所有更新任务", "close::tgtable");
  91. exit();
  92. } else {
  93. $jumpurl = GetNextUrl();
  94. ShowMsg("完成首页更新 现在跳转其它更新任务", $jumpurl, 0, 500);
  95. exit();
  96. }
  97. }
  98. //更新所有关连的栏目
  99. else if ($dopost == 'makeparenttype') {
  100. require_once(DEDEDATA."/cache/inc_catalog_base.inc");
  101. require_once(DEDEINC.'/archive/listview.class.php');
  102. $notallowArr = array('dopost', 'f', 'del', 'curpage', 'morejob');
  103. $jumpurl = GetNextUrl($notallowArr);
  104. if (empty($typeid)) {
  105. ShowMsg("完成栏目更新任务完成所有更新任务", "close::tgtable");
  106. exit();
  107. }
  108. $topids = explode(',', GetTopids($typeid));
  109. if (empty($curpage)) $curpage = 0;
  110. $tid = $topids[$curpage];
  111. if (isset($cfg_Cs[$tid]) && $cfg_Cs[$tid][1] > 0) {
  112. require_once(DEDEINC."/archive/listview.class.php");
  113. $lv = new ListView($tid);
  114. $lv->CountRecord();
  115. $lv->MakeHtml();
  116. $lv->Close();
  117. } else {
  118. require_once(DEDEINC."/archive/sglistview.class.php");
  119. $lv = new SgListView($tid);
  120. $lv->CountRecord();
  121. $lv->MakeHtml();
  122. $lv->Close();
  123. }
  124. if ($curpage >= count($topids) - 1) {
  125. if (!empty($doposttmp)) {
  126. $jumpurl = preg_replace("#doposttmp|nextdotmp#", 'del', $jumpurl);
  127. $jumpurl .= "&dopost={$doposttmp}&nextdo={$nextdotmp}";
  128. ShowMsg("完成栏目:{$tid}更新<br>完成栏目更新任务,继续执行后续任务", $jumpurl, 0, 500);
  129. exit();
  130. } else {
  131. ShowMsg("完成栏目:{$tid}更新<br>完成栏目更新任务,完成所有更新任务", "close::tgtable");
  132. exit();
  133. }
  134. } else {
  135. $curpage++;
  136. $jumpurl .= "&curpage={$curpage}&dopost=makeparenttype";
  137. ShowMsg("完成栏目:{$tid}更新,继续更新其它栏目", $jumpurl, 0, 500);
  138. exit();
  139. }
  140. }
  141. ?>