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

83 lines
3.0KB

  1. <?php
  2. /**
  3. * 检测重复文档
  4. *
  5. * @version $id:article_test_same.php 14:31 2010年7月12日 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. @set_time_limit(0);
  13. CheckPurview('sys_ArcBatch');
  14. if (empty($dopost)) $dopost = '';
  15. if ($dopost == 'analyse') {
  16. $arr = $dsql->getone("SELECT maintable FROM `#@__channeltype` WHERE id='$channelid' ");
  17. if (is_array($arr)) {
  18. $maintable = $arr['maintable'];
  19. } else {
  20. showmsg('栏目id不正确,无法处理', 'javascript:;');
  21. exit();
  22. }
  23. $pagesize = intval($pagesize);
  24. $dsql->SetQuery("SELECT COUNT(title) AS dd,title FROM `$maintable` WHERE channel='$channelid' GROUP BY title ORDER BY dd DESC LIMIT 0, $pagesize");
  25. $dsql->Execute();
  26. $allarc = 0;
  27. include DedeInclude('templets/article_result_same.htm');
  28. exit();
  29. }
  30. //删除选中的文档(只保留一条)
  31. else if ($dopost == 'delsel') {
  32. require_once(DEDEINC."/typelink/typelink.class.php");
  33. require_once(dirname(__FILE__)."/inc/inc_batchup.php");
  34. if (empty($titles)) {
  35. header("Content-Type: text/html; charset={$cfg_ver_lang}");
  36. echo "<meta charset={$cfg_ver_lang}\">\r\n";
  37. echo "没有指定删除的文档";
  38. exit();
  39. }
  40. if (!$dsql->IsTable($maintable)) {
  41. ShowMsg("数据表名称错误", "javascript:;");
  42. exit();
  43. }
  44. $titless = split('`', $titles);
  45. if ($channelid < -1) {
  46. $orderby = ($deltype == 'delnew' ? " ORDER BY aid DESC " : " ORDER BY aid ASC ");
  47. } else {
  48. $orderby = ($deltype == 'delnew' ? " ORDER BY id DESC " : " ORDER BY id ASC ");
  49. }
  50. $totalarc = 0;
  51. foreach ($titless as $title) {
  52. $title = trim($title);
  53. $title = addslashes($title == '' ? '' : urldecode($title));
  54. if ($channelid < -1) {
  55. $q1 = "SELECT aid as id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby ";
  56. } else {
  57. $q1 = "SELECT id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby ";
  58. }
  59. $dsql->SetQuery($q1);
  60. $dsql->Execute();
  61. $rownum = $dsql->GetTotalRow();
  62. if ($rownum < 2) continue;
  63. $i = 1;
  64. while ($row = $dsql->GetObject()) {
  65. $i++;
  66. $naid = $row->id;
  67. $ntitle = $row->title;
  68. if ($i > $rownum) continue;
  69. $totalarc++;
  70. DelArc($naid, 'OFF');
  71. }
  72. }
  73. $dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `$maintable`;");
  74. ShowMsg("一共删除了<span class='text-primary'>{$totalarc}</span>篇重复的文档", "javascript:;");
  75. exit();
  76. }
  77. //向导页
  78. $channelinfos = array();
  79. $dsql->setquery("SELECT id,typename,maintable,addtable FROM `#@__channeltype`");
  80. $dsql->execute();
  81. while ($row = $dsql->getarray()) $channelinfos[] = $row;
  82. include DedeInclude('templets/article_test_same.htm');
  83. ?>