PageRenderTime 45ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/source/include/post/post_editpost.php

https://github.com/jinbo51/DiscuzX
PHP | 528 lines | 420 code | 102 blank | 6 comment | 210 complexity | 1df4e5dcfebcf220b6dfc670ec75223c MD5 | raw file
Possible License(s): BSD-3-Clause
  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: post_editpost.php 33417 2013-06-08 08:25:16Z andyzheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $orig = get_post_by_tid_pid($_G['tid'], $pid);
  12. $isfirstpost = $orig['first'] ? 1 : 0;
  13. if($isfirstpost && (($special == 1 && !$_G['group']['allowpostpoll']) || ($special == 2 && !$_G['group']['allowposttrade']) || ($special == 3 && !$_G['group']['allowpostreward']) || ($special == 4 && !$_G['group']['allowpostactivity']) || ($special == 5 && !$_G['group']['allowpostdebate']))) {
  14. showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
  15. }
  16. if($_G['setting']['magicstatus']) {
  17. $magiclog = C::t('forum_threadmod')->fetch_by_tid_magicid($_G['tid'], 10);
  18. $magicid = $magiclog['magicid'];
  19. $_G['group']['allowanonymous'] = $_G['group']['allowanonymous'] || $magicid ? 1 : $_G['group']['allowanonymous'];
  20. }
  21. $isorigauthor = $_G['uid'] && $_G['uid'] == $orig['authorid'];
  22. $isanonymous = ($_G['group']['allowanonymous'] || $orig['anonymous']) && getgpc('isanonymous') ? 1 : 0;
  23. $audit = $orig['invisible'] == -2 || $thread['displayorder'] == -2 ? $_GET['audit'] : 0;
  24. if(empty($orig)) {
  25. showmessage('post_nonexistence');
  26. } elseif((!$_G['forum']['ismoderator'] || !$_G['group']['alloweditpost'] || (in_array($orig['adminid'], array(1, 2, 3)) && $_G['adminid'] > $orig['adminid'])) && !(($_G['forum']['alloweditpost'] || $orig['invisible'] == -3)&& $isorigauthor)) {
  27. showmessage('post_edit_nopermission', NULL);
  28. } elseif($isorigauthor && !$_G['forum']['ismoderator'] && $orig['invisible'] != -3) {
  29. $alloweditpost_status = getstatus($_G['setting']['alloweditpost'], $special + 1);
  30. if(!$alloweditpost_status && $_G['group']['edittimelimit'] && TIMESTAMP - $orig['dateline'] > $_G['group']['edittimelimit'] * 60) {
  31. showmessage('post_edit_timelimit', NULL, array('edittimelimit' => $_G['group']['edittimelimit']));
  32. }
  33. }
  34. $thread['pricedisplay'] = $thread['price'] == -1 ? 0 : $thread['price'];
  35. if($special == 5) {
  36. $debate = array_merge($thread, daddslashes(C::t('forum_debate')->fetch($_G['tid'])));
  37. $firststand = C::t('forum_debatepost')->get_firststand($_G['tid'], $_G['uid']);
  38. if(!$isfirstpost && $debate['endtime'] && $debate['endtime'] < TIMESTAMP && !$_G['forum']['ismoderator']) {
  39. showmessage('debate_end');
  40. }
  41. if($isfirstpost && $debate['umpirepoint'] && !$_G['forum']['ismoderator']) {
  42. showmessage('debate_umpire_comment_invalid');
  43. }
  44. }
  45. $rushreply = getstatus($thread['status'], 3);
  46. if($isfirstpost && $isorigauthor && $_G['group']['allowreplycredit']) {
  47. if($replycredit_rule = C::t('forum_replycredit')->fetch($_G['tid'])) {
  48. if($thread['replycredit']) {
  49. $replycredit_rule['lasttimes'] = $thread['replycredit'] / $replycredit_rule['extcredits'];
  50. }
  51. $replycredit_rule['extcreditstype'] = $replycredit_rule['extcreditstype'] ? $replycredit_rule['extcreditstype'] : $_G['setting']['creditstransextra'][10];
  52. }
  53. }
  54. if(!submitcheck('editsubmit')) {
  55. $thread['hiddenreplies'] = getstatus($thread['status'], 2);
  56. $postinfo = C::t('forum_post')->fetch('tid:'.$_G['tid'], $pid);
  57. if($postinfo['fid'] != $_G['fid'] || $postinfo['tid'] != $_G['tid']) {
  58. $postinfo = array();
  59. }
  60. $usesigcheck = $postinfo['usesig'] ? 'checked="checked"' : '';
  61. $urloffcheck = $postinfo['parseurloff'] ? 'checked="checked"' : '';
  62. $smileyoffcheck = $postinfo['smileyoff'] == 1 ? 'checked="checked"' : '';
  63. $codeoffcheck = $postinfo['bbcodeoff'] == 1 ? 'checked="checked"' : '';
  64. $tagoffcheck = $postinfo['htmlon'] & 2 ? 'checked="checked"' : '';
  65. $htmloncheck = $postinfo['htmlon'] & 1 ? 'checked="checked"' : '';
  66. if(!$isfirstpost) {
  67. $_G['group']['allowimgcontent'] = 0;
  68. }
  69. if($isfirstpost && $imgcontentcheck && $_G['group']['allowimgcontent']) {
  70. $editor['editormode'] = 0;
  71. }
  72. if($htmloncheck) {
  73. $editor['editormode'] = 0;
  74. $editor['allowswitcheditor'] = 0;
  75. }
  76. $showthreadsorts = ($thread['sortid'] || !empty($sortid)) && $isfirstpost;
  77. $sortid = empty($sortid) ? $thread['sortid'] : $sortid;
  78. $poll = $temppoll = '';
  79. if($isfirstpost) {
  80. if($postinfo['tags']) {
  81. $tagarray_all = $array_temp = $threadtag_array = array();
  82. $tagarray_all = explode("\t", $postinfo['tags']);
  83. if($tagarray_all) {
  84. foreach($tagarray_all as $var) {
  85. if($var) {
  86. $array_temp = explode(',', $var);
  87. $threadtag_array[] = $array_temp['1'];
  88. }
  89. }
  90. }
  91. $postinfo['tag'] = implode(',', $threadtag_array);
  92. }
  93. $allownoticeauthor = getstatus($thread['status'], 6);
  94. if($rushreply) {
  95. $postinfo['rush'] = C::t('forum_threadrush')->fetch($_G['tid']);
  96. if($postinfo['rush']['creditlimit'] == -996) {
  97. $postinfo['rush']['creditlimit'] = '';
  98. }
  99. $postinfo['rush']['stopfloor'] = $postinfo['rush']['stopfloor'] ? $postinfo['rush']['stopfloor'] : '';
  100. $postinfo['rush']['starttimefrom'] = $postinfo['rush']['starttimefrom'] ? dgmdate($postinfo['rush']['starttimefrom'], 'Y-m-d H:i') : '';
  101. $postinfo['rush']['starttimeto'] = $postinfo['rush']['starttimeto'] ? dgmdate($postinfo['rush']['starttimeto'], 'Y-m-d H:i') : '';
  102. }
  103. if($special == 127) {
  104. $sppos = strpos($postinfo['message'], chr(0).chr(0).chr(0));
  105. $specialextra = substr($postinfo['message'], $sppos + 3);
  106. if($specialextra && array_key_exists($specialextra, $_G['setting']['threadplugins']) && in_array($specialextra, $_G['forum']['threadplugin']) && in_array($specialextra, $_G['group']['allowthreadplugin'])) {
  107. $postinfo['message'] = substr($postinfo['message'], 0, $sppos);
  108. } else {
  109. showmessage('post_edit_nopermission_threadplign');
  110. $special = 0;
  111. $specialextra = '';
  112. }
  113. }
  114. $thread['freecharge'] = $_G['setting']['maxchargespan'] && TIMESTAMP - $thread['dateline'] >= $_G['setting']['maxchargespan'] * 3600 ? 1 : 0;
  115. $freechargehours = !$thread['freecharge'] ? $_G['setting']['maxchargespan'] - intval((TIMESTAMP - $thread['dateline']) / 3600) : 0;
  116. if($thread['special'] == 1 && ($_G['group']['alloweditpoll'] || $thread['authorid'] == $_G['uid'])) {
  117. $pollinfo = C::t('forum_poll')->fetch($_G['tid']);
  118. if($pollinfo['isimage']) {
  119. $pollimages = C::t('forum_polloption_image')->fetch_all_by_tid($_G['tid']);
  120. require_once libfile('function/home');
  121. }
  122. $query = C::t('forum_polloption')->fetch_all_by_tid($_G['tid']);
  123. foreach($query as $temppoll) {
  124. $poll['multiple'] = $pollinfo['multiple'];
  125. $poll['visible'] = $pollinfo['visible'];
  126. $poll['maxchoices'] = $pollinfo['maxchoices'];
  127. $poll['expiration'] = $pollinfo['expiration'];
  128. $poll['overt'] = $pollinfo['overt'];
  129. $poll['isimage'] = $pollinfo['isimage'];
  130. $poll['polloptionid'][] = $temppoll['polloptionid'];
  131. $poll['displayorder'][] = $temppoll['displayorder'];
  132. $poll['polloption'][] = $temppoll['polloption'];
  133. $attach = array();
  134. if($pollinfo['isimage'] && $pollimages[$temppoll['polloptionid']]) {
  135. $attach = $pollimages[$temppoll['polloptionid']];
  136. $attach['small'] = pic_get($attach['attachment'], 'forum', $attach['thumb'], $attach['remote']);
  137. $attach['big'] = pic_get($attach['attachment'], 'forum', 0, $attach['remote']);
  138. $poll['imginfo'][$temppoll['polloptionid']] = $attach;
  139. }
  140. }
  141. } elseif($thread['special'] == 3) {
  142. $rewardprice = $thread['price'];
  143. } elseif($thread['special'] == 4) {
  144. $activitytypelist = $_G['setting']['activitytype'] ? explode("\n", trim($_G['setting']['activitytype'])) : '';
  145. $activity = C::t('forum_activity')->fetch($_G['tid']);
  146. $activity['starttimefrom'] = dgmdate($activity['starttimefrom'], 'Y-m-d H:i');
  147. $activity['starttimeto'] = $activity['starttimeto'] ? dgmdate($activity['starttimeto'], 'Y-m-d H:i') : '';
  148. $activity['expiration'] = $activity['expiration'] ? dgmdate($activity['expiration'], 'Y-m-d H:i') : '';
  149. $activity['ufield'] = $activity['ufield'] ? dunserialize($activity['ufield']) : array();
  150. if($activity['ufield']['extfield']) {
  151. $activity['ufield']['extfield'] = implode("\n", $activity['ufield']['extfield']);
  152. }
  153. } elseif($thread['special'] == 5 ) {
  154. $debate['endtime'] = $debate['endtime'] ? dgmdate($debate['endtime'], 'Y-m-d H:i') : '';
  155. }
  156. if ($_G['group']['allowsetpublishdate']) {
  157. loadcache('cronpublish');
  158. $cron_publish_ids = dunserialize(getglobal('cache/cronpublish'));
  159. if (in_array($_G['tid'], $cron_publish_ids)) {
  160. $cronpublish = 1;
  161. $cronpublishdate = dgmdate($thread['dateline'], "dt");
  162. }
  163. }
  164. }
  165. if($thread['special'] == 2 && ($thread['authorid'] == $_G['uid'] && $_G['group']['allowposttrade'] || $_G['group']['allowedittrade'])) {
  166. $trade = C::t('forum_trade')->fetch_goods(0, $pid);
  167. if($trade) {
  168. $trade['expiration'] = $trade['expiration'] ? date('Y-m-d', $trade['expiration']) : '';
  169. $trade['costprice'] = $trade['costprice'] > 0 ? $trade['costprice'] : '';
  170. $trade['message'] = dhtmlspecialchars($trade['message']);
  171. $expiration_7days = date('Y-m-d', TIMESTAMP + 86400 * 7);
  172. $expiration_14days = date('Y-m-d', TIMESTAMP + 86400 * 14);
  173. $expiration_month = date('Y-m-d', mktime(0, 0, 0, date('m')+1, date('d'), date('Y')));
  174. $expiration_3months = date('Y-m-d', mktime(0, 0, 0, date('m')+3, date('d'), date('Y')));
  175. $expiration_halfyear = date('Y-m-d', mktime(0, 0, 0, date('m')+6, date('d'), date('Y')));
  176. $expiration_year = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')+1));
  177. } else {
  178. $special = 0;
  179. $trade = array();
  180. }
  181. }
  182. if($isfirstpost && $specialextra) {
  183. @include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
  184. $classname = 'threadplugin_'.$specialextra;
  185. if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'editpost')) {
  186. $threadplughtml = $threadpluginclass->editpost($_G['fid'], $_G['tid']);
  187. }
  188. }
  189. $postinfo['subject'] = str_replace('"', '&quot;', $postinfo['subject']);
  190. $postinfo['message'] = dhtmlspecialchars($postinfo['message']);
  191. $selectgroupid = 0;
  192. if($postinfo['first'] == 1) {
  193. preg_match("/(\[groupid=(\d+)\].*\[\/groupid\])/i", $postinfo['message'], $matchs);
  194. $postinfo['message'] = str_replace($matchs[1], '', $postinfo['message']);
  195. $selectgroupid = $matchs[2];
  196. if(helper_access::check_module('group')) {
  197. $mygroups = $groupids = array();
  198. $groupids = C::t('forum_groupuser')->fetch_all_fid_by_uids($_G['uid']);
  199. array_slice($groupids, 0, 20);
  200. $query = C::t('forum_forum')->fetch_all_info_by_fids($groupids);
  201. foreach($query as $group) {
  202. $mygroups[$group['fid']] = $group['name'];
  203. }
  204. }
  205. }
  206. $language = lang('forum/misc');
  207. $postinfo['message'] = preg_replace($postinfo['htmlon'] ? $language['post_edithtml_regexp'] : (!$_G['forum']['allowbbcode'] || $postinfo['bbcodeoff'] ? $language['post_editnobbcode_regexp'] : $language['post_edit_regexp']), '', $postinfo['message']);
  208. if($special == 5) {
  209. $standselected = array($firststand => 'selected="selected"');
  210. }
  211. if($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
  212. $attachlist = getattach($pid);
  213. $attachs = $attachlist['attachs'];
  214. $imgattachs = $attachlist['imgattachs'];
  215. unset($attachlist);
  216. $attachfind = $attachreplace = array();
  217. if(!empty($attachs['used'])) {
  218. foreach($attachs['used'] as $attach) {
  219. if($attach['isimage']) {
  220. $attachfind[] = "/\[attach\]$attach[aid]\[\/attach\]/i";
  221. $attachreplace[] = '[attachimg]'.$attach['aid'].'[/attachimg]';
  222. }
  223. }
  224. }
  225. if(!empty($imgattachs['used'])) {
  226. foreach($imgattachs['used'] as $attach) {
  227. $attachfind[] = "/\[attach\]$attach[aid]\[\/attach\]/i";
  228. $attachreplace[] = '[attachimg]'.$attach['aid'].'[/attachimg]';
  229. }
  230. }
  231. $attachfind && $postinfo['message'] = preg_replace($attachfind, $attachreplace, $postinfo['message']);
  232. }
  233. if($special == 2 && $trade['aid'] && !empty($imgattachs['used']) && is_array($imgattachs['used'])) {
  234. foreach($imgattachs['used'] as $k => $tradeattach) {
  235. if($tradeattach['aid'] == $trade['aid']) {
  236. unset($imgattachs['used'][$k]);
  237. break;
  238. }
  239. }
  240. }
  241. if($special == 4 && $activity['aid'] && !empty($imgattachs['used']) && is_array($imgattachs['used'])) {
  242. foreach($imgattachs['used'] as $k => $activityattach) {
  243. if($activityattach['aid'] == $activity['aid']) {
  244. unset($imgattachs['used'][$k]);
  245. break;
  246. }
  247. }
  248. }
  249. if($sortid) {
  250. require_once libfile('post/threadsorts', 'include');
  251. foreach($_G['forum_optionlist'] as $option) {
  252. if($option['type'] == 'image') {
  253. foreach($imgattachs['used'] as $k => $sortattach) {
  254. if($sortattach['aid'] == $option['value']['aid']) {
  255. unset($imgattachs['used'][$k]);
  256. break;
  257. }
  258. }
  259. }
  260. }
  261. }
  262. $imgattachs['unused'] = !$sortid ? $imgattachs['unused'] : '';
  263. include template('forum/post');
  264. } else {
  265. if($_GET['mygroupid']) {
  266. $mygroupid = explode('__', $_GET['mygroupid']);
  267. $mygid = intval($mygroupid[0]);
  268. if($mygid) {
  269. $mygname = $mygroupid[1];
  270. if(count($mygroupid) > 2) {
  271. unset($mygroupid[0]);
  272. $mygname = implode('__', $mygroupid);
  273. }
  274. $message .= '[groupid='.intval($mygid).']'.$mygname.'[/groupid]';
  275. }
  276. }
  277. $modpost = C::m('forum_post', $_G['tid'], $pid);
  278. $modpost->param('redirecturl', "forum.php?mod=viewthread&tid=$_G[tid]&page=$_GET[page]&extra=$extra".($vid && $isfirstpost ? "&vid=$vid" : '')."#pid$pid");
  279. if(empty($_GET['delete'])) {
  280. if($isfirstpost) {
  281. if($thread['special'] == 1 && ($_G['group']['alloweditpoll'] || $isorigauthor) && !empty($_GET['polls'])) {
  282. } elseif($thread['special'] == 3 && $isorigauthor) {
  283. } elseif($thread['special'] == 4 && $_G['group']['allowpostactivity']) {
  284. } elseif($thread['special'] == 5 && $_G['group']['allowpostdebate']) {
  285. } elseif($specialextra) {
  286. @include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
  287. $classname = 'threadplugin_'.$specialextra;
  288. if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'editpost_submit')) {
  289. $threadpluginclass->editpost_submit($_G['fid'], $_G['tid']);
  290. }
  291. }
  292. } else {
  293. }
  294. $feed = array();
  295. if($special == 127) {
  296. $message .= chr(0).chr(0).chr(0).$specialextra;
  297. }
  298. if($isfirstpost) {
  299. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_sort', 'method' => 'before_editpost'));
  300. if($thread['special'] == 3) {
  301. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_reward', 'method' => 'before_editpost'));
  302. }
  303. if($thread['special'] == 1) {
  304. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_poll', 'method' => 'before_editpost'));
  305. }
  306. if($thread['special'] == 4 && $_G['group']['allowpostactivity']) {
  307. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_activity', 'method' => 'before_editpost'));
  308. }
  309. if($thread['special'] == 5 && $_G['group']['allowpostdebate']) {
  310. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_debate', 'method' => 'before_editpost'));
  311. }
  312. if($_G['group']['allowreplycredit']) {
  313. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_replycredit', 'method' => 'before_editpost'));
  314. }
  315. if($rushreply) {
  316. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_rushreply', 'method' => 'before_editpost'));
  317. }
  318. $modpost->attach_after_method('editpost', array('class' => 'extend_thread_follow', 'method' => 'after_editpost'));
  319. }
  320. if($_G['group']['allowat']) {
  321. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_allowat', 'method' => 'before_editpost'));
  322. $modpost->attach_after_method('editpost', array('class' => 'extend_thread_allowat', 'method' => 'after_editpost'));
  323. }
  324. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_image', 'method' => 'before_editpost'));
  325. if($special == '2' && $_G['group']['allowposttrade']) {
  326. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_trade', 'method' => 'before_editpost'));
  327. }
  328. $modpost->attach_before_method('editpost', array('class' => 'extend_thread_filter', 'method' => 'before_editpost'));
  329. $modpost->attach_after_method('editpost', array('class' => 'extend_thread_filter', 'method' => 'after_editpost'));
  330. $param = array(
  331. 'subject' => $subject,
  332. 'message' => $message,
  333. 'special' => $special,
  334. 'sortid' => $sortid,
  335. 'typeid' => $typeid,
  336. 'isanonymous' => $isanonymous,
  337. 'cronpublish' => $_GET['cronpublish'],
  338. 'cronpublishdate' => $_GET['cronpublishdate'],
  339. 'save' => $_GET['save'],
  340. 'readperm' => $readperm,
  341. 'price' => $_GET['price'],
  342. 'ordertype' => $_GET['ordertype'],
  343. 'hiddenreplies' => $_GET['hiddenreplies'],
  344. 'allownoticeauthor' => $_GET['allownoticeauthor'],
  345. 'audit' => $_GET['audit'],
  346. 'tags' => $_GET['tags'],
  347. 'bbcodeoff' => $_GET['bbcodeoff'],
  348. 'smileyoff' => $_GET['smileyoff'],
  349. 'parseurloff' => $_GET['parseurloff'],
  350. 'usesig' => $_GET['usesig'],
  351. 'htmlon' => $_GET['htmlon'],
  352. 'extramessage' => $extramessage,
  353. );
  354. if($_G['group']['allowimgcontent']) {
  355. $param['imgcontent'] = $_GET['imgcontent'];
  356. $param['imgcontentwidth'] = $_G['setting']['imgcontentwidth'] ? intval($_G['setting']['imgcontentwidth']) : 100;
  357. }
  358. if($isfirstpost && $isorigauthor && $_G['group']['allowreplycredit']) {
  359. $param['replycredit_rule'] = $replycredit_rule;
  360. }
  361. $modpost->editpost($param);
  362. } else {
  363. if($thread['special'] == 3) {
  364. $modpost->attach_before_method('deletepost', array('class' => 'extend_thread_reward', 'method' => 'before_deletepost'));
  365. }
  366. if($rushreply) {
  367. $modpost->attach_before_method('deletepost', array('class' => 'extend_thread_rushreply', 'method' => 'before_deletepost'));
  368. }
  369. if($thread['replycredit'] && $isfirstpost) {
  370. $modpost->attach_before_method('deletepost', array('class' => 'extend_thread_replycredit', 'method' => 'before_deletepost'));
  371. }
  372. $modpost->attach_before_method('deletepost', array('class' => 'extend_thread_image', 'method' => 'before_deletepost'));
  373. if($thread['special'] == 2) {
  374. $modpost->attach_after_method('deletepost', array('class' => 'extend_thread_trade', 'method' => 'after_deletepost'));
  375. }
  376. if($isfirstpost) {
  377. $modpost->attach_after_method('deletepost', array('class' => 'extend_thread_sort', 'method' => 'after_deletepost'));
  378. }
  379. $modpost->attach_after_method('deletepost', array('class' => 'extend_thread_filter', 'method' => 'after_deletepost'));
  380. $param = array(
  381. 'special' => $special,
  382. 'isanonymous' => $isanonymous,
  383. );
  384. $modpost->deletepost($param);
  385. }
  386. if($specialextra) {
  387. @include_once DISCUZ_ROOT.'./source/plugin/'.$_G['setting']['threadplugins'][$specialextra]['module'].'.class.php';
  388. $classname = 'threadplugin_'.$specialextra;
  389. if(class_exists($classname) && method_exists($threadpluginclass = new $classname, 'editpost_submit_end')) {
  390. $threadpluginclass->editpost_submit_end($_G['fid'], $_G['tid']);
  391. }
  392. }
  393. if($_G['forum']['threadcaches']) {
  394. deletethreadcaches($_G['tid']);
  395. }
  396. $param = array('fid' => $_G['fid'], 'tid' => $_G['tid'], 'pid' => $pid);
  397. dsetcookie('clearUserdata', 'forum');
  398. if($_G['forum_auditstatuson']) {
  399. if($audit == 1) {
  400. updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid, '2');
  401. showmessage('auditstatuson_succeed', $modpost->param('redirecturl'), $param);
  402. } else {
  403. updatemoderate($isfirstpost ? 'tid' : 'pid', $isfirstpost ? $_G['tid'] : $pid);
  404. showmessage('audit_edit_succeed', '', $param, array('alert' => 'right'));
  405. }
  406. } else {
  407. if(!empty($_GET['delete']) && $isfirstpost) {
  408. showmessage('post_edit_delete_succeed', "forum.php?mod=forumdisplay&fid=$_G[fid]", $param);
  409. } elseif(!empty($_GET['delete'])) {
  410. showmessage('post_edit_delete_succeed', "forum.php?mod=viewthread&tid=$_G[tid]&page=$_GET[page]&extra=$extra".($vid && $isfirstpost ? "&vid=$vid" : ''), $param);
  411. } else {
  412. if($isfirstpost && $modpost->param('modnewthreads')) {
  413. C::t('forum_post')->update($thread['posttableid'], $pid, array('status' => 4), false, false, null, -2, null, 0);
  414. updatemoderate('tid', $_G['tid']);
  415. showmessage('edit_newthread_mod_succeed', $modpost->param('redirecturl'), $param);
  416. } elseif(!$isfirstpost && $modpost->param('modnewreplies')) {
  417. C::t('forum_post')->update($thread['posttableid'], $pid, array('status' => 4), false, false, null, -2, null, 0);
  418. updatemoderate('pid', $pid);
  419. showmessage('edit_reply_mod_succeed', "forum.php?mod=forumdisplay&fid=$_G[fid]", $param);
  420. } else {
  421. showmessage('post_edit_succeed', $modpost->param('redirecturl'), $param);
  422. }
  423. }
  424. }
  425. }
  426. ?>