本文整理汇总了PHP中CSocNetLogRights::SetForSonet方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogRights::SetForSonet方法的具体用法?PHP CSocNetLogRights::SetForSonet怎么用?PHP CSocNetLogRights::SetForSonet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogRights
的用法示例。
在下文中一共展示了CSocNetLogRights::SetForSonet方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetMessage
if (!$CWiki->Rename($arParams['ELEMENT_ID'], array('NAME' => $newName, 'IBLOCK_ID' => $arParams['IBLOCK_ID']), true)) {
$arResult['ERROR_MESSAGE'] = GetMessage('WIKI_ERROR_RENAME');
break;
}
$iBlockSectId = CWikiSocnet::$iCatId ? CWikiSocnet::$iCatId : false;
$CWiki->RenameLinkOnPages($arParams['IBLOCK_ID'], $arParams['ELEMENT_NAME'], $newName, $iBlockSectId);
//post to feed
if (CWikiSocnet::IsSocNet()) {
$postUrl = str_replace(array('#group_id#', '#wiki_name#'), array(intval($arParams['SOCNET_GROUP_ID']), urlencode($newName)), $arParams['~PATH_TO_POST']);
$dbLog = CSocNetLog::GetList(array('ID' => 'DESC'), array('SOURCE_ID' => $arParams['ELEMENT_ID']));
if ($arLog = $dbLog->Fetch()) {
$arSoFields = array('=LOG_DATE' => $GLOBALS['DB']->CurrentTimeFunction(), '=LOG_UPDATE' => $GLOBALS['DB']->CurrentTimeFunction(), 'USER_ID' => $GLOBALS['USER']->GetID(), 'TITLE' => $newName, 'TEXT_MESSAGE' => "\n" . GetMessage('WIKI_MODIFY_COMMENT') . ": " . GetMessage('WIKI_PAGE_RENAMED', array("%OLD_NAME%" => $arParams['ELEMENT_NAME'], "%NEW_NAME%" => $newName)) . "\n", 'URL' => $postUrl);
//die(print_r($arSoFields,true));
$logID = CSocNetLog::Update($arLog['ID'], $arSoFields);
if (intval($logID) > 0) {
CSocNetLogRights::SetForSonet($arLog['ID'], SONET_SUBSCRIBE_ENTITY_GROUP, intval($arParams['SOCNET_GROUP_ID']), "wiki", "view");
CSocNetLog::CounterIncrement($logID);
$notify_title_tmp = str_replace(array("\r\n", "\n"), " ", $arLog["TITLE"]);
$notify_title_old = TruncateText($notify_title_tmp, 100);
$notify_title_old_out = TruncateText($notify_title_tmp, 255);
$notify_title_tmp = str_replace(array("\r\n", "\n"), " ", $newName);
$notify_title_new = TruncateText($notify_title_tmp, 100);
$notify_title_new_out = TruncateText($notify_title_tmp, 255);
$arNotifyParams = array("LOG_ID" => $logID, "GROUP_ID" => intval($arParams['SOCNET_GROUP_ID']), "NOTIFY_MESSAGE" => "", "FROM_USER_ID" => $arSoFields["USER_ID"], "URL" => $arSoFields["URL"], "MESSAGE" => GetMessage("WIKI_SONET_IM_RENAME", array("#title_old#" => $notify_title_old, "#title_new#" => "<a href=\"#URL#\" class=\"bx-notifier-item-action\">" . $notify_title_new . "</a>")), "MESSAGE_OUT" => GetMessage("WIKI_SONET_IM_RENAME", array("#title_old#" => $notify_title_old_out, "#title_new#" => $notify_title_new_out)) . " (#URL#)", "EXCLUDE_USERS" => array($arSoFields["USER_ID"]));
CSocNetSubscription::NotifyGroup($arNotifyParams);
}
}
}
$arParams['ELEMENT_NAME'] = $newName;
break;
}
示例2: 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);
//.........这里部分代码省略.........
示例3: array
if ($arParams["MODE"] == "GROUP") {
CSocNetGroup::SetLastActivity($arParams["SOCNET_GROUP_ID"]);
}
$logID = CSocNetLog::Add($arSonetFields, false);
if (intval($logID) > 0) {
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
CSocNetLogRights::SetForSonet($logID, $arSonetFields["ENTITY_TYPE"], $arSonetFields["ENTITY_ID"], "forum", "view", true);
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
}
} elseif ($arParams["MESSAGE_TYPE"] == "EDIT") {
$dbRes = CSocNetLog::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
if ($arRes = $dbRes->Fetch()) {
// topic
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLog::Update($arRes["ID"], $arSonetFields);
CSocNetLogRights::SetForSonet($arRes["ID"], $arParams["MODE"] == "GROUP" ? SONET_ENTITY_GROUP : SONET_ENTITY_USER, $arParams["MODE"] == "GROUP" ? $arParams["SOCNET_GROUP_ID"] : $arParams["USER_ID"], "forum", "view");
} else {
$dbRes = CSocNetLogComments::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
if ($arRes = $dbRes->Fetch()) {
// message/comment
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLogComments::Update($arRes["ID"], $arSonetFields);
}
}
}
$url = ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arParams["FID"], "TID" => $arParams["TID"], "MID" => intVal($arParams["MID"]), "UID" => $arParams["USER_ID"], "GID" => $arParams["SOCNET_GROUP_ID"])), array("result" => $arNote["code"]));
LocalRedirect($url);
} elseif (intVal($arFieldsG["PARAM2"]) > 0 && $arFieldsG["PARAM1"] == "VT") {
CVote::Delete($arFieldsG["PARAM2"]);
}
}
示例4: array
case "system_friends":
$operation = "viewfriends";
break;
}
$perm = CSocNetUserPerms::GetOperationPerms($arLog["ENTITY_ID"], $operation);
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"));
}
} 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!!!
}
示例5: 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;
}
示例6: SocnetLogMessageAdd
public static function SocnetLogMessageAdd($arParams, $arMessageFields, $action = "")
{
static $parser = null;
if ($parser == null) {
$parser = new forumTextParser();
}
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "LIST" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "SMILES" => "N", "UPLOAD" => "Y", "NL2BR" => "N", "TABLE" => "N", "ALIGN" => "N");
// $arParams["LOG_ID"], $arParams["LANG"] ....
$arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $arParams["ENTITY_ID"], "EVENT_ID" => "forum", "=LOG_DATE" => !!$arMessageFields["DATE_CREATE"] ? $arMessageFields["DATE_CREATE"] : $GLOBALS["DB"]->CurrentTimeFunction(), "LOG_UPDATE" => !!$arMessageFields["POST_DATE"] ? $arMessageFields["POST_DATE"] : null, "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $arMessageFields["AUTHOR_NAME"], CForumEmail::GetLangMessage("FORUM_MAIL_SOCNET_TITLE_TOPIC", $arParams["LANG"])), "TITLE" => $arMessageFields["TITLE"], "MESSAGE" => $parser->convert($arMessageFields["POST_MESSAGE"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($arMessageFields["POST_MESSAGE"]), "URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $arMessageFields["AUTHOR_ID"], "FID" => $arMessageFields["FORUM_ID"], "TID" => $arMessageFields["TOPIC_ID"], "TITLE_SEO" => $arMessageFields["TOPIC_ID"], "MID" => $arMessageFields["ID"])), "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $arMessageFields["TOPIC_ID"])))), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arMessageFields["ID"], "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => $arMessageFields["TOPIC_ID"]);
if ($arMessageFields["AUTHOR_ID"] > 0) {
$arFieldsForSocnet["USER_ID"] = $arMessageFields["AUTHOR_ID"];
}
$db_res = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $arMessageFields["ID"]));
$ufFileID = array();
while ($res = $db_res->Fetch()) {
$ufFileID[] = $res["FILE_ID"];
}
$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $arMessageFields["ID"], LANGUAGE_ID);
$logID = $arParams["LOG_ID"];
if ($logID <= 0) {
if (!empty($ufFileID)) {
$arFieldsForSocnet["UF_SONET_LOG_FILE"] = $ufFileID;
}
if ($ufDocID) {
$arFieldsForSocnet["UF_SONET_LOG_DOC"] = $ufDocID;
}
$logID = CSocNetLog::Add($arFieldsForSocnet, false);
if (intval($logID) > 0) {
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
CSocNetLogRights::SetForSonet($logID, $arFieldsForSocnet["ENTITY_TYPE"], $arFieldsForSocnet["ENTITY_ID"], "forum", "view", true);
if ($action == "SEND_EVENT") {
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
}
}
}
if ($logID > 0 && $action == "ADD_COMMENT") {
if (!empty($ufFileID)) {
$arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;
}
if ($ufDocID) {
$arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;
}
$arFieldsForSocnet["LOG_ID"] = $logID;
$arFieldsForSocnet["RATING_TYPE_ID"] = "FORUM_POST";
$arFieldsForSocnet["RATING_ENTITY_ID"] = $arMessageFields["ID"];
$commentID = CSocNetLogComments::Add($arFieldsForSocnet);
CSocNetLog::CounterIncrement($commentID, false, false, "LC");
return $commentID;
}
return $logID;
}
示例7: 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"));
}
}
示例8: onAfterMessageAdd
function onAfterMessageAdd($ID, $arFields)
{
$bSocNetLogRecordExists = false;
// add log comment
if ((!array_key_exists('PARAM1', $arFields) || $arFields['PARAM1'] != 'IB') && array_key_exists('PARAM2', $arFields) && intval($arFields['PARAM2']) > 0) {
$dbRes = CSocNetLog::GetList(array('ID' => 'DESC'), array("EVENT_ID" => "wiki", "SOURCE_ID" => $arFields["PARAM2"]), false, false, array('ID', 'ENTITY_TYPE', 'ENTITY_ID', 'TMP_ID', 'URL'));
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes['TMP_ID'];
$url = $arRes['URL'];
$bSocNetLogRecordExists = true;
} else {
$rsElement = CIBlockElement::GetByID($arFields['PARAM2']);
if ($arElement = $rsElement->Fetch()) {
$arWikiElement = CWiki::GetElementById($arElement['ID'], array('IBLOCK_ID' => $arElement['IBLOCK_ID']));
$CWikiParser = new CWikiParser();
$parserLog = new logTextParser();
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N", "TABLE" => "N");
$text4message = $CWikiParser->Parse($arElement['DETAIL_TEXT'], $arElement['DETAIL_TEXT_TYPE'], $arWikiElement['IMAGES']);
$text4message = preg_replace("#<br[\\s]*\\/>#is", "#BR#", $text4message);
$text4message = htmlspecialcharsback($parserLog->convert($text4message, array(), $arAllow));
$text4message = preg_replace("#\\#BR\\##is", "\n", $text4message);
$text4message = $CWikiParser->Clear($text4message);
$url = str_replace(array('#group_id#', '#wiki_name#'), array(intval($this->SonetGroupID), urlencode($arElement['NAME'])), $this->arPath['PATH_TO_POST']);
$arSoFields = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'IS_CUSTOM_ET' => 'N', 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki', 'USER_ID' => $arElement['CREATED_BY'], 'LOG_DATE' => $arElement['DATE_CREATE'], 'LOG_UPDATE' => $arElement['DATE_CREATE'], 'TITLE_TEMPLATE' => GetMessage('WIKI_SONET_LOG_TITLE_TEMPLATE'), 'TITLE' => $arElement['NAME'], 'MESSAGE' => $text4message, 'TEXT_MESSAGE' => '', 'MODULE_ID' => 'wiki', 'URL' => $url, 'CALLBACK_FUNC' => false, 'SOURCE_ID' => $arFields['PARAM2'], 'PARAMS' => 'forum_id=' . $this->ForumID, 'RATING_TYPE_ID' => 'IBLOCK_ELEMENT', 'RATING_ENTITY_ID' => intval($arFields['PARAM2']));
$log_id = CSocNetLog::Add($arSoFields, false);
if (intval($log_id) > 0) {
CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
CSocNetLogRights::SetForSonet($log_id, SONET_SUBSCRIBE_ENTITY_GROUP, intval($this->SonetGroupID), "wiki", "view", true);
}
}
}
if (intval($log_id) > 0) {
$arForum = CForumNew::GetByID($this->ForumID);
$parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']);
$parser->image_params['width'] = false;
$parser->image_params['height'] = false;
$arAllow = array('HTML' => "N", 'ANCHOR' => "N", 'BIU' => "N", 'IMG' => "N", 'LIST' => "N", 'QUOTE' => "N", 'CODE' => "N", 'FONT' => "N", 'UPLOAD' => $arForum['ALLOW_UPLOAD'], 'NL2BR' => "N", 'SMILES' => "N");
$sAuthorForMail = str_replace('#TITLE#', $arMessage['AUTHOR_NAME'], GetMessage('SONET_FORUM_LOG_TEMPLATE_GUEST'));
if ($bSocNetLogRecordExists) {
$arMessage = CForumMessage::GetByIDEx($ID);
$parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']);
$parser->image_params['width'] = false;
$parser->image_params['height'] = false;
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR'));
}
$arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CurrentTimeFunction(), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $url, 'MODULE_ID' => false, 'SOURCE_ID' => $ID, 'LOG_ID' => $log_id, 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID']));
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID'];
}
CSocNetLogComments::Add($arFieldsForSocnet);
} else {
$dbMessage = CForumMessage::GetListEx(array(), array('TOPIC_ID' => $arFields["TOPIC_ID"], "NEW_TOPIC" => "N"));
while ($arMessage = $dbMessage->GetNext()) {
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR'));
}
$arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CharToDateFunction($arMessage['POST_DATE'], "FULL", SITE_ID), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $url, 'MODULE_ID' => false, 'SOURCE_ID' => $ID, 'LOG_ID' => $log_id, 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID']));
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID'];
}
CSocNetLogComments::Add($arFieldsForSocnet);
}
}
}
}
}
示例9: createLogEntry
private function createLogEntry($iblockElementID)
{
$rsElement = CIBlockElement::GetByID($iblockElementID);
if ($arElement = $rsElement->Fetch()) {
$arWikiElement = CWiki::GetElementById($arElement['ID'], array('IBLOCK_ID' => $arElement['IBLOCK_ID']));
$CWikiParser = new CWikiParser();
$parserLog = new logTextParser();
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N", "TABLE" => "N");
$text4message = $CWikiParser->Parse($arElement['DETAIL_TEXT'], $arElement['DETAIL_TEXT_TYPE'], $arWikiElement['IMAGES']);
$text4message = preg_replace("#<br[\\s]*\\/>#is", "#BR#", $text4message);
$text4message = htmlspecialcharsback($parserLog->convert($text4message, array(), $arAllow));
$text4message = preg_replace("#\\#BR\\##is", "\n", $text4message);
$text4message = $CWikiParser->Clear($text4message);
$url = str_replace(array('#group_id#', '#wiki_name#'), array(intval($this->SonetGroupID), urlencode($arElement['NAME'])), $this->arPath['PATH_TO_POST']);
$arSoFields = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'IS_CUSTOM_ET' => 'N', 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki', 'USER_ID' => $arElement['CREATED_BY'], 'LOG_DATE' => $arElement['DATE_CREATE'], 'LOG_UPDATE' => $arElement['DATE_CREATE'], 'TITLE_TEMPLATE' => GetMessage('WIKI_SONET_LOG_TITLE_TEMPLATE'), 'TITLE' => $arElement['NAME'], 'MESSAGE' => $text4message, 'TEXT_MESSAGE' => '', 'MODULE_ID' => 'wiki', 'URL' => $url, 'CALLBACK_FUNC' => false, 'SOURCE_ID' => intval($iblockElementID), 'PARAMS' => 'forum_id=' . $this->ForumID, 'RATING_TYPE_ID' => 'IBLOCK_ELEMENT', 'RATING_ENTITY_ID' => intval($iblockElementID));
$log_id = CSocNetLog::Add($arSoFields, false);
$log_user_id = $arElement['CREATED_BY'];
$log_title = $arElement["NAME"];
if (intval($log_id) > 0) {
CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
CSocNetLogRights::SetForSonet($log_id, SONET_SUBSCRIBE_ENTITY_GROUP, intval($this->SonetGroupID), "wiki", "view", true);
return array("LOG_ID" => $log_id, "LOG_USER_ID" => $log_user_id, "LOG_TITLE" => $log_title, "URL" => $url);
}
}
return false;
}
示例10: OnAfterPhotoCommentAddBlog
//.........这里部分代码省略.........
$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)
{
CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
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);
$text4mail = $parserBlog->convert4mail($arFields["POST_TEXT"]);
$arFieldsForSocnet = array(
"ENTITY_TYPE" => $entity_type,
"ENTITY_ID" => $entity_id,
"EVENT_ID" => "photo_comment",
"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
"MESSAGE" => $text4message,
"TEXT_MESSAGE" => $text4mail,
"MODULE_ID" => false,
"SOURCE_ID" => $ID,
"LOG_ID" => $log_id,
"RATING_TYPE_ID" => "BLOG_COMMENT",
"RATING_ENTITY_ID" => $ID,
);
if (intval($arFields["AUTHOR_ID"]) > 0)
$arFieldsForSocnet["USER_ID"] = $arFields["AUTHOR_ID"];
CSocNetLogComments::Add($arFieldsForSocnet);