print_standard_redirect('redirect_deletethread'); } else { print_no_permission(); } } else { //delete just this post if ($vbulletin->GPC['deletepost'] == 'remove' and can_moderate($threadinfo['forumid'], 'canremoveposts')) { $removaltype = true; } else { $removaltype = false; } $postman =& datamanager_init('Post', $vbulletin, ERRTYPE_SILENT, 'threadpost'); $postman->set_existing($postinfo); $postman->delete($foruminfo['countposts'], $threadinfo['threadid'], $removaltype, array('userid' => $vbulletin->userinfo['userid'], 'username' => $vbulletin->userinfo['username'], 'reason' => $vbulletin->GPC['reason'], 'keepattachments' => $vbulletin->GPC['keepattachments'])); unset($postman); if ($node = get_nodeFromThreadid($threadinfo['threadid'])) { // Expire any CMS comments cache entries. $expire_cache = array('cms_comments_change'); $expire_cache[] = 'cms_comments_add_' . $node; $expire_cache[] = 'cms_comments_change_' . $threadinfo['threadid']; vB_Cache::instance()->eventPurge($expire_cache); vB_Cache::instance()->cleanNow(); } build_thread_counters($threadinfo['threadid']); if ($foruminfo['lastthreadid'] != $threadinfo['threadid']) { // just decrement the reply counter $forumdm =& datamanager_init('Forum', $vbulletin, ERRTYPE_SILENT); $forumdm->set_existing($foruminfo); $forumdm->set('replycount', 'replycount - 1', false); $forumdm->save(); unset($forumdm);
if (!physicaldel and (!can_moderate($post['forumid'], 'candeleteposts') and ($post['posteruserid'] != $vbulletin->userinfo['userid'] or !($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['candeletepost'])))) { eval(standard_error(fetch_error('you_do_not_have_permission_to_delete_threads_and_posts', $post['title'], $post['threadtitle'], $vbulletin->forumcache["{$post['forumid']}"]['title']))); } } $postarray["{$post['postid']}"] = $post; $threadlist["{$post['threadid']}"] = true; $forumlist["{$post['forumid']}"] = true; if ($post['firstpostid'] == $post['postid']) { // deleting a thread so do not decremement the counters of any other posts in this thread $firstpost["{$post['threadid']}"] = true; } else { if (!empty($firstpost["{$post['threadid']}"])) { $postarray["{$post['postid']}"]['skippostcount'] = true; } } if ($node = get_nodeFromThreadid($post['threadid'])) { // Expire any CMS comments cache entries. $expire_cache = array('cms_comments_change'); $expire_cache[] = 'cms_comments_add_' . $node; $expire_cache[] = 'cms_comments_change_' . $post['threadid']; vB_Cache::instance()->eventPurge($expire_cache); vB_Cache::instance()->cleanNow(); } } if (empty($postarray)) { eval(standard_error(fetch_error('no_applicable_posts_selected'))); } $firstpost = false; $gotothread = true; foreach ($postarray as $postid => $post) { $foruminfo = fetch_foruminfo($post['forumid']);