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

task_do.php 6.0KB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. /******************************
  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.'/archive/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("完成上下篇文档更新任务完成所有更新任务", "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.'/archive/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("完成主页更新任务完成所有更新任务", "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.'/archive/listview.class.php');
  118. $notallowArr = array('dopost', 'f', 'del', 'curpage', 'morejob');
  119. $jumpurl = GetNextUrl($notallowArr);
  120. if (empty($typeid)) {
  121. ShowMsg("完成栏目更新任务完成所有更新任务", "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."/archive/listview.class.php");
  129. $lv = new ListView($tid);
  130. $lv->CountRecord();
  131. $lv->MakeHtml();
  132. $lv->Close();
  133. } else {
  134. require_once(DEDEINC."/archive/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>完成栏目更新任务,继续执行后续任务", $jumpurl, 0, 500);
  145. exit();
  146. } else {
  147. ShowMsg("完成栏目:{$tid} 更新<br>完成栏目更新任务,完成所有更新任务", "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. }
  157. ?>