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

85 lines
3.0KB

  1. <?php
  2. /**
  3. * 检测重复文档
  4. *
  5. * @version $Id: article_test_same.php 1 14:31 2010年7月12日Z tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2021, 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. $dsql->SetQuery("SELECT COUNT(title) AS dd,title FROM `$maintable` WHERE channel='$channelid' GROUP BY title ORDER BY dd DESC LIMIT 0, $pagesize");
  24. $dsql->Execute();
  25. $allarc = 0;
  26. include DedeInclude('templets/article_result_same.htm');
  27. exit();
  28. }
  29. //删除选中的内容(只保留一条)
  30. else if ($dopost == 'delsel') {
  31. require_once(dirname(__FILE__) . "/../include/typelink.class.php");
  32. require_once(dirname(__FILE__) . "/inc/inc_batchup.php");
  33. if (empty($titles)) {
  34. header("Content-Type: text/html; charset={$cfg_ver_lang}");
  35. echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$cfg_ver_lang}\">\r\n";
  36. echo "没有指定删除的文档!";
  37. exit();
  38. }
  39. $titless = split('`', $titles);
  40. if ($channelid < -1) {
  41. $orderby = ($deltype == 'delnew' ? " ORDER BY aid DESC " : " ORDER BY aid ASC ");
  42. } else {
  43. $orderby = ($deltype == 'delnew' ? " ORDER BY id DESC " : " ORDER BY id ASC ");
  44. }
  45. $totalarc = 0;
  46. foreach ($titless as $title) {
  47. $title = trim($title);
  48. $title = addslashes($title == '' ? '' : urldecode($title));
  49. if ($channelid < -1) {
  50. $q1 = "SELECT aid as id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby ";
  51. } else {
  52. $q1 = "SELECT id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby ";
  53. }
  54. $dsql->SetQuery($q1);
  55. $dsql->Execute();
  56. $rownum = $dsql->GetTotalRow();
  57. if ($rownum < 2) continue;
  58. $i = 1;
  59. while ($row = $dsql->GetObject()) {
  60. $i++;
  61. $naid = $row->id;
  62. $ntitle = $row->title;
  63. if ($i > $rownum) continue;
  64. $totalarc++;
  65. DelArc($naid, 'OFF');
  66. }
  67. }
  68. $dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `$maintable`; ");
  69. ShowMsg("一共删除了[{$totalarc}]篇重复的文档!", "javascript:;");
  70. exit();
  71. }
  72. //向导页
  73. $channelinfos = array();
  74. $dsql->setquery("SELECT id,typename,maintable,addtable FROM `#@__channeltype` ");
  75. $dsql->execute();
  76. while ($row = $dsql->getarray()) $channelinfos[] = $row;
  77. include DedeInclude('templets/article_test_same.htm');