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


PHP CSocNetLogRights::Add方法代码示例

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


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

示例1: NewUserMessage

 public static function NewUserMessage($USER_ID)
 {
     global $DB, $APPLICATION;
     if (!CModule::IncludeModule('socialnetwork')) {
         return false;
     }
     $USER_ID = intval($USER_ID);
     if ($USER_ID <= 0) {
         return false;
     }
     $arRights = self::GetRights($USER_ID);
     if (!$arRights) {
         return false;
     }
     $dbRes = CUser::GetByID($USER_ID);
     if ($arUser = $dbRes->Fetch()) {
         $arSoFields = array("ENTITY_TYPE" => SONET_INTRANET_NEW_USER_ENTITY, "EVENT_ID" => SONET_INTRANET_NEW_USER_EVENT_ID, "ENTITY_ID" => $USER_ID, "SOURCE_ID" => $USER_ID, "USER_ID" => $USER_ID, "=LOG_DATE" => $DB->CurrentTimeFunction(), "MODULE_ID" => "intranet", "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => GetMessage('I_NEW_USER_TITLE'), "MESSAGE" => '', "TEXT_MESSAGE" => '', "CALLBACK_FUNC" => false, "SITE_ID" => SITE_ID, "ENABLE_COMMENTS" => "Y", "RATING_TYPE_ID" => "INTRANET_NEW_USER", "RATING_ENTITY_ID" => $USER_ID);
         // check that there wasn't message for this user
         $dbRes = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => $arSoFields['ENTITY_TYPE'], 'ENTITY_ID' => $arSoFields['ENTITY_ID'], 'EVENT_ID' => $arSoFields['EVENT_ID'], 'SOURCE_ID' => $arSoFields['SOURCE_ID']));
         if (!$dbRes->Fetch()) {
             $logID = CSocNetLog::Add($arSoFields, false);
             if (intval($logID) > 0) {
                 CSocNetLog::Update($logID, array("TMP_ID" => $logID));
                 CSocNetLogRights::Add($logID, $arRights);
             }
         }
         if (intval($logID) > 0) {
             CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:notify.php

示例2: UpdateActivityIBlock

 function UpdateActivityIBlock(&$arFields)
 {
     if ($arFields['RESULT']) {
         // absence
         $iblock = COption::GetOptionInt('intranet', 'iblock_absence');
         if (!$iblock) {
             $iblock = array();
             $dbRes = CSite::GetList($b = 'SORT', $o = 'ASC');
             while ($arRes = $dbRes->Fetch()) {
                 if ($ib = COption::GetOptionInt('intranet', 'iblock_absence', false, $arRes['ID'])) {
                     $iblock[] = $ib;
                 }
             }
         } else {
             $iblock = array($iblock);
         }
         if (count($iblock) > 0) {
             foreach ($iblock as $ib) {
                 if ($arFields['IBLOCK_ID'] == $ib) {
                     static $PROPERTY_USER = 0;
                     if ($PROPERTY_USER <= 0) {
                         $dbRes = CIBlockProperty::GetByID('USER', $arFields['IBLOCK_ID']);
                         if ($arRes = $dbRes->Fetch()) {
                             $PROPERTY_USER = $arRes['ID'];
                         }
                     }
                     if ($PROPERTY_USER > 0) {
                         //							$arPropertyValue = array_values($arFields['PROPERTY_VALUES']);
                         //							$USER_ID = $arPropertyValue[0];
                         $USER_ID = $arFields['PROPERTY_VALUES']['USER'];
                         $dbRes = CUser::GetByID($USER_ID);
                         if ($arUser = $dbRes->Fetch()) {
                             CIBlockElement::SetPropertyValues($arFields['ID'], $arFields['IBLOCK_ID'], $arUser['ACTIVE'], 'USER_ACTIVE');
                         }
                     }
                 }
             }
         }
         // -- absence
         // news
         if (intval($arFields["IBLOCK_ID"]) > 0) {
             $rsIBlock = CIBlock::GetByID($arFields["IBLOCK_ID"]);
             if ($arIBlock = $rsIBlock->Fetch()) {
                 if ($arIBlock["IBLOCK_TYPE_ID"] == "news" && CModule::IncludeModule("socialnetwork")) {
                     CSocNetAllowed::GetAllowedEntityTypes();
                     $dbLog = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "news", "SOURCE_ID" => $arFields["ID"]));
                     if ($arLog = $dbLog->Fetch()) {
                         if ($arFields["ACTIVE"] == "Y" && (strlen($arFields["PREVIEW_TEXT"]) > 0 || strlen($arFields["DETAIL_TEXT"]) > 0) && (!array_key_exists("WF", $arFields) || $arFields["WF"] == "N" || $arFields["WF_STATUS_ID"] == 1 && $arFields["WF_PARENT_ELEMENT_ID"] == $arFields["ID"])) {
                             $arSoFields = array("=LOG_DATE" => strlen($arFields["ACTIVE_FROM"]) > 0 ? MakeTimeStamp($arFields["ACTIVE_FROM"], CSite::GetDateFormat("FULL", $site_id)) > time() ? $GLOBALS["DB"]->CharToDateFunction($arFields["ACTIVE_FROM"], "FULL", $site_id) : $GLOBALS["DB"]->CurrentTimeFunction() : $GLOBALS["DB"]->CurrentTimeFunction(), "=LOG_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE" => $arFields["NAME"], "MESSAGE" => strlen($arFields["DETAIL_TEXT"]) > 0 ? $arFields["DETAIL_TEXT_TYPE"] == "text" ? htmlspecialcharsbx($arFields["DETAIL_TEXT"]) : $arFields["DETAIL_TEXT"] : ($arFields["PREVIEW_TEXT_TYPE"] == "text" ? htmlspecialcharsbx($arFields["PREVIEW_TEXT"]) : $arFields["PREVIEW_TEXT"]));
                             $logID = CSocNetLog::Update($arLog["ID"], $arSoFields);
                             if (intval($logID) > 0) {
                                 $rsRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $logID));
                                 $arRights = $rsRights->Fetch();
                                 if (!$arRights) {
                                     CSocNetLogRights::Add($logID, "G2");
                                 }
                                 CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT");
                             }
                         } else {
                             CSocNetLog::Delete($arLog["ID"]);
                         }
                     } else {
                         if ($arFields["ACTIVE"] == "Y" && (strlen($arFields["PREVIEW_TEXT"]) > 0 || strlen($arFields["DETAIL_TEXT"]) > 0) && (!array_key_exists("WF", $arFields) || $arFields["WF"] == "N" || $arFields["WF_STATUS_ID"] == 1 && $arFields["WF_PARENT_ELEMENT_ID"] == $arFields["ID"])) {
                             $dbIBlock = CIBlock::GetByID($arFields["IBLOCK_ID"]);
                             if ($arIBlock = $dbIBlock->Fetch()) {
                                 $rsSite = CIBlock::GetSite($arFields["IBLOCK_ID"]);
                                 if ($arSite = $rsSite->Fetch()) {
                                     $site_id = $arSite["SITE_ID"];
                                 }
                                 $val = COption::GetOptionString("intranet", "sonet_log_news_iblock", "", $site_id);
                                 if (strlen($val) > 0) {
                                     $arIBCode = unserialize($val);
                                     if (!is_array($arIBCode) || count($arIBCode) <= 0) {
                                         $arIBCode = array();
                                     }
                                 } else {
                                     $arIBCode = array();
                                 }
                                 if (in_array($arIBlock["CODE"], $arIBCode)) {
                                     $entity_url = str_replace("#SITE_DIR#", $arSite["DIR"], $arIBlock["LIST_PAGE_URL"]);
                                     if (strpos($entity_url, "/") === 0) {
                                         $entity_url = "/" . ltrim($entity_url, "/");
                                     }
                                     $url = str_replace(array("#SITE_DIR#", "#ID#", "#CODE#"), array($arSite["DIR"], $arFields["ID"], $arFields["CODE"]), $arIBlock["DETAIL_PAGE_URL"]);
                                     if (strpos($url, "/") === 0) {
                                         $url = "/" . ltrim($url, "/");
                                     }
                                     $val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
                                     if (strlen($val) > 0) {
                                         $arIBlockForum = unserialize($val);
                                     } else {
                                         $arIBlockForum = array();
                                     }
                                     $strMessage = strlen($arFields["DETAIL_TEXT"]) > 0 ? $arFields["DETAIL_TEXT_TYPE"] == "text" ? htmlspecialcharsbx($arFields["DETAIL_TEXT"]) : $arFields["DETAIL_TEXT"] : ($arFields["PREVIEW_TEXT_TYPE"] == "text" ? htmlspecialcharsbx($arFields["PREVIEW_TEXT"]) : $arFields["PREVIEW_TEXT"]);
                                     $dtFormatSite = defined("ADMIN_SECTION") && ADMIN_SECTION === true ? SITE_ID : $site_id;
                                     $dtValue = strlen($arFields["ACTIVE_FROM"]) > 0 ? MakeTimeStamp($arFields["ACTIVE_FROM"], CSite::GetDateFormat("FULL", $dtFormatSite)) > time() ? $GLOBALS["DB"]->CharToDateFunction($arFields["ACTIVE_FROM"], "FULL", $dtFormatSite) : $GLOBALS["DB"]->CurrentTimeFunction() : $GLOBALS["DB"]->CurrentTimeFunction();
                                     $arSoFields = array("SITE_ID" => $site_id, "ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_NEWS, "ENTITY_ID" => $arIBlock["ID"], "EVENT_ID" => "news", "USER_ID" => $GLOBALS["USER"]->GetID(), "=LOG_DATE" => $dtValue, "=LOG_UPDATE" => $dtValue, "TITLE_TEMPLATE" => GetMessage("INTR_SOCNET_LOG_NEWS_TITLE"), "TITLE" => $arFields["NAME"], "MESSAGE" => $strMessage, "TEXT_MESSAGE" => "", "URL" => $url, "MODULE_ID" => "intranet", "CALLBACK_FUNC" => false, "TMP_ID" => false, "PARAMS" => serialize(array("ENTITY_NAME" => $arIBlock["NAME"], "ENTITY_URL" => $entity_url)), "SOURCE_ID" => $arFields["ID"], "ENABLE_COMMENTS" => array_key_exists($arIBlock["ID"], $arIBlockForum) ? "Y" : "N");
                                     $logID = CSocNetLog::Add($arSoFields, false);
                                     if (intval($logID) > 0) {
                                         CSocNetLog::Update($logID, array("TMP_ID" => $logID));
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:include.php

示例3: DeleteRelation

	function DeleteRelation($senderUserID, $targetUserID)
	{
		global $APPLICATION;

		$senderUserID = IntVal($senderUserID);
		if ($senderUserID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_SENDER_USER_ID"), "ERROR_SENDER_USER_ID");
			return false;
		}

		$targetUserID = IntVal($targetUserID);
		if ($targetUserID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_TARGET_USER_ID"), "ERROR_TARGET_USER_ID");
			return false;
		}

		$arRelation = CSocNetUserRelations::GetByUserID($senderUserID, $targetUserID);
		if (!$arRelation)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_RELATION_NOT_FOUND"), "ERROR_RELATION_NOT_FOUND");
			return false;
		}

		if (CSocNetUserRelations::Delete($arRelation["ID"]))
		{
			$logID = CSocNetLog::Add(
				array(
					"ENTITY_TYPE" => SONET_ENTITY_USER,
					"ENTITY_ID" => $senderUserID,
					"EVENT_ID" => "system_friends",
					"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
					"TITLE_TEMPLATE" => false,
					"TITLE" => "unfriend",
					"MESSAGE" => $targetUserID,
					"URL" => false,
					"MODULE_ID" => false,
					"CALLBACK_FUNC" => false,
					"USER_ID" => $targetUserID,
				),
				false
			);
			if (intval($logID) > 0)
			{
				CSocNetLog::Update($logID, array("TMP_ID" => $logID));

				$perm = CSocNetUserPerms::GetOperationPerms($senderUserID, "viewfriends");
				if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS)))
					CSocNetLogRights::Add($logID, array("SA", "U".$senderUserID, "S".SONET_ENTITY_USER.$senderUserID."_".$perm));
				elseif ($perm == SONET_RELATIONS_TYPE_NONE)
					CSocNetLogRights::Add($logID, array("SA", "U".$senderUserID));
				elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED)
					CSocNetLogRights::Add($logID, array("SA", "AU"));
				elseif ($perm == SONET_RELATIONS_TYPE_ALL)
					CSocNetLogRights::Add($logID, array("SA", "G2"));

				$tmpID = $logID;
			}

			$logID2 = CSocNetLog::Add(
				array(
					"ENTITY_TYPE" => SONET_ENTITY_USER,
					"ENTITY_ID" => $targetUserID,
					"EVENT_ID" => "system_friends",
					"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
					"TITLE_TEMPLATE" => false,
					"TITLE" => "unfriend",
					"MESSAGE" => $senderUserID,
					"URL" => false,
					"MODULE_ID" => false,
					"CALLBACK_FUNC" => false,
					"USER_ID" => $senderUserID,
					"TMP_ID" => (intval($tmpID) > 0 ? $tmpID : false),
				),
				false
			);

			if (intval($logID2) > 0)
			{
				$perm = CSocNetUserPerms::GetOperationPerms($targetUserID, "viewfriends");
				if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS)))
					CSocNetLogRights::Add($logID2, array("SA", "U".$targetUserID, "S".SONET_ENTITY_USER.$targetUserID."_".$perm));
				elseif ($perm == SONET_RELATIONS_TYPE_NONE)
					CSocNetLogRights::Add($logID2, array("SA", "U".$targetUserID));
				elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED)
					CSocNetLogRights::Add($logID2, array("SA", "AU"));
				elseif ($perm == SONET_RELATIONS_TYPE_ALL)
					CSocNetLogRights::Add($logID2, array("SA", "G2"));
			}

			CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $tmpID);			

			if ($arRelation["RELATION"] == SONET_RELATIONS_FRIEND)
				$GLOBALS["DB"]->Query("DELETE FROM b_sonet_event_user_view WHERE
					ENTITY_TYPE = '".SONET_ENTITY_USER."'
					AND (
						(USER_ID = ".$arRelation["FIRST_USER_ID"]." AND ENTITY_ID = ".$arRelation["SECOND_USER_ID"].")
						OR (USER_ID = ".$arRelation["SECOND_USER_ID"]." AND ENTITY_ID = ".$arRelation["FIRST_USER_ID"].")
						OR (ENTITY_ID = ".$arRelation["FIRST_USER_ID"]." AND USER_IM_ID = ".$arRelation["SECOND_USER_ID"].")
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:101,代码来源:user_relations.php

示例4: CreateLogMessage

 public static function CreateLogMessage(&$fields, $options = array())
 {
     if (!CModule::IncludeModule('socialnetwork')) {
         return false;
     }
     global $APPLICATION, $DB;
     if (!is_array($options)) {
         $options = array();
     }
     $entityTypeID = isset($fields['ENTITY_TYPE_ID']) ? intval($fields['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
     if (!CCrmOwnerType::IsDefined($entityTypeID)) {
         $fields['ERROR'] = GetMessage('CRM_LF_MSG_ENTITY_TYPE_NOT_FOUND');
         return false;
     }
     $entityType = CCrmOwnerType::ResolveName($entityTypeID);
     $entityID = isset($fields['ENTITY_ID']) ? intval($fields['ENTITY_ID']) : 0;
     if ($entityID < 0) {
         $fields['ERROR'] = GetMessage('CRM_LF_MSG_ENTITY_TYPE_NOT_FOUND');
         return false;
     }
     $message = isset($fields['MESSAGE']) && is_string($fields['MESSAGE']) ? $fields['MESSAGE'] : '';
     if ($message === '') {
         $fields['ERROR'] = GetMessage('CRM_LF_MSG_EMPTY');
         return false;
     }
     $title = isset($fields['TITLE']) && is_string($fields['TITLE']) ? $fields['TITLE'] : '';
     if ($title === '') {
         $title = self::UntitledMessageStub;
     }
     $userID = isset($fields['USER_ID']) ? intval($fields['USER_ID']) : 0;
     if ($userID <= 0) {
         $userID = CCrmSecurityHelper::GetCurrentUserID();
     }
     $bbCodeParser = new CTextParser();
     $bbCodeParser->allow["HTML"] = "Y";
     $eventText = $bbCodeParser->convert4mail($message);
     $CCrmEvent = new CCrmEvent();
     $eventID = $CCrmEvent->Add(array('ENTITY_TYPE' => $entityType, 'ENTITY_ID' => $entityID, 'EVENT_ID' => 'INFO', 'EVENT_TYPE' => 0, 'EVENT_TEXT_1' => $eventText, 'DATE_CREATE' => ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'FULL', SITE_ID), 'FILES' => array()));
     if (is_string($eventID)) {
         //MS SQL RETURNS STRING INSTEAD INT
         $eventID = intval($eventID);
     }
     if (!(is_int($eventID) && $eventID > 0)) {
         $fields['ERROR'] = 'Could not create event';
         return false;
     }
     $liveFeedEntityType = CCrmLiveFeedEntity::GetByEntityTypeID($entityTypeID);
     $eventID = CCrmLiveFeedEvent::GetEventID($liveFeedEntityType, CCrmLiveFeedEvent::Message);
     $eventFields = array('EVENT_ID' => $eventID, '=LOG_DATE' => $DB->CurrentTimeFunction(), 'TITLE' => $title, 'MESSAGE' => $message, 'TEXT_MESSAGE' => '', 'MODULE_ID' => 'crm_shared', 'CALLBACK_FUNC' => false, 'ENABLE_COMMENTS' => 'Y', 'PARAMS' => '', 'USER_ID' => $userID, 'ENTITY_TYPE' => $liveFeedEntityType, 'ENTITY_ID' => $entityID, 'SOURCE_ID' => $eventID, 'URL' => CCrmUrlUtil::AddUrlParams(CCrmOwnerType::GetShowUrl($entityTypeID, $entityID), array()));
     if (isset($fields['WEB_DAV_FILES']) && is_array($fields['WEB_DAV_FILES'])) {
         $eventFields = array_merge($eventFields, $fields['WEB_DAV_FILES']);
     }
     $sendMessage = isset($options['SEND_MESSAGE']) && is_bool($options['SEND_MESSAGE']) ? $options['SEND_MESSAGE'] : false;
     $logEventID = CSocNetLog::Add($eventFields, $sendMessage);
     if (is_int($logEventID) && $logEventID > 0) {
         $arSocnetRights = $fields["RIGHTS"];
         if (!empty($arSocnetRights)) {
             $socnetPermsAdd = array();
             foreach ($arSocnetRights as $perm_tmp) {
                 if (preg_match('/^SG(\\d+)$/', $perm_tmp, $matches)) {
                     if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_USER, $arSocnetRights)) {
                         $socnetPermsAdd[] = "SG" . $matches[1] . "_" . SONET_ROLES_USER;
                     }
                     if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_MODERATOR, $arSocnetRights)) {
                         $socnetPermsAdd[] = "SG" . $matches[1] . "_" . SONET_ROLES_MODERATOR;
                     }
                     if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_OWNER, $arSocnetRights)) {
                         $socnetPermsAdd[] = "SG" . $matches[1] . "_" . SONET_ROLES_OWNER;
                     }
                 }
             }
             if (count($socnetPermsAdd) > 0) {
                 $arSocnetRights = array_merge($arSocnetRights, $socnetPermsAdd);
             }
             CSocNetLogRights::DeleteByLogID($logEventID);
             CSocNetLogRights::Add($logEventID, $arSocnetRights);
             if (array_key_exists("UF_SONET_LOG_DOC", $eventFields) && is_array($eventFields["UF_SONET_LOG_DOC"]) && count($eventFields["UF_SONET_LOG_DOC"]) > 0) {
                 if (!in_array("U" . $userID, $arSocnetRights)) {
                     $arSocnetRights[] = "U" . $userID;
                 }
                 CSocNetLogTools::SetUFRights($eventFields["UF_SONET_LOG_DOC"], $arSocnetRights);
             }
         }
         $arUpdateFields = array("RATING_TYPE_ID" => "LOG_ENTRY", "RATING_ENTITY_ID" => $logEventID);
         CSocNetLog::Update($logEventID, $arUpdateFields);
         self::RegisterOwnershipRelations($logEventID, $eventID, $fields);
         $eventFields["LOG_ID"] = $logEventID;
         CCrmLiveFeed::CounterIncrement($eventFields);
         return $logEventID;
     }
     $ex = $APPLICATION->GetException();
     $fields['ERROR'] = $ex->GetString();
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:94,代码来源:livefeed.php

示例5: SocnetLogUpdateRights

 public function SocnetLogUpdateRights($ID, $iblockID, $eventID)
 {
     if (!CModule::IncludeModule("socialnetwork")) {
         return null;
     }
     $arReaders = CWebDavIblock::GetReaders($ID, $iblockID);
     if ($arLog = self::GetSocnetLogByFileID($ID, $eventID)) {
         CSocNetLogRights::DeleteByLogID($arLog['ID']);
         if (CModule::IncludeModule("extranet")) {
             $arSiteID = CExtranet::GetSitesByLogDestinations($arReaders);
             CSocNetLog::Update($arLog['ID'], array("SITE_ID" => $arSiteID));
         }
         CSocNetLogRights::Add($arLog['ID'], $arReaders);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:15,代码来源:iblocksocnetevent.php

示例6: array

     // socnet admin
     if (in_array("AU", $socnetPerms) || in_array("G2", $socnetPerms)) {
         $socnetPermsAdd = array();
         foreach ($socnetPerms as $perm_tmp) {
             if (preg_match('/^SG(\\d+)$/', $perm_tmp, $matches)) {
                 if (!in_array("SG" . $matches[1] . "_" . SONET_ROLES_USER, $socnetPerms) && !in_array("SG" . $matches[1] . "_" . SONET_ROLES_MODERATOR, $socnetPerms) && !in_array("SG" . $matches[1] . "_" . SONET_ROLES_OWNER, $socnetPerms)) {
                     $socnetPermsAdd[] = "SG" . $matches[1] . "_" . SONET_ROLES_USER;
                 }
             }
         }
         if (count($socnetPermsAdd) > 0) {
             $socnetPerms = array_merge($socnetPerms, $socnetPermsAdd);
         }
     }
     CSocNetLogRights::DeleteByLogID($arRes["ID"]);
     CSocNetLogRights::Add($arRes["ID"], $socnetPerms, true);
     if (count(array_diff($arLogSitesNew, $arLogSites)) > 0) {
         CSocNetLog::Update($arRes["ID"], array("ENTITY_TYPE" => $arRes["ENTITY_TYPE"], "SITE_ID" => $arLogSitesNew, "=LOG_UPDATE" => $DB->CurrentTimeFunction()));
     } else {
         CSocNetLog::Update($arRes["ID"], array("=LOG_UPDATE" => $DB->CurrentTimeFunction()));
     }
     /* subscribe share author */
     CSocNetLogFollow::Set($user_id, "L" . $arRes["ID"], "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"));
 }
 /* update socnet groupd activity*/
 foreach ($arNewRights as $v) {
     if (substr($v, 0, 2) == "SG") {
         $group_id_tmp = substr($v, 2);
         if (IntVal($group_id_tmp) > 0) {
             CSocNetGroup::SetLastActivity(IntVal($group_id_tmp));
         }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例7: RegisterLiveFeedEvent

 private static function RegisterLiveFeedEvent(&$arFields)
 {
     $ID = isset($arFields['ID']) ? intval($arFields['ID']) : 0;
     if ($ID <= 0) {
         $arFields['ERROR'] = 'Could not find activity ID.';
         return false;
     }
     $ownerTypeID = isset($arFields['OWNER_TYPE_ID']) ? intval($arFields['OWNER_TYPE_ID']) : CCrmOwnerType::Undefined;
     if (!CCrmOwnerType::IsDefined($ownerTypeID)) {
         $arFields['ERROR'] = 'Could not find owner type ID.';
         return false;
     }
     $ownerID = isset($arFields['OWNER_ID']) ? intval($arFields['OWNER_ID']) : 0;
     if ($ownerID <= 0) {
         $arFields['ERROR'] = 'Could not find owner ID.';
         return false;
     }
     $arOwners = array(array("OWNER_TYPE_ID" => $ownerTypeID, "OWNER_ID" => $ownerID));
     $authorID = isset($arFields['AUTHOR_ID']) ? intval($arFields['AUTHOR_ID']) : 0;
     $editorID = isset($arFields['EDITOR_ID']) ? intval($arFields['EDITOR_ID']) : 0;
     $userID = $authorID > 0 ? $authorID : $editorID;
     if ($userID <= 0) {
         $userID = CCrmSecurityHelper::GetCurrentUserID();
     }
     // Params are not assigned - we will use current activity only.
     $liveFeedFields = array('ENTITY_TYPE_ID' => CCrmOwnerType::Activity, 'ENTITY_ID' => $ID, 'USER_ID' => $userID, 'MESSAGE' => '', 'TITLE' => '');
     $bindings = isset($arFields['BINDINGS']) && is_array($arFields['BINDINGS']) ? $arFields['BINDINGS'] : array();
     if (!empty($bindings)) {
         $liveFeedFields['PARENTS'] = $bindings;
         $liveFeedFields['PARENT_OPTIONS'] = array('ENTITY_TYPE_ID_KEY' => 'OWNER_TYPE_ID', 'ENTITY_ID_KEY' => 'OWNER_ID');
         $ownerInfoOptions = array('ENTITY_TYPE_ID_KEY' => 'OWNER_TYPE_ID', 'ENTITY_ID_KEY' => 'OWNER_ID', 'ADDITIONAL_DATA' => array('LEVEL' => 2));
         $additionalParents = array();
         foreach ($bindings as &$binding) {
             $ownerTypeID = isset($binding['OWNER_TYPE_ID']) ? intval($binding['OWNER_TYPE_ID']) : CCrmOwnerType::Undefined;
             $ownerID = isset($binding['OWNER_ID']) ? intval($binding['OWNER_ID']) : 0;
             if ($ownerTypeID != CCrmOwnerType::Undefined && $ownerID > 0) {
                 $arOwners[] = array("OWNER_TYPE_ID" => $ownerTypeID, "OWNER_ID" => $ownerID);
             }
             if ($ownerTypeID === CCrmOwnerType::Contact && $ownerID > 0) {
                 $owners = array();
                 if (CCrmOwnerType::TryGetOwnerInfos(CCrmOwnerType::Contact, $ownerID, $owners, $ownerInfoOptions)) {
                     $additionalParents = array_merge($additionalParents, $owners);
                 }
             }
         }
         unset($binding);
         if (!empty($additionalParents)) {
             $liveFeedFields['PARENTS'] = array_merge($bindings, $additionalParents);
         }
         $arOwners = array_unique($arOwners);
     }
     self::PrepareStorageElementIDs($arFields);
     $arStorageElementID = $arFields["STORAGE_ELEMENT_IDS"];
     if (!empty($arStorageElementID)) {
         if ($arFields["STORAGE_TYPE_ID"] == StorageType::WebDav) {
             $liveFeedFields["UF_SONET_LOG_DOC"] = $arStorageElementID;
         } else {
             if ($arFields["STORAGE_TYPE_ID"] == StorageType::Disk) {
                 $liveFeedFields["UF_SONET_LOG_DOC"] = array();
                 //We have to add prefix Bitrix\Disk\Uf\FileUserType::NEW_FILE_PREFIX to file ID
                 foreach ($arStorageElementID as $elementID) {
                     $liveFeedFields["UF_SONET_LOG_DOC"][] = "n{$elementID}";
                 }
             } else {
                 $liveFeedFields["UF_SONET_LOG_FILE"] = $arStorageElementID;
             }
         }
     }
     if ($arFields['TYPE_ID'] == CCrmActivityType::Task && isset($arFields["ASSOCIATED_ENTITY_ID"]) && intval($arFields["ASSOCIATED_ENTITY_ID"]) > 0 && CModule::IncludeModule("tasks")) {
         $dbTask = CTasks::GetByID($arFields["ASSOCIATED_ENTITY_ID"], false);
         if ($arTask = $dbTask->Fetch()) {
             $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("TASKS_TASK", "UF_TASK_WEBDAV_FILES", $arTask["ID"], LANGUAGE_ID);
             if ($ufDocID) {
                 $liveFeedFields["UF_SONET_LOG_DOC"] = $ufDocID;
             }
         }
     }
     $bConvert = false;
     if ($arTask) {
         $rsLog = CSocNetLog::GetList(array(), array("EVENT_ID" => "tasks", "SOURCE_ID" => $arTask["ID"]), array("ID"));
         if ($arLog = $rsLog->Fetch()) {
             $eventID = CCrmLiveFeed::ConvertTasksLogEvent(array("LOG_ID" => $arLog["ID"], "ACTIVITY_ID" => $ID));
             $bConvert = true;
         }
     }
     if (!$bConvert) {
         $eventID = CCrmLiveFeed::CreateLogEvent($liveFeedFields, CCrmLiveFeedEvent::Add);
     }
     if (!(is_int($eventID) && $eventID > 0) && isset($liveFeedFields['ERROR'])) {
         $arFields['ERROR'] = $liveFeedFields['ERROR'];
     } else {
         if ($arTask) {
             $arTaskParticipant = CTaskNotifications::GetRecipientsIDs($arTask, false);
             $arSocnetRights = CTaskNotifications::__UserIDs2Rights($arTaskParticipant);
             if (isset($arTask['GROUP_ID']) && intval($arTask['GROUP_ID']) > 0) {
                 $perm = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $arTask['GROUP_ID'], "tasks", "view");
                 $arSocnetRights = array_merge($arSocnetRights, array('SG' . $arTask['GROUP_ID'], 'SG' . $arTask['GROUP_ID'] . '_' . $perm));
             }
             CSocNetLogRights::DeleteByLogID($eventID);
             CSocNetLogRights::Add($eventID, $arSocnetRights);
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:crm_activity.php

示例8: elseif

                } elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
                    CSocNetLogRights::Add($arLog["ID"], array("SA", "AU"));
                } elseif ($perm == SONET_RELATIONS_TYPE_ALL) {
                    CSocNetLogRights::Add($arLog["ID"], array("SA", "G2"));
                }
            } elseif ($featureID = CSocNetLogTools::FindFeatureByEventID($arLog["EVENT_ID"])) {
                CSocNetLogRights::SetForSonet($arLog["ID"], $arLog["ENTITY_TYPE"], $arLog["ENTITY_ID"], $featureID, $GLOBALS["arSocNetFeaturesSettings"][$featureID]["subscribe_events"][$arLog["EVENT_ID"]]["OPERATION"]);
            } elseif ($arLog["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP) {
                CSocNetLogRights::Add($arLog["ID"], array("SA", "SG" . $arLog["ENTITY_ID"] . "_" . SONET_ROLES_OWNER, "SG" . $arLog["ENTITY_ID"] . "_" . SONET_ROLES_MODERATOR, "SG" . $arLog["ENTITY_ID"] . "_" . SONET_ROLES_USER));
            } elseif ($arLog["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_USER) {
                $perm = CSocNetUserPerms::GetOperationPerms($arLog["ENTITY_ID"], "viewprofile");
                if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS))) {
                    CSocNetLogRights::Add($arLog["ID"], array("SA", "U" . $arLog["ENTITY_ID"], "SU" . $arLog["ENTITY_ID"] . "_" . $perm));
                } elseif ($perm == SONET_RELATIONS_TYPE_NONE) {
                    CSocNetLogRights::Add($arLog["ID"], array("SA", "U" . $arLog["ENTITY_ID"]));
                } elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
                    CSocNetLogRights::Add($arLog["ID"], array("SA", "AU"));
                } elseif ($perm == SONET_RELATIONS_TYPE_ALL) {
                    CSocNetLogRights::Add($arLog["ID"], array("SA", "G2"));
                }
                // tasks!!!
            }
        } elseif (in_array($arLog["ENTITY_TYPE"], array('R'))) {
            // reports
        } elseif (in_array($arLog["ENTITY_TYPE"], array('T'))) {
            // timeman
        } else {
            CSocNetLogRights::Add($arLog["ID"], array("AU"));
        }
    }
}
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:updtr1107.php

示例9: DeleteRelation

	function DeleteRelation($userID, $groupID)
	{
		global $APPLICATION;

		$userID = IntVal($userID);
		if ($userID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_USER_ID");
			return false;
		}

		$groupID = IntVal($groupID);
		if ($groupID <= 0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_GROUPID"), "ERROR_GROUPID");
			return false;
		}

		$dbResult = CSocNetUserToGroup::GetList(
			array(),
			array(
				"GROUP_ID" => $groupID,
				"USER_ID" => $userID,
			),
			false,
			false,
			array("ID", "ROLE", "GROUP_VISIBLE")
		);

		if ($arResult = $dbResult->Fetch())
		{
			if ($arResult["ROLE"] != SONET_ROLES_USER && $arResult["ROLE"] != SONET_ROLES_MODERATOR)
				return false;

			if (CSocNetUserToGroup::Delete($arResult["ID"]))
			{
				$arGroupSiteID = array();
				$rsGroupSite = CSocNetGroup::GetSite($groupID);
				while($arGroupSite = $rsGroupSite->Fetch())
				{
					$arGroupSiteID[] = $arGroupSite["LID"];

					//get server name
					$rsSites = CSite::GetByID($arGroupSite["LID"]);
					$arSite = $rsSites->Fetch();
					$serverName = $arSite["SERVER_NAME"];
					if (strlen($serverName) <= 0)
					{
						if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0)
							$serverName = SITE_SERVER_NAME;
						else
							$serverName = COption::GetOptionString("main", "server_name", $GLOBALS["SERVER_NAME"]);
					}

					if (strlen($serverName) > 0)
					{
						$protocol = (CMain::IsHTTPS() ? "https" : "http");
						$serverName = $protocol."://".$serverName;
					}
				}

				$fullWorkgroupsUrl = $serverName.COption::GetOptionString("socialnetwork", "workgroups_page", false, $arGroupSiteID["0"]);

				$logID = CSocNetLog::Add(
					array(
						"ENTITY_TYPE" => SONET_ENTITY_GROUP,
						"ENTITY_ID" => $groupID,
						"EVENT_ID" => "system",
						"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
						"TITLE_TEMPLATE" => false,
						"TITLE" => "unjoin",
						"MESSAGE" => $userID,
						"URL" => $fullWorkgroupsUrl,
						"MODULE_ID" => false,
						"CALLBACK_FUNC" => false,
						"USER_ID" => $userID,
						"SITE_ID" => $arGroupSiteID
					),
					false
				);
				if (intval($logID) > 0)
				{
					$tmpID = $logID;
					CSocNetLog::Update($logID, array("TMP_ID" => $tmpID));
					CSocNetLogRights::Add($logID, array("SA", "U".$userID, "S".SONET_ENTITY_GROUP.$groupID, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_OWNER, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_MODERATOR, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_USER));
					CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $tmpID);
				}
			}
			else
			{
				$errorMessage = "";
				if ($e = $APPLICATION->GetException())
					$errorMessage = $e->GetString();
				if (StrLen($errorMessage) <= 0)
					$errorMessage = GetMessage("SONET_UR_ERROR_CREATE_USER2GROUP");

				$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_DELETE_RELATION");
				return false;
			}
		}
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:101,代码来源:user_group.php

示例10: ShowMessage

 public function ShowMessage()
 {
     if (!$this->IsAvailable()) {
         return false;
     }
     $arNotification = $this->Notify->getNotification();
     $oLog = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => 'idea', "SOURCE_ID" => $arNotification["ID"]), false, false, array("ID"));
     while ($arLog = $oLog->Fetch()) {
         CSocNetLogRights::DeleteByLogID($arLog["ID"]);
         CSocNetLogRights::Add($arLog["ID"], array("G2"));
     }
     return false;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:13,代码来源:idea_sonet_notify.php

示例11: SetSonetLogRights

 function SetSonetLogRights($logID, $entity_type, $entity_id, $event_id)
 {
     if (!CModule::IncludeModule("socialnetwork")) {
         return;
     }
     if (in_array($entity_type, array(SONET_SUBSCRIBE_ENTITY_USER, SONET_SUBSCRIBE_ENTITY_GROUP))) {
         if (in_array($event_id, array("blog_post", "forum", "photo", "blog_post_micro", "files", "wiki"))) {
             $arLogEventTmp = CSocNetLogTools::FindLogEventByID($event_id);
             CSocNetLogRights::SetForSonet($logID, $entity_type, $entity_id, CSocNetLogTools::FindFeatureByEventID($event_id), $arLogEventTmp["OPERATION"]);
         } elseif (in_array($event_id, array("data", "system")) && $entity_type == SONET_SUBSCRIBE_ENTITY_GROUP) {
             CSocNetLogRights::Add($logID, array("SA", "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
         } elseif (in_array($event_id, array("data", "system")) && $entity_type == SONET_SUBSCRIBE_ENTITY_USER) {
             $perm = CSocNetUserPerms::GetOperationPerms($entity_id, "viewprofile");
             if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS))) {
                 CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id, "S" . SONET_SUBSCRIBE_ENTITY_USER . $entity_id . "_" . $perm));
             } elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
                 CSocNetLogRights::Add($logID, array("SA", "AU"));
             } elseif ($perm == SONET_RELATIONS_TYPE_ALL) {
                 CSocNetLogRights::Add($logID, array("SA", "G2"));
             }
         }
     } elseif ($entity_type == SONET_SUBSCRIBE_ENTITY_PROVIDER) {
         $arRights = array("SA");
         $rsSchemeRights = CXDILFSchemeRights::GetList(array(), array("SCHEME_ID" => $entity_id));
         while ($arSchemeRights = $rsSchemeRights->Fetch()) {
             if (substr($arSchemeRights["GROUP_CODE"], 0, 1) == "U") {
                 if (substr($arSchemeRights["GROUP_CODE"], 1) == "A") {
                     $arRights[] = "AU";
                     break;
                 } elseif (substr($arSchemeRights["GROUP_CODE"], 1) == "N") {
                     $arRights[] = "G2";
                     break;
                 } elseif (intval(substr($arSchemeRights["GROUP_CODE"], 1)) > 0) {
                     $arRights[] = "U" . substr($arSchemeRights["GROUP_CODE"], 1);
                 }
             }
         }
         if (count($arRights) > 0) {
             CSocNetLogRights::Add($logID, $arRights);
         }
     } elseif (defined("SONET_SUBSCRIBE_ENTITY_NEWS") && $entity_type == SONET_SUBSCRIBE_ENTITY_NEWS) {
         CSocNetLogRights::Add($logID, array("SA", "G2"));
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:44,代码来源:lf_scheme.php

示例12: SendMessageToSocNet

 protected static function SendMessageToSocNet($arFields, $bSpawnedByAgent, $arChanges = null, $arTask = null, array $parameters = array())
 {
     global $USER, $DB;
     $effectiveUserId = self::getEffectiveUserId($arFields, array(), $bSpawnedByAgent, $parameters);
     if (!CModule::IncludeModule('socialnetwork')) {
         return null;
     }
     $bCrmTask = isset($arTask) && isset($arTask["UF_CRM_TASK"]) && (is_array($arTask["UF_CRM_TASK"]) && (isset($arTask["UF_CRM_TASK"][0]) && strlen($arTask["UF_CRM_TASK"][0]) > 0) || !is_array($arTask["UF_CRM_TASK"]) && strlen($arTask["UF_CRM_TASK"]) > 0);
     $arLogFilter = false;
     if (!$bCrmTask) {
         $arLogFilter = array("EVENT_ID" => "tasks", "SOURCE_ID" => $arTask["ID"]);
     } elseif (CModule::IncludeModule("crm")) {
         $dbCrmActivity = CCrmActivity::GetList(array(), array('TYPE_ID' => CCrmActivityType::Task, 'ASSOCIATED_ENTITY_ID' => $arTask["ID"], 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID'));
         if ($arCrmActivity = $dbCrmActivity->Fetch()) {
             $arLogFilter = array("EVENT_ID" => "crm_activity_add", "ENTITY_ID" => $arCrmActivity["ID"]);
         }
     }
     if (!$arLogFilter) {
         return null;
     }
     static $arCheckedUsers = array();
     // users that checked for their existing
     static $cachedSiteTimeFormat = -1;
     // select "real" author
     $occurAsUserId = CTasksTools::getOccurAsUserId();
     if (!$occurAsUserId) {
         $occurAsUserId = $effectiveUserId;
     }
     if ($cachedSiteTimeFormat === -1) {
         $cachedSiteTimeFormat = CSite::GetDateFormat('FULL', SITE_ID);
     }
     static $cachedAllSitesIds = -1;
     if ($cachedAllSitesIds === -1) {
         $cachedAllSitesIds = array();
         $dbSite = CSite::GetList($by = 'sort', $order = 'desc', array('ACTIVE' => 'Y'));
         while ($arSite = $dbSite->Fetch()) {
             $cachedAllSitesIds[] = $arSite['ID'];
         }
     }
     // Check that user exists
     if (!in_array((int) $arFields["CREATED_BY"], $arCheckedUsers, true)) {
         $rsUser = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => $arFields["CREATED_BY"]), array('FIELDS' => array('ID')));
         if (!($arUser = $rsUser->Fetch())) {
             return false;
         }
         $arCheckedUsers[] = (int) $arFields["CREATED_BY"];
     }
     if (is_array($arChanges)) {
         if (count($arChanges) == 0) {
             $rsSocNetLogItems = CSocNetLog::GetList(array("ID" => "DESC"), $arLogFilter, false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID"));
             while ($arRes = $rsSocNetLogItems->Fetch()) {
                 $authorUserId = false;
                 if (isset($arFields['CREATED_BY'])) {
                     $authorUserId = (int) $arFields['CREATED_BY'];
                 } elseif (isset($arTask['CREATED_BY'])) {
                     $authorUserId = (int) $arTask['CREATED_BY'];
                 }
                 // Add author to list of users that view log about task in livefeed
                 // But only when some other person change task
                 // or if added FORUM_TOPIC_ID
                 if ($authorUserId !== $effectiveUserId || $arTask['FORUM_TOPIC_ID'] == 0 && isset($arFields['FORUM_TOPIC_ID']) && $arFields['FORUM_TOPIC_ID'] > 0) {
                     $authorGroupCode = 'U' . $authorUserId;
                     $rsRights = CSocNetLogRights::GetList(array(), array('LOG_ID' => $arRes['ID'], 'GROUP_CODE' => $authorGroupCode));
                     // If task's author hasn't rights yet, give them
                     if (!($arRights = $rsRights->fetch())) {
                         CSocNetLogRights::Add($arRes["ID"], array($authorGroupCode));
                     }
                 }
             }
             return null;
         } elseif (count($arChanges) == 1 && isset($arChanges['STATUS'])) {
             return null;
             // if only status changes - don't send message, because it will be sent by SendStatusMessage()
         }
     }
     if ($bSpawnedByAgent === 'Y') {
         $bSpawnedByAgent = true;
     } elseif ($bSpawnedByAgent === 'N') {
         $bSpawnedByAgent = false;
     }
     if (!is_bool($bSpawnedByAgent)) {
         return false;
     }
     $taskId = false;
     if (is_array($arFields) && isset($arFields['ID']) && $arFields['ID'] > 0) {
         $taskId = $arFields['ID'];
     } elseif (is_array($arTask) && isset($arTask['ID']) && $arTask['ID'] > 0) {
         $taskId = $arTask['ID'];
     }
     // We will mark this to false, if we send update message and log item already exists
     $bSocNetAddNewItem = true;
     $logDate = $DB->CurrentTimeFunction();
     $curTimeTimestamp = time() + CTimeZone::GetOffset();
     if (!$bCrmTask) {
         $arSoFields = array('EVENT_ID' => 'tasks', 'TITLE' => $arFields['TITLE'], 'MESSAGE' => '', 'MODULE_ID' => 'tasks');
     } else {
         $arSoFields = array();
     }
     // If changes and task data given => we are prepare "update" message,
     // or "add" message otherwise
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:tasknotifications.php

示例13: array

         if (intval($arParams["user_id"]) > 0) {
             $arSoFields["USER_ID"] = $arParams["user_id"];
         }
         $logID = CSocNetLog::Add($arSoFields, false);
         if (intval($logID) > 0) {
             $socnetPerms = CBlogPost::GetSocNetPermsCode($arPost["ID"]);
             if (!in_array("U" . $arPost["AUTHOR_ID"], $socnetPerms)) {
                 $socnetPerms[] = "U" . $arPost["AUTHOR_ID"];
             }
             CSocNetLog::Update($logID, array("TMP_ID" => $logID));
             if (CModule::IncludeModule("extranet")) {
                 $arSiteID = CExtranet::GetSitesByLogDestinations($socnetPerms);
                 CSocNetLog::Update($logID, array("SITE_ID" => $arSiteID));
             }
             CSocNetLogRights::DeleteByLogID($logID);
             CSocNetLogRights::Add($logID, $socnetPerms);
             CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
         }
     }
 }
 // IMAGES UPDATE
 if (!empty($arImagesToUpdate)) {
     foreach ($arImagesToUpdate as $imgID) {
         CBlogImage::Update($imgID, array("POST_ID" => $postID));
     }
 }
 // category update
 foreach ($iCategory as $iCategoryValue) {
     CBlogPostCategory::Add(array("BLOG_ID" => $blogID, "POST_ID" => $postID, "CATEGORY_ID" => $iCategoryValue));
 }
 // COMMENTS
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:index.php

示例14: __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

示例15: OnEditCalendarEventEntry

 public static function OnEditCalendarEventEntry($eventId, $arFields = array(), $attendeesCodes = array())
 {
     global $DB;
     if ($eventId > 0) {
         $arSoFields = array("ENTITY_ID" => $arFields["OWNER_ID"], "USER_ID" => $arFields["OWNER_ID"], "=LOG_DATE" => $DB->CurrentTimeFunction(), "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => $arFields["NAME"], "MESSAGE" => "", "TEXT_MESSAGE" => "");
         $arAccessCodes = array();
         foreach ($attendeesCodes as $value) {
             if ($value == "UA") {
                 $arAccessCodes[] = "G2";
             } else {
                 $arAccessCodes[] = $value;
             }
         }
         $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "calendar", "SOURCE_ID" => $eventId), false, false, array("ID"));
         $arCodes = array();
         foreach ($arAccessCodes as $value) {
             if (substr($value, 0, 2) === 'SG') {
                 $arCodes[] = $value . '_K';
             }
             $arCodes[] = $value;
         }
         $arCodes = array_unique($arCodes);
         if ($arRes = $dbRes->Fetch()) {
             CSocNetLog::Update($arRes["ID"], $arSoFields);
             CSocNetLogRights::DeleteByLogID($arRes["ID"]);
             CSocNetLogRights::Add($arRes["ID"], $arCodes);
         } else {
             $arSoFields = array_merge($arSoFields, array("ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_USER, "EVENT_ID" => "calendar", "SITE_ID" => SITE_ID, "SOURCE_ID" => $eventId, "ENABLE_COMMENTS" => "Y", "CALLBACK_FUNC" => false));
             $logID = CSocNetLog::Add($arSoFields, false);
             CSocNetLogRights::Add($logID, $arCodes);
         }
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:33,代码来源:calendar_livefeed.php


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