예제 #1
0
	public static function AddComment_Photo($arFields)
	{
		$dbResult = CSocNetLog::GetList(
			array(),
			array("ID" => $arFields["LOG_ID"]),
			false,
			false,
			array("ID", "SOURCE_ID", "USER_ID", "TITLE", "URL", "PARAMS")
		);

		$bFoundForum = false;
		$bFoundBlog = false;
		if ($arLog = $dbResult->Fetch())
		{
			if (strlen($arLog["PARAMS"]) > 0)
			{
				$arTmp = unserialize(htmlspecialcharsback($arLog["PARAMS"]));
				if ($arTmp)
				{
					$FORUM_ID = $arTmp["FORUM_ID"];
					$BLOG_ID = $arTmp["BLOG_ID"];

					if (
						array_key_exists("SECTION_NAME", $arTmp)
						&& strlen($arTmp["SECTION_NAME"]) > 0
					)
						$log_section_name = $arTmp["SECTION_NAME"];

					if (
						array_key_exists("SECTION_URL", $arTmp)
						&& strlen($arTmp["SECTION_URL"]) > 0
					)
						$log_section_url = $arTmp["SECTION_URL"];
				}
			}
			if ($FORUM_ID > 0 && intval($arLog["SOURCE_ID"]) > 0)
				$bFoundForum = true;
			elseif ($BLOG_ID > 0 && intval($arLog["SOURCE_ID"]) > 0)
				$bFoundBlog = true;
		}

		if ($bFoundForum)
			$arReturn = CSocNetPhotoCommentEvent::AddComment_Photo_Forum($arFields, $FORUM_ID, $arLog);
		elseif ($bFoundBlog)
			$arReturn = CSocNetPhotoCommentEvent::AddComment_Photo_Blog($arFields, $BLOG_ID, $arLog);
		else
			$arReturn =  array(
				"SOURCE_ID" => false,
				"ERROR" => GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR"),
				"NOTES" => ""
			);
			
		if (
			($bFoundForum || $bFoundBlog)
			&& !empty($arReturn["IM_MESSAGE"])
		)
		{
			$arFieldsIM = Array(
				"TYPE" => "COMMENT",
				"TITLE" => $arLog["TITLE"],
				"MESSAGE" => $arReturn["IM_MESSAGE"],
				"URL" => $arLog["URL"],
				"SECTION_NAME" => $log_section_name,
				"SECTION_URL" => $log_section_url,
				"ID" => $arLog["SOURCE_ID"],
				"PHOTO_AUTHOR_ID" => $arLog["USER_ID"],
				"COMMENT_AUTHOR_ID" => $GLOBALS["USER"]->GetID(),
			);
			CSocNetPhotoCommentEvent::NotifyIm($arFieldsIM);
		}

		return $arReturn;
	}
예제 #2
0
 public static function AddComment_Photo($arFields)
 {
     $arLogType = self::FindLogType($arFields["LOG_ID"]);
     if ($arLogType["TYPE"] == "FORUM") {
         $arReturn = CSocNetPhotoCommentEvent::AddComment_Photo_Forum($arFields, $arLogType["ENTITY_ID"], $arLogType["LOG"]);
     } elseif ($arLogType["TYPE"] == "BLOG") {
         $arReturn = CSocNetPhotoCommentEvent::AddComment_Photo_Blog($arFields, $arLogType["ENTITY_ID"], $arLogType["LOG"]);
     } else {
         $arReturn = array("SOURCE_ID" => false, "ERROR" => GetMessage("SONET_PHOTO_ADD_COMMENT_SOURCE_ERROR"), "NOTES" => "");
     }
     if ($arLogType["TYPE"] && !empty($arReturn["IM_MESSAGE"])) {
         $arFieldsIM = array("TYPE" => "COMMENT", "TITLE" => $arLogType["LOG"]["TITLE"], "MESSAGE" => $arReturn["IM_MESSAGE"], "URL" => $arLogType["LOG"]["URL"], "SECTION_NAME" => $log_section_name, "SECTION_URL" => $log_section_url, "ID" => $arLogType["LOG"]["SOURCE_ID"], "PHOTO_AUTHOR_ID" => $arLogType["LOG"]["USER_ID"], "COMMENT_AUTHOR_ID" => $GLOBALS["USER"]->GetID());
         CSocNetPhotoCommentEvent::NotifyIm($arFieldsIM);
     }
     return $arReturn;
 }
예제 #3
0
 function AddComment_Photo_Forum($arFields, $FORUM_ID, $arLog)
 {
     return CSocNetPhotoCommentEvent::AddComment_Photo_Forum($arFields, $FORUM_ID, $arLog);
 }