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


PHP CSocNetLogRights::DeleteByLogID方法代码示例

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


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

示例1: array

     $socnetPerms[] = "SA";
     // 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

示例2: 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

示例3: OnAfterUserUpdate

 public static function OnAfterUserUpdate($arFields)
 {
     if (array_key_exists("UF_DEPARTMENT", $arFields)) {
         $arDept = $arFields["UF_DEPARTMENT"];
         if (!is_array($arDept)) {
             $arDept = array($arDept);
         }
         foreach ($arDept as $key => $val) {
             if (intval($val) <= 0) {
                 unset($arDept[$key]);
             }
         }
         if (!empty($arDept) && CModule::IncludeModule("socialnetwork")) {
             $arNewRights = CReportNotifications::GetRights($arFields["ID"]);
             $rsLog = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => SONET_WORK_REPORT_ENTITY, 'ENTITY_ID' => $arFields["ID"], 'EVENT_ID' => "report"), false, false, array("ID"));
             while ($arLog = $rsLog->Fetch()) {
                 $arOldRights = array();
                 $rsLogRight = CSocNetLogRights::GetList(array(), array("LOG_ID" => $arLog["ID"]));
                 while ($arLogRight = $rsLogRight->Fetch()) {
                     $arOldRights[] = $arLogRight["GROUP_CODE"];
                 }
                 $diff1 = array_diff($arNewRights, $arOldRights);
                 $diff2 = array_diff($arOldRights, $arNewRights);
                 if (!empty($diff1) || !empty($diff2)) {
                     CSocNetLogRights::DeleteByLogID($arLog["ID"]);
                     CSocNetLogRights::Add($arLog["ID"], $arNewRights);
                 }
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:timeman_report_full.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: OnSearchReindex


//.........这里部分代码省略.........
                         }
                         $sqlR = "SELECT * FROM b_blog_socnet_rights where POST_ID=" . IntVal($ar["ID"]);
                         $dbBB = $DB->Query($sqlR);
                         if (!$dbBB->Fetch()) {
                             $arF["SC_PERM"] = CBlogPost::UpdateSocNetPerms($ar["ID"], $arF["SOCNET_RIGHTS"], array("AUTHOR_ID" => $ar["AUTHOR_ID"]));
                         }
                         if (IntVal($arF["BLOG_ID"]) > 0 && $ar["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
                             $dbComment = CBlogComment::GetList(array(), array("POST_ID" => $ar["ID"]), false, false, array("ID", "POST_ID", "BLOG_ID", "PATH"));
                             if ($arComment = $dbComment->Fetch()) {
                                 $arParamsComment = array("BLOG_ID" => $arF["BLOG_ID"], "POST_ID" => $ar["ID"], "SITE_ID" => $ar["SITE_ID"], "PATH" => $arPostSite[$arGroup["SITE_ID"]] . "?commentId=#comment_id###comment_id#", "USE_SOCNET" => "Y");
                                 CBlogComment::_IndexPostComments($arParamsComment);
                             }
                         }
                     }
                 }
                 if ($ar["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH) {
                     if (empty($arF["SC_PERM"])) {
                         $arF["SC_PERM"] = CBlogPost::GetSocNetPermsCode($ar["ID"]);
                     }
                     $Result["PERMISSIONS"] = $arF["SC_PERM"];
                     if (IntVal($ar["SLID"]) <= 0) {
                         $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "TABLE" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
                         $text4message = $parserBlog->convert($ar["DETAIL_TEXT"], false, array(), $arAllow, array("isSonetLog" => true));
                         $arSoFields = array("EVENT_ID" => "blog_post", "=LOG_DATE" => $DB->CharToDateFunction($ar["DATE_PUBLISH"], "FULL", SITE_ID), "LOG_UPDATE" => $DB->CharToDateFunction($ar["DATE_PUBLISH"], "FULL", SITE_ID), "TITLE_TEMPLATE" => "#USER_NAME# add post", "TITLE" => $ar["TITLE"], "MESSAGE" => $text4message, "MODULE_ID" => "blog", "CALLBACK_FUNC" => false, "SOURCE_ID" => $ar["ID"], "ENABLE_COMMENTS" => "N", "ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $ar["AUTHOR_ID"], "USER_ID" => $ar["AUTHOR_ID"], "URL" => $arSite[$ar["SITE_ID"]], "SITE_ID" => $arSites);
                         $logID = CSocNetLog::Add($arSoFields, false);
                         if (intval($logID) > 0) {
                             $socnetPerms = $arF["SC_PERM"];
                             if (!in_array("U" . $ar["AUTHOR_ID"], $socnetPerms)) {
                                 $socnetPerms[] = "U" . $ar["AUTHOR_ID"];
                             }
                             $socnetPerms[] = "SA";
                             // socnet admin
                             CSocNetLog::Update($logID, array("TMP_ID" => $logID, "=LOG_UPDATE" => $arSoFields["LOG_UPDATE"]));
                             CSocNetLogRights::DeleteByLogID($logID);
                             CSocNetLogRights::Add($logID, $socnetPerms);
                         }
                     } else {
                         $socnetPerms = $arF["SC_PERM"];
                         if (!in_array("U" . $ar["AUTHOR_ID"], $socnetPerms)) {
                             $socnetPerms[] = "U" . $ar["AUTHOR_ID"];
                         }
                         $socnetPerms[] = "SA";
                         // socnet admin
                         CSocNetLogRights::DeleteByLogID($ar["SLID"]);
                         CSocNetLogRights::Add($ar["SLID"], $socnetPerms);
                     }
                 }
             }
             if ($ar["PUBLISH_STATUS"] == BLOG_PUBLISH_STATUS_PUBLISH && $ar["SEARCH_INDEX"] == "Y") {
                 //CBlogSearch::Trace('OnSearchReindex', 'Result', $Result);
                 if ($oCallback) {
                     $res = call_user_func(array($oCallback, $callback_method), $Result);
                     if (!$res) {
                         return $Result["ID"];
                     }
                 } else {
                     $arResult[] = $Result;
                 }
             }
         }
         //all blog posts indexed so let's start index users
         $category = 'C';
         $id = 0;
         COption::SetOptionString("blog", "socNetNewPerms", "Y");
     }
     if ($category == 'C') {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:67,代码来源:blog_search.php

示例6: SetPerm

 function SetPerm($featureID, $operation, $perm)
 {
     $arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
     $featureID = IntVal($featureID);
     $operation = Trim($operation);
     $perm = Trim($perm);
     $dbResult = CSocNetFeaturesPerms::GetList(array(), array("FEATURE_ID" => $featureID, "OPERATION_ID" => $operation), false, false, array("ID", "FEATURE_ENTITY_TYPE", "FEATURE_ENTITY_ID", "FEATURE_FEATURE", "OPERATION_ID", "ROLE"));
     if ($arResult = $dbResult->Fetch()) {
         $r = CSocNetFeaturesPerms::Update($arResult["ID"], array("ROLE" => $perm));
     } else {
         $r = CSocNetFeaturesPerms::Add(array("FEATURE_ID" => $featureID, "OPERATION_ID" => $operation, "ROLE" => $perm));
     }
     if (!$r) {
         $errorMessage = "";
         if ($e = $GLOBALS["APPLICATION"]->GetException()) {
             $errorMessage = $e->GetString();
         }
         if (StrLen($errorMessage) <= 0) {
             $errorMessage = GetMessage("SONET_GF_ERROR_SET") . ".";
         }
         $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_SET_RECORD");
         return false;
     } else {
         if (!$arResult) {
             $arFeature = CSocNetFeatures::GetByID($featureID);
             $entity_type = $arFeature["ENTITY_TYPE"];
             $entity_id = $arFeature["ENTITY_ID"];
             $feature = $arFeature["FEATURE"];
         } else {
             $entity_type = $arResult["FEATURE_ENTITY_TYPE"];
             $entity_id = $arResult["FEATURE_ENTITY_ID"];
             $feature = $arResult["FEATURE_FEATURE"];
         }
         if (empty($arResult) || $arResult["ROLE"] != $perm) {
             if ($arResult && $arResult["ROLE"] != $perm) {
                 CSocNetSearch::SetFeaturePermissions($entity_type, $entity_id, $feature, $arResult["OPERATION_ID"], $perm);
             } else {
                 CSocNetSearch::SetFeaturePermissions($entity_type, $entity_id, $feature, $operation, $perm);
             }
         }
         if (!in_array($feature, array("tasks", "files", "blog")) && is_array($arSocNetFeaturesSettings[$feature]["subscribe_events"])) {
             $arEventsTmp = array_keys($arSocNetFeaturesSettings[$feature]["subscribe_events"]);
             $rsLog = CSocNetLog::GetList(array(), array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => $arEventsTmp), false, false, array("ID", "EVENT_ID"));
             while ($arLog = $rsLog->Fetch()) {
                 CSocNetLogRights::DeleteByLogID($arLog["ID"]);
                 CSocNetLogRights::SetForSonet($arLog["ID"], $entity_type, $entity_id, $feature, $arSocNetFeaturesSettings[$feature]["subscribe_events"][$arLog["EVENT_ID"]]["OPERATION"]);
             }
         }
     }
     return $r;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:group_features_perms.php

示例7: OnAfterPhotoCommentAddBlog

 public function OnAfterPhotoCommentAddBlog($ID, $arFields)
 {
     if (!CModule::IncludeModule('iblock')) {
         return;
     }
     if (!$this->IsSocnet) {
         return;
     }
     if (intval($this->PhotoElementID) > 0) {
         $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "photo_photo", "SOURCE_ID" => $this->PhotoElementID), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "TMP_ID", "TITLE", "URL", "USER_ID", "PARAMS"));
         $bSocNetLogRecordExists = false;
         if ($arRes = $dbRes->Fetch()) {
             $log_id = $arRes["ID"];
             $entity_type = $arRes["ENTITY_TYPE"];
             $entity_id = $arRes["ENTITY_ID"];
             $log_title = $arRes["TITLE"];
             $log_url = $arRes["URL"];
             $log_user_id = $arRes["USER_ID"];
             $bSocNetLogRecordExists = true;
             if (strlen($arRes["PARAMS"]) > 0) {
                 $arTmp = unserialize($arRes["PARAMS"]);
                 if ($arTmp) {
                     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"];
                     }
                 }
             }
         } else {
             $rsElement = CIBlockElement::GetByID($this->PhotoElementID);
             if ($arElement = $rsElement->Fetch()) {
                 $url = $this->arPath["DETAIL_URL"];
                 $sAuthorName = GetMessage("SONET_PHOTO_LOG_GUEST");
                 if (intval($arElement["CREATED_BY"]) > 0) {
                     $rsUser = CUser::GetByID($arElement["CREATED_BY"]);
                     if ($arUser = $rsUser->Fetch()) {
                         $sAuthorName = CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false);
                     }
                 }
                 if (in_array($this->entity_type, array(SONET_ENTITY_USER, SONET_ENTITY_GROUP)) && intval($this->entity_id) > 0) {
                     $entity_type = $this->entity_type;
                     $entity_id = $this->entity_id;
                     $alias = ($this->entity_type == SONET_ENTITY_GROUP ? "group" : "user") . "_" . $this->entity_id;
                 }
                 $arLogParams = array("BLOG_ID" => intval($this->BlogID));
                 $rsIBlock = CIBlock::GetByID($arElement["IBLOCK_ID"]);
                 if ($arIBlock = $rsIBlock->Fetch()) {
                     $arLogParams["IBLOCK_ID"] = $arIBlock["ID"];
                     $arLogParams["IBLOCK_TYPE"] = $arIBlock["IBLOCK_TYPE_ID"];
                 }
                 $rsSection = CIBlockSection::GetByID($arElement["IBLOCK_SECTION_ID"]);
                 if ($arSection = $rsSection->Fetch()) {
                     $arLogParams["SECTION_ID"] = $arSection["ID"];
                     $arLogParams["SECTION_NAME"] = $arSection["NAME"];
                     $arLogParams["SECTION_URL"] = str_replace("#SECTION_ID#", $arSection["ID"], $this->arPath["SECTION_URL"]);
                     $arSectionPath = array();
                     $bPassword = false;
                     $dbSectionPath = CIBlockSection::GetList(array("LEFT_MARGIN" => "ASC"), array("IBLOCK_ID" => intval($arLogParams["IBLOCK_ID"]), "<=LEFT_BORDER" => intval($arSection["LEFT_MARGIN"]), ">=RIGHT_BORDER" => intval($arSection["RIGHT_MARGIN"]), "<=DEPTH_LEVEL" => intval($arSection["DEPTH_LEVEL"])), false, array("ID", "IBLOCK_ID", "NAME", "CREATED_BY", "DEPTH_LEVEL", "LEFT_MARGIN", "RIGHT_MARGIN", "UF_PASSWORD"));
                     while ($arPath = $dbSectionPath->Fetch()) {
                         $arSectionPath[] = $arPath;
                         if (strlen(trim($arPath["UF_PASSWORD"])) > 0) {
                             $bPassword = true;
                             break;
                         }
                     }
                     if (!$alias) {
                         $entity_type = SONET_ENTITY_USER;
                         $entity_id = $arSectionPath[0]["CREATED_BY"];
                         $alias = $arSectionPath[0]["CODE"];
                     }
                 }
                 $arLogParams["ALIAS"] = $alias;
                 $arSonetFields = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo_photo", "LOG_DATE" => $arElement["TIMESTAMP_X"], "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $sAuthorName, GetMessage("SONET_PHOTOPHOTO_LOG_1")), "TITLE" => $arElement["NAME"], "MESSAGE" => "", "TEXT_MESSAGE" => "", "URL" => CComponentEngine::MakePathFromTemplate($url, array("ELEMENT_ID" => $arElement["ID"], "element_id" => $arElement["ID"], "SECTION_ID" => $arElement["IBLOCK_SECTION_ID"], "section_id" => $arElement["IBLOCK_SECTION_ID"])), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arElement["ID"], "PARAMS" => serialize($arLogParams), "RATING_TYPE_ID" => "IBLOCK_ELEMENT", "RATING_ENTITY_ID" => $arElement["ID"]);
                 if (intval($arElement["CREATED_BY"]) > 0) {
                     $arSonetFields["USER_ID"] = $arElement["CREATED_BY"];
                 }
                 $log_id = CSocNetLog::Add($arSonetFields, false);
                 if (intval($log_id) > 0) {
                     $log_title = $arSonetFields["TITLE"];
                     $log_url = $arSonetFields["URL"];
                     $log_section_name = $arLogParams["SECTION_NAME"];
                     $log_section_url = $arLogParams["SECTION_URL"];
                     $log_user_id = $arSonetFields["USER_ID"];
                     CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
                     if ($bPassword) {
                         CSocNetLogRights::DeleteByLogID($log_id);
                         CSocNetLogRights::Add($log_id, array("U" . $GLOBALS["USER"]->GetID(), "SA"));
                     } else {
                         CSocNetLogRights::SetForSonet($log_id, $entity_type, $entity_id, "photo", "view", true);
                     }
                 }
             }
         }
         if (intval($log_id) > 0) {
             $parserBlog = new blogTextParser(false, $this->arPath["PATH_TO_SMILE"]);
             $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
             if ($bSocNetLogRecordExists) {
                 $text4message = $parserBlog->convert($arFields["POST_TEXT"], true, array(), $arAllow);
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:log_tools_photo.php

示例8: 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

示例9: 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

示例10: SendMessageToSocNet


//.........这里部分代码省略.........
     }
     // rating entity id (ilike)
     $arSoFields["RATING_ENTITY_ID"] = $taskId;
     $arSoFields["RATING_TYPE_ID"] = "TASK";
     // Do we need add new item to socnet?
     // We adds new item, if it is not exists.
     $logID = false;
     if (IsModuleInstalled("webdav") || IsModuleInstalled("disk")) {
         $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("TASKS_TASK", "UF_TASK_WEBDAV_FILES", $taskId, LANGUAGE_ID);
         if ($ufDocID) {
             $arSoFields["UF_SONET_LOG_DOC"] = $ufDocID;
         }
     }
     if ($bSocNetAddNewItem) {
         $arSoFields['=LOG_DATE'] = $logDate;
         $arSoFields['CALLBACK_FUNC'] = false;
         $arSoFields['SOURCE_ID'] = $taskId;
         $arSoFields['ENABLE_COMMENTS'] = 'Y';
         $arSoFields['URL'] = CTaskNotifications::GetNotificationPath(array('ID' => (int) $arFields["CREATED_BY"]), $taskId, false);
         $arSoFields['USER_ID'] = $arFields['CREATED_BY'];
         $arSoFields['TITLE_TEMPLATE'] = '#TITLE#';
         // Set all sites because any user from any site may be
         // added to task in future. For example, new auditor, etc.
         $arSoFields['SITE_ID'] = $cachedAllSitesIds;
         $logID = CSocNetLog::Add($arSoFields, false);
         if (intval($logID) > 0) {
             CSocNetLog::Update($logID, array("TMP_ID" => $logID));
             $arTaskParticipant = CTaskNotifications::GetRecipientsIDs($arFields, false);
             // Exclude author
             $arLogCanViewedBy = array_diff($arTaskParticipant, array($arFields['CREATED_BY']));
             $arRights = CTaskNotifications::__UserIDs2Rights($arLogCanViewedBy);
             if (isset($arFields['GROUP_ID'])) {
                 $arRights = array_merge($arRights, self::prepareRightsCodesForViewInGroupLiveFeed($logID, $arFields['GROUP_ID']));
             }
             CSocNetLogRights::Add($logID, $arRights);
             CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
         }
     } else {
         $arSoFields['=LOG_DATE'] = $logDate;
         $arSoFields['=LOG_UPDATE'] = $logDate;
         // All tasks posts in live feed should be from director
         if (isset($arFields['CREATED_BY'])) {
             $arSoFields['USER_ID'] = $arFields['CREATED_BY'];
         } elseif (isset($arTask['CREATED_BY'])) {
             $arSoFields['USER_ID'] = $arTask['CREATED_BY'];
         } elseif ($occurAsUserId) {
             $arSoFields['USER_ID'] = $occurAsUserId;
         } else {
             unset($arSoFields['USER_ID']);
         }
         $rsSocNetLogItems = CSocNetLog::GetList(array("ID" => "DESC"), $arLogFilter, false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID"));
         while ($arRes = $rsSocNetLogItems->Fetch()) {
             CSocNetLog::Update($arRes["ID"], $arSoFields);
             $arTaskParticipant = CTaskNotifications::GetRecipientsIDs($arFields, false, true);
             $bAuthorMustBeExcluded = false;
             $authorUserId = false;
             if (isset($arFields['CREATED_BY'])) {
                 $authorUserId = (int) $arFields['CREATED_BY'];
             } elseif (isset($arTask['CREATED_BY'])) {
                 $authorUserId = (int) $arTask['CREATED_BY'];
             }
             // Get current rights
             $rsRights = CSocNetLogRights::GetList(array(), array('LOG_ID' => $arRes['ID']));
             $arCurrentRights = array();
             while ($arRights = $rsRights->fetch()) {
                 $arCurrentRights[] = $arRights['GROUP_CODE'];
             }
             // If author changes the task and author doesn't have
             // access to task yet, don't give access to him.
             if ($authorUserId === $effectiveUserId) {
                 $authorGroupCode = 'U' . $authorUserId;
                 // If task's author hasn't rights yet, still exclude him
                 if (!in_array($authorGroupCode, $arCurrentRights, true)) {
                     $bAuthorMustBeExcluded = true;
                 }
             }
             if ($bAuthorMustBeExcluded) {
                 $arLogCanViewedBy = array_diff($arTaskParticipant, array($authorUserId));
             } else {
                 $arLogCanViewedBy = $arTaskParticipant;
             }
             $arNewRights = CTaskNotifications::__UserIDs2Rights($arLogCanViewedBy);
             $bGroupChanged = false;
             if (isset($arFields['GROUP_ID'], $arTask['GROUP_ID']) && $arFields['GROUP_ID'] && $arFields['GROUP_ID'] != $arTask['GROUP_ID']) {
                 $bGroupChanged = true;
             }
             // If rights really changed, update them
             if (count(array_diff($arCurrentRights, $arNewRights)) || count(array_diff($arNewRights, $arCurrentRights)) || $bGroupChanged) {
                 if (isset($arFields['GROUP_ID'])) {
                     $arNewRights = array_merge($arNewRights, self::prepareRightsCodesForViewInGroupLiveFeed($logID, $arFields['GROUP_ID']));
                 } elseif (isset($arTask['GROUP_ID'])) {
                     $arNewRights = array_merge($arNewRights, self::prepareRightsCodesForViewInGroupLiveFeed($logID, $arTask['GROUP_ID']));
                 }
                 CSocNetLogRights::DeleteByLogID($arRes["ID"], true);
                 CSocNetLogRights::Add($arRes["ID"], $arNewRights);
             }
         }
     }
     return $logID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:tasknotifications.php

示例11: 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));
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:index.php

示例12: 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


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