当前位置: 首页>>代码示例>>PHP>>正文


PHP build_thread_counters函数代码示例

本文整理汇总了PHP中build_thread_counters函数的典型用法代码示例。如果您正苦于以下问题:PHP build_thread_counters函数的具体用法?PHP build_thread_counters怎么用?PHP build_thread_counters使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了build_thread_counters函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete_internal

 /**
  * Process the actual deletes
  *
  * @param boolean $is_hard_delete
  * @param vB_Legacy_User $user
  * @param string $reason
  * @param boolean $keepattachments
  */
 protected function delete_internal($is_hard_delete, $user, $reason, $keepattachments)
 {
     global $vbulletin;
     $thread = $this->get_field('thread');
     $forum = $thread->get_field('forum');
     $postman =& datamanager_init('Post', $vbulletin, ERRTYPE_SILENT, 'threadpost');
     $postman->set_existing($this->record);
     $postman->delete($forum->get_countposts(), $thread->get_field('threadid'), $is_hard_delete, array('userid' => $user->get_field('userid'), 'username' => $user->get_field('username'), 'reason' => $reason, 'keepattachments' => $keepattachments));
     unset($postman);
     build_thread_counters($threadinfo['threadid']);
     if ($forum->get_field('lastthreadid') != $thread->get_field('threadid')) {
         $forum->decrement_replycount();
     } else {
         // this thread is the one being displayed as the thread with the last post...
         // need to get the lastpost datestamp and lastposter name from the thread.
         build_forum_counters($thread->get_field('forumid'));
     }
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:26,代码来源:post.php

示例2: newPost

function newPost($newpost, $posterid = '')
{
    global $vbulletin;
    if ($posterid == '') {
        $posterid = $vbulletin->userinfo['userid'];
    }
    $postman =& datamanager_init('Post', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
    //$foruminfo = fetch_foruminfo($newpost['forumid']);
    $threadinfo = array();
    $postman->set_info('thread', $threadinfo);
    $postman->setr('threadid', $newpost['threadid']);
    $postman->setr('parentid', $newpost['parentid']);
    $postman->setr('userid', $posterid);
    $postman->setr('pagetext', $newpost['pagetext']);
    $postman->setr('title', $newpost['title']);
    $postman->setr('showsignature', $signature);
    $postman->set('allowsmilie', $newpost['allowsmilie']);
    $postman->set('visible', $newpost['visible']);
    $postman->set_info('parseurl', $newpost['parseurl']);
    $postid = $postman->save();
    build_thread_counters($newpost['threadid']);
    //$result = $vbulletin->db->query_read("SELECT `firstpostid` FROM `".TABLE_PREFIX."thread` WHERE `threadid`='{$idpack['threadid']}'");
    //$row = $vbulletin->db->fetch_row($result);
    //$idpack['postid'] = $row[0];
    return $postid;
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:26,代码来源:function.php

示例3: array

    // skip any guest posts
    if (!empty($userbyuserid)) {
        $userbypostcount = array();
        foreach ($userbyuserid as $postuserid => $postcount) {
            $alluserids .= ",{$postuserid}";
            $userbypostcount["{$postcount}"] .= ",{$postuserid}";
        }
        foreach ($userbypostcount as $postcount => $userids) {
            $casesql .= " WHEN userid IN (0{$userids}) THEN {$postcount}\n";
        }
        $db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "user\n\t\t\tSET posts = posts +\n\t\t\tCASE\n\t\t\t\t{$casesql}\n\t\t\t\tELSE 0\n\t\t\tEND\n\t\t\tWHERE userid IN (0{$alluserids})\n\t\t");
    }
    // update counters
    if (!empty($updatethread)) {
        foreach ($updatethread as $threadid => $null) {
            build_thread_counters($threadid);
        }
    }
    if (!empty($updateforum)) {
        foreach ($updateforum as $forumid => $null) {
            build_forum_counters($forumid);
        }
    }
    define('CP_REDIRECT', 'moderate.php?do=posts');
    print_stop_message('moderated_posts_successfully');
}
// ###################### Start attachment moderation #######################
if ($_REQUEST['do'] == 'attachments') {
    $sql = fetch_moderator_forum_list_sql('canmoderateattachments');
    print_form_header('moderate', 'doattachments');
    print_table_header($vbphrase['attachments_awaiting_moderation']);
开发者ID:benyamin20,项目名称:vbregistration,代码行数:31,代码来源:moderate.php

示例4:

	echo '<p>' . $vbphrase['updating_threads'] . '</p>';

	$threads = $db->query_read("
		SELECT threadid
		FROM " . TABLE_PREFIX . "thread
		WHERE threadid >= " . $vbulletin->GPC['startat'] . "
		ORDER BY threadid
		LIMIT " . $vbulletin->GPC['perpage']
	);

	$finishat = $vbulletin->GPC['startat'];

	while ($thread = $db->fetch_array($threads))
	{
		build_thread_counters($thread['threadid']);
		echo construct_phrase($vbphrase['processing_x'], $thread['threadid'])."<br />\n";
		vbflush();

		$finishat = ($thread['threadid'] > $finishat ? $thread['threadid'] : $finishat);
	}

	$finishat++;

	if ($checkmore = $db->query_first("SELECT threadid FROM " . TABLE_PREFIX . "thread WHERE threadid >= $finishat LIMIT 1"))
	{
		print_cp_redirect("misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=updatethread&startat=$finishat&pp=" . $vbulletin->GPC['perpage']);
		echo "<p><a href=\"misc.php?" . $vbulletin->session->vars['sessionurl'] . "do=updatethread&amp;startat=$finishat&amp;pp=" . $vbulletin->GPC['perpage'] . "\">" . $vbphrase['click_here_to_continue_processing'] . "</a></p>";
	}
	else
	{
开发者ID:hungnv0789,项目名称:vhtm,代码行数:30,代码来源:misc.php

示例5: undelete_post

function undelete_post($postid, $countposts, $postinfo = NULL, $threadinfo = NULL, $counterupdate = true)
{
	global $vbulletin, $vbphrase;

	// Valid postinfo array will contain: postid, threadid, visible, userid, username, title
	// 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)
	{
		// undelete thread
		undelete_thread($threadinfo['threadid'], $countposts, $threadinfo);
		return;
	}

	// Post is not deleted
	if ($postinfo['visible'] != 2)
	{
		return;
	}

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

	$deletiondata =& datamanager_init('Deletionlog_ThreadPost', $vbulletin, ERRTYPE_SILENT, 'deletionlog');
	$deletioninfo = array('type' => 'post', 'primaryid' => $postid);
	$deletiondata->set_existing($deletioninfo);
	$deletiondata->delete();
	unset($deletiondata, $deletioninfo);

	$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, 'post_y_by_x_undeleted', array($postinfo['title'], $postinfo['username']));
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:64,代码来源:functions_databuild.php

示例6: postSave


//.........这里部分代码省略.........

		if (isset($this->set_fields['navigation']))
		{
			$nodeid = intval((isset($this->set_fields['nodeid']) ? $this->set_fields['nodeid'] : $this->item->getNodeId()));

			// if there is array for navigation menu, it means we are not inheriting from parent
			// so we must add/modify the record in the navigation table for this node
			if (is_array($this->set_fields['navigation']))
			{
				vB::$vbulletin->db->query_write("
					REPLACE INTO " . TABLE_PREFIX . "cms_navigation
					SET nodeid = $nodeid,
						nodelist = '" . implode(',', $this->set_fields['navigation']) . "'
				");
			}

			// if this is not an array, it means the drop-down was selected to inherit from parent
			// so delete any record in the navigation table for this node
			else
			{
				vB::$vbulletin->db->query_write("
					DELETE FROM " . TABLE_PREFIX . "cms_navigation
					WHERE nodeid = $nodeid
				");
			}

		}

		if (isset($this->set_fields['setpublish']) OR isset($this->set_fields['navigation']))
		{
				// clear the navbar cache
			vB_Cache::instance()->event(array(vBCms_NavBar::GLOBAL_CACHE_EVENT,
				vBCms_NavBar::getCacheEventId($this->item->getNodeId()),
				$this->item->getCacheEvents(), $this->item->getContentCacheEvent()));
			vB_Cache::instance()->cleanNow();
			$nav_node = new vBCms_Item_Content($this->item->getNodeId(), vBCms_Item_Content::INFO_NAVIGATION);
			// reload the navbar for the page
			vBCms_NavBar::prepareNavBar($nav_node, true);
			unset($nav_node);
		}
		else if ($this->item)
		{
			vB_Cache::instance()->event(array($this->item->getCacheEvents(),
				$this->item->getContentCacheEvent()));
		}

		//Let's set the thread status, if there is one.
		//If we get called from dm/rate.php or somewhere like that, we skip this section
		if ($this->isUpdating() AND in_array('comments_enabled', $this->set_fields) AND
			isset($this->set_fields['comments_enabled']))
		{
			$record = vB::$vbulletin->db->query_first("SELECT info.associatedthreadid, thread.forumid FROM " .
				TABLE_PREFIX . "cms_nodeinfo AS info INNER JOIN " .
				TABLE_PREFIX . "thread AS thread ON thread.threadid = info.associatedthreadid
				WHERE info.nodeid = ". $this->item->getNodeId() );

			if ($record['associatedthreadid'])
			{
				require_once DIR . '/includes/functions_databuild.php';
				$thread = vB_Legacy_Thread::create_from_id($record['associatedthreadid']);

				if ($thread)
				{
					if (intval($this->set_fields['comments_enabled']))
					{
						//We need to ensure comments are enabled.
						$visible = $thread->get_field('visible');
						if ( intval($visible) != 1)
						{
							undelete_thread($record['associatedthreadid']);
						}

						//If the title has been updated in the article, update the thread title.
						if (($thread->getField('title') != '') AND isset($this->set_fields['title'])
							AND ($thread->getField('title') != $this->set_fields['title']))
						{
							$sql = "UPDATE " . TABLE_PREFIX . "thread SET title = '" .
								vB::$db->escape_string($this->set_fields['title']) .
								"' WHERE threadid = " . $record['associatedthreadid'];
							vB::$db->query_write($sql);
						}
					}
					else
					{
						//We need to hide the thread.
						$thread->soft_delete(new vB_Legacy_CurrentUser(), '', true);
					}

				}
				build_thread_counters($record['associatedthreadid']);
				build_forum_counters($record['forumid']);
			}
		}

		parent::postSave($result, $deferred, $replace, $ignore);
		//we should never return false if we got here.
		$result = (intval($result) ? $result : true);

		return $result;
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:node.php

示例7: array

        // to this thread, you will be subscribed with the default option. (See 3.6 bug 1342.)
        $insert_subscriptions = array();
        foreach ($unique_thread_user as $threadid => $users) {
            foreach ($users as $userid => $subscriptioninfo) {
                if ($subscriptioninfo['issubscribed'] and $subscriptioninfo['autosubscribe'] != -1) {
                    $insert_subscriptions[] = "({$userid}, {$destthreadinfo['threadid']}, {$subscriptioninfo['autosubscribe']}, 0, 1)";
                }
            }
        }
        if ($insert_subscriptions) {
            $db->query_write("\n\t\t\t\tINSERT IGNORE INTO " . TABLE_PREFIX . "subscribethread\n\t\t\t\t\t(userid, threadid, emailupdate, folderid, canview)\n\t\t\t\tVALUES\n\t\t\t\t\t" . implode(', ', $insert_subscriptions));
        }
        // need to check permissions on these threads
        update_subscriptions(array('threadids' => array($destthreadinfo['threadid'])));
    }
    build_thread_counters($destthreadinfo['threadid']);
    build_forum_counters($destforuminfo['forumid']);
    log_moderator_action($destthreadinfo, 'posts_copied_to_x', $destthreadinfo['threadid']);
    // empty cookie
    setcookie('vbulletin_inlinepost', '', TIMENOW - 3600, '/');
    ($hook = vBulletinHook::fetch_hook('inlinemod_docopyposts')) ? eval($hook) : false;
    $vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$destthreadinfo['threadid']}";
    eval(print_standard_redirect('redirect_inline_copiedposts', true, $forceredirect));
}
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
($hook = vBulletinHook::fetch_hook('inlinemod_complete')) ? eval($hook) : false;
$url =& $vbulletin->url;
// spit out the final HTML if we have got this far
eval('$HTML = "' . fetch_template($template) . '";');
eval('print_output("' . fetch_template('THREADADMIN') . '");');
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:inlinemod.php

示例8: do_moderation


//.........这里部分代码省略.........
            }
            if (!can_moderate($post['forumid'], 'canremoveposts') and $physicaldel) {
                standard_error(fetch_error('you_do_not_have_permission_to_delete_threads_and_posts', $post['title'], $post['thread_title'], $vbulletin->forumcache["{$post['forumid']}"]['title']));
            } else {
                if (!physicaldel and (!can_moderate($post['forumid'], 'candeleteposts') and ($post['posteruserid'] != $vbulletin->userinfo['userid'] or !($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['candeletepost'])))) {
                    standard_error(fetch_error('you_do_not_have_permission_to_delete_threads_and_posts', $post['title'], $post['thread_title'], $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 (empty($postarray)) {
            standard_error(fetch_error('no_applicable_posts_selected'));
        }
        $firstpost = false;
        $gotothread = true;
        foreach ($postarray as $postid => $post) {
            $foruminfo = fetch_foruminfo($post['forumid']);
            $postman =& datamanager_init('Post', $vbulletin, ERRTYPE_SILENT, 'threadpost');
            $postman->set_existing($post);
            $postman->delete($foruminfo['countposts'] and !$post['skippostcount'], $post['threadid'], $physicaldel, array('userid' => $vbulletin->userinfo['userid'], 'username' => $vbulletin->userinfo['username'], 'reason' => $vbulletin->GPC['deletereason'], 'keepattachments' => $vbulletin->GPC['keepattachments']));
            unset($postman);
        }
        foreach (array_keys($threadlist) as $threadid) {
            build_thread_counters($threadid);
        }
        foreach (array_keys($forumlist) as $forumid) {
            build_forum_counters($forumid);
        }
        ($hook = vBulletinHook::fetch_hook('inlinemod_dodeleteposts')) ? eval($hook) : false;
    }
    // Move Thread
    if ($_POST['do'] == 'domovethread') {
        $vbulletin->input->clean_array_gpc('p', array('destforumid' => TYPE_UINT, 'redirect' => TYPE_STR, 'title' => TYPE_NOHTML, 'redirectprefixid' => TYPE_NOHTML, 'redirecttitle' => TYPE_NOHTML, 'period' => TYPE_UINT, 'frame' => TYPE_STR));
        $vbulletin->GPC['title'] = prepare_remote_utf8_string($vbulletin->GPC['title']);
        $vbulletin->GPC['redirecttitle'] = prepare_remote_utf8_string($vbulletin->GPC['redirecttitle']);
        $vbulletin->GPC['redirectprefixid'] = prepare_remote_utf8_string($vbulletin->GPC['redirectprefixid']);
        if ($threadinfo['isdeleted'] and !can_moderate($threadinfo['forumid'], 'candeleteposts') or !$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts')) {
            if (can_moderate($threadinfo['forumid'])) {
                json_error(ERR_NO_PERMISSION);
            } else {
                standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink']));
            }
        }
        // check whether dest can contain posts
        $destforumid = verify_id('forum', $vbulletin->GPC['destforumid']);
        $destforuminfo = fetch_foruminfo($destforumid);
        if (!$destforuminfo['cancontainthreads'] or $destforuminfo['link']) {
            standard_error(fetch_error('moveillegalforum'));
        }
        if ($threadinfo['isdeleted'] and !can_moderate($destforuminfo['forumid'], 'candeleteposts') or !$threadinfo['visible'] and !can_moderate($destforuminfo['forumid'], 'canmoderateposts')) {
            ## Insert proper phrase about not being able to move a hidden thread to a forum you can't moderateposts in or a deleted thread to a forum you can't deletethreads in
            standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink']));
        }
        // check source forum permissions
        if (!can_moderate($threadinfo['forumid'], 'canmanagethreads')) {
            if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canmove'])) {
开发者ID:0hyeah,项目名称:yurivn,代码行数:67,代码来源:moderation.php

示例9: PostReply

function PostReply($who, $threadid, $pagetext, $quotepostid = 0)
{
    global $db, $vbulletin, $server, $structtypes, $lastpostarray;
    $result = RegisterService($who);
    if ($result['Code'] != 0) {
        $retval['Result'] = $result;
        return $retval;
    }
    $threadinfo = fetch_threadinfo($threadid);
    $foruminfo = fetch_foruminfo($threadinfo['forumid'], false);
    $postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);
    $postdm->set_info('skip_maximagescheck', true);
    $postdm->set_info('forum', $foruminfo);
    $postdm->set_info('thread', $threadinfo);
    $postdm->set('threadid', $threadid);
    $postdm->set('userid', $vbulletin->userinfo['userid']);
    $postdm->set('allowsmilie', 1);
    $postdm->set('visible', 1);
    $postdm->set('dateline', TIMENOW);
    if ($quotepostid > 0) {
        $quote_postids[] = $quotepostid;
        $quotetxt = fetch_quotable_posts($quote_postids, $threadinfo['threadid'], $unquoted_post_count, $quoted_post_ids, 'only');
        $pagetext = "{$quotetxt}{$pagetext}";
    }
    $postdm->set('pagetext', "{$pagetext}");
    $postdm->pre_save();
    $postid = 0;
    if (count($postdm->errors) > 0) {
        // pre_save failed
        return ErrorResult('pre_save_failed_thread_reply');
    } else {
        $postid = $postdm->save();
        require_once './includes/functions_databuild.php';
        build_thread_counters($threadinfo['threadid']);
        build_forum_counters($foruminfo['forumid']);
        correct_forum_counters($threadinfo['threadid'], $foruminfo['forumid']);
        mark_thread_read($threadinfo, $foruminfo, $vbulletin->userinfo['userid'], TIMENOW);
    }
    $retval['PostID'] = $postid;
    $result['Code'] = 1;
    $result['Text'] = "QuotePostID: {$quotepostid}";
    $result['RemoteUser'] = ConsumeArray($vbulletin->userinfo, $structtypes['RemoteUser']);
    $retval['Result'] = $result;
    return $retval;
}
开发者ID:TheProjecter,项目名称:vbulletinbot,代码行数:45,代码来源:vbulletinbot.php


注:本文中的build_thread_counters函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。