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


PHP CForumUser::SetStat方法代码示例

本文整理汇总了PHP中CForumUser::SetStat方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumUser::SetStat方法的具体用法?PHP CForumUser::SetStat怎么用?PHP CForumUser::SetStat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CForumUser的用法示例。


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

示例1: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = intVal($ID);
     $arMessage = array();
     if ($ID > 0) {
         $arMessage = CForumMessage::GetByID($ID, array("FILTER" => "N"));
     }
     if (empty($arMessage)) {
         return false;
     }
     /***************** Event onBeforeMessageAdd ************************/
     foreach (GetModuleEvents("forum", "onBeforeMessageDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage)) === false) {
             return false;
         }
     }
     /***************** /Event ******************************************/
     $AUTHOR_ID = intVal($arMessage["AUTHOR_ID"]);
     $TOPIC_ID = intVal($arMessage["TOPIC_ID"]);
     $FORUM_ID = intVal($arMessage["FORUM_ID"]);
     $DB->StartTransaction();
     // delete votes
     if ($arMessage["PARAM1"] == "VT" && intVal($arMessage["PARAM2"]) > 0 && IsModuleInstalled("vote")) {
         CModule::IncludeModule("vote");
         CVote::Delete($arMessage["PARAM2"]);
     }
     // delete files
     CForumFiles::Delete(array("MESSAGE_ID" => $ID), array("DELETE_MESSAGE_FILE" => "Y"));
     // delete message
     $DB->Query("DELETE FROM b_forum_message WHERE ID=" . $ID);
     // after delete
     $db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $TOPIC_ID), false, 1);
     $res = false;
     if (!($db_res && ($res = $db_res->Fetch()))) {
         CForumTopic::Delete($TOPIC_ID);
     } else {
         // if deleted message was first
         if ($arMessage["NEW_TOPIC"] == "Y") {
             $DB->Update('b_forum_message', array('NEW_TOPIC' => '"Y"'), "WHERE ID=" . $res["ID"]);
         }
         CForumTopic::SetStat($TOPIC_ID);
     }
     $DB->Commit();
     $GLOBALS["USER_FIELD_MANAGER"]->Delete("FORUM_MESSAGE", $ID);
     if ($AUTHOR_ID > 0) {
         CForumUser::SetStat($AUTHOR_ID);
     }
     CForumNew::SetStat($FORUM_ID);
     /***************** Event onBeforeMessageAdd ************************/
     foreach (GetModuleEvents("forum", "onAfterMessageDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $arMessage));
     }
     /***************** /Event ******************************************/
     if (CModule::IncludeModule("search")) {
         CSearch::DeleteIndex("forum", $ID);
         if (is_array($res) && !empty($res)) {
             CForumMessage::Reindex($res["ID"], $res);
         }
     }
     return true;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:62,代码来源:message.php

示例2: Add

	function Add($arFields, $strUploadDir = false, $arParams = array())
	{
		global $DB;

		$strUploadDir = ($strUploadDir === false ? "forum/upload" : $strUploadDir);

		if (!CForumMessage::CheckFields("ADD", $arFields))
			return false;

		$arForum = CForumNew::GetByID($arFields["FORUM_ID"]);
		$arParams["SKIP_STATISTIC"] = ($arParams["SKIP_STATISTIC"] == "Y" ? "Y" : "N");
		$arParams["SKIP_INDEXING"] = ($arParams["SKIP_INDEXING"] == "Y" || $arForum["INDEXATION"] != "Y" ? "Y" : "N");

		$POST_MESSAGE = $arFields["POST_MESSAGE"];
		$parser = new forumTextParser(LANGUAGE_ID);
		$allow = forumTextParser::GetFeatures($arForum);
		$allow['SMILES'] = (($arFields["USE_SMILES"] != "Y") ? 'N' : $allow['SMILES']);
		if (COption::GetOptionString("forum", "FILTER", "Y") == "Y")
		{
			$POST_MESSAGE = CFilterUnquotableWords::Filter($POST_MESSAGE);
			$arFields["POST_MESSAGE_FILTER"] = (empty($POST_MESSAGE) ? "*" : $POST_MESSAGE);
		}
/***************** Attach ******************************************/
		$arFiles = array();
		if (is_array($arFields["ATTACH_IMG"]))
			$arFields["FILES"] = array($arFields["ATTACH_IMG"]);
		unset($arFields["ATTACH_IMG"]);
		if (is_array($arFields["FILES"]) && !empty($arFields["FILES"]))
		{
			$res = array("FORUM_ID" => $arFields["FORUM_ID"], "USER_ID" => $arFields["AUTHOR_ID"], "upload_dir" => $strUploadDir);
			$arFiles = CForumFiles::Save($arFields["FILES"], $res, false);
			if (!empty($arFiles))
			{
				$arFiles = array_keys($arFiles);
				sort($arFiles);
				$arFields["ATTACH_IMG"] = $arFiles[0];
				$arFields["ATTACHED_FILES"] = $arFiles;
			}
			unset($arFields["FILES"]);
		}
/***************** Attach/******************************************/
		if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y")
			$POST_MESSAGE = $parser->convert($POST_MESSAGE, $allow, "html", $arFiles);
		$arFields["POST_MESSAGE_HTML"] = $POST_MESSAGE;
/***************** Event onBeforeMessageAdd ************************/
		foreach(GetModuleEvents("forum", "onBeforeMessageAdd", true) as $arEvent)
		{
			if (ExecuteModuleEventEx($arEvent, array(&$arFields, &$strUploadDir)) === false)
				return false;
		}
/***************** /Event ******************************************/
		if (empty($arFields))
			return false;
		$arInsert = $DB->PrepareInsert("b_forum_message", $arFields, $strUploadDir);

		$strDatePostField = "";
		$strDatePostValue = "";
		if (!is_set($arFields, "POST_DATE"))
		{
			$strDatePostField = ", POST_DATE";
			$strDatePostValue = ", ".$DB->GetNowFunction()."";
		}

		$strSql = "INSERT INTO b_forum_message(".$arInsert[0].$strDatePostField.") VALUES(".$arInsert[1].$strDatePostValue.")";
		$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
		$ID = intVal($DB->LastID());
/***************** Attach ******************************************/
		if (!empty($arFiles))
			CForumFiles::UpdateByID($arFiles, array("FORUM_ID" => $arFields["FORUM_ID"],
				"TOPIC_ID" => $arFields["TOPIC_ID"], "MESSAGE_ID" => $ID));
/***************** Attach/******************************************/
/***************** Quota *******************************************/
		$_SESSION["SESS_RECOUNT_DB"] = "Y";

		$GLOBALS["USER_FIELD_MANAGER"]->Update("FORUM_MESSAGE", $ID, $arFields);
		if ($arParams["SKIP_STATISTIC"] == "Y" && $arParams["SKIP_INDEXING"] == "Y")
			return $ID;
		$arMessage = CForumMessage::GetByIDEx($ID, array("GET_FORUM_INFO" => "N", "GET_TOPIC_INFO" => "Y", "FILTER" => "Y"));

		if ($arParams["SKIP_STATISTIC"] != "Y")
		{
			if (intVal($arMessage["AUTHOR_ID"]) > 0)
			{
				CForumUser::SetStat($arMessage["AUTHOR_ID"], array("MESSAGE" => $arMessage));
			}
			CForumTopic::SetStat($arMessage["TOPIC_ID"],  array("MESSAGE" => $arMessage));
			CForumNew::SetStat($arMessage["FORUM_ID"],  array("MESSAGE" => $arMessage));
		}
/***************** Events onAfterMessageAdd ************************/
		foreach(GetModuleEvents("forum", "onAfterMessageAdd", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage, $arMessage["TOPIC_INFO"], $arMessage["FORUM_INFO"], $arFields));
/***************** /Events *****************************************/
		if ($arMessage["APPROVED"] == "Y")
		{
			if ($arParams["SKIP_INDEXING"] != "Y" && CModule::IncludeModule("search"))
			{
				$arMessage["POST_MESSAGE"] = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ?
					$arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
				$arParams = array(
					"PERMISSION" => array(),
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:101,代码来源:message.php

示例3: Delete

 public static function Delete($ID)
 {
     global $DB;
     $ID = intVal($ID);
     $arUsers = array();
     $db_res = CForumUser::GetList(array(), array("RANK_ID" => $ID));
     while ($ar_res = $db_res->Fetch()) {
         $arUsers[] = $ar_res["USER_ID"];
     }
     $DB->Query("DELETE FROM b_forum_rank_lang WHERE RANK_ID = " . $ID, True);
     $DB->Query("DELETE FROM b_forum_rank WHERE ID = " . $ID, True);
     foreach ($arUsers as $userId) {
         CForumUser::SetStat($userId);
     }
     return true;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:16,代码来源:user.php

示例4: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = intVal($ID);
     $bCanDelete = true;
     /***************** Event OnBeforeForumDelete ***********************/
     foreach (GetModuleEvents("forum", "OnBeforeForumDelete", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array(&$ID)) === false) {
             $bCanDelete = false;
             break;
         }
     }
     /***************** /Event ******************************************/
     if (!$bCanDelete) {
         return false;
     }
     /***************** Event OnForumDelete *****************************/
     foreach (GetModuleEvents("forum", "OnForumDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array(&$ID));
     }
     /***************** /Event ******************************************/
     /***************** Cleaning cache **********************************/
     unset($GLOBALS["FORUM_CACHE"]["FORUM"][$ID]);
     if (CACHED_b_forum !== false) {
         $GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum");
     }
     if (CACHED_b_forum_perms !== false) {
         $GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum_perms");
     }
     if (CACHED_b_forum2site !== false) {
         $GLOBALS["CACHE_MANAGER"]->CleanDir("b_forum2site");
     }
     /***************** Cleaning cache/**********************************/
     /***************** Search module ***********************************/
     set_time_limit(0);
     if (CModule::IncludeModule("search")) {
         CSearch::DeleteIndex("forum", false, $ID);
     }
     CForumFiles::Delete(array("FORUM_ID" => $ID), array("DELETE_FORUM_FILE" => "Y"));
     $DB->StartTransaction();
     // Update USER statistic
     $arProcAuth = array();
     $db_res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID, "!AUTHOR_ID" => 0));
     while ($res = $db_res->Fetch()) {
         $res["AUTHOR_ID"] = intVal($res["AUTHOR_ID"]);
         if (!in_array($res["AUTHOR_ID"], $arProcAuth)) {
             $arProcAuth[] = intVal($res["AUTHOR_ID"]);
         }
     }
     if (IsModuleInstalled("vote")) {
         $db_res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID, "PARAM1" => "VT", "!PARAM2" => 0));
         if ($db_res && ($res = $db_res->Fetch())) {
             CModule::IncludeModule("vote");
             do {
                 CVote::Delete($res["PARAM2"]);
             } while ($res = $db_res->Fetch());
         }
     }
     if (!$DB->Query("DELETE FROM b_forum_subscribe WHERE FORUM_ID=" . $ID, true)) {
         $DB->Rollback();
         return false;
     }
     if (!$DB->Query("DELETE FROM b_forum_message WHERE FORUM_ID=" . $ID, true)) {
         $DB->Rollback();
         return false;
     }
     if (!$DB->Query("DELETE FROM b_forum_topic WHERE FORUM_ID=" . $ID, true)) {
         $DB->Rollback();
         return false;
     }
     if (!$DB->Query("DELETE FROM b_forum_perms WHERE FORUM_ID=" . $ID, true)) {
         $DB->Rollback();
         return false;
     }
     if (!$DB->Query("DELETE FROM b_forum2site WHERE FORUM_ID=" . $ID, true)) {
         $DB->Rollback();
         return false;
     }
     if (!$DB->Query("DELETE FROM b_forum WHERE ID=" . $ID, true)) {
         $DB->Rollback();
         return false;
     }
     // Update USER statistic
     foreach ($arProcAuth as $i => $procAuth) {
         CForumUser::SetStat($procAuth);
     }
     $DB->Commit();
     /***************** Event OnAfterForumDelete ************************/
     foreach (GetModuleEvents("forum", "OnAfterForumDelete", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     /***************** /Event ******************************************/
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:94,代码来源:forum_new.php

示例5: Delete

 function Delete($ID)
 {
     global $DB;
     $ID = intVal($ID);
     $arTopic = CForumTopic::GetByID($ID);
     if (empty($arTopic)) {
         return false;
     }
     /***************** Event onBeforeTopicDelete ***********************/
     $events = GetModuleEvents("forum", "onBeforeTopicDelete");
     while ($arEvent = $events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array(&$ID, $arTopic)) === false) {
             return false;
         }
     }
     /***************** /Event ******************************************/
     $arAuthor = array();
     $arVotes = array();
     $db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $ID));
     while ($res = $db_res->Fetch()) {
         if (intVal($res["AUTHOR_ID"]) > 0) {
             $arAuthor[intVal($res["AUTHOR_ID"])] = $res["AUTHOR_ID"];
         }
         if ($res["PARAM1"] == "VT" && intVal($res["PARAM2"]) > 0) {
             $arVotes[] = intVal($res["PARAM2"]);
         }
     }
     if (!empty($arVotes) && IsModuleInstalled("vote") && CModule::IncludeModule("vote")) {
         foreach ($arVotes as $res) {
             CVote::Delete($res);
         }
     }
     //		$DB->StartTransaction();
     CForumFiles::Delete(array("TOPIC_ID" => $ID), array("DELETE_TOPIC_FILE" => "Y"));
     $DB->Query("DELETE FROM b_forum_subscribe WHERE TOPIC_ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_message WHERE TOPIC_ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_user_topic WHERE TOPIC_ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_topic WHERE ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_topic WHERE TOPIC_ID = " . $ID . "");
     $DB->Query("DELETE FROM b_forum_stat WHERE TOPIC_ID = " . $ID . "");
     //		$DB->Commit();
     unset($GLOBALS["FORUM_CACHE"]["TOPIC"][$ID]);
     unset($GLOBALS["FORUM_CACHE"]["TOPIC_FILTER"][$ID]);
     foreach ($arAuthor as $key) {
         CForumUser::SetStat($key);
     }
     CForumNew::SetStat($arTopic["FORUM_ID"]);
     if (IsModuleInstalled("search") && CModule::IncludeModule("search")) {
         CSearch::DeleteIndex("forum", false, $arTopic["FORUM_ID"], $ID);
     }
     /***************** Event onAfterTopicDelete ************************/
     $events = GetModuleEvents("forum", "onAfterTopicDelete");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array(&$ID, $arTopic));
     }
     /***************** /Event ******************************************/
     return true;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:58,代码来源:topic.php

示例6: Delete

	/**
	 * <p>Удаляет сообщение с кодом <i>ID</i>.</p> <p><b>Примечание</b>. Метод использует внутреннюю транзакцию. Если у вас используется <b>MySQL</b> и <b>InnoDB</b>, и ранее была открыта транзакция, то ее необходимо закрыть до подключения метода.</p>
	 *
	 *
	 *
	 *
	 * @param int $ID  Код сообщения, которое необходимо удалить.
	 *
	 *
	 *
	 * @return bool 
	 *
	 *
	 * <h4>See Also</h4> 
	 * <ul><li>Перед удалением сообщения следует проверить возможность
	 * удаления методом <a
	 * href="http://dev.1c-bitrix.ru/api_help/forum/developer/cforummessage/canuserdeletemessage.php">CForumMessage::CanUserDeleteMessage</a>
	 * </li></ul>
	 *
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/forum/developer/cforummessage/delete.php
	 * @author Bitrix
	 */
	public static function Delete($ID)
	{
		global $DB;
		$ID = intVal($ID);
		$arMessage = array();
		if ($ID > 0)
			$arMessage = CForumMessage::GetByID($ID, array("FILTER" => "N"));
		if (empty($arMessage))
			return false;
/***************** Event onBeforeMessageAdd ************************/
		$events = GetModuleEvents("forum", "onBeforeMessageDelete");
		while ($arEvent = $events->Fetch())
		{
			if (ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage)) === false)
				return false;
		}
/***************** /Event ******************************************/
		$AUTHOR_ID = intVal($arMessage["AUTHOR_ID"]);
		$TOPIC_ID = intVal($arMessage["TOPIC_ID"]);
		$FORUM_ID = intVal($arMessage["FORUM_ID"]);

		$DB->StartTransaction();
		// delete votes
		if ($arMessage["PARAM1"] == "VT" && intVal($arMessage["PARAM2"]) > 0 && IsModuleInstalled("vote")):
			CModule::IncludeModule("vote");
			CVote::Delete($arMessage["PARAM2"]);
		endif;
		// delete files
		CForumFiles::Delete(array("MESSAGE_ID" => $ID), array("DELETE_MESSAGE_FILE" => "Y"));
		// delete message
		$DB->Query("DELETE FROM b_forum_message WHERE ID=".$ID);
		// after delete
		$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $TOPIC_ID), false, 1);
		$res = false;
		if (!($db_res && $res = $db_res->Fetch())):
			CForumTopic::Delete($TOPIC_ID);
		else:
			// if deleted message was first
			if ($arMessage["NEW_TOPIC"] == "Y"):
				$DB->Query("UPDATE b_forum_message SET NEW_TOPIC='Y' WHERE ID=".$res["ID"]);
			endif;
			CForumTopic::SetStat($TOPIC_ID);
		endif;
		$DB->Commit();

		$GLOBALS["USER_FIELD_MANAGER"]->Delete("FORUM_MESSAGE", $ID);

		if ($AUTHOR_ID > 0):
			CForumUser::SetStat($AUTHOR_ID);
		endif;
		CForumNew::SetStat($FORUM_ID);
/***************** Event onBeforeMessageAdd ************************/
		$events = GetModuleEvents("forum", "onAfterMessageDelete");
		while ($arEvent = $events->Fetch())
			ExecuteModuleEventEx($arEvent, array($ID, $arMessage));
/***************** /Event ******************************************/
		if (CModule::IncludeModule("search"))
		{
			CSearch::DeleteIndex("forum", $ID);
		}
		return true;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:86,代码来源:message.php


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