topicadmin_restore.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_restore.php 27088 2012-01-05 02:36:48Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. if($_G['adminid'] != '1') {
  12. showmessage('no_privilege_restore');
  13. }
  14. $archiveid = intval($_GET['archiveid']);
  15. if(!submitcheck('modsubmit')) {
  16. include template('forum/topicadmin_action');
  17. } else {
  18. if(!in_array($archiveid, $threadtableids)) {
  19. $archiveid = 0;
  20. }
  21. C::t('forum_thread')->insert_thread_copy_by_tid($_G['tid'], $archiveid, 0);
  22. C::t('forum_thread')->delete_by_tid($_G['tid'], false, $archiveid);
  23. $threadcount = C::t('forum_thread')->count_by_fid($_G['fid'], $archiveid);
  24. if($threadcount) {
  25. C::t('forum_forum_threadtable')->update($_G['fid'], $archiveid, array('threads' => $threadcount));
  26. } else {
  27. C::t('forum_forum_threadtable')->delete($_G['fid'], $archiveid);
  28. }
  29. if(!C::t('forum_forum_threadtable')->count_by_fid($_G['fid'])) {
  30. C::t('forum_forum')->update($_G['fid'], array('archive' => 0));
  31. }
  32. $modaction = 'RST';
  33. $reason = checkreasonpm();
  34. $resultarray = array(
  35. 'redirect' => "forum.php?mod=viewthread&tid=$_G[tid]&page=$page",
  36. 'reasonpm' => ($sendreasonpm ? array('data' => array($thread), 'var' => 'thread') : array()),
  37. 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason),
  38. 'modaction' => $modaction,
  39. 'modlog' => $thread
  40. );
  41. }
  42. ?>