本文整理汇总了PHP中CSocNetLog类的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLog类的具体用法?PHP CSocNetLog怎么用?PHP CSocNetLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSocNetLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UnInstallDB
function UnInstallDB($arParams = array())
{
global $DB, $APPLICATION;
$errors = null;
if (CModule::IncludeModule("socialnetwork")) {
$dbLog = CSocNetLog::GetList(array(), array("ENTITY_TYPE" => array("R", "T"), "EVENT_ID" => array("timeman_entry", "report")), false, false, array("ID"));
while ($arLog = $dbLog->Fetch()) {
CSocNetLog::Delete($arLog["ID"]);
}
}
if (true == array_key_exists("savedata", $arParams) && $arParams["savedata"] != 'Y') {
$errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/' . $this->MODULE_ID . '/install/db/' . strtolower($DB->type) . '/uninstall.sql');
if (!empty($errors)) {
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
$this->UnInstallTasks();
}
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'timeman', 'CReportNotifications', 'AddEvent');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'timeman', 'CReportNotifications', 'OnFillSocNetAllowedSubscribeEntityTypes');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'timeman', 'CTimeManNotify', 'OnFillSocNetLogEvents');
UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'timeman', 'CTimeManNotify', 'OnFillSocNetAllowedSubscribeEntityTypes');
UnRegisterModuleDependences("im", "OnGetNotifySchema", "timeman", "CTimemanNotifySchema", "OnGetNotifySchema");
UnRegisterModuleDependences('main', 'OnAfterUserUpdate', 'timeman', 'CTimeManNotify', 'OnAfterUserUpdate');
UnRegisterModuleDependences('main', 'OnAfterUserUpdate', 'timeman', 'CReportNotifications', 'OnAfterUserUpdate');
UnRegisterModule($this->MODULE_ID);
return true;
}
示例2: Execute
public function Execute()
{
if (!CModule::IncludeModule("socialnetwork")) {
CBPActivityExecutionStatus::Closed;
}
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $this->workflow->GetService("DocumentService");
$document = $documentService->GetDocument($documentId);
$entityType = $this->EntityType;
if ($entityType == "user") {
$entityType = SONET_ENTITY_USER;
} elseif ($entityType == "group") {
$entityType = SONET_ENTITY_GROUP;
}
$USER_ID = false;
if ($GLOBALS["USER"]->IsAuthorized()) {
$USER_ID = $GLOBALS["USER"]->GetID();
}
$logID = CSocNetLog::Add(array("ENTITY_TYPE" => $entityType, "ENTITY_ID" => $this->EntityId, "EVENT_ID" => $this->Event, "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => $this->LogTitle, "TITLE" => $document["NAME"], "MESSAGE" => nl2br($this->LogText), "TEXT_MESSAGE" => $this->LogText, "URL" => $documentService->GetDocumentAdminPage($documentId), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "USER_ID" => $USER_ID), false);
if (intval($logID > 0)) {
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
}
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
return CBPActivityExecutionStatus::Closed;
}
示例3: OnUserDelete
public static function OnUserDelete($ID)
{
global $DB;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$bSuccess = True;
if (!CSocNetGroup::DeleteNoDemand($ID)) {
if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
$err = $ex->GetString();
}
$GLOBALS["APPLICATION"]->ThrowException($err);
$bSuccess = false;
}
if ($bSuccess) {
CSocNetUserRelations::DeleteNoDemand($ID);
CSocNetUserPerms::DeleteNoDemand($ID);
CSocNetUserEvents::DeleteNoDemand($ID);
CSocNetMessages::DeleteNoDemand($ID);
CSocNetUserToGroup::DeleteNoDemand($ID);
CSocNetLogEvents::DeleteNoDemand($ID);
CSocNetLog::DeleteNoDemand($ID);
CSocNetLogComments::DeleteNoDemand($ID);
CSocNetFeatures::DeleteNoDemand($ID);
CSocNetSubscription::DeleteEx($ID);
CUserOptions::DeleteOption("socialnetwork", "~menu_" . SONET_ENTITY_USER . "_" . $ID, false, 0);
}
return $bSuccess;
}
示例4: addComment
public function addComment($authorId, array $data)
{
$this->loadBlogPostData();
$commentFields = array("POST_ID" => $this->entityId, "BLOG_ID" => $this->blogPostData['BLOG_ID'], "POST_TEXT" => $data['text'], "DATE_CREATE" => new DateTime(), "PARENT_ID" => false, "AUTHOR_ID" => $authorId, "HAS_PROPS" => 'Y');
if (!empty($data['fileId'])) {
$commentFields['UF_BLOG_COMMENT_FILE'] = array($data['fileId']);
} elseif (!empty($data['versionId'])) {
$commentFields['UF_BLOG_COMMENT_FH'] = $data['versionId'];
}
$comId = \CBlogComment::add($commentFields);
if (!$comId) {
return;
}
if (method_exists("CBlogComment", "addLiveComment")) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
\CBlogComment::addLiveComment($comId, array("MODE" => "PULL_MESSAGE"));
}
BXClearCache(true, "/blog/comment/" . $this->entityId . "/");
if (!Loader::includeModule('socialnetwork')) {
return;
}
$query = \CSocNetLog::getList(array("ID" => "DESC"), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $this->entityId), false, false, array("ID", "TMP_ID"));
$row = $query->fetch();
if (!$row) {
return;
}
$fieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $this->blogPostData["AUTHOR_ID"], "EVENT_ID" => "blog_comment", "=LOG_DATE" => Application::getInstance()->getConnection()->getSqlHelper()->getCurrentDateTimeFunction(), "MESSAGE" => "file", "TEXT_MESSAGE" => "file", "URL" => "", "MODULE_ID" => false, "SOURCE_ID" => $comId, "LOG_ID" => $row["ID"], "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => $comId, "USER_ID" => $authorId);
\CSocNetLogComments::add($fieldsForSocnet, false, false, false);
}
示例5: Update
function Update($ID, $arFields)
{
global $DB;
$ID = IntVal($ID);
if ($ID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_L_WRONG_PARAMETER_ID"), "ERROR_NO_ID");
return false;
}
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetLog::CheckFields("UPDATE", $arFields, $ID)) {
return false;
} else {
$arSiteID = array();
if (is_set($arFields, "SITE_ID")) {
if (is_array($arFields["SITE_ID"])) {
$arSiteID = $arFields["SITE_ID"];
} else {
$arSiteID[] = $arFields["SITE_ID"];
}
$arFields["SITE_ID"] = false;
$str_SiteID = "''";
foreach ($arSiteID as $v) {
$arFields["SITE_ID"] = $v;
$str_SiteID .= ", '" . $DB->ForSql($v) . "'";
}
}
}
$strUpdate = $DB->PrepareUpdate("b_sonet_log", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
$strSql = "UPDATE b_sonet_log SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (count($arSiteID) > 0) {
$strSql = "DELETE FROM b_sonet_log_site WHERE LOG_ID=" . $ID;
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
$strSql = "INSERT INTO b_sonet_log_site(LOG_ID, SITE_ID) " . "SELECT " . $ID . ", LID " . "FROM b_lang " . "WHERE LID IN (" . $str_SiteID . ") ";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_" . $ID);
}
} else {
$ID = False;
}
return $ID;
}
示例6: Set
function Set($user_id, $code = "**", $type = "Y", $follow_date = false, $site_id = SITE_ID)
{
static $LOG_CACHE;
if (strlen($code) <= 0) {
$code = "**";
}
if ($type != "Y") {
$type = "N";
}
if (intval($user_id) <= 0) {
$user_id = $GLOBALS["USER"]->GetID();
}
$arFollows = array();
$rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $user_id, "CODE" => array_unique(array("**", $code))));
while ($arFollow = $rsFollow->Fetch()) {
$arFollows[$arFollow["CODE"]] = array("TYPE" => $arFollow["TYPE"], "FOLLOW_DATE" => $arFollow["FOLLOW_DATE"]);
}
if (array_key_exists("**", $arFollows)) {
$default_type = $arFollows["**"]["TYPE"];
} else {
$default_type = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
}
if (preg_match('/^L(\\d+)$/', $code, $matches)) {
$log_id = intval($matches[1]);
if ($log_id > 0) {
if (isset($LOG_CACHE[$log_id])) {
$arLog = $LOG_CACHE[$log_id];
} else {
$rsLog = CSocNetLog::GetList(array("ID" => "DESC"), array("ID" => $log_id), false, false, array("ID", "LOG_UPDATE", "LOG_DATE"), array("CHECK_RIGHTS" => "N", "USE_SUBSCRIBE" => "N", "USE_FOLLOW" => "N"));
if ($arLog = $rsLog->Fetch()) {
$LOG_CACHE[$log_id] = $arLog;
}
}
if ($arLog) {
$log_date = strlen($arLog["LOG_DATE"]) > 0 ? $arLog["LOG_DATE"] : false;
$log_update = strlen($arLog["LOG_UPDATE"]) > 0 ? $arLog["LOG_UPDATE"] : false;
if (array_key_exists($code, $arFollows)) {
// already in the follows table
$res = CSocNetLogFollow::Update($user_id, $code, $type, strlen($arFollows[$code]["FOLLOW_DATE"]) > 0 ? $arFollows[$code]["FOLLOW_DATE"] : ($type == "N" ? $log_update : $log_date));
} elseif ($type != $default_type) {
// new record in the follow table only if not equal to default type
$res = CSocNetLogFollow::Add($user_id, $code, $type, $follow_date ? $follow_date : ($type == "N" ? $log_update : $log_date));
}
}
}
} else {
if (array_key_exists($code, $arFollows)) {
$res = CSocNetLogFollow::Update($user_id, $code, $type, false);
} else {
$res = CSocNetLogFollow::Add($user_id, $code, $type, false);
}
}
return $res;
}
示例7: OnAfterIBlockElementDelete
public function OnAfterIBlockElementDelete($fields)
{
$errors = array();
if (Loader::includeModule('socialnetwork')) {
$states = CBPStateService::getDocumentStates(array('lists', get_called_class(), $fields['ID']));
foreach ($states as $workflowId => $state) {
$sourceId = CBPStateService::getWorkflowIntegerId($workflowId);
$resultQuery = CSocNetLog::getList(array(), array('EVENT_ID' => 'lists_new_element', 'SOURCE_ID' => $sourceId), false, false, array('ID'));
while ($log = $resultQuery->fetch()) {
CSocNetLog::delete($log['ID']);
}
}
}
CBPDocument::onDocumentDelete(array('lists', get_called_class(), $fields['ID']), $errors);
}
示例8: toggleFavorites
public static function toggleFavorites(array $params)
{
$params['TASK_ID'] = intval($params['TASK_ID']);
$params['USER_ID'] = intval($params['USER_ID']);
if ($params['TASK_ID'] && $params['USER_ID'] && static::includeModule()) {
// get all soc net log records considering this task and user
$res = \CSocNetLog::GetList(array(), array('SOURCE_ID' => $params['TASK_ID'], 'USER_ID' => $params['USER_ID']));
while ($item = $res->fetch()) {
// add them to favorite
if ($params['OPERATION'] == 'ADD') {
\CSocNetLogFavorites::Add($item['USER_ID'], $item['ID'], array('TRIGGER_EVENT' => false));
} else {
\CSocNetLogFavorites::Change($item['USER_ID'], $item['ID'], array('TRIGGER_EVENT' => false));
}
}
}
}
示例9: canRead
public function canRead($userId)
{
if ($this->canRead !== null) {
return $this->canRead;
}
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if (\CSocNetUser::isCurrentUserModuleAdmin()) {
$this->canRead = true;
return $this->canRead;
}
if ($comment = $this->loadLogCommentData()) {
if (strpos($comment["EVENT_ID"], "crm_") === 0) {
$queryLog = \CSocNetLog::getList(array(), array("ID" => intval($comment["LOG_ID"])), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID"));
if (($log = $queryLog->fetch()) && Loader::includeModule("crm")) {
$userPermissions = \CCrmPerms::getUserPermissions($userId);
if ($log["ENTITY_TYPE"] == "CRMACTIVITY") {
$bindings = \CCRMActivity::getBindings($log["ENTITY_ID"]);
foreach ($bindings as $binding) {
if (\CCrmAuthorizationHelper::checkReadPermission(\CCrmOwnerType::resolveName($binding["OWNER_TYPE_ID"]), $binding["OWNER_ID"], $userPermissions)) {
$this->canRead = true;
return $this->canRead;
}
}
} else {
if (\CCrmAuthorizationHelper::checkReadPermission(\CCrmLiveFeedEntity::resolveEntityTypeID($log["ENTITY_TYPE"]), $log["ENTITY_ID"], $userPermissions)) {
$this->canRead = true;
return $this->canRead;
} elseif (intval($comment["LOG_ID"]) > 0 && \CSocNetLogRights::checkForUser($comment["LOG_ID"], $userId)) {
$this->canRead = true;
return $this->canRead;
}
}
}
} elseif (intval($comment["LOG_ID"]) > 0 && \CSocNetLogRights::checkForUser($comment["LOG_ID"], $userId)) {
$this->canRead = true;
return $this->canRead;
}
}
$this->canRead = false;
return $this->canRead;
}
示例10: LocalRedirectHandler
function LocalRedirectHandler(&$url)
{
$bSuccess = false;
if (strpos($url, "?") > 0) {
$arUrlParam = explode("&", substr($url, strpos($url, "?") + 1));
foreach ($arUrlParam as $url_param) {
list($key, $val) = explode("=", $url_param, 2);
if ($key == "new_post_id") {
$new_post_id = $val;
break;
}
}
}
if (strpos($url, "success=Y") > 0 && intval($new_post_id) > 0) {
unset($_SESSION["MFU_UPLOADED_FILES"]);
unset($_SESSION["MFU_UPLOADED_DOCS"]);
unset($_SESSION["MFU_UPLOADED_FILES_" . $GLOBALS["USER"]->GetId()]);
unset($_SESSION["MFU_UPLOADED_DOCS_" . $GLOBALS["USER"]->GetId()]);
$GLOBALS["APPLICATION"]->RestartBuffer();
$rsLogSrc = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_important"), "SOURCE_ID" => $new_post_id), false, false, array("ID"), array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N"));
if ($arLogSrc = $rsLogSrc->Fetch()) {
ob_start();
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:mobile.socialnetwork.log.ex", ".default", array("NEW_LOG_ID" => intval($arLogSrc["ID"]), "PATH_TO_LOG_ENTRY" => SITE_DIR . "mobile/log/?detail_log_id=#log_id#", "PATH_TO_LOG_ENTRY_EMPTY" => SITE_DIR . "mobile/log/?empty=Y", "PATH_TO_USER" => SITE_DIR . "mobile/users/?user_id=#user_id#", "SET_LOG_CACHE" => "N", "IMAGE_MAX_WIDTH" => 550, "DATE_TIME_FORMAT" => ""), false, array("HIDE_ICONS" => "Y"));
$postText = ob_get_contents();
ob_end_clean();
$bSuccess = true;
}
}
$GLOBALS["APPLICATION"]->RestartBuffer();
if (!$bSuccess) {
echo $_POST["response_type"] == "json" ? CUtil::PhpToJSObject(array("error" => "*")) : "*";
} else {
echo $_POST["response_type"] == "json" ? CUtil::PhpToJSObject(array("text" => $postText)) : $postText;
}
die;
}
示例11: list
break;
case "exclude_group":
list($titleTmp, $messageTmp) = CSocNetLog::InitUsersTmp($arEvents["MESSAGE"], GetMessage("SONET_ACTIVITY_TITLE_EXCLUDE_GROUP1"), GetMessage("SONET_ACTIVITY_TITLE_EXCLUDE_GROUP1"), $arParams);
$arEvents["TITLE"] = $titleTmp;
$arEvents["MESSAGE_FORMAT"] = $messageTmp;
break;
default:
continue;
break;
}
}
$arTmpUser = array("NAME" => "", "LAST_NAME" => "", "SECOND_NAME" => "", "LOGIN" => "");
if ($arEvents["ENTITY_TYPE"] == SONET_ENTITY_USER && intval($arEvents["ENTITY_ID"]) > 0) {
$arTmpUser = array("NAME" => $arEvents["~USER_NAME"], "LAST_NAME" => $arEvents["~USER_LAST_NAME"], "SECOND_NAME" => $arEvents["~USER_SECOND_NAME"], "LOGIN" => $arEvents["~USER_LOGIN"]);
}
$arTmpEvent = array("ID" => $arEvents["ID"], "ENTITY_TYPE" => $arEvents["ENTITY_TYPE"], "ENTITY_ID" => $arEvents["ENTITY_ID"], "EVENT_ID" => $arEvents["EVENT_ID"], "LOG_DATE" => $arEvents["LOG_DATE"], "LOG_TIME_FORMAT" => $timeFormated, "TITLE_TEMPLATE" => $arEvents["TITLE_TEMPLATE"], "TITLE" => $arEvents["TITLE"], "TITLE_FORMAT" => CSocNetLog::MakeTitle($arEvents["TITLE_TEMPLATE"], $arEvents["TITLE"], $arEvents["URL"], true), "MESSAGE" => $arEvents["MESSAGE"], "MESSAGE_FORMAT" => $arEvents["MESSAGE_FORMAT"], "URL" => $arEvents["URL"], "MODULE_ID" => $arEvents["MODULE_ID"], "CALLBACK_FUNC" => $arEvents["CALLBACK_FUNC"], "ENTITY_NAME" => $arEvents["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arEvents["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity);
if ($arEvents["ENTITY_TYPE"] == SONET_ENTITY_USER) {
$arTmpEvent["USER_NAME"] = $arTmpUser["NAME"];
$arTmpEvent["USER_LAST_NAME"] = $arTmpUser["LAST_NAME"];
$arTmpEvent["USER_SECOND_NAME"] = $arTmpUser["SECOND_NAME"];
$arTmpEvent["USER_LOGIN"] = $arTmpUser["LOGIN"];
}
if (preg_match("/#USER_NAME#/i" . BX_UTF_PCRE_MODIFIER, $arTmpEvent["TITLE_FORMAT"], $res)) {
if (intval($arEvents["USER_ID"]) > 0) {
$arTmpCreatedBy = array("NAME" => $arEvents["~CREATED_BY_NAME"], "LAST_NAME" => $arEvents["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arEvents["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arEvents["~CREATED_BY_LOGIN"]);
$name_formatted = CUser::FormatName($arParams["NAME_TEMPLATE_WO_NOBR"], $arTmpCreatedBy, $bUseLogin);
} else {
$name_formatted = GetMessage("SONET_C73_CREATED_BY_ANONYMOUS");
}
$arTmpEvent["TITLE_FORMAT"] = str_replace("#USER_NAME#", $name_formatted, $arTmpEvent["TITLE_FORMAT"]);
}
示例12: FormatEvent_Data
function FormatEvent_Data($arFields, $arParams, $bMail = false)
{
$arResult = array("EVENT" => $arFields, "URL" => "");
if (!CModule::IncludeModule("socialnetwork")) {
return $arResult;
}
if (in_array($arFields["ENTITY_TYPE"], array(SONET_SUBSCRIBE_ENTITY_GROUP, SONET_SUBSCRIBE_ENTITY_USER))) {
$arResult["ENTITY"] = CSocNetLogTools::FormatEvent_GetEntity($arFields, $arParams, $bMail);
$rsRight = CSocNetLogRights::GetList(array(), array("LOG_ID" => $arFields["ID"]));
$arRights = array();
while ($arRight = $rsRight->Fetch()) {
$arRights[] = $arRight["GROUP_CODE"];
}
$arDestination = CSocNetLogTools::FormatDestinationFromRights($arRights, $arParams, $iMoreCount);
}
$title = "";
$arEventParams = unserialize(strlen($arFields["~PARAMS"]) > 0 ? $arFields["~PARAMS"] : $arFields["PARAMS"]);
if (in_array($arFields["ENTITY_TYPE"], array(SONET_SUBSCRIBE_ENTITY_GROUP, SONET_SUBSCRIBE_ENTITY_USER)) && is_array($arEventParams) && count($arEventParams) > 0 && array_key_exists("ENTITY_NAME", $arEventParams) && strlen($arEventParams["ENTITY_NAME"]) > 0) {
if (!$bMail && strlen($arFields["URL"]) > 0) {
$title_tmp = '<a href="' . $arFields["URL"] . '">' . $arEventParams["ENTITY_NAME"] . '</a>';
} else {
$title_tmp = $arEventParams["ENTITY_NAME"];
}
} else {
if (!$bMail && strlen($arFields["URL"]) > 0) {
$title_tmp = '<a href="' . $arFields["URL"] . '">' . $arFields["TITLE"] . '</a>';
} else {
$title_tmp = $arFields["TITLE"];
}
}
$title = str_replace(array("#TITLE#", "#ENTITY#"), array($title_tmp, $bMail ? $arResult["ENTITY"]["FORMATTED"] : $arResult["ENTITY"]["FORMATTED"]["NAME"]), $bMail ? GetMessage("LFP_SOCNET_LOG_DATA_" . $arFields["ENTITY_TYPE"] . "_TITLE_MAIL") : GetMessage("LFP_SOCNET_LOG_DATA_TITLE"));
$url = false;
if (strlen($arFields["URL"]) > 0) {
$url = $arFields["URL"];
}
if (in_array($arFields["ENTITY_TYPE"], array(SONET_SUBSCRIBE_ENTITY_GROUP, SONET_SUBSCRIBE_ENTITY_USER))) {
if (!$bMail) {
$message = $arFields["MESSAGE"];
} else {
$message = $arFields["TITLE"] . "#BR##BR#" . $arFields["MESSAGE"];
}
} else {
$message = $arFields["MESSAGE"];
}
$arFieldsTooltip = array('ID' => $arFields['USER_ID'], 'NAME' => $arFields['~CREATED_BY_NAME'], 'LAST_NAME' => $arFields['~CREATED_BY_LAST_NAME'], 'SECOND_NAME' => $arFields['~CREATED_BY_SECOND_NAME'], 'LOGIN' => $arFields['~CREATED_BY_LOGIN']);
$arResult['CREATED_BY']['TOOLTIP_FIELDS'] = CSocNetLog::FormatEvent_FillTooltip($arFieldsTooltip, $arParams);
$twitInfo = unserialize($arFields['~PARAMS']);
$arResult["EVENT_FORMATTED"] = array("TITLE" => $arFields["TITLE"], "TITLE_24" => "", "MESSAGE" => "<a target=\"_blank\" style=\"text-decoration: none; color: #5C6470; font-weight: bold; font-size: 12px\" href=\"https://twitter.com/" . $twitInfo['SCREEN_NAME'] . "/status/" . $twitInfo['TWIT_ID'] . "\">" . $arFields["TITLE"] . "</a><p>" . ($bMail ? CSocNetTextParser::killAllTags($message) : $message), "IS_IMPORTANT" => false, "STYLE" => "", "DESTINATION" => $arDestination);
if (intval($iMoreCount) > 0) {
$arResult["EVENT_FORMATTED"]["DESTINATION_MORE"] = $iMoreCount;
}
if (is_array($arEventParams) && array_key_exists("SOURCE_TIMESTAMP", $arEventParams)) {
$arResult["EVENT_FORMATTED"]["LOG_DATE_FORMAT"] = ConvertTimeStamp($arEventParams["SOURCE_TIMESTAMP"], "FULL");
}
if (strlen($url) > 0) {
$arResult["EVENT_FORMATTED"]["URL"] = $url;
}
if (!$bMail) {
if ($arFields["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP) {
$arGroup = array("IMAGE_ID" => $arFields["GROUP_IMAGE_ID"]);
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatarGroup($arGroup, $arParams);
} elseif ($arFields["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_USER) {
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatar($arFields, $arParams, "USER_");
} elseif ($arFields["ENTITY_TYPE"] == "N") {
$arResult["EVENT_FORMATTED"]["AVATAR_STYLE"] = "avatar-info";
}
$parserLog = new logTextParser(false, $arParams["PATH_TO_SMILE"]);
$arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LOG_IMG" => "N", "QUOTE" => "Y", "LOG_QUOTE" => "N", "CODE" => "Y", "LOG_CODE" => "N", "FONT" => "Y", "LOG_FONT" => "N", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "MULTIPLE_BR" => "Y", "VIDEO" => "Y", "LOG_VIDEO" => "N");
$arResult["EVENT_FORMATTED"]["SHORT_MESSAGE"] = $parserLog->html_cut($parserLog->convert(htmlspecialcharsback(str_replace("#CUT#", "", $arResult["EVENT_FORMATTED"]["MESSAGE"])), array(), $arAllow), 500);
$arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "MULTIPLE_BR" => "Y", "VIDEO" => "Y", "LOG_VIDEO" => "N");
$arResult["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsbx($parserLog->convert(htmlspecialcharsback($arResult["EVENT_FORMATTED"]["MESSAGE"]), array(), $arAllow));
if ($arParams["MOBILE"] != "Y" && $arParams["NEW_TEMPLATE"] != "Y") {
$arResult["EVENT_FORMATTED"]["IS_MESSAGE_SHORT"] = CSocNetLogTools::FormatEvent_IsMessageShort($arResult["EVENT_FORMATTED"]["MESSAGE"], $arResult["EVENT_FORMATTED"]["SHORT_MESSAGE"]);
}
}
return $arResult;
}
示例13: SetForSonet
function SetForSonet($logID, $entity_type, $entity_id, $feature, $operation, $bNew = false)
{
$bFlag = true;
if (!$bNew) {
$rsRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $logID));
if ($arRights = $rsRights->Fetch()) {
$bFlag = false;
}
}
if ($bFlag) {
$bExtranet = false;
$perm = CSocNetFeaturesPerms::GetOperationPerm($entity_type, $entity_id, $feature, $operation);
if ($perm) {
if (CModule::IncludeModule("extranet") && ($extranet_site_id = CExtranet::GetExtranetSiteID())) {
$arLogSites = array();
$rsLogSite = CSocNetLog::GetSite($logID);
while ($arLogSite = $rsLogSite->Fetch()) {
$arLogSites[] = $arLogSite["LID"];
}
if (in_array($extranet_site_id, $arLogSites)) {
$bExtranet = true;
}
}
if ($bExtranet) {
if ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_OWNER) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_MODERATOR) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR));
} elseif ($entity_type == SONET_ENTITY_GROUP && in_array($perm, array(SONET_ROLES_USER, SONET_ROLES_AUTHORIZED, SONET_ROLES_ALL))) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
} elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_NONE) {
CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id));
} elseif ($entity_type == SONET_ENTITY_USER && in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS, SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_AUTHORIZED, SONET_RELATIONS_TYPE_ALL))) {
$arCode = array("SA");
$arLog = CSocNetLog::GetByID($logID);
if ($arLog) {
$dbUsersInGroup = CSocNetUserToGroup::GetList(array(), array("USER_ID" => $arLog["USER_ID"], "<=ROLE" => SONET_ROLES_USER, "GROUP_SITE_ID" => $extranet_site_id, "GROUP_ACTIVE" => "Y"), false, false, array("ID", "GROUP_ID"));
while ($arUsersInGroup = $dbUsersInGroup->Fetch()) {
if (!in_array("S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_USER, $arCode)) {
$arCode = array_merge($arCode, array("S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $arUsersInGroup["GROUP_ID"] . "_" . SONET_ROLES_USER));
}
}
CSocNetLogRights::Add($logID, $arCode);
}
}
} else {
if ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_OWNER) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_MODERATOR) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_USER) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_ENTITY_GROUP . $entity_id, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
} elseif ($entity_type == SONET_ENTITY_USER && in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS, SONET_RELATIONS_TYPE_FRIENDS2))) {
$arCodes = array("SA", "U" . $entity_id, "S" . $entity_type . $entity_id . "_" . SONET_RELATIONS_TYPE_FRIENDS);
if ($perm == SONET_RELATIONS_TYPE_FRIENDS2) {
$arCodes[] = "S" . $entity_type . $entity_id . "_" . SONET_RELATIONS_TYPE_FRIENDS2;
}
CSocNetLogRights::Add($logID, $arCodes);
} elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_NONE) {
CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_AUTHORIZED) {
CSocNetLogRights::Add($logID, array("SA", "S" . $entity_type . $entity_id, "AU"));
} elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
CSocNetLogRights::Add($logID, array("SA", "AU"));
} elseif ($entity_type == SONET_ENTITY_GROUP && $perm == SONET_ROLES_ALL) {
CSocNetLogRights::Add($logID, array("SA", "S" . $entity_type . $entity_id, "G2"));
} elseif ($entity_type == SONET_ENTITY_USER && $perm == SONET_RELATIONS_TYPE_ALL) {
CSocNetLogRights::Add($logID, array("SA", "G2"));
}
}
}
}
}
示例14: AddComment_Wiki
static function AddComment_Wiki($arFields)
{
if (!CModule::IncludeModule('iblock')) {
return false;
}
if (!CModule::IncludeModule('socialnetwork')) {
return false;
}
$ufFileID = array();
$ufDocID = array();
$dbResult = CSocNetLog::GetList(array('ID' => 'DESC'), array('TMP_ID' => $arFields['LOG_ID']), false, false, array('ID', 'SOURCE_ID', 'PARAMS', 'URL'));
$bFound = false;
if ($arLog = $dbResult->Fetch()) {
if (strlen($arLog['PARAMS']) > 0) {
$arFieldsParams = explode('&', $arLog['PARAMS']);
if (is_array($arFieldsParams) && count($arFieldsParams) > 0) {
foreach ($arFieldsParams as $tmp) {
list($key, $value) = explode('=', $tmp);
if ($key == 'forum_id') {
$FORUM_ID = intval($value);
break;
}
}
}
}
if ($FORUM_ID > 0 && intval($arLog['SOURCE_ID']) > 0) {
$bFound = true;
}
}
if ($bFound) {
$arElement = false;
$arFilter = array('ID' => $arLog['SOURCE_ID']);
$arSelectedFields = array('IBLOCK_ID', 'ID', 'NAME', 'TAGS', 'CODE', 'IBLOCK_SECTION_ID', 'DETAIL_PAGE_URL', 'CREATED_BY', 'PREVIEW_PICTURE', 'PREVIEW_TEXT', 'PROPERTY_FORUM_TOPIC_ID', 'PROPERTY_FORUM_MESSAGE_CNT');
$db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
if ($db_res && ($res = $db_res->GetNext())) {
$arElement = $res;
}
if ($arElement) {
// check iblock properties
CSocNetLogTools::AddComment_Review_CheckIBlock($arElement);
$dbMessage = CForumMessage::GetList(array(), array('PARAM2' => $arElement['ID']));
if (!($arMessage = $dbMessage->Fetch())) {
// Add Topic and Root Message
$TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot($arElement, $FORUM_ID, false);
$bNewTopic = true;
} else {
$TOPIC_ID = $arMessage['TOPIC_ID'];
}
if (intval($TOPIC_ID) > 0) {
// Add comment
$messageID = false;
$arFieldsMessage = array('POST_MESSAGE' => $arFields['TEXT_MESSAGE'], 'USE_SMILES' => 'Y', 'PARAM2' => $arElement['ID'], 'APPROVED' => 'Y');
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
if (is_array($arTmp)) {
if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
$GLOBALS["UF_FORUM_MESSAGE_DOC"] = $arTmp["UF_SONET_COM_DOC"];
} elseif (array_key_exists("UF_SONET_COM_FILE", $arTmp)) {
$arFieldsMessage["FILES"] = array();
foreach ($arTmp["UF_SONET_COM_FILE"] as $file_id) {
$arFieldsMessage["FILES"][] = array("FILE_ID" => $file_id);
}
}
}
$messageID = ForumAddMessage('REPLY', $FORUM_ID, $TOPIC_ID, 0, $arFieldsMessage, $sError, $sNote);
if (!$messageID) {
$strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
} else {
$dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $messageID));
while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
$ufFileID[] = $arAddedMessageFiles["FILE_ID"];
}
$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $messageID, LANGUAGE_ID);
CSocNetLogTools::AddComment_Review_UpdateElement($arElement, $TOPIC_ID, $bNewTopic);
$userID = $GLOBALS["USER"]->GetID();
if (CModule::IncludeModule("im") && intval($arElement["CREATED_BY"]) > 0 && $arElement["CREATED_BY"] != $userID) {
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arElement["CREATED_BY"], "CODE" => "L" . $arLog["ID"], "TYPE" => "N"), array("USER_ID"));
$arUnFollower = $rsUnFollower->Fetch();
if (!$arUnFollower) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arElement["CREATED_BY"], "FROM_USER_ID" => $userID, "LOG_ID" => $arLog["ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "wiki", "NOTIFY_EVENT" => "comment");
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arElement["NAME"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$arTmp = CSocNetLogTools::ProcessPath(array("ELEMENT_URL" => $arLog["URL"]), $arElement["CREATED_BY"]);
$serverName = $arTmp["SERVER_NAME"];
$url = $arTmp["URLS"]["ELEMENT_URL"];
$arMessageFields["NOTIFY_TAG"] = "WIKI|COMMENT|" . $arElement['ID'];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("WIKI_SONET_FROM_LOG_IM_COMMENT", array("#title#" => strlen($url) > 0 ? "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>" : htmlspecialcharsbx($arParams["TITLE"])));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("WIKI_SONET_FROM_LOG_IM_COMMENT", array("#title#" => htmlspecialcharsbx($arParams["TITLE"]))) . (strlen($url) > 0 ? " (" . $serverName . $url . ")" : "") . "#BR##BR#" . $arFields["TEXT_MESSAGE"];
CIMNotify::Add($arMessageFields);
}
}
}
} else {
$strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
}
} else {
$strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
}
} else {
$strError = GetMessage('SONET_ADD_COMMENT_SOURCE_ERROR');
//.........这里部分代码省略.........
示例15: GetMessage
$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;
}
if (empty($arResult['ERROR_MESSAGE'])) {