Ejemplo n.º 1
0
function approve_post($postid, $countposts, $dolog = true, $postinfo = NULL, $threadinfo = NULL, $counterupdate = true)
{
	global $vbulletin, $vbphrase;

	// Valid postinfo array will contain: postid, threadid, visible, userid
	// Invalid post or post is not deleted
	if (!$postinfo AND !$postinfo = fetch_postinfo($postid))
	{
		return;
	}

	// Valid threadinfo array will contain: threadid, forumid, visible, firstpostid
	if (!$threadinfo AND !$threadinfo = fetch_threadinfo($postinfo['threadid']))
	{
		return;
	}

	if ($threadinfo['firstpostid'] == $postid)
	{
		// approve_thread
		approve_thread($threadinfo['threadid'], $countposts, $dolog, $threadinfo);
		return;
	}

	// Post is not moderated
	if ($postinfo['visible'])
	{
		return;
	}

	// Only increment post for a visible thread in a counting forum
	if (($countposts OR $postinfo['dateline']) AND $postinfo['userid'] AND $threadinfo['visible'] == 1)
	{
		$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
		$userdata->set_existing($postinfo);
		if ($countposts)
		{
			$userdata->set('posts', 'posts + 1', false);
			$userdata->set_ladder_usertitle_relative(1);
		}

		if ($postinfo['dateline'])
		{
			$userdata->set('lastpost', "IF($postinfo[dateline] >= lastpost, $postinfo[dateline], lastpost)", false);
			$userdata->set('lastpostid', "IF($postinfo[dateline] >= lastpost, $postinfo[postid], lastpostid)", false);
		}
		$userdata->save();
		unset($userdata);
	}

	$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "moderation WHERE primaryid = $postid AND type = 'reply'");
	$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "spamlog WHERE postid = $postid");

	$postman =& datamanager_init('Post', $vbulletin, ERRTYPE_SILENT, 'threadpost');
	$postman->set_existing($postinfo);
	$postman->set('visible', 1);
	$postman->save();

	if ($counterupdate)
	{
		build_thread_counters($postinfo['threadid']);
		build_forum_counters($threadinfo['forumid']);
	}

	fetch_phrase_group('threadmanage');
	$postinfo['forumid'] = $threadinfo['forumid'];

	require_once(DIR . '/includes/functions_log_error.php');
	log_moderator_action($postinfo, 'approved_post');
}
Ejemplo n.º 2
0
    ($hook = vBulletinHook::fetch_hook('threadmanage_domanagepost')) ? eval($hook) : false;
    if ($postdeleted != 1) {
        $vbulletin->url = fetch_seo_url('thread', $threadinfo, array('p' => $postid)) . "#post{$postid}";
    } else {
        $vbulletin->url = fetch_seo_url('thread', $threadinfo);
    }
    print_standard_redirect('redirect_post_manage');
}
// ############################### start moderate thread ###############################
if ($_POST['do'] == 'moderatethread') {
    if (!can_moderate($threadinfo['forumid'], 'canmoderateposts')) {
        print_no_permission();
    }
    if ($threadinfo['open'] != 10) {
        if ($threadinfo['visible'] == 0) {
            approve_thread($threadid, $foruminfo['countposts'], true, $threadinfo);
            build_forum_counters($threadinfo['forumid']);
            print_standard_redirect('thread_approved');
        } else {
            unapprove_thread($threadid, $foruminfo['countposts'], true, $threadinfo);
            build_forum_counters($threadinfo['forumid']);
            print_standard_redirect('thread_unapproved');
        }
    }
}
// ############################### all done, do shell template ###############################
if (!empty($page_templater)) {
    // draw navbar
    $navbar = render_navbar_template($navbits);
    ($hook = vBulletinHook::fetch_hook('threadmanage_complete')) ? eval($hook) : false;
    $templater = vB_Template::create('THREADADMIN');