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


PHP CForumMessage::GetByID方法代码示例

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


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

示例1: SetStat

 public static function SetStat($USER_ID = 0, $arParams = array())
 {
     $USER_ID = intVal($USER_ID);
     if ($USER_ID <= 0) {
         return 0;
     }
     $bNeedCreateUser = false;
     $arUser = array();
     $arUserFields = array();
     $arParams = is_array($arParams) ? $arParams : array();
     $arMessage = is_array($arParams["MESSAGE"]) ? $arParams["MESSAGE"] : array();
     $arMessage = $arMessage["AUTHOR_ID"] != $USER_ID ? array() : $arMessage;
     if (!empty($arMessage)) {
         $arParams["ACTION"] = $arParams["ACTION"] == "DECREMENT" || $arParams["ACTION"] == "UPDATE" ? $arParams["ACTION"] : "INCREMENT";
         if ($arParams["ACTION"] == "UPDATE") {
             $arParams["ACTION"] = $arMessage["APPROVED"] == "Y" ? "INCREMENT" : "DECREMENT";
             $arMessage["APPROVED"] = "Y";
         }
         $arParams["POSTS"] = intVal($arParams["POSTS"] > 0 ? $arParams["POSTS"] : 1);
         $arUser = CForumUser::GetByUSER_ID($USER_ID);
     }
     if (empty($arMessage)) {
         // full recount;
     } elseif ($arMessage["APPROVED"] != "Y") {
         return true;
     } elseif (empty($arUser)) {
         $bNeedCreateUser = true;
         // full recount;
     } elseif ($arParams["ACTION"] == "DECREMENT" && $arMessage["ID"] >= $arUser["LAST_POST"]) {
         // full recount;
     } elseif ($arParams["ACTION"] == "DECREMENT") {
         $arUserFields = array("=NUM_POSTS" => "NUM_POSTS-" . $arParams["POSTS"], "POINTS" => intVal(CForumUser::GetUserPoints($USER_ID, array("DECREMENT" => $arParams["POSTS"]))));
     } elseif ($arParams["ACTION"] == "INCREMENT" && $arMessage["ID"] < $arUser["LAST_POST"]) {
         $arUserFields = array("=NUM_POSTS" => "NUM_POSTS+" . $arParams["POSTS"], "POINTS" => intVal(CForumUser::GetUserPoints($USER_ID, array("INCREMENT" => $arParams["POSTS"]))));
     } elseif ($arParams["ACTION"] == "INCREMENT") {
         $arUserFields["IP_ADDRESS"] = $arMessage["AUTHOR_IP"];
         $arUserFields["REAL_IP_ADDRESS"] = $arMessage["AUTHOR_REAL_IP"];
         $arUserFields["LAST_POST"] = intVal($arMessage["ID"]);
         $arUserFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
         $arUserFields["=NUM_POSTS"] = "NUM_POSTS+" . $arParams["POSTS"];
         $arUserFields["POINTS"] = intVal(CForumUser::GetUserPoints($USER_ID, array("INCREMENT" => $arParams["POSTS"])));
     }
     if (empty($arUserFields)) {
         $arUserFields = array("LAST_POST" => false, "LAST_POST_DATE" => false);
         if ($bNeedCreateUser == false) {
             $arUser = CForumUser::GetByUSER_IDEx($USER_ID);
         }
         if (empty($arUser) || $bNeedCreateUser == true) {
             $bNeedCreateUser = true;
             $arUser = CForumMessage::GetList(array(), array("AUTHOR_ID" => $USER_ID, "APPROVED" => "Y"), "cnt_and_last_mid");
             $arUser = is_array($arUser) ? $arUser : array();
         }
         $arMessage = CForumMessage::GetByID($arUser["LAST_MESSAGE_ID"], array("FILTER" => "N"));
         if ($arMessage) {
             $arUserFields["IP_ADDRESS"] = $arMessage["AUTHOR_IP"];
             $arUserFields["REAL_IP_ADDRESS"] = $arMessage["AUTHOR_REAL_IP"];
             $arUserFields["LAST_POST"] = intVal($arMessage["ID"]);
             $arUserFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
         }
         $arUserFields["NUM_POSTS"] = intVal($arUser["CNT"]);
         $arUserFields["POINTS"] = intVal(CForumUser::GetUserPoints($USER_ID, array("NUM_POSTS" => $arUserFields["NUM_POSTS"])));
     }
     if ($bNeedCreateUser) {
         $arUserFields["USER_ID"] = $USER_ID;
         $arUser = CForumUser::Add($arUserFields);
     } else {
         CForumUser::Update($USER_ID, $arUserFields, false, true);
     }
     return $USER_ID;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:70,代码来源:user.php

示例2: GetEventInfo

	public static function GetEventInfo($row, $arParams)
	{
		if (CModule::IncludeModule('forum'))
		{
			$DESCRIPTION = unserialize($row['DESCRIPTION']);
			$site_id = ($row['SITE_ID'] == "s1") ? "" : "site_".$row['SITE_ID']."/";
	// messages
			if (strpos($row['AUDIT_TYPE_ID'], "MESSAGE"))
			{
				$MID = $row['ITEM_ID'];
				$TID = $DESCRIPTION['TOPIC_ID'];
				$FID = $DESCRIPTION['FORUM_ID'];
				if ($arMessage = CForumMessage::GetByID($MID))
					$sPath = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_MESSAGE_PATH'], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "MESSAGE_ID" => $MID, "SITE_ID" => $site_id));
				else
					if ($arTopic = CForumTopic::GetByID($TID))
						$sPath = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_TOPIC_PATH'], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "SITE_ID" => $site_id));

				switch($row['AUDIT_TYPE_ID'])
				{
					case "FORUM_MESSAGE_APPROVE":
						$EventPrint = GetMessage("LOG_FORUM_MESSAGE_APPROVE");
						break;
					case "FORUM_MESSAGE_UNAPPROVE":
						$EventPrint = GetMessage("LOG_FORUM_MESSAGE_UNAPPROVE");
						break;
					case "FORUM_MESSAGE_MOVE":
						$EventPrint = GetMessage("LOG_FORUM_MESSAGE_MOVE");
						break;
					case "FORUM_MESSAGE_EDIT":
						$EventPrint = GetMessage("LOG_FORUM_MESSAGE_EDIT");
						break;
					case "FORUM_MESSAGE_DELETE":
						$EventPrint = GetMessage("LOG_FORUM_MESSAGE_DELETE");
						break;
				}
			}
			else
	// topics
			{
				$TID = $row["ITEM_ID"];
				$FID = $DESCRIPTION['FORUM_ID'];
				if ($arTopic = CForumTopic::GetByID($TID))
					$sPath = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_TOPIC_PATH'], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "SITE_ID" => $site_id));

				switch($row['AUDIT_TYPE_ID'])
				{
					case "FORUM_TOPIC_APPROVE":
						$EventPrint = GetMessage("LOG_FORUM_TOPIC_APPROVE");
						break;
					case "FORUM_TOPIC_UNAPPROVE":
						$EventPrint = GetMessage("LOG_FORUM_TOPIC_UNAPPROVE");
						break;
					case "FORUM_TOPIC_STICK":
						$EventPrint = GetMessage("LOG_FORUM_TOPIC_STICK");
						break;
					case "FORUM_TOPIC_UNSTICK":
						$EventPrint = GetMessage("LOG_FORUM_TOPIC_UNSTICK");
						break;
					case "FORUM_TOPIC_OPEN":
						$EventPrint = GetMessage("LOG_FORUM_TOPIC_OPEN");
						break;
					case "FORUM_TOPIC_CLOSE":
						$EventPrint = GetMessage("LOG_FORUM_TOPIC_CLOSE");
						break;
					case "FORUM_TOPIC_DELETE":
						$EventPrint = GetMessage("LOG_FORUM_TOPIC_DELETE");
						break;
					case "FORUM_TOPIC_MOVE":
						$EventPrint = GetMessage("LOG_FORUM_TOPIC_MOVE", array("#FORUM#" => $DESCRIPTION["FORUM_TITLE"]));
						break;
					case "FORUM_TOPIC_EDIT":
						$EventPrint = GetMessage("LOG_FORUM_TOPIC_EDIT");
						break;
				}
			}
			if($arForum = CForumNew::GetByID($FID))
			{
				$ForumPageURL = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_PATH'], array("FORUM_ID" => $FID, "SITE_ID" => $site_id));
				$resForum = "<a href =".$ForumPageURL.">".$arForum["NAME"]."</a>";
			}
			else
			{
				$resForum = GetMessage("LOG_FORUM");
			}
		}
		return array(
					"eventType" => $EventPrint,
					"eventName" => $DESCRIPTION['TITLE'],
					"eventURL" => $sPath,
					"pageURL" => $resForum
				);
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:93,代码来源:event_log.php

示例3: SetStat

 function SetStat($ID = 0, $arParams = array())
 {
     global $DB;
     $ID = intVal($ID);
     if ($ID <= 0) {
         return false;
     }
     $arParams = is_array($arParams) ? $arParams : array();
     $arMessage = is_array($arParams["MESSAGE"]) ? $arParams["MESSAGE"] : array();
     if ($arMessage["FORUM_ID"] != $ID) {
         $arMessage = array();
     }
     $arForum = CForumNew::GetByID($ID);
     $arParams["ACTION"] = $arParams["ACTION"] == "DECREMENT" || $arParams["ACTION"] == "UPDATE" ? $arParams["ACTION"] : "INCREMENT";
     $arParams["POSTS"] = intVal($arParams["POSTS"] > 0 ? $arParams["POSTS"] : 1);
     $arFields = array();
     if (empty($arMessage)) {
         // full recount
     } elseif ($arParams["ACTION"] == "INCREMENT") {
         if ($arMessage["ID"] > $arForum["ABS_LAST_MESSAGE_ID"]) {
             $arFields["ABS_LAST_POSTER_ID"] = intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false;
             $arFields["ABS_LAST_POSTER_NAME"] = $arMessage["AUTHOR_NAME"];
             $arFields["ABS_LAST_POST_DATE"] = $arMessage["POST_DATE"];
             $arFields["ABS_LAST_MESSAGE_ID"] = $arMessage["ID"];
             if ($arMessage["APPROVED"] == "Y") {
                 $arFields["LAST_POSTER_ID"] = $arFields["ABS_LAST_POSTER_ID"];
                 $arFields["LAST_POSTER_NAME"] = $arFields["ABS_LAST_POSTER_NAME"];
                 $arFields["LAST_POST_DATE"] = $arFields["ABS_LAST_POST_DATE"];
                 $arFields["LAST_MESSAGE_ID"] = $arFields["ABS_LAST_MESSAGE_ID"];
             }
         }
         if ($arMessage["APPROVED"] == "Y") {
             $arFields["=POSTS"] = "POSTS+1";
             if ($arMessage["NEW_TOPIC"] == "Y") {
                 $arFields["=TOPICS"] = "TOPICS+1";
             }
         } else {
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
         }
     } elseif ($arMessage["ID"] > $arForum["ABS_LAST_MESSAGE_ID"]) {
         // full recount
     } elseif ($arParams["ACTION"] == "DECREMENT" && ($arMessage["ID"] == $arForum["ABS_LAST_MESSAGE_ID"] || $arMessage["ID"] == $arForum["LAST_MESSAGE_ID"])) {
         // full recount
     } elseif ($arParams["ACTION"] == "DECREMENT") {
         if ($arMessage["APPROVED"] == "Y") {
             $arFields["=POSTS"] = "POSTS-1";
             if ($arMessage["NEW_TOPIC"] == "Y") {
                 $arFields["=TOPICS"] = "TOPICS-1";
             }
         } else {
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED-1";
         }
     } elseif ($arParams["ACTION"] == "UPDATE") {
         if ($arMessage["APPROVED"] == "Y") {
             if ($arMessage["ID"] > $arForum["LAST_MESSAGE_ID"]) {
                 $arFields["LAST_POSTER_ID"] = intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false;
                 $arFields["LAST_POSTER_NAME"] = $arMessage["AUTHOR_NAME"];
                 $arFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
                 $arFields["LAST_MESSAGE_ID"] = $arMessage["ID"];
             }
             $arFields["=POSTS"] = "POSTS+1";
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED-1";
             if ($arMessage["NEW_TOPIC"] == "Y") {
                 $arFields["=TOPICS"] = "TOPICS+1";
             }
         } elseif ($arMessage["ID"] != $arForum["LAST_MESSAGE_ID"]) {
             $arFields["=POSTS"] = "POSTS-1";
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
             if ($arMessage["NEW_TOPIC"] == "Y") {
                 $arFields["=TOPICS"] = "TOPICS-1";
             }
         }
     }
     if (empty($arFields)) {
         $res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID), "cnt_not_approved");
         $res = is_array($res) ? $res : array();
         $res["CNT"] = intVal($res["CNT"]) - intVal($res["CNT_NOT_APPROVED"]);
         $res["CNT"] = $res["CNT"] > 0 ? $res["CNT"] : 0;
         $arFields = array("TOPICS" => CForumTopic::GetList(array(), array("FORUM_ID" => $ID, "APPROVED" => "Y"), true), "POSTS" => $res["CNT"], "LAST_POSTER_ID" => false, "LAST_POSTER_NAME" => false, "LAST_POST_DATE" => false, "LAST_MESSAGE_ID" => intVal($res["LAST_MESSAGE_ID"]), "POSTS_UNAPPROVED" => intVal($res["CNT_NOT_APPROVED"]), "ABS_LAST_POSTER_ID" => false, "ABS_LAST_POSTER_NAME" => false, "ABS_LAST_POST_DATE" => false, "ABS_LAST_MESSAGE_ID" => intVal($res["ABS_LAST_MESSAGE_ID"]));
         if ($arFields["ABS_LAST_MESSAGE_ID"] > 0) {
             $res = CForumMessage::GetByID($arFields["ABS_LAST_MESSAGE_ID"], array("FILTER" => "N"));
             $arFields["ABS_LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
             $arFields["ABS_LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
             $arFields["ABS_LAST_POST_DATE"] = $res["POST_DATE"];
             if (intVal($arFields["LAST_MESSAGE_ID"]) > 0) {
                 if ($arFields["LAST_MESSAGE_ID"] < $arFields["ABS_LAST_MESSAGE_ID"]) {
                     $res = CForumMessage::GetByID($arFields["LAST_MESSAGE_ID"], array("FILTER" => "N"));
                 }
                 $arFields["LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
                 $arFields["LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
                 $arFields["LAST_POST_DATE"] = $res["POST_DATE"];
             }
         }
     }
     if (!CForumNew::CheckFields("UPDATE", $arFields)) {
         return false;
     }
     $strUpdate = $DB->PrepareUpdate("b_forum", $arFields);
     if (!empty($arFields)) {
         $res = array();
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:forum_new.php

示例4: IntVal

 $FID = IntVal($_REQUEST["FID"]);
 $MID = IntVal($_REQUEST["MID"]);
 $MESSAGE_TYPE = $_REQUEST["MESSAGE_TYPE"];
 if ($MESSAGE_TYPE != "EDIT") {
     $MESSAGE_TYPE = "NEW";
 }
 if ($MESSAGE_TYPE == "EDIT" && $MID <= 0) {
     LocalRedirect("index.php");
     die;
 }
 define("FORUM_MODULE_PAGE", "NEW_TOPIC");
 if ($GLOBALS["SHOW_FORUM_DEBUG_INFO"]) {
     $prexectime = getmicrotime();
 }
 if ($MESSAGE_TYPE == "EDIT") {
     $arMessage = CForumMessage::GetByID($MID);
     if (!$arMessage) {
         LocalRedirect("index.php");
         die;
     }
     $FID = IntVal($arMessage["FORUM_ID"]);
     $TID = IntVal($arMessage["TOPIC_ID"]);
 }
 $arForum = CForumNew::GetByID($FID);
 ForumSetLastVisit();
 if (!$arForum) {
     LocalRedirect("index.php");
     die;
 }
 if ($MESSAGE_TYPE == "NEW" && !CForumTopic::CanUserAddTopic($FID, $USER->GetUserGroupArray(), $USER->GetID())) {
     $APPLICATION->AuthForm(GetMessage("FNT_NO_NPERMS"));
开发者ID:,项目名称:,代码行数:31,代码来源:

示例5: OnRate

 function OnRate($rateID, $arData)
 {
     if (!isset($arData['ENTITY_TYPE_ID']) || !isset($arData['ENTITY_ID']) || $arData['ENTITY_TYPE_ID'] !== 'FORUM_POST' && $arData['ENTITY_TYPE_ID'] !== 'FORUM_TOPIC') {
         return false;
     }
     if ($arData['ENTITY_TYPE_ID'] === 'FORUM_POST') {
         $arMessage = CForumMessage::GetByID($arData['ENTITY_ID']);
         if ($arMessage) {
             $this->ClearTag("T", $arMessage['TOPIC_ID']);
         }
     } else {
         if ($arData['ENTITY_TYPE_ID'] === 'FORUM_TOPIC') {
             $arTopic = CForumTopic::GetByID($arData['ENTITY_ID']);
             if ($arTopic) {
                 $this->ClearTag("F", $arTopic['FORUM_ID']);
             }
             $this->ClearTag("T", $arData['ENTITY_ID']);
         }
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:21,代码来源:functions.php

示例6: AddComment_Tasks

 function AddComment_Tasks($arFields)
 {
     global $DB;
     if (!CModule::IncludeModule("forum")) {
         return false;
     }
     if (!CModule::IncludeModule("tasks")) {
         return false;
     }
     $dbResult = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID"));
     if ($arLog = $dbResult->Fetch()) {
         $rsTask = CTasks::GetById($arLog["SOURCE_ID"]);
         if ($arTask = $rsTask->Fetch()) {
             $forumID = COption::GetOptionString("tasks", "task_forum_id");
             if ($forumID) {
                 if (!$arTask["FORUM_TOPIC_ID"]) {
                     $arUserStart = array("ID" => intVal($arTask["CREATED_BY"]), "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
                     if ($arUserStart["ID"] > 0) {
                         $res = array();
                         $db_res = CForumUser::GetListEx(array(), array("USER_ID" => $arTask["CREATED_BY"]));
                         if ($db_res && ($res = $db_res->Fetch())) {
                             $res["FORUM_USER_ID"] = intVal($res["ID"]);
                             $res["ID"] = $res["USER_ID"];
                         } else {
                             $db_res = CUser::GetByID($arTask["CREATED_BY"]);
                             if ($db_res && ($res = $db_res->Fetch())) {
                                 $res["SHOW_NAME"] = COption::GetOptionString("forum", "USER_SHOW_NAME", "Y");
                                 $res["USER_PROFILE"] = "N";
                             }
                         }
                         if (!empty($res)) {
                             $arUserStart = $res;
                             $sName = $res["SHOW_NAME"] == "Y" ? trim($res["NAME"] . " " . $res["LAST_NAME"]) : "";
                             $arUserStart["NAME"] = empty($sName) ? trim($res["LOGIN"]) : $sName;
                         }
                     }
                     $arUserStart["NAME"] = empty($arUserStart["NAME"]) ? $GLOBALS["FORUM_STATUS_NAME"]["guest"] : $arUserStart["NAME"];
                     $DB->StartTransaction();
                     $arTopicFields = array("TITLE" => $arTask["TITLE"], "FORUM_ID" => $forumID, "USER_START_ID" => $arUserStart["ID"], "USER_START_NAME" => $arUserStart["NAME"], "LAST_POSTER_NAME" => $arUserStart["NAME"], "APPROVED" => "Y");
                     $TID = CForumTopic::Add($arTopicFields);
                     if (intVal($TID) > 0) {
                         $arTask["FORUM_TOPIC_ID"] = $TID;
                         $arTaskFields = array("FORUM_TOPIC_ID" => $TID);
                         $task = new CTasks();
                         $task->Update($arTask["ID"], $arTaskFields);
                     }
                     if (!$arTask["FORUM_TOPIC_ID"]) {
                         $DB->Rollback();
                     } else {
                         $DB->Commit();
                     }
                 }
                 if ($arTask["FORUM_TOPIC_ID"]) {
                     $userID = $GLOBALS["USER"]->GetID();
                     $arLogSites = array();
                     $rsLogSite = CSocNetLog::GetSite($arLog["ID"]);
                     while ($arLogSite = $rsLogSite->Fetch()) {
                         $arLogSites[] = $arLogSite["LID"];
                     }
                     $bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin($arLogSites);
                     if ($arFields["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
                         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "tasks", "view", $bCurrentUserIsAdmin)) {
                             $strPermission = "I";
                         }
                     } else {
                         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "tasks", "view", $bCurrentUserIsAdmin)) {
                             $strPermission = "I";
                         }
                     }
                     $arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "PERMISSION_EXTERNAL" => $strPermission, "PERMISSION" => $strPermission);
                     $MESSAGE_TYPE = 'REPLY';
                     $messageID = ForumAddMessage($MESSAGE_TYPE, $forumID, $arTask["FORUM_TOPIC_ID"], 0, $arFieldsMessage, $sError, $sNote);
                     if ($messageID && ($arMessage = CForumMessage::GetByID($messageID))) {
                         $arLogFields = array("TASK_ID" => $arTask["ID"], "USER_ID" => $userID, "CREATED_DATE" => $arMessage["POST_DATE"], "FIELD" => "COMMENT", "TO_VALUE" => $messageID);
                         $log = new CTaskLog();
                         $log->Add($arLogFields);
                         // notification to IM
                         $arRecipientsIDs = CTaskNotifications::GetRecipientsIDs($arTask);
                         if (IsModuleInstalled("im") && CModule::IncludeModule("im") && sizeof($arRecipientsIDs)) {
                             $extranetSiteId = false;
                             if (CModule::IncludeModule('extranet') && method_exists('CExtranet', 'GetExtranetSiteID')) {
                                 $extranetSiteId = CExtranet::GetExtranetSiteID();
                             }
                             foreach ($arRecipientsIDs as $recipientUserID) {
                                 $arFilter = array('UF_DEPARTMENT' => false, 'ID' => $recipientUserID);
                                 $rsUser = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array('SELECT' => array('UF_DEPARTMENT')));
                                 $isExtranetUser = false;
                                 if ($arUser = $rsUser->Fetch()) {
                                     $isExtranetUser = true;
                                 }
                                 if ($isExtranetUser && $extranetSiteId !== false) {
                                     if ($arTask["GROUP_ID"]) {
                                         $pathTemplate = str_replace("#group_id#", $arTask["GROUP_ID"], COption::GetOptionString("tasks", "paths_task_group_entry", "/extranet/workgroups/group/#group_id#/tasks/task/view/#task_id#/", $extranetSiteId));
                                         $pathTemplate = str_replace("#GROUP_ID#", $arTask["GROUP_ID"], $pathTemplate);
                                     } else {
                                         $pathTemplate = COption::GetOptionString("tasks", "paths_task_user_entry", "/extranet/contacts/personal/user/#user_id#/tasks/task/view/#task_id#/", $extranetSiteId);
                                     }
                                 } else {
                                     if ($arTask["GROUP_ID"]) {
                                         $pathTemplate = str_replace("#group_id#", $arTask["GROUP_ID"], COption::GetOptionString("tasks", "paths_task_group_entry", "/workgroups/group/#group_id#/tasks/task/view/#task_id#/", $arLog["SITE_ID"]));
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:log_tools.php

示例7: onAfterCommentUpdate

	public static function onAfterCommentUpdate($entityType, $entityId, $arData)
	{
		$log_event_id = CSocNetForumComments::FindLogEventIDByForumEntityID($entityType);
		if (!$log_event_id)
			return false;

		$arLogCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($log_event_id);
		if (!$arLogCommentEvent)
			return false;

		$arLogEvent = CSocNetLogTools::FindLogEventByID($log_event_id);

		$entityId = intval($entityId);
		if ($entityId <= 0)
			return;	

		if (empty($arData["MESSAGE_ID"]))
			return;

		$parser = new CTextParser();
		$parser->allow = array("HTML" => 'N',"ANCHOR" => 'Y',"BIU" => 'Y',"IMG" => "Y","VIDEO" => "Y","LIST" => 'N',"QUOTE" => 'Y',"CODE" => 'Y',"FONT" => 'Y',"SMILES" => "N","UPLOAD" => 'N',"NL2BR" => 'N',"TABLE" => "Y");

		switch ($arData["ACTION"])
		{
			case "DEL":
			case "HIDE":
				$dbLogComment = CSocNetLogComments::GetList(
					array("ID" => "DESC"),
					array(
						"EVENT_ID"	=> array($arLogCommentEvent["EVENT_ID"]),
						"SOURCE_ID" => intval($arData["MESSAGE_ID"])
					),
					false,
					false,
					array("ID")
				);
				while ($arLogComment = $dbLogComment->Fetch())
					CSocNetLogComments::Delete($arLogComment["ID"]);
				break;
			case "SHOW":
				$dbLogComment = CSocNetLogComments::GetList(
					array("ID" => "DESC"),
					array(
						"EVENT_ID"	=> array($arLogCommentEvent["EVENT_ID"]),
						"SOURCE_ID" => intval($arData["MESSAGE_ID"])
					),
					false,
					false,
					array("ID")
				);
				$arLogComment = $dbLogComment->Fetch();
				if (!$arLogComment)
				{
					$arMessage = CForumMessage::GetByID(intval($arData["MESSAGE_ID"]));
					if ($arMessage)
					{
						$dbLog = CSocNetLog::GetList(
							array("ID" => "DESC"),
							array(
								"EVENT_ID" => $log_event_id,
								"SOURCE_ID" => $entityId
							),
							false,
							false,
							array("ID", "ENTITY_TYPE", "ENTITY_ID")
						);

						if ($arLog = $dbLog->Fetch())
						{
							$log_id = $arLog["ID"];
							$entity_type = $arLog["ENTITY_TYPE"];
							$entity_id = $arLog["ENTITY_ID"];

							$sText = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
							$strURL = $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
							$strURL = ForumAddPageParams(
								$strURL,
								array(
									"MID" => intval($arData["MESSAGE_ID"]),
									"result" => "reply"
								),
								false,
								false
							);

							$arFieldsForSocnet = array(
								"ENTITY_TYPE" => $entity_type,
								"ENTITY_ID" => $entity_id,
								"EVENT_ID" => $arLogCommentEvent["EVENT_ID"],
								"MESSAGE" => $sText,
								"TEXT_MESSAGE" => $parser->convert4mail($sText),
								"URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))),
								"MODULE_ID" => (array_key_exists("MODULE_ID", $arLogCommentEvent) && strlen($arLogCommentEvent["MODULE_ID"]) > 0 ? $arLogCommentEvent["MODULE_ID"] : ""),
								"SOURCE_ID" => intval($arData["MESSAGE_ID"]),
								"LOG_ID" => $log_id,
								"RATING_TYPE_ID" => "FORUM_POST",
								"RATING_ENTITY_ID" => intval($arData["MESSAGE_ID"])
							);

							$arFieldsForSocnet["USER_ID"] = $arMessage["AUTHOR_ID"];
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:101,代码来源:log_forum_comments.php

示例8: __deprecated_Add

 /**
  * WARNING! This method is transitional and can be changed without 
  * any notifications! Don't use it.
  * 
  * @deprecated
  */
 public static function __deprecated_Add($commentText, $forumTopicId, $forumId, $nameTemplate, $arTask, $permissions, $commentId, $givenUserId, $imageWidth, $imageHeight, $arSmiles, $arForum, $messagesPerPage, $arUserGroupArray, $backPage, $strMsgAddComment, $strMsgEditComment, $strMsgNewTask, $componentName, &$outForumTopicId, &$arErrorCodes, &$outStrUrl, $arFieldsAdditional = array())
 {
     global $DB;
     if (is_array($arTask)) {
         if (!array_key_exists('~TITLE', $arTask)) {
             $arTmpTask = $arTask;
             foreach ($arTmpTask as $key => $value) {
                 if (substr($key, 0, 1) !== '~') {
                     $arTask['~' . $key] = $arTmpTask[$key];
                 }
             }
         }
     }
     $MID = 0;
     $TID = 0;
     if ($forumTopicId > 0 && CForumTopic::GetByID($forumTopicId) === false) {
         $forumTopicId = false;
     }
     if ($forumTopicId <= 0) {
         $arUserStart = array("ID" => intVal($arTask["CREATED_BY"]), "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
         if ($arUserStart["ID"] > 0) {
             $res = array();
             $db_res = CForumUser::GetListEx(array(), array("USER_ID" => $arTask["CREATED_BY"]));
             if ($db_res && ($res = $db_res->Fetch())) {
                 $res["FORUM_USER_ID"] = intVal($res["ID"]);
                 $res["ID"] = $res["USER_ID"];
             } else {
                 $db_res = CUser::GetByID($arTask["CREATED_BY"]);
                 if ($db_res && ($res = $db_res->Fetch())) {
                     $res["SHOW_NAME"] = COption::GetOptionString("forum", "USER_SHOW_NAME", "Y");
                     $res["USER_PROFILE"] = "N";
                 }
             }
             if (!empty($res)) {
                 $arUserStart = $res;
                 $sName = $res["SHOW_NAME"] == "Y" ? trim(CUser::FormatName($nameTemplate, $res)) : "";
                 $arUserStart["NAME"] = empty($sName) ? trim($res["LOGIN"]) : $sName;
             }
         }
         $arUserStart["NAME"] = empty($arUserStart["NAME"]) ? $GLOBALS["FORUM_STATUS_NAME"]["guest"] : $arUserStart["NAME"];
         $DB->StartTransaction();
         $arFields = array("TITLE" => $arTask["~TITLE"], "FORUM_ID" => $forumId, "USER_START_ID" => $arUserStart["ID"], "USER_START_NAME" => $arUserStart["NAME"], "LAST_POSTER_NAME" => $arUserStart["NAME"], "APPROVED" => "Y", "PERMISSION_EXTERNAL" => $permissions, "PERMISSION" => $permissions, "NAME_TEMPLATE" => $nameTemplate, 'XML_ID' => 'TASK_' . $arTask['ID']);
         $TID = CForumTopic::Add($arFields);
         if (intVal($TID) <= 0) {
             $arErrorCodes[] = array('code' => 'topic is not created');
         } else {
             $arFields = array("FORUM_TOPIC_ID" => $TID);
             $task = new CTasks();
             $task->Update($arTask["ID"], $arFields);
         }
         if (!empty($arErrorCodes)) {
             $DB->Rollback();
             return false;
         } else {
             $DB->Commit();
         }
     }
     $arFieldsG = array("POST_MESSAGE" => $commentText, "AUTHOR_NAME" => '', "AUTHOR_EMAIL" => $GLOBALS['USER']->GetEmail(), "USE_SMILES" => NULL, "PARAM2" => $arTask['ID'], "TITLE" => $arTask["~TITLE"], "PERMISSION_EXTERNAL" => $permissions, "PERMISSION" => $permissions);
     // UF_* forwarding
     if (is_array($arFieldsAdditional)) {
         foreach ($arFieldsAdditional as $field => $value) {
             if (strlen($field) && substr($field, 0, 3) == 'UF_') {
                 $arFieldsG[$field] = $value;
                 $GLOBALS[$field] = $value;
                 // strange behaviour required for ForumMessageAdd() to handle UF_* properly
             }
         }
     }
     if (!empty($_FILES["REVIEW_ATTACH_IMG"])) {
         $arFieldsG["ATTACH_IMG"] = $_FILES["REVIEW_ATTACH_IMG"];
     } else {
         $arFiles = array();
         if (!empty($_REQUEST["FILES"])) {
             foreach ($_REQUEST["FILES"] as $key) {
                 $arFiles[$key] = array("FILE_ID" => $key);
                 if (!in_array($key, $_REQUEST["FILES_TO_UPLOAD"])) {
                     $arFiles[$key]["del"] = "Y";
                 }
             }
         }
         if (!empty($_FILES)) {
             $res = array();
             foreach ($_FILES as $key => $val) {
                 if (substr($key, 0, strLen("FILE_NEW")) == "FILE_NEW" && !empty($val["name"])) {
                     $arFiles[] = $_FILES[$key];
                 }
             }
         }
         if (!empty($arFiles)) {
             $arFieldsG["FILES"] = $arFiles;
         }
     }
     $TOPIC_ID = $forumTopicId > 0 ? $forumTopicId : $TID;
     $MESSAGE_ID = 0;
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:taskcomments.php

示例9: AddComment_Tasks

 function AddComment_Tasks($arFields)
 {
     global $DB;
     if (!CModule::IncludeModule("forum")) {
         return false;
     }
     if (!CModule::IncludeModule("tasks")) {
         return false;
     }
     $ufFileID = array();
     $ufDocID = array();
     $dbResult = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID"));
     if ($arLog = $dbResult->Fetch()) {
         $rsTask = CTasks::GetById($arLog["SOURCE_ID"]);
         if ($arTask = $rsTask->Fetch()) {
             // read shared cross-site FORUM_ID
             $forumID = COption::GetOptionString("tasks", "task_forum_id", 0, $siteId = '');
             if ($forumID) {
                 if (!$arTask["FORUM_TOPIC_ID"]) {
                     $arUserStart = array("ID" => intVal($arTask["CREATED_BY"]), "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
                     if ($arUserStart["ID"] > 0) {
                         $res = array();
                         $db_res = CForumUser::GetListEx(array(), array("USER_ID" => $arTask["CREATED_BY"]));
                         if ($db_res && ($res = $db_res->Fetch())) {
                             $res["FORUM_USER_ID"] = intVal($res["ID"]);
                             $res["ID"] = $res["USER_ID"];
                         } else {
                             $db_res = CUser::GetByID($arTask["CREATED_BY"]);
                             if ($db_res && ($res = $db_res->Fetch())) {
                                 $res["SHOW_NAME"] = COption::GetOptionString("forum", "USER_SHOW_NAME", "Y");
                                 $res["USER_PROFILE"] = "N";
                             }
                         }
                         if (!empty($res)) {
                             $arUserStart = $res;
                             $sName = $res["SHOW_NAME"] == "Y" ? trim($res["NAME"] . " " . $res["LAST_NAME"]) : "";
                             $arUserStart["NAME"] = empty($sName) ? trim($res["LOGIN"]) : $sName;
                         }
                     }
                     $arUserStart["NAME"] = empty($arUserStart["NAME"]) ? $GLOBALS["FORUM_STATUS_NAME"]["guest"] : $arUserStart["NAME"];
                     $DB->StartTransaction();
                     $arTopicFields = array("TITLE" => $arTask["TITLE"], "FORUM_ID" => $forumID, "USER_START_ID" => $arUserStart["ID"], "USER_START_NAME" => $arUserStart["NAME"], "LAST_POSTER_NAME" => $arUserStart["NAME"], "PERMISSION_EXTERNAL" => 'E', "PERMISSION" => 'E', "APPROVED" => "Y", 'XML_ID' => 'TASK_' . $arTask['ID']);
                     $TID = CForumTopic::Add($arTopicFields);
                     if (intVal($TID) > 0) {
                         $arFieldsFirstMessage = array("POST_MESSAGE" => $arTopicFields['XML_ID'], "AUTHOR_ID" => $arTopicFields["USER_START_ID"], "AUTHOR_NAME" => $arTopicFields["USER_START_NAME"], "FORUM_ID" => $arTopicFields["FORUM_ID"], "TOPIC_ID" => $TID, "APPROVED" => "Y", "NEW_TOPIC" => "Y", "PARAM1" => 'TK', "PARAM2" => $arTask['ID'], "PERMISSION_EXTERNAL" => 'E', "PERMISSION" => 'E');
                         CForumMessage::Add($arFieldsFirstMessage, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N"));
                         $arTask["FORUM_TOPIC_ID"] = $TID;
                         $arTaskFields = array("FORUM_TOPIC_ID" => $TID);
                         $task = new CTasks();
                         $task->Update($arTask["ID"], $arTaskFields);
                     }
                     if (!$arTask["FORUM_TOPIC_ID"]) {
                         $DB->Rollback();
                     } else {
                         $DB->Commit();
                     }
                 } else {
                     // override forumId by fact forum, attached to the task
                     if ($arTopic = CForumTopic::getByID($arTask['FORUM_TOPIC_ID'])) {
                         $forumID = $arTopic['FORUM_ID'];
                     }
                 }
                 if ($forumID && $arTask["FORUM_TOPIC_ID"]) {
                     $userID = $GLOBALS["USER"]->GetID();
                     $arLogSites = array();
                     $rsLogSite = CSocNetLog::GetSite($arLog["ID"]);
                     while ($arLogSite = $rsLogSite->Fetch()) {
                         $arLogSites[] = $arLogSite["LID"];
                     }
                     $bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin($arLogSites);
                     if ($arFields["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
                         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "tasks", "view", $bCurrentUserIsAdmin)) {
                             $strPermission = "I";
                         }
                     } else {
                         if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "tasks", "view", $bCurrentUserIsAdmin)) {
                             $strPermission = "I";
                         }
                     }
                     $arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "PERMISSION_EXTERNAL" => "Q", "PERMISSION" => $strPermission, "APPROVED" => "Y");
                     $MESSAGE_TYPE = 'REPLY';
                     $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
                     if (is_array($arTmp)) {
                         if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
                             $GLOBALS["UF_FORUM_MESSAGE_DOC"] = $arTmp["UF_SONET_COM_DOC"];
                         } elseif (array_key_exists("UF_SONET_COM_FILE", $arTmp)) {
                             $arFieldsMessage["FILES"] = array();
                             foreach ($arTmp["UF_SONET_COM_FILE"] as $file_id) {
                                 $arFieldsMessage["FILES"][] = array("FILE_ID" => $file_id);
                             }
                         }
                     }
                     $messageID = ForumAddMessage($MESSAGE_TYPE, $forumID, $arTask["FORUM_TOPIC_ID"], 0, $arFieldsMessage, $sError, $sNote);
                     // get UF DOC value and FILE_ID there
                     if ($messageID > 0) {
                         $dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $messageID));
                         while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
                             $ufFileID[] = $arAddedMessageFiles["FILE_ID"];
                         }
                         $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $messageID, LANGUAGE_ID);
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:log_tools.php

示例10: OnGetRatingContentOwner

 function OnGetRatingContentOwner($arParams)
 {
     if ($arParams['ENTITY_TYPE_ID'] == 'FORUM_TOPIC') {
         $arTopic = CForumTopic::GetByID(IntVal($arParams['ENTITY_ID']));
         return $arTopic['USER_START_ID'];
     } elseif ($arParams['ENTITY_TYPE_ID'] == 'FORUM_POST') {
         $arMessage = CForumMessage::GetByID(IntVal($arParams['ENTITY_ID']));
         return $arMessage['AUTHOR_ID'];
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:ratings_components.php

示例11: ForumMoveMessage2Support

function ForumMoveMessage2Support($MID, &$strErrorMessage, &$strOKMessage, $arAddParams = array())
{
    global $USER;
    $MID = IntVal($MID);
    $sError = array();
    $sNote = array();
    $arAddParams = !is_array($arAddParams) ? array($arAddParams) : $arAddParams;
    $arAddParams["PERMISSION"] = !empty($arAddParams["PERMISSION"]) ? $arAddParams["PERMISSION"] : false;
    if ($MID <= 0) {
        $arError[] = GetMessage("MOVEMES_NO_MESS_EX");
    }
    if (!CModule::IncludeModule("support")) {
        $arError[] = GetMessage("MOVEMES_NO_SUPPORT");
    }
    if (empty($arError)) {
        $arMessage = CForumMessage::GetByID($MID, array("FILTER" => "N"));
        if (!$arMessage) {
            $arError[] = GetMessage("MOVEMES_NO_MESS_EX");
        } elseif (IntVal($arMessage["AUTHOR_ID"]) <= 0) {
            $arError[] = GetMessage("MOVEMES_NO_ANONYM");
        } elseif (!CForumMessage::CanUserDeleteMessage($MID, $USER->GetUserGroupArray(), $USER->GetID(), $arAddParams["PERMISSION"])) {
            $arError[] = GetMessage("MOVEMES_NO_PERMS2MOVE");
        } else {
            $arTopic = CForumTopic::GetByID($arMessage["TOPIC_ID"]);
            $arFieldsSu = array("CLOSE" => "N", "TITLE" => $arTopic["TITLE"], "MESSAGE" => $arMessage["POST_MESSAGE"], "OWNER_USER_ID" => $arMessage["AUTHOR_ID"], "OWNER_SID" => $arMessage["AUTHOR_NAME"], "SOURCE_SID" => "forum");
            $arIMAGE = CFile::MakeFileArray($arMessage["ATTACH_IMG"]);
            if (is_array($arIMAGE)) {
                $arIMAGE["MODULE_ID"] = "support";
                $arFieldsSu["FILES"] = array($arIMAGE);
            }
            $SuID = CTicket::SetTicket($arFieldsSu);
            $SuID = IntVal($SuID);
            if ($SuID > 0) {
                $sNote[] = GetMessage("MOVEMES_SUCCESS_SMOVE");
            } else {
                $arError[] = GetMessage("MOVEMES_ERROR_SMOVE");
            }
        }
    }
    if (!empty($arError)) {
        $strErrorMessage .= implode(".\n", $arError) . ".\n";
    }
    if (!empty($arNote)) {
        $strOKMessage .= implode(".\n", $arNote) . ".\n";
    }
    if (empty($arError)) {
        return $SuID;
    } else {
        return False;
    }
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:include.php

示例12: ForumAddMessage

             }
         }
     }
     if (!empty($arFiles)) {
         $arFieldsG["FILES"] = $arFiles;
     }
 }
 $TOPIC_ID = $FORUM_TOPIC_ID > 0 ? $FORUM_TOPIC_ID : $TID;
 $MID = ForumAddMessage($TOPIC_ID > 0 ? "REPLY" : "NEW", $arParams["FORUM_ID"], $TOPIC_ID, 0, $arFieldsG, $strErrorMessage, $strOKMessage, false, $_POST["captcha_word"], 0, $_POST["captcha_code"], $arParams["NAME_TEMPLATE"]);
 if ($MID <= 0 || !empty($strErrorMessage)) {
     $arError[] = array("code" => "message is not added 2", "title" => empty($strErrorMessage) ? GetMessage("F_ERR_ADD_MESSAGE") : $strErrorMessage);
     $arResult['RESULT'] = false;
     $arResult["OK_MESSAGE"] = '';
 } else {
     if ($TOPIC_ID <= 0) {
         $res = CForumMessage::GetByID($MID);
         $FORUM_TOPIC_ID = $TID = intVal($res["TOPIC_ID"]);
     }
     if ($arParams["AUTOSAVE"]) {
         $arParams["AUTOSAVE"]->Reset();
     }
     // 1.7 Update Iblock Property
     if ($TID > 0) {
         CIBlockElement::SetPropertyValues($arParams["ELEMENT_ID"], $PRODUCT_IBLOCK_ID, intVal($TID), "FORUM_TOPIC_ID");
     } else {
         if ($TOPIC_ID > 0) {
             $TID = $TOPIC_ID;
         }
         if ($FORUM_TOPIC_ID > 0) {
             $TID = $FORUM_TOPIC_ID;
         }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:action.php

示例13: strlen

                     $UserPermStr = $arUserRank["NAME"];
                 }
                 $UserPermStr = strlen(trim($UserPermStr)) > 0 ? $UserPermStr : $ForumsPerms["user"];
                 //
                 $main[$arForum["ID"]] = $arForum;
                 $main[$arForum["ID"]]["ALLOW"] = $arAllow;
                 $main[$arForum["ID"]]["USER_PERM"] = $UserPerm;
                 $main[$arForum["ID"]]["USER_PERM_STR"] = $UserPermStr;
             }
             //**********************************************************************************************
             // Topics
             //						$arTopic = array_merge($arTopic, CForumTopic::GetByIDEx($arTopic["TOPIC_ID"]));
             $arTopic["ID"] = $arTopic["TOPIC_ID"];
             $main[$arForum["ID"]]["TOPIC"][$arTopic["ID"]] = $arTopic;
             // Message
             $main[$arForum["ID"]]["TOPIC"][$arTopic["ID"]]["MESSAGE"][] = CForumMessage::GetByID($arTopic["FIRST_POST"]);
             // User
             $main[$arForum["ID"]]["TOPIC"][$arTopic["ID"]]["USER_PERM_DELETE"] = ForumCurrUserPermissions($arTopic["FORUM_ID"]) < "U" ? false : true;
             $main[$arForum["ID"]]["TOPIC"][$arTopic["ID"]]["LAST_TOPIC_MESSAGE"] = false;
             $main[$arForum["ID"]]["NUM_POSTS_ALL"] += intVal($arTopic["COUNT_MESSAGE"]);
         } while ($arTopic = $db_topics->GetNext());
     }
     $db_topics->NavPrint(GetMessage("LU_TITLE_TOPIC"));
     PrintMessages($main, $arUser);
     $db_topics->NavPrint(GetMessage("LU_TITLE_TOPIC"));
     break;
 case "all":
     // »нформаци¤ о пользователе 1 запрос
     $arUser = CForumUser::GetListEx(array(), array("USER_ID" => $UID));
     $arUser = $arUser->GetNext();
     $db_topics = CForumUser::UserAddInfo(array("FORUM_ID" => "ASC"), array("AUTHOR_ID" => $UID), "topics");
开发者ID:,项目名称:,代码行数:31,代码来源:

示例14: GetMessagePage

 function GetMessagePage($ID, $mess_per_page, $arUserGroups, $TID = false, $arAddParams = array())
 {
     $ID = intVal($ID);
     $mess_per_page = intVal($mess_per_page);
     $arAddParams = is_array($arAddParams) ? $arAddParams : array($arAddParams);
     $arAddParams["ORDER_DIRECTION"] = $arAddParams["ORDER_DIRECTION"] == "DESC" ? "DESC" : "ASC";
     $arAddParams["FILTER"] = is_array($arAddParams["FILTER"]) ? $arAddParams["FILTER"] : array();
     if ($mess_per_page <= 0) {
         return 0;
     }
     if (!empty($arAddParams["PERMISSION_EXTERNAL"])) {
         $arMessage = array("TOPIC_ID" => $TID);
         $permission = $arAddParams["PERMISSION_EXTERNAL"];
     } else {
         $arMessage = CForumMessage::GetByID($ID, array("FILTER" => "N"));
         $permission = CForumNew::GetUserPermission($arMessage["FORUM_ID"], $arUserGroups);
     }
     $arFilter = $arAddParams["FILTER"] + array("TOPIC_ID" => $arMessage["TOPIC_ID"]);
     if ($permission < "Q") {
         $arFilter["APPROVED"] = "Y";
     }
     if ($arAddParams["ORDER_DIRECTION"] == "DESC") {
         $arFilter[">ID"] = $ID;
     } else {
         $arFilter["<ID"] = $ID;
     }
     $iCnt = CForumMessage::GetList(array("ID" => $arAddParams["ORDER_DIRECTION"]), $arFilter, True);
     $iCnt = intVal($iCnt);
     return intVal($iCnt / $mess_per_page) + 1;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:30,代码来源:message.php

示例15: SetStat

 function SetStat($ID = 0, $arParams = array())
 {
     global $DB;
     $ID = intVal($ID);
     if ($ID <= 0) {
         return false;
     }
     $arParams = is_array($arParams) ? $arParams : array();
     $arMessage = is_array($arParams["MESSAGE"]) ? $arParams["MESSAGE"] : array();
     if ($arMessage["TOPIC_ID"] != $ID) {
         $arMessage = array();
     }
     $arFields = array();
     if (!empty($arMessage)) {
         $arFields = array("ABS_LAST_POSTER_ID" => intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false, "ABS_LAST_POSTER_NAME" => $arMessage["AUTHOR_NAME"], "ABS_LAST_POST_DATE" => $arMessage["POST_DATE"], "ABS_LAST_MESSAGE_ID" => $arMessage["ID"]);
         if ($arMessage["APPROVED"] == "Y") {
             $arFields["APPROVED"] = "Y";
             $arFields["LAST_POSTER_ID"] = $arFields["ABS_LAST_POSTER_ID"];
             $arFields["LAST_POSTER_NAME"] = $arFields["ABS_LAST_POSTER_NAME"];
             $arFields["LAST_POST_DATE"] = $arFields["ABS_LAST_POST_DATE"];
             $arFields["LAST_MESSAGE_ID"] = $arFields["ABS_LAST_MESSAGE_ID"];
             if ($arMessage["NEW_TOPIC"] != "Y") {
                 $arFields["=POSTS"] = "POSTS+1";
             }
         } else {
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
         }
     } else {
         $res = CForumMessage::GetList(array(), array("TOPIC_ID" => $ID), "cnt_not_approved");
         $res["CNT"] = intVal($res["CNT"]) - intVal($res["CNT_NOT_APPROVED"]);
         $res["CNT"] = $res["CNT"] > 0 ? $res["CNT"] : 0;
         if (intval($res["ABS_FIRST_MESSAGE_ID"]) > 0 && intval($res["ABS_FIRST_MESSAGE_ID"]) != intval($res["FIRST_MESSAGE_ID"])) {
             $strSQL = "UPDATE b_forum_message SET NEW_TOPIC = (CASE WHEN ID=" . intval($res["ABS_FIRST_MESSAGE_ID"]) . " THEN 'Y' ELSE 'N' END) WHERE TOPIC_ID=" . $ID;
             $GLOBALS["DB"]->Query($strSQL, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         $arFields = array("APPROVED" => $res["CNT"] > 0 ? "Y" : "N", "POSTS" => $res["CNT"] > 0 ? $res["CNT"] - 1 : 0, "LAST_POSTER_ID" => false, "LAST_POSTER_NAME" => false, "LAST_POST_DATE" => false, "LAST_MESSAGE_ID" => intVal($res["LAST_MESSAGE_ID"]), "POSTS_UNAPPROVED" => intVal($res["CNT_NOT_APPROVED"]), "ABS_LAST_POSTER_ID" => false, "ABS_LAST_POSTER_NAME" => false, "ABS_LAST_POST_DATE" => false, "ABS_LAST_MESSAGE_ID" => intVal($res["ABS_LAST_MESSAGE_ID"]));
         if ($arFields["ABS_LAST_MESSAGE_ID"] > 0) {
             $res = CForumMessage::GetByID($arFields["ABS_LAST_MESSAGE_ID"], array("FILTER" => "N"));
             $arFields["ABS_LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
             $arFields["ABS_LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
             $arFields["ABS_LAST_POST_DATE"] = $res["POST_DATE"];
             if (intVal($arFields["LAST_MESSAGE_ID"]) > 0) {
                 if ($arFields["LAST_MESSAGE_ID"] < $arFields["ABS_LAST_MESSAGE_ID"]) {
                     $res = CForumMessage::GetByID($arFields["LAST_MESSAGE_ID"], array("FILTER" => "N"));
                 }
                 $arFields["LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
                 $arFields["LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
                 $arFields["LAST_POST_DATE"] = $res["POST_DATE"];
             }
         }
         foreach (array("LAST_POST_DATE" => "START_DATE", "ABS_LAST_POST_DATE" => "START_DATE", "LAST_POSTER_NAME" => "USER_START_NAME", "ABS_LAST_POSTER_NAME" => "USER_START_NAME") as $key => $val) {
             if ($arFields[$key] == false) {
                 $arFields["=" . $key] = $val;
                 unset($arFields[$key]);
             }
         }
     }
     return CForumTopic::Update($ID, $arFields);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:59,代码来源:topic.php


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