admincp_moderate.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: admincp_moderate.php 32501 2013-01-29 09:51:00Z chenmengshu $
  7. */
  8. if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
  9. exit('Access Denied');
  10. }
  11. cpheader();
  12. $ignore = $_GET['ignore'];
  13. $filter = $_GET['filter'];
  14. $modfid = $_GET['modfid'];
  15. $modsubmit = $_GET['modsubmit'];
  16. $moderate = $_GET['moderate'];
  17. $pm = $_GET['pm'];
  18. $showcensor = !empty($_GET['showcensor']) ? 1 : 0;
  19. $_G['setting']['memberperpage'] = 100;
  20. if(empty($operation)) {
  21. $operation = 'threads';
  22. }
  23. if($operation == 'members') {
  24. require_once libfile('moderate/member', 'admincp');
  25. exit;
  26. } else {
  27. require_once libfile('function/forumlist');
  28. require_once libfile('function/post');
  29. $modfid = !empty($modfid) ? intval($modfid) : 0;
  30. $recyclebins = $forumlist = array();
  31. $query = C::t('forum_forum')->fetch_all_valid_forum();
  32. foreach($query as $forum) {
  33. $recyclebins[$forum['fid']] = $forum['recyclebin'];
  34. $forumlist[$forum['fid']] = $forum['name'];
  35. }
  36. if($modfid && $modfid != '-1') {
  37. $fidadd = array('fids' => $modfid, 'and' => ' AND ', 't' => 't.', 'p' => 'p.');
  38. } else {
  39. $fidadd = array();
  40. }
  41. if(isset($filter) && $filter == 'ignore') {
  42. $displayorder = -3;
  43. $moderatestatus = 1;
  44. $filteroptions = '<option value="normal">'.$lang['moderate_none'].'</option><option value="ignore" selected>'.$lang['moderate_ignore'].'</option>';
  45. } else {
  46. $displayorder = -2;
  47. $moderatestatus = 0;
  48. $filter = 'normal';
  49. $filteroptions = '<option value="normal" selected>'.$lang['moderate_none'].'</option><option value="ignore">'.$lang['moderate_ignore'].'</option>';
  50. }
  51. $forumoptions = '<option value="all"'.(empty($modfid) ? ' selected' : '').'>'.$lang['moderate_all_fields'].'</option>';
  52. if($operation != 'replies') {
  53. $forumoptions .= '<option value="-1" '.($modfid == '-1' ? 'selected' : '').'>'.$lang['moderate_all_groups'].'</option>'."\n";
  54. }
  55. foreach($forumlist as $fid => $forumname) {
  56. $selected = $modfid == $fid ? ' selected' : '';
  57. $forumoptions .= '<option value="'.$fid.'" '.$selected.'>'.$forumname.'</option>'."\n";
  58. }
  59. require_once libfile('function/misc');
  60. $modreasonoptions = '<option value="">'.$lang['none'].'</option><option value="">--------</option>'.modreasonselect(1);
  61. echo <<<EOT
  62. <script type="text/JavaScript">
  63. var cookiepre = "{$_G[config][cookie][cookiepre]}";
  64. function mod_setbg(tid, value) {
  65. $('mod_' + tid + '_row1').className = 'mod_' + value;
  66. $('mod_' + tid + '_row2').className = 'mod_' + value;
  67. $('mod_' + tid + '_row3').className = 'mod_' + value;
  68. $("chk_apply_all").checked = false;
  69. $("chk_apply_all").disabled = true;
  70. }
  71. function mod_setbg_all(value) {
  72. checkAll('option', $('cpform'), value);
  73. var trs = $('cpform').getElementsByTagName('TR');
  74. for(var i in trs) {
  75. if(trs[i].id && trs[i].id.substr(0, 4) == 'mod_') {
  76. trs[i].className = 'mod_' + value;
  77. }
  78. }
  79. $("chk_apply_all").disabled = false;
  80. $("chk_apply_all").value = value;
  81. }
  82. function attachimg() {}
  83. function expandall() {
  84. var tds = $('cpform').getElementsByTagName('TD');
  85. for(var i in tds) {
  86. if(tds[i].id && tds[i].id.match(/^mod_(\d+)_row1_op$/) != null) {
  87. tds[i].rowSpan = "3";
  88. }
  89. }
  90. var trs = $('cpform').getElementsByTagName('TR');
  91. for(var i in trs) {
  92. if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row1$/) != null) {
  93. tds = trs[i].getElementsByTagName('TD');
  94. for(var j in tds) {
  95. if(tds[j].className == "threadtitle threadopt") {
  96. tds[j].className = "";
  97. }
  98. }
  99. }
  100. if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row(2|3)$/) != null) {
  101. trs[i].style.display = "";
  102. }
  103. }
  104. setcookie("foldall", 0, 3600);
  105. }
  106. function foldall() {
  107. var tds = $('cpform').getElementsByTagName('TD');
  108. for(var i in tds) {
  109. if(tds[i].id && tds[i].id.match(/^mod_(\d+)_row1_op$/) != null) {
  110. tds[i].rowSpan = "1";
  111. }
  112. }
  113. var trs = $('cpform').getElementsByTagName('TR');
  114. for(var i in trs) {
  115. if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row1$/) != null) {
  116. tds = trs[i].getElementsByTagName('TD');
  117. for(var j in tds) {
  118. if(tds[j].className == "") {
  119. tds[j].className = "threadtitle threadopt";
  120. }
  121. }
  122. }
  123. if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row(2|3)$/) != null) {
  124. trs[i].style.display = "none";
  125. }
  126. }
  127. setcookie("foldall", 1, 3600);
  128. }
  129. function display_toggle(tid) {
  130. var tr1 = $('mod_' + tid + '_row1');
  131. var tr1_op = $('mod_' + tid + '_row1_op');
  132. var tr2 = $('mod_' + tid + '_row2');
  133. var tr3 = $('mod_' + tid + '_row3');
  134. var tds = tr1.getElementsByTagName('TD');
  135. if(tr1_op.rowSpan == "1") {
  136. for(var i in tds) {
  137. if(tds[i].className == "threadtitle threadopt") {
  138. tds[i].className = "";
  139. }
  140. }
  141. tr1_op.rowSpan = "3";
  142. tr2.style.display = "";
  143. tr3.style.display = "";
  144. } else {
  145. for(var i in tds) {
  146. if(tds[i].className == "") {
  147. tds[i].className = "threadtitle threadopt";
  148. }
  149. }
  150. tr1_op.rowSpan = "1";
  151. tr2.style.display = "none";
  152. tr3.style.display = "none";
  153. }
  154. }
  155. function mod_cancel_all() {
  156. var form = $('cpform');
  157. var checkall = 'chkall';
  158. for(var i = 0; i < form.elements.length; i++) {
  159. var e = form.elements[i];
  160. if(e.type == 'radio') {
  161. e.checked = '';
  162. }
  163. }
  164. var trs = $('cpform').getElementsByTagName('TR');
  165. for(var i in trs) {
  166. if(trs[i].id && trs[i].id.match(/^mod_(\d+)_row(1|2|3)$/)) {
  167. trs[i].className = "mod_cancel";
  168. }
  169. }
  170. $("chk_apply_all").checked = false;
  171. $("chk_apply_all").disabled = true;
  172. }
  173. function remove_element(_element) {
  174. var _parentElement = _element.parentNode;
  175. if(_parentElement){
  176. _parentElement.removeChild(_element);
  177. }
  178. }
  179. function mod_remove_row(id) {
  180. var id1 = "mod_" + id + "_row1";
  181. var id2 = "mod_" + id + "_row2";
  182. var id3 = "mod_" + id + "_row3";
  183. var node1 = parent.document.getElementById(id1);
  184. var node2 = parent.document.getElementById(id2);
  185. var node3 = parent.document.getElementById(id3);
  186. remove_element(node1);
  187. remove_element(node2);
  188. remove_element(node3);
  189. }
  190. window.onload = function() {
  191. if(getcookie("foldall")) {
  192. foldall();
  193. }
  194. };
  195. </script>
  196. EOT;
  197. }
  198. $submenu = array(
  199. array(array('menu' => 'moderate_m_forum', 'submenu' => array(
  200. 'threads' => array('nav_moderate_threads', 'moderate&operation=threads', $operation == 'threads'),
  201. 'replies' => array('nav_moderate_replies', 'moderate&operation=replies', $operation == 'replies'),
  202. )), in_array($operation, array('threads', 'replies'))),
  203. array(array('menu' => 'moderate_m_home', 'submenu' => array(
  204. 'blogs' => array('nav_moderate_blogs', 'moderate&operation=blogs', $operation == 'blogs'),
  205. 'pictures' => array('nav_moderate_pictures', 'moderate&operation=pictures', $operation == 'pictures'),
  206. 'doings' => array('nav_moderate_doings', 'moderate&operation=doings', $operation == 'doings'),
  207. 'shares' => array('nav_moderate_shares', 'moderate&operation=shares', $operation == 'shares'),
  208. 'comments' => array('nav_moderate_comments', 'moderate&operation=comments', $operation == 'comments'),
  209. )), in_array($operation, array('blogs', 'pictures', 'doings', 'shares', 'comments'))),
  210. array(array('menu' => 'moderate_m_portal', 'submenu' => array(
  211. 'articles' => array('nav_moderate_articles', 'moderate&operation=articles', $operation == 'articles'),
  212. 'articlecomments' => array('nav_moderate_articlecomments', 'moderate&operation=articlecomments', $operation == 'articlecomments'),
  213. 'topiccomments' => array('nav_moderate_topiccomments', 'moderate&operation=topiccomments', $operation == 'topiccomments'),
  214. )), in_array($operation, array('articles', 'articlecomments', 'topiccomments')))
  215. );
  216. if($operation == 'threads') {
  217. require_once libfile('moderate/thread', 'admincp');
  218. } elseif($operation == 'replies') {
  219. require_once libfile('moderate/reply', 'admincp');
  220. } elseif($operation == 'blogs') {
  221. require_once libfile('moderate/blog', 'admincp');
  222. } elseif($operation == 'pictures') {
  223. require_once libfile('moderate/picture', 'admincp');
  224. } elseif($operation == 'doings') {
  225. require_once libfile('moderate/doing', 'admincp');
  226. } elseif($operation == 'shares') {
  227. require_once libfile('moderate/share', 'admincp');
  228. } elseif($operation == 'comments') {
  229. require_once libfile('moderate/comment', 'admincp');
  230. } elseif($operation == 'articles') {
  231. require_once libfile('moderate/article', 'admincp');
  232. } elseif($operation == 'articlecomments' || $operation == 'topiccomments') {
  233. require_once libfile('moderate/portalcomment', 'admincp');
  234. }
  235. echo '<iframe name="fasthandle" style="display: none;"></iframe>';
  236. function callback_js($id) {
  237. $js = <<<EOT
  238. <script type="text/javascript">
  239. mod_remove_row('$id');
  240. </script>
  241. EOT;
  242. return $js;
  243. }
  244. function moderateswipe($type, $ids) {
  245. if($type == 'pid') {
  246. $exist_ids = array_keys(C::t('forum_post')->fetch_all(0, $ids));
  247. } elseif($type == 'tid') {
  248. $exist_ids = array_keys(C::t('forum_thread')->fetch_all($ids));
  249. }
  250. $remove_ids = array_diff($ids, $exist_ids);
  251. if($remove_ids) {
  252. return C::t('common_moderate')->delete($remove_ids, $type);
  253. } else {
  254. return 0;
  255. }
  256. }
  257. ?>