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

162 lines
6.3KB

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