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

89 lines
3.1KB

  1. <?php
  2. /**
  3. * 检测重复文档
  4. *
  5. * @version $Id: article_test_same.php 1 14:31 2010年7月12日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2007 - 2019, DesDev, Inc.
  8. * @license http://help.dedecms.com/usersguide/license.html
  9. * @link http://www.dedecms.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. {
  17. $arr = $dsql->getone("SELECT maintable FROM `#@__channeltype` WHERE id='$channelid' ");
  18. if(is_array($arr)) {
  19. $maintable = $arr['maintable'];
  20. } else {
  21. showmsg('频道id不正确,无法处理!','javascript:;');
  22. exit();
  23. }
  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. {
  33. require_once(dirname(__FILE__)."/../include/typelink.class.php");
  34. require_once(dirname(__FILE__)."/inc/inc_batchup.php");
  35. if(empty($titles))
  36. {
  37. header("Content-Type: text/html; charset={$cfg_ver_lang}");
  38. echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$cfg_ver_lang}\">\r\n";
  39. echo "没有指定删除的文档!";
  40. exit();
  41. }
  42. $titless = split('`',$titles);
  43. if($channelid < -1) {
  44. $orderby = ($deltype=='delnew' ? " ORDER BY aid DESC " : " ORDER BY aid ASC ");
  45. } else {
  46. $orderby = ($deltype=='delnew' ? " ORDER BY id DESC " : " ORDER BY id ASC ");
  47. }
  48. $totalarc = 0;
  49. foreach($titless as $title)
  50. {
  51. $title = trim($title);
  52. $title = addslashes( $title=='' ? '' : urldecode($title) );
  53. if($channelid < -1) {
  54. $q1 = "SELECT aid as id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby ";
  55. }
  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. {
  66. $i++;
  67. $naid = $row->id;
  68. $ntitle = $row->title;
  69. if($i > $rownum) continue;
  70. $totalarc++;
  71. DelArc($naid, 'OFF');
  72. }
  73. }
  74. $dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `$maintable`; ");
  75. ShowMsg("一共删除了[{$totalarc}]篇重复的文档!","javascript:;");
  76. exit();
  77. }
  78. //向导页
  79. $channelinfos = array();
  80. $dsql->setquery("SELECT id,typename,maintable,addtable FROM `#@__channeltype` ");
  81. $dsql->execute();
  82. while($row = $dsql->getarray()) $channelinfos[] = $row;
  83. include DedeInclude('templets/article_test_same.htm');