forum_topicadmin.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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: forum_topicadmin.php 30872 2012-06-27 10:11:44Z liulanbo $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. define('NOROBOT', TRUE);
  12. $_G['inajax'] = 1;
  13. $_GET['topiclist'] = !empty($_GET['topiclist']) ? (is_array($_GET['topiclist']) ? array_unique($_GET['topiclist']) : $_GET['topiclist']) : array();
  14. loadcache(array('modreasons', 'stamptypeid', 'threadtableids'));
  15. require_once libfile('function/post');
  16. require_once libfile('function/misc');
  17. $modpostsnum = 0;
  18. $resultarray = $thread = array();
  19. $threadtableids = !empty($_G['cache']['threadtableids']) ? $_G['cache']['threadtableids'] : array();
  20. $specialperm = $_GET['action'] == 'stickreply' && $_G['thread']['authorid'] == $_G['uid'];
  21. if(!$specialperm && (!$_G['uid'] || !$_G['forum']['ismoderator'])) {
  22. showmessage('admin_nopermission', NULL);
  23. }
  24. $frommodcp = !empty($_GET['frommodcp']) ? intval($_GET['frommodcp']) : 0;
  25. $navigation = $navtitle = '';
  26. if(!empty($_G['tid'])) {
  27. $_GET['archiveid'] = intval($_GET['archiveid']);
  28. $archiveid = 0;
  29. if(!empty($_GET['archiveid']) && in_array($_GET['archiveid'], $threadtableids)) {
  30. $archiveid = $_GET['archiveid'];
  31. }
  32. $displayorder = !$_G['forum_auditstatuson'] ? 0 : null;
  33. $thread = C::t('forum_thread')->fetch_by_tid_fid_displayorder($_G['tid'], $_G['fid'], $displayorder, $archiveid);
  34. if(!$thread) {
  35. showmessage('thread_nonexistence');
  36. }
  37. $navigation .= " &raquo; <a href=\"forum.php?mod=viewthread&tid=$_G[tid]\">$thread[subject]</a> ";
  38. $navtitle .= ' - '.$thread['subject'].' - ';
  39. if($thread['special'] && in_array($_GET['action'], array('copy', 'split', 'merge'))) {
  40. showmessage('special_noaction');
  41. }
  42. }
  43. if(($_G['group']['reasonpm'] == 2 || $_G['group']['reasonpm'] == 3) || !empty($_GET['sendreasonpm'])) {
  44. $forumname = strip_tags($_G['forum']['name']);
  45. $sendreasonpm = 1;
  46. } else {
  47. $sendreasonpm = 0;
  48. }
  49. $_GET['handlekey'] = 'mods';
  50. if(preg_match('/^\w+$/', $_GET['action']) && file_exists($topicadminfile = libfile('topicadmin/'.$_GET['action'], 'include'))) {
  51. require_once $topicadminfile;
  52. } else {
  53. showmessage('undefined_action', NULL);
  54. }
  55. if($resultarray) {
  56. if($resultarray['modtids']) {
  57. updatemodlog($resultarray['modtids'], $modaction, $resultarray['expiration']);
  58. }
  59. updatemodworks($modaction, $modpostsnum);
  60. if(is_array($resultarray['modlog'])) {
  61. if(isset($resultarray['modlog']['tid'])) {
  62. modlog($resultarray['modlog'], $modaction);
  63. } else {
  64. foreach($resultarray['modlog'] as $thread) {
  65. modlog($thread, $modaction);
  66. }
  67. }
  68. }
  69. if($resultarray['reasonpm']) {
  70. $modactioncode = lang('forum/modaction');
  71. $modaction = $modactioncode[$modaction];
  72. foreach($resultarray['reasonpm']['data'] as $var) {
  73. sendreasonpm($var, $resultarray['reasonpm']['item'], $resultarray['reasonvar'], $resultarray['reasonpm']['notictype']);
  74. }
  75. }
  76. showmessage((isset($resultarray['message']) ? $resultarray['message'] : 'admin_succeed'), $resultarray['redirect']);
  77. }
  78. ?>