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

178 lines
6.4KB

  1. <?php
  2. /**
  3. * 内容处理函数
  4. *
  5. * @version $Id: content_batch_up.php 1 14:31 2010年7月12日Z 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_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('sys_ArcBatch');
  13. require_once(DEDEINC."/typelink/typelink.class.php");
  14. require_once(DEDEADMIN."/inc/inc_batchup.php");
  15. @set_time_limit(0);
  16. //获取id条件
  17. if (empty($startid)) $startid = 0;
  18. if (empty($endid)) $endid = 0;
  19. if (empty($seltime)) $seltime = 0;
  20. if (empty($typeid)) $typeid = 0;
  21. if (empty($userid)) $userid = '';
  22. //生成网页操作由其它页面处理
  23. if ($action == "makehtml") {
  24. $jumpurl = "makehtml_archives_action.php?endid=$endid&startid=$startid";
  25. $jumpurl .= "&typeid=$typeid&pagesize=20&seltime=$seltime";
  26. $jumpurl .= "&stime=".urlencode($starttime)."&etime=".urlencode($endtime);
  27. header("Location: $jumpurl");
  28. exit();
  29. }
  30. $gwhere = " WHERE 1 ";
  31. if ($startid > 0) $gwhere .= " AND id>= $startid ";
  32. if ($endid > $startid) $gwhere .= " AND id<= $endid ";
  33. $idsql = '';
  34. if ($typeid != 0) {
  35. $ids = GetSonIds($typeid);
  36. $gwhere .= " AND typeid IN($ids) ";
  37. }
  38. if ($seltime == 1) {
  39. $t1 = GetMkTime($starttime);
  40. $t2 = GetMkTime($endtime);
  41. $gwhere .= " AND (senddate >= $t1 AND senddate <= $t2) ";
  42. }
  43. if (!empty($userid)) {
  44. $row = $dsql->GetOne("SELECT `mid` FROM #@__member WHERE `userid` LIKE '$userid'");
  45. if (is_array($row)) {
  46. $gwhere .= " AND mid = {$row['mid']} ";
  47. }
  48. }
  49. //特殊操作
  50. if (!empty($heightdone)) $action = $heightdone;
  51. //指量审核
  52. if ($action == 'check') {
  53. if (empty($startid) || empty($endid) || $endid < $startid) {
  54. ShowMsg('该操作必须指定起始id', 'javascript:;');
  55. exit();
  56. }
  57. $jumpurl = "makehtml_archives_action.php?endid=$endid&startid=$startid";
  58. $jumpurl .= "&typeid=$typeid&pagesize=20&seltime=$seltime";
  59. $jumpurl .= "&stime=".urlencode($starttime)."&etime=".urlencode($endtime);
  60. $dsql->SetQuery("SELECT id,arcrank FROM `#@__arctiny` $gwhere");
  61. $dsql->Execute('c');
  62. while ($row = $dsql->GetObject('c')) {
  63. if ($row->arcrank == -1) {
  64. $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank=0 WHERE id='{$row->id}'");
  65. $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET arcrank=0 WHERE id='{$row->id}'");
  66. }
  67. }
  68. ShowMsg("完成数据库的审核处理,准备更新网页", $jumpurl);
  69. exit();
  70. }
  71. //批量删除
  72. else if ($action == 'del') {
  73. if (empty($startid) || empty($endid) || $endid < $startid) {
  74. ShowMsg('该操作必须指定起始id', 'javascript:;');
  75. exit();
  76. }
  77. $dsql->SetQuery("SELECT id FROM `#@__archives` $gwhere");
  78. $dsql->Execute('x');
  79. $tdd = 0;
  80. while ($row = $dsql->GetObject('x')) {
  81. if (DelArc($row->id)) $tdd++;
  82. }
  83. ShowMsg("成功删除 $tdd 条记录", "javascript:;");
  84. exit();
  85. }
  86. //删除空标题文档
  87. else if ($action == 'delnulltitle') {
  88. $dsql->SetQuery("SELECT id FROM `#@__archives` WHERE trim(title)='' ");
  89. $dsql->Execute('x');
  90. $tdd = 0;
  91. while ($row = $dsql->GetObject('x')) {
  92. if (DelArc($row->id)) $tdd++;
  93. }
  94. ShowMsg("成功删除 $tdd 条记录", "javascript:;");
  95. exit();
  96. }
  97. //删除空内容文档
  98. else if ($action == 'delnullbody') {
  99. $dsql->SetQuery("SELECT aid FROM `#@__addonarticle` WHERE LENGTH(body) < 10 ");
  100. $dsql->Execute('x');
  101. $tdd = 0;
  102. while ($row = $dsql->GetObject('x')) {
  103. if (DelArc($row->aid)) $tdd++;
  104. }
  105. ShowMsg("成功删除 $tdd 条记录", "javascript:;");
  106. exit();
  107. }
  108. //修正缩略图错误
  109. else if ($action == 'modddpic') {
  110. $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET litpic='' WHERE trim(litpic)='litpic' ");
  111. ShowMsg("成功修正缩略图错误", "javascript:;");
  112. exit();
  113. }
  114. //批量移动
  115. else if ($action == 'move') {
  116. if (empty($typeid)) {
  117. ShowMsg('该操作必须指定栏目', 'javascript:;');
  118. exit();
  119. }
  120. $typeold = $dsql->GetOne("SELECT * FROM #@__arctype WHERE id='$typeid'; ");
  121. $typenew = $dsql->GetOne("SELECT * FROM #@__arctype WHERE id='$newtypeid'; ");
  122. if (!is_array($typenew)) {
  123. ShowMsg("无法检测移动到的新栏目的信息,不能完成操作", "javascript:;");
  124. exit();
  125. }
  126. if ($typenew['ispart'] != 0) {
  127. ShowMsg("您不能把数据移动到非最终列表的栏目", "javascript:;");
  128. exit();
  129. }
  130. if ($typenew['channeltype'] != $typeold['channeltype']) {
  131. ShowMsg("不能把数据移动到内容类型不同的栏目", "javascript:;");
  132. exit();
  133. }
  134. $gwhere .= " And channel='".$typenew['channeltype']."' And title like '%$keyword%'";
  135. $ch = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id={$typenew['channeltype']} ");
  136. $addtable = $ch['addtable'];
  137. $dsql->SetQuery("SELECT id FROM `#@__archives` $gwhere");
  138. $dsql->Execute('m');
  139. $tdd = 0;
  140. while ($row = $dsql->GetObject('m')) {
  141. $rs = $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET typeid='$newtypeid' WHERE id='{$row->id}'");
  142. $rs = $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET typeid='$newtypeid' WHERE id='{$row->id}'");
  143. if ($addtable != '') {
  144. $dsql->ExecuteNoneQuery("UPDATE `$addtable` SET typeid='$newtypeid' WHERE aid='{$row->id}' ");
  145. }
  146. if ($rs) $tdd++;
  147. //DelArc($row->id,true);
  148. }
  149. if ($tdd > 0) {
  150. $jumpurl = "makehtml_archives_action.php?endid=$endid&startid=$startid";
  151. $jumpurl .= "&typeid=$newtypeid&pagesize=20&seltime=$seltime";
  152. $jumpurl .= "&stime=".urlencode($starttime)."&etime=".urlencode($endtime);
  153. ShowMsg("成功移动 $tdd 条记录,准备重新生成网页", $jumpurl);
  154. } else {
  155. ShowMsg("完成操作,没移动任何数据", "javascript:;");
  156. }
  157. }
  158. //删除空标题内容
  159. else if ($action == 'delnulltitle') {
  160. $dsql->SetQuery("SELECT id FROM #@__archives WHERE trim(title)='' ");
  161. $dsql->Execute('x');
  162. $tdd = 0;
  163. while ($row = $dsql->GetObject('x')) {
  164. if (DelArc($row->id)) $tdd++;
  165. }
  166. ShowMsg("成功删除 $tdd 条记录", "javascript:;");
  167. exit();
  168. }
  169. //修正缩略图错误
  170. else if ($action == 'modddpic') {
  171. $dsql->ExecuteNoneQuery("UPDATE #@__archives SET litpic='' WHERE trim(litpic)='litpic' ");
  172. ShowMsg("成功修正缩略图错误", "javascript:;");
  173. exit();
  174. }
  175. ?>