topicadmin_removereward.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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: topicadmin_removereward.php 31998 2012-10-30 07:17:49Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if(!$_G['group']['allowremovereward']) {
  12. showmessage('no_privilege_removereward');
  13. }
  14. if(!submitcheck('modsubmit')) {
  15. include template('forum/topicadmin_action');
  16. } else {
  17. if(!is_array($thread) || $thread['special'] != '3') {
  18. showmessage('reward_end');
  19. }
  20. $modaction = 'RMR';
  21. $reason = checkreasonpm();
  22. $log = C::t('common_credit_log')->fetch_by_operation_relatedid('RAC', $thread['tid']);
  23. $answererid = $log['uid'];
  24. if($thread['price'] < 0) {
  25. $thread['price'] = abs($thread['price']);
  26. updatemembercount($answererid, array($_G['setting']['creditstransextra'][2] => -$thread['price']));
  27. }
  28. updatemembercount($thread['authorid'], array($_G['setting']['creditstransextra'][2] => $thread['price']));
  29. C::t('forum_thread')->update($thread['tid'], array('special'=>0, 'price'=>0), true);
  30. C::t('common_credit_log')->delete_by_operation_relatedid(array('RTC', 'RAC'), $thread['tid']);
  31. $resultarray = array(
  32. 'redirect' => "forum.php?mod=viewthread&tid=$thread[tid]",
  33. 'reasonpm' => ($sendreasonpm ? array('data' => array($thread), 'var' => 'thread', 'item' => 'reason_remove_reward', 'notictype' => 'post') : array()),
  34. 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason, 'threadid' => $thread[tid]),
  35. 'modtids' => $thread['tid']
  36. );
  37. }
  38. ?>