本文整理汇总了PHP中CSocNetLog::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLog::Update方法的具体用法?PHP CSocNetLog::Update怎么用?PHP CSocNetLog::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLog
的用法示例。
在下文中一共展示了CSocNetLog::Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: NewUserMessage
public static function NewUserMessage($USER_ID)
{
global $DB, $APPLICATION;
if (!CModule::IncludeModule('socialnetwork')) {
return false;
}
$USER_ID = intval($USER_ID);
if ($USER_ID <= 0) {
return false;
}
$arRights = self::GetRights($USER_ID);
if (!$arRights) {
return false;
}
$dbRes = CUser::GetByID($USER_ID);
if ($arUser = $dbRes->Fetch()) {
$arSoFields = array("ENTITY_TYPE" => SONET_INTRANET_NEW_USER_ENTITY, "EVENT_ID" => SONET_INTRANET_NEW_USER_EVENT_ID, "ENTITY_ID" => $USER_ID, "SOURCE_ID" => $USER_ID, "USER_ID" => $USER_ID, "=LOG_DATE" => $DB->CurrentTimeFunction(), "MODULE_ID" => "intranet", "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => GetMessage('I_NEW_USER_TITLE'), "MESSAGE" => '', "TEXT_MESSAGE" => '', "CALLBACK_FUNC" => false, "SITE_ID" => SITE_ID, "ENABLE_COMMENTS" => "Y", "RATING_TYPE_ID" => "INTRANET_NEW_USER", "RATING_ENTITY_ID" => $USER_ID);
// check that there wasn't message for this user
$dbRes = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => $arSoFields['ENTITY_TYPE'], 'ENTITY_ID' => $arSoFields['ENTITY_ID'], 'EVENT_ID' => $arSoFields['EVENT_ID'], 'SOURCE_ID' => $arSoFields['SOURCE_ID']));
if (!$dbRes->Fetch()) {
$logID = CSocNetLog::Add($arSoFields, false);
if (intval($logID) > 0) {
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
CSocNetLogRights::Add($logID, $arRights);
}
}
if (intval($logID) > 0) {
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
}
}
}
示例3: SendMessage
public static function SendMessage($ENTRY_ID, $SEND_TYPE = false)
{
global $DB, $APPLICATION, $USER;
$ENTRY_ID = intval($ENTRY_ID);
if ($ENTRY_ID <= 0) {
return false;
}
$dbEntry = CTimeManEntry::GetList(array(), array("ID" => $ENTRY_ID), false, false, array("ID", "USER_ID", "DATE_START", "USER_GENDER", "INACTIVE_OR_ACTIVATED"));
if (CModule::IncludeModule("socialnetwork") && ($arEntry = $dbEntry->Fetch())) {
$arRights = self::GetRights($arEntry["USER_ID"]);
if (!$arRights) {
return false;
}
$date = strlen($arEntry["DATE_START"]) > 0 ? MakeTimeStamp($arEntry["DATE_START"], CSite::GetDateFormat("FULL", $site_id)) > time() + CTimeZone::GetOffset() ? $DB->CharToDateFunction($arEntry["DATE_START"], "FULL", $site_id) : $DB->CurrentTimeFunction() : $DB->CurrentTimeFunction();
$arSoFields = array("EVENT_ID" => "timeman_entry", "=LOG_DATE" => $date, "MODULE_ID" => "timeman", "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => GetMessage("TIMEMAN_NOTIFY_TITLE") . $date_text, "MESSAGE" => '', "TEXT_MESSAGE" => '', "CALLBACK_FUNC" => false, "SOURCE_ID" => $ENTRY_ID, "SITE_ID" => SITE_ID, "ENABLE_COMMENTS" => "Y", "PARAMS" => serialize(array("FORUM_ID" => COption::GetOptionInt("timeman", "report_forum_id", ""))));
$arSoFields["ENTITY_TYPE"] = SONET_TIMEMAN_ENTRY_ENTITY;
$arSoFields["ENTITY_ID"] = $arEntry["USER_ID"];
$arSoFields["USER_ID"] = $USER->GetID();
//$arEntry["USER_ID"];
$dbRes = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => $arSoFields['ENTITY_TYPE'], 'ENTITY_ID' => $arSoFields['ENTITY_ID'], 'EVENT_ID' => $arSoFields['EVENT_ID'], 'SOURCE_ID' => $arSoFields['SOURCE_ID']));
$arRes = $dbRes->Fetch();
$bSend = false;
if ($arRes) {
$logID = $arRes['ID'];
if ($SEND_TYPE != 'A') {
$arSoFields["=LOG_UPDATE"] = $date;
CSocNetLog::Update($logID, $arSoFields);
$bSend = true;
if (IsModuleInstalled("im")) {
$arEntry["LOG_ID"] = $logID;
$arEntry["DATE_TEXT"] = FormatDate("j F", MakeTimeStamp($arEntry["DATE_START"], CSite::GetDateFormat("FULL", SITE_ID)));
if ($SEND_TYPE == "U") {
self::NotifyImApprove($arEntry);
} else {
self::NotifyImNew($arEntry);
}
}
}
} else {
if ($SEND_TYPE != 'U') {
$logID = CSocNetLog::Add($arSoFields, false);
if (intval($logID) > 0) {
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
CSocNetLogRights::Add($logID, $arRights);
if ($arEntry["INACTIVE_OR_ACTIVATED"] == "Y" && IsModuleInstalled("im")) {
$arEntry["LOG_ID"] = $logID;
$arEntry["DATE_TEXT"] = FormatDate("j F", MakeTimeStamp($arEntry["DATE_START"], CSite::GetDateFormat("FULL", SITE_ID)));
self::NotifyImNew($arEntry);
}
$bSend = true;
}
}
}
if ($bSend && intval($logID) > 0) {
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
}
return $logID;
}
}
示例4: array
$arSoFields["ENTITY_ID"] = $arBlog["OWNER_ID"];
$arSoFields["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"], "group_id" => $arParams["SOCNET_GROUP_ID"], "post_id" => $arPost["ID"]));
}
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) {
示例5: NotifyError
private function NotifyError()
{
if ($this->arExternalSale == null) {
$this->arExternalSale = CCrmExternalSale::GetDefaultSettings($this->externalSaleId);
}
if (intval($this->arExternalSale["GROUP_ID"]) <= 0) {
return true;
}
static $isSNIncluded = null;
if ($isSNIncluded === null) {
$isSNIncluded = CModule::IncludeModule("socialnetwork");
}
if (!$isSNIncluded) {
return;
}
$ar = array("#NAME#" => $this->arExternalSale["NAME"], "#URL#" => "/crm/configs/external_sale/", "#DATE#" => date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), time()));
$message = GetMessage("CRM_GCES_NOTIFY_ERROR_MESSAGE", $ar);
$arFields = array("EVENT_ID" => "crm_10_errors", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => "SYSTEM MESSAGE", "TITLE" => GetMessage("CRM_GCES_NOTIFY_ERROR_TITLE", array("#NAME#" => $this->arExternalSale["NAME"])), "MESSAGE" => $message, "TEXT_MESSAGE" => HTMLToTxt($message), "MODULE_ID" => "crm", "CALLBACK_FUNC" => false, "SOURCE_ID" => false, "ENABLE_COMMENTS" => "Y", "ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $this->arExternalSale["GROUP_ID"], "URL" => "");
$logId = CSocNetLog::Add($arFields, false);
if (intval($logId) > 0) {
$arPerms = array("SG" . $this->arExternalSale["GROUP_ID"], "SG" . $this->arExternalSale["GROUP_ID"] . "_A", "SG" . $this->arExternalSale["GROUP_ID"] . "_E", "SG" . $this->arExternalSale["GROUP_ID"] . "_K");
CSocNetLog::Update($logId, array("TMP_ID" => $logId));
CSocNetLogRights::Add($logId, $arPerms);
CSocNetLog::SendEvent($logId, "SONET_NEW_EVENT", $logId);
return $logId;
}
if (($ex = $GLOBALS["APPLICATION"]->GetException()) !== false) {
$this->AddError($ex->GetID(), $ex->GetString());
} else {
$this->AddError("CDA", "Notify error");
}
return false;
}
示例6: UpdateLogData
function UpdateLogData($log_id, $bSetDate = true, $bSetDateByLastComment = false)
{
$dbResult = CSocNetLogComments::GetList(array(), array("LOG_ID" => $log_id), array());
$comments_count = $dbResult;
$dbResult = CSocNetLog::GetList(array(), array("ID" => $log_id), false, false, array("ID", "COMMENTS_COUNT", "LOG_DATE"));
while ($arResult = $dbResult->Fetch()) {
$arFields = array("COMMENTS_COUNT" => $comments_count);
if ($bSetDateByLastComment) {
$dbComment = CSocNetLogComments::GetList(array("LOG_DATE" => "DESC"), array("LOG_ID" => $log_id), false, false, array("ID", "LOG_DATE"));
if ($arComment = $dbComment->Fetch()) {
$arFields["LOG_UPDATE"] = $arComment["LOG_DATE"];
} else {
$arFields["LOG_UPDATE"] = $arResult["LOG_DATE"];
}
} elseif ($bSetDate) {
$arFields["=LOG_UPDATE"] = $GLOBALS["DB"]->CurrentTimeFunction();
}
CSocNetLog::Update($arResult["ID"], $arFields);
CSocNetLogFollow::DeleteByLogID($log_id, "Y", true);
}
}
示例7: MessageUpdate
public static function MessageUpdate($REPORT_ID, $arReport = array(), $arFields = array())
{
global $DB, $USER;
$curUser = $USER->GetID();
if (CModule::IncludeModule("socialnetwork")) {
$dbLog = CSocNetLog::GetList(array(), array("SOURCE_ID" => $REPORT_ID, "EVENT_ID" => "report"));
if (!($arLog = $dbLog->Fetch())) {
$LOG_ID = CReportNotifications::SendMessage($REPORT_ID, false);
} else {
$LOG_ID = $arLog["ID"];
CSocNetLog::Update($LOG_ID, array("USER_ID" => $curUser, "=LOG_DATE" => $DB->CurrentTimeFunction(), "=LOG_UPDATE" => $DB->CurrentTimeFunction()));
CUserCounter::IncrementWithSelect(CSocNetLogCounter::GetSubSelect($LOG_ID, $arLog["ENTITY_TYPE"], $arLog["ENTITY_ID"], $arLog["EVENT_ID"], $arLog["USER_ID"]));
}
if (CModule::IncludeModule("im") && is_array($arFields) && is_array($arReport) && intval($arReport["USER_ID"]) > 0 && $arReport["USER_ID"] != $curUser) {
$date_text = "";
$date_from = FormatDate("j F", MakeTimeStamp($arReport["DATE_FROM"], CSite::GetDateFormat("FULL", SITE_ID)));
$date_to = FormatDate("j F", MakeTimeStamp($arReport["DATE_TO"], CSite::GetDateFormat("FULL", SITE_ID)));
if ($date_from == $date_to) {
$date_text = $date_to;
} else {
$date_text = $date_from . " - " . $date_to;
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arReport["USER_ID"], "FROM_USER_ID" => $curUser, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "timeman", "NOTIFY_EVENT" => "report_approve", "NOTIFY_TAG" => "TIMEMAN|REPORT|" . $arReport["ID"] . "_" . $arFields["MARK"]);
$gender_suffix = "";
$dbUser = CUser::GetByID($curUser);
if ($arUser = $dbUser->Fetch()) {
switch ($arUser["PERSONAL_GENDER"]) {
case "M":
$gender_suffix = "_M";
break;
case "F":
$gender_suffix = "_F";
break;
default:
$gender_suffix = "";
}
}
$reports_page = COption::GetOptionString("timeman", "WORK_REPORT_PATH", "/company/work_report.php");
$arTmp = CSocNetLogTools::ProcessPath(array("REPORTS_PAGE" => $reports_page), $arReport["USER_ID"]);
switch ($arFields["MARK"]) {
case "G":
$mark = "G";
break;
case "B":
$mark = "B";
break;
case "X":
$mark = "X";
break;
default:
$mark = "N";
}
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("REPORT_FULL_IM_APPROVE" . $gender_suffix . "_" . $mark, array("#period#" => "<a href=\"" . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $REPORT_ID . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($date_text) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("REPORT_FULL_IM_APPROVE" . $gender_suffix . "_" . $mark, array("#period#" => htmlspecialcharsbx($date_text))) . " ( " . $arTmp["SERVER_NAME"] . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $REPORT_ID . " )";
CIMNotify::Add($arMessageFields);
}
$dbLogRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $LOG_ID));
while ($arRight = $dbLogRights->Fetch()) {
$arRights[] = $arRight["GROUP_CODE"];
}
if (!in_array("U" . $curUser, $arRights)) {
CSocNetLogRights::Add($LOG_ID, "U" . $curUser);
}
return $LOG_ID;
} else {
return false;
}
}
示例8: array
if ($arParams["MESSAGE_TYPE"] == "NEW") {
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"]);
}
示例9: __deprecated_Add
/**
* WARNING! This method is transitional and can be changed without
* any notifications! Don't use it.
*
* @deprecated
*/
public static function __deprecated_Add($commentText, $forumTopicId, $forumId, $nameTemplate, $arTask, $permissions, $commentId, $givenUserId, $imageWidth, $imageHeight, $arSmiles, $arForum, $messagesPerPage, $arUserGroupArray, $backPage, $strMsgAddComment, $strMsgEditComment, $strMsgNewTask, $componentName, &$outForumTopicId, &$arErrorCodes, &$outStrUrl, $arFieldsAdditional = array())
{
global $DB;
if (is_array($arTask)) {
if (!array_key_exists('~TITLE', $arTask)) {
$arTmpTask = $arTask;
foreach ($arTmpTask as $key => $value) {
if (substr($key, 0, 1) !== '~') {
$arTask['~' . $key] = $arTmpTask[$key];
}
}
}
}
$MID = 0;
$TID = 0;
if ($forumTopicId > 0 && CForumTopic::GetByID($forumTopicId) === false) {
$forumTopicId = false;
}
if ($forumTopicId <= 0) {
$arUserStart = array("ID" => intVal($arTask["CREATED_BY"]), "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
if ($arUserStart["ID"] > 0) {
$res = array();
$db_res = CForumUser::GetListEx(array(), array("USER_ID" => $arTask["CREATED_BY"]));
if ($db_res && ($res = $db_res->Fetch())) {
$res["FORUM_USER_ID"] = intVal($res["ID"]);
$res["ID"] = $res["USER_ID"];
} else {
$db_res = CUser::GetByID($arTask["CREATED_BY"]);
if ($db_res && ($res = $db_res->Fetch())) {
$res["SHOW_NAME"] = COption::GetOptionString("forum", "USER_SHOW_NAME", "Y");
$res["USER_PROFILE"] = "N";
}
}
if (!empty($res)) {
$arUserStart = $res;
$sName = $res["SHOW_NAME"] == "Y" ? trim(CUser::FormatName($nameTemplate, $res)) : "";
$arUserStart["NAME"] = empty($sName) ? trim($res["LOGIN"]) : $sName;
}
}
$arUserStart["NAME"] = empty($arUserStart["NAME"]) ? $GLOBALS["FORUM_STATUS_NAME"]["guest"] : $arUserStart["NAME"];
$DB->StartTransaction();
$arFields = array("TITLE" => $arTask["~TITLE"], "FORUM_ID" => $forumId, "USER_START_ID" => $arUserStart["ID"], "USER_START_NAME" => $arUserStart["NAME"], "LAST_POSTER_NAME" => $arUserStart["NAME"], "APPROVED" => "Y", "PERMISSION_EXTERNAL" => $permissions, "PERMISSION" => $permissions, "NAME_TEMPLATE" => $nameTemplate, 'XML_ID' => 'TASK_' . $arTask['ID']);
$TID = CForumTopic::Add($arFields);
if (intVal($TID) <= 0) {
$arErrorCodes[] = array('code' => 'topic is not created');
} else {
$arFields = array("FORUM_TOPIC_ID" => $TID);
$task = new CTasks();
$task->Update($arTask["ID"], $arFields);
}
if (!empty($arErrorCodes)) {
$DB->Rollback();
return false;
} else {
$DB->Commit();
}
}
$arFieldsG = array("POST_MESSAGE" => $commentText, "AUTHOR_NAME" => '', "AUTHOR_EMAIL" => $GLOBALS['USER']->GetEmail(), "USE_SMILES" => NULL, "PARAM2" => $arTask['ID'], "TITLE" => $arTask["~TITLE"], "PERMISSION_EXTERNAL" => $permissions, "PERMISSION" => $permissions);
// UF_* forwarding
if (is_array($arFieldsAdditional)) {
foreach ($arFieldsAdditional as $field => $value) {
if (strlen($field) && substr($field, 0, 3) == 'UF_') {
$arFieldsG[$field] = $value;
$GLOBALS[$field] = $value;
// strange behaviour required for ForumMessageAdd() to handle UF_* properly
}
}
}
if (!empty($_FILES["REVIEW_ATTACH_IMG"])) {
$arFieldsG["ATTACH_IMG"] = $_FILES["REVIEW_ATTACH_IMG"];
} else {
$arFiles = array();
if (!empty($_REQUEST["FILES"])) {
foreach ($_REQUEST["FILES"] as $key) {
$arFiles[$key] = array("FILE_ID" => $key);
if (!in_array($key, $_REQUEST["FILES_TO_UPLOAD"])) {
$arFiles[$key]["del"] = "Y";
}
}
}
if (!empty($_FILES)) {
$res = array();
foreach ($_FILES as $key => $val) {
if (substr($key, 0, strLen("FILE_NEW")) == "FILE_NEW" && !empty($val["name"])) {
$arFiles[] = $_FILES[$key];
}
}
}
if (!empty($arFiles)) {
$arFieldsG["FILES"] = $arFiles;
}
}
$TOPIC_ID = $forumTopicId > 0 ? $forumTopicId : $TID;
$MESSAGE_ID = 0;
//.........这里部分代码省略.........
示例10: DeleteRelation
function DeleteRelation($senderUserID, $targetUserID)
{
global $APPLICATION;
$senderUserID = IntVal($senderUserID);
if ($senderUserID <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_SENDER_USER_ID"), "ERROR_SENDER_USER_ID");
return false;
}
$targetUserID = IntVal($targetUserID);
if ($targetUserID <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_TARGET_USER_ID"), "ERROR_TARGET_USER_ID");
return false;
}
$arRelation = CSocNetUserRelations::GetByUserID($senderUserID, $targetUserID);
if (!$arRelation)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_RELATION_NOT_FOUND"), "ERROR_RELATION_NOT_FOUND");
return false;
}
if (CSocNetUserRelations::Delete($arRelation["ID"]))
{
$logID = CSocNetLog::Add(
array(
"ENTITY_TYPE" => SONET_ENTITY_USER,
"ENTITY_ID" => $senderUserID,
"EVENT_ID" => "system_friends",
"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
"TITLE_TEMPLATE" => false,
"TITLE" => "unfriend",
"MESSAGE" => $targetUserID,
"URL" => false,
"MODULE_ID" => false,
"CALLBACK_FUNC" => false,
"USER_ID" => $targetUserID,
),
false
);
if (intval($logID) > 0)
{
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
$perm = CSocNetUserPerms::GetOperationPerms($senderUserID, "viewfriends");
if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS)))
CSocNetLogRights::Add($logID, array("SA", "U".$senderUserID, "S".SONET_ENTITY_USER.$senderUserID."_".$perm));
elseif ($perm == SONET_RELATIONS_TYPE_NONE)
CSocNetLogRights::Add($logID, array("SA", "U".$senderUserID));
elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED)
CSocNetLogRights::Add($logID, array("SA", "AU"));
elseif ($perm == SONET_RELATIONS_TYPE_ALL)
CSocNetLogRights::Add($logID, array("SA", "G2"));
$tmpID = $logID;
}
$logID2 = CSocNetLog::Add(
array(
"ENTITY_TYPE" => SONET_ENTITY_USER,
"ENTITY_ID" => $targetUserID,
"EVENT_ID" => "system_friends",
"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
"TITLE_TEMPLATE" => false,
"TITLE" => "unfriend",
"MESSAGE" => $senderUserID,
"URL" => false,
"MODULE_ID" => false,
"CALLBACK_FUNC" => false,
"USER_ID" => $senderUserID,
"TMP_ID" => (intval($tmpID) > 0 ? $tmpID : false),
),
false
);
if (intval($logID2) > 0)
{
$perm = CSocNetUserPerms::GetOperationPerms($targetUserID, "viewfriends");
if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS)))
CSocNetLogRights::Add($logID2, array("SA", "U".$targetUserID, "S".SONET_ENTITY_USER.$targetUserID."_".$perm));
elseif ($perm == SONET_RELATIONS_TYPE_NONE)
CSocNetLogRights::Add($logID2, array("SA", "U".$targetUserID));
elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED)
CSocNetLogRights::Add($logID2, array("SA", "AU"));
elseif ($perm == SONET_RELATIONS_TYPE_ALL)
CSocNetLogRights::Add($logID2, array("SA", "G2"));
}
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $tmpID);
if ($arRelation["RELATION"] == SONET_RELATIONS_FRIEND)
$GLOBALS["DB"]->Query("DELETE FROM b_sonet_event_user_view WHERE
ENTITY_TYPE = '".SONET_ENTITY_USER."'
AND (
(USER_ID = ".$arRelation["FIRST_USER_ID"]." AND ENTITY_ID = ".$arRelation["SECOND_USER_ID"].")
OR (USER_ID = ".$arRelation["SECOND_USER_ID"]." AND ENTITY_ID = ".$arRelation["FIRST_USER_ID"].")
OR (ENTITY_ID = ".$arRelation["FIRST_USER_ID"]." AND USER_IM_ID = ".$arRelation["SECOND_USER_ID"].")
//.........这里部分代码省略.........
示例11: __InTaskAdd2Log
function __InTaskAdd2Log($entityType, $entityId, $type, $title, $message, $url)
{
if ($type == "add") {
$template = GetMessage("INTASK_2LOG_ADD");
} elseif ($type == "update") {
$template = GetMessage("INTASK_2LOG_UPDATE");
} elseif ($type == "delete") {
$template = GetMessage("INTASK_2LOG_DELETE");
}
$logID = CSocNetLog::Add(array("ENTITY_TYPE" => $entityType, "ENTITY_ID" => $entityId, "EVENT_ID" => "tasks", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => $template, "TITLE" => $title, "MESSAGE" => nl2br($message), "TEXT_MESSAGE" => $message, "URL" => $url, "MODULE_ID" => false, "CALLBACK_FUNC" => false));
if (intval($logID) > 0) {
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
}
}
示例12: 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;
}
示例13: AddComment_Tasks
function AddComment_Tasks($arFields)
{
global $DB;
if (!CModule::IncludeModule("forum")) {
return false;
}
if (!CModule::IncludeModule("tasks")) {
return false;
}
$ufFileID = array();
$ufDocID = array();
$dbResult = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID"));
if ($arLog = $dbResult->Fetch()) {
$rsTask = CTasks::GetById($arLog["SOURCE_ID"]);
if ($arTask = $rsTask->Fetch()) {
// read shared cross-site FORUM_ID
$forumID = COption::GetOptionString("tasks", "task_forum_id", 0, $siteId = '');
if ($forumID) {
if (!$arTask["FORUM_TOPIC_ID"]) {
$arUserStart = array("ID" => intVal($arTask["CREATED_BY"]), "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
if ($arUserStart["ID"] > 0) {
$res = array();
$db_res = CForumUser::GetListEx(array(), array("USER_ID" => $arTask["CREATED_BY"]));
if ($db_res && ($res = $db_res->Fetch())) {
$res["FORUM_USER_ID"] = intVal($res["ID"]);
$res["ID"] = $res["USER_ID"];
} else {
$db_res = CUser::GetByID($arTask["CREATED_BY"]);
if ($db_res && ($res = $db_res->Fetch())) {
$res["SHOW_NAME"] = COption::GetOptionString("forum", "USER_SHOW_NAME", "Y");
$res["USER_PROFILE"] = "N";
}
}
if (!empty($res)) {
$arUserStart = $res;
$sName = $res["SHOW_NAME"] == "Y" ? trim($res["NAME"] . " " . $res["LAST_NAME"]) : "";
$arUserStart["NAME"] = empty($sName) ? trim($res["LOGIN"]) : $sName;
}
}
$arUserStart["NAME"] = empty($arUserStart["NAME"]) ? $GLOBALS["FORUM_STATUS_NAME"]["guest"] : $arUserStart["NAME"];
$DB->StartTransaction();
$arTopicFields = array("TITLE" => $arTask["TITLE"], "FORUM_ID" => $forumID, "USER_START_ID" => $arUserStart["ID"], "USER_START_NAME" => $arUserStart["NAME"], "LAST_POSTER_NAME" => $arUserStart["NAME"], "PERMISSION_EXTERNAL" => 'E', "PERMISSION" => 'E', "APPROVED" => "Y", 'XML_ID' => 'TASK_' . $arTask['ID']);
$TID = CForumTopic::Add($arTopicFields);
if (intVal($TID) > 0) {
$arFieldsFirstMessage = array("POST_MESSAGE" => $arTopicFields['XML_ID'], "AUTHOR_ID" => $arTopicFields["USER_START_ID"], "AUTHOR_NAME" => $arTopicFields["USER_START_NAME"], "FORUM_ID" => $arTopicFields["FORUM_ID"], "TOPIC_ID" => $TID, "APPROVED" => "Y", "NEW_TOPIC" => "Y", "PARAM1" => 'TK', "PARAM2" => $arTask['ID'], "PERMISSION_EXTERNAL" => 'E', "PERMISSION" => 'E');
CForumMessage::Add($arFieldsFirstMessage, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N"));
$arTask["FORUM_TOPIC_ID"] = $TID;
$arTaskFields = array("FORUM_TOPIC_ID" => $TID);
$task = new CTasks();
$task->Update($arTask["ID"], $arTaskFields);
}
if (!$arTask["FORUM_TOPIC_ID"]) {
$DB->Rollback();
} else {
$DB->Commit();
}
} else {
// override forumId by fact forum, attached to the task
if ($arTopic = CForumTopic::getByID($arTask['FORUM_TOPIC_ID'])) {
$forumID = $arTopic['FORUM_ID'];
}
}
if ($forumID && $arTask["FORUM_TOPIC_ID"]) {
$userID = $GLOBALS["USER"]->GetID();
$arLogSites = array();
$rsLogSite = CSocNetLog::GetSite($arLog["ID"]);
while ($arLogSite = $rsLogSite->Fetch()) {
$arLogSites[] = $arLogSite["LID"];
}
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin($arLogSites);
if ($arFields["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "tasks", "view", $bCurrentUserIsAdmin)) {
$strPermission = "I";
}
} else {
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "tasks", "view", $bCurrentUserIsAdmin)) {
$strPermission = "I";
}
}
$arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "PERMISSION_EXTERNAL" => "Q", "PERMISSION" => $strPermission, "APPROVED" => "Y");
$MESSAGE_TYPE = 'REPLY';
$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($MESSAGE_TYPE, $forumID, $arTask["FORUM_TOPIC_ID"], 0, $arFieldsMessage, $sError, $sNote);
// get UF DOC value and FILE_ID there
if ($messageID > 0) {
$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);
//.........这里部分代码省略.........
示例14: DeleteRelation
function DeleteRelation($userID, $groupID)
{
global $APPLICATION;
$userID = IntVal($userID);
if ($userID <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_USER_ID");
return false;
}
$groupID = IntVal($groupID);
if ($groupID <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_GROUPID"), "ERROR_GROUPID");
return false;
}
$dbResult = CSocNetUserToGroup::GetList(
array(),
array(
"GROUP_ID" => $groupID,
"USER_ID" => $userID,
),
false,
false,
array("ID", "ROLE", "GROUP_VISIBLE")
);
if ($arResult = $dbResult->Fetch())
{
if ($arResult["ROLE"] != SONET_ROLES_USER && $arResult["ROLE"] != SONET_ROLES_MODERATOR)
return false;
if (CSocNetUserToGroup::Delete($arResult["ID"]))
{
$arGroupSiteID = array();
$rsGroupSite = CSocNetGroup::GetSite($groupID);
while($arGroupSite = $rsGroupSite->Fetch())
{
$arGroupSiteID[] = $arGroupSite["LID"];
//get server name
$rsSites = CSite::GetByID($arGroupSite["LID"]);
$arSite = $rsSites->Fetch();
$serverName = $arSite["SERVER_NAME"];
if (strlen($serverName) <= 0)
{
if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0)
$serverName = SITE_SERVER_NAME;
else
$serverName = COption::GetOptionString("main", "server_name", $GLOBALS["SERVER_NAME"]);
}
if (strlen($serverName) > 0)
{
$protocol = (CMain::IsHTTPS() ? "https" : "http");
$serverName = $protocol."://".$serverName;
}
}
$fullWorkgroupsUrl = $serverName.COption::GetOptionString("socialnetwork", "workgroups_page", false, $arGroupSiteID["0"]);
$logID = CSocNetLog::Add(
array(
"ENTITY_TYPE" => SONET_ENTITY_GROUP,
"ENTITY_ID" => $groupID,
"EVENT_ID" => "system",
"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
"TITLE_TEMPLATE" => false,
"TITLE" => "unjoin",
"MESSAGE" => $userID,
"URL" => $fullWorkgroupsUrl,
"MODULE_ID" => false,
"CALLBACK_FUNC" => false,
"USER_ID" => $userID,
"SITE_ID" => $arGroupSiteID
),
false
);
if (intval($logID) > 0)
{
$tmpID = $logID;
CSocNetLog::Update($logID, array("TMP_ID" => $tmpID));
CSocNetLogRights::Add($logID, array("SA", "U".$userID, "S".SONET_ENTITY_GROUP.$groupID, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_OWNER, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_MODERATOR, "S".SONET_ENTITY_GROUP.$groupID."_".SONET_ROLES_USER));
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $tmpID);
}
}
else
{
$errorMessage = "";
if ($e = $APPLICATION->GetException())
$errorMessage = $e->GetString();
if (StrLen($errorMessage) <= 0)
$errorMessage = GetMessage("SONET_UR_ERROR_CREATE_USER2GROUP");
$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_DELETE_RELATION");
return false;
}
}
//.........这里部分代码省略.........
示例15: CheckRequest
function CheckRequest()
{
global $DB;
$result = "";
if (!CModule::IncludeModule("socialnetwork")) {
return $result;
}
$current_time = time();
$time_of_exec = false;
$rsScheme = CXDILFScheme::GetList(array(), array("ACTIVE" => "Y", "AUTO" => "Y"));
while (($arScheme = $rsScheme->Fetch()) && $time_of_exec === false) {
if ($arScheme["LAST_EXECUTED"] == '') {
continue;
}
$last_executed = MakeTimeStamp(ConvertDateTime($arScheme["LAST_EXECUTED"], "DD.MM.YYYY HH:MI:SS"), "DD.MM.YYYY HH:MI:SS");
if ($last_executed <= 0) {
continue;
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arScheme["EVENT_ID"]);
if (array_key_exists("REAL_EVENT_ID", $arEventTmp) && strlen($arEventTmp["REAL_EVENT_ID"]) > 0) {
$arScheme["EVENT_ID"] = $arEventTmp["REAL_EVENT_ID"];
}
//parse schedule
$arDoM = CXDImport::ParseDaysOfMonth($arScheme["DAYS_OF_MONTH"]);
$arDoW = CXDImport::ParseDaysOfWeek($arScheme["DAYS_OF_WEEK"]);
$arToD = CXDImport::ParseTimesOfDay($arScheme["TIMES_OF_DAY"]);
if ($arToD) {
sort($arToD, SORT_NUMERIC);
}
$arSDate = localtime($last_executed);
//sdate = truncate(last_execute)
$sdate = mktime(0, 0, 0, $arSDate[4] + 1, $arSDate[3], $arSDate[5] + 1900);
while ($sdate < $current_time && $time_of_exec === false) {
$arSDate = localtime($sdate);
if ($arSDate[6] == 0) {
$arSDate[6] = 7;
}
//determine if date is good for execution
if ($arDoM) {
$flag = array_search($arSDate[3], $arDoM);
if ($arDoW) {
$flag = array_search($arSDate[6], $arDoW);
}
} elseif ($arDoW) {
$flag = array_search($arSDate[6], $arDoW);
} else {
$flag = false;
}
if ($flag !== false && $arToD) {
foreach ($arToD as $intToD) {
if ($sdate + $intToD > $last_executed && $sdate + $intToD <= $current_time) {
$time_of_exec = $sdate + $intToD;
break;
}
}
}
$sdate = mktime(0, 0, 0, date("m", $sdate), date("d", $sdate) + 1, date("Y", $sdate));
//next day
}
if ($time_of_exec !== false) {
if ($arScheme["TYPE"] == "XML") {
$arParams = array();
if (strlen($arScheme["PARAMS"]) > 0) {
$arTmp = explode("&", $arScheme["PARAMS"]);
if (is_array($arTmp) && count($arTmp) > 0) {
foreach ($arTmp as $pair) {
list($key, $value) = explode("=", $pair);
$arParams[$key] = $value;
}
}
}
$arResponse = CXDILFSchemeXML::Request($arScheme["HOST"], $arScheme["PAGE"], $arScheme["PORT"], $arScheme["METHOD"], "http://" . $arScheme["HOST"], $arScheme["LOGIN"], $arScheme["PASSWORD"], $arParams);
if ($arResponse && is_array($arResponse)) {
if (XDI_DEBUG) {
CXDImport::WriteToLog("Successful webservice response, scheme ID: " . $arScheme["ID"], "RXML");
}
$entityName = $arScheme["NAME"];
if ($arScheme["EVENT_ID"] == "news") {
$rsIBlock = CIBlock::GetList(array("ID" => "ASC"), array("ACTIVE" => "Y", "TYPE" => "news", "ID" => $arScheme["ENTITY_ID"]));
if ($arIBlock = $rsIBlock->Fetch()) {
$entityName = $arIBlock["NAME"];
}
}
$arLogParams = array("ENTITY_NAME" => $entityName, "ENTITY_URL" => $arResponse["URL"]);
$arSonetFields = array("SITE_ID" => $arScheme["LID"], "ENTITY_TYPE" => $arScheme["ENTITY_TYPE"], "ENTITY_ID" => $arScheme["ENTITY_ID"], "EVENT_ID" => $arScheme["EVENT_ID"], "ENABLE_COMMENTS" => $arScheme["ENABLE_COMMENTS"], "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => $arResponse["TITLE"], "TITLE" => $arResponse["TITLE"], "MESSAGE" => $arResponse["MESSAGE"], "TEXT_MESSAGE" => $arResponse["TEXT_MESSAGE"], "URL" => $arResponse["URL"], "PARAMS" => serialize($arLogParams), "MODULE_ID" => false, "CALLBACK_FUNC" => false);
$logID = CSocNetLog::Add($arSonetFields, false);
if (intval($logID) > 0) {
$arUpdateFields = array("TMP_ID" => $logID, "RATING_TYPE_ID" => "LOG_ENTRY", "RATING_ENTITY_ID" => $logID);
CSocNetLog::Update($logID, $arUpdateFields);
CXDILFScheme::SetSonetLogRights($logID, $arScheme["ENTITY_TYPE"], $arScheme["ENTITY_ID"], $arScheme["EVENT_ID"]);
CSocNetLog::CounterIncrement($logID);
if ($arScheme["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP && intval($arScheme["ENTITY_ID"]) > 0) {
$notify_title_tmp = str_replace(array("\r\n", "\n"), " ", $arScheme["NAME"]);
$notify_title = TruncateText($notify_title_tmp, 100);
$notify_title_out = TruncateText($notify_title_tmp, 255);
$arNotifyParams = array("LOG_ID" => $logID, "GROUP_ID" => intval($arScheme["ENTITY_ID"]), "NOTIFY_MESSAGE" => "", "URL" => "", "MESSAGE" => GetMessage("LFP_CLASS_SCHEME_IM_ADD", array("#title#" => $notify_title)), "MESSAGE_OUT" => GetMessage("LFP_CLASS_SCHEME_IM_ADD", array("#title#" => $notify_title_out)), "EXCLUDE_USERS" => array());
CSocNetSubscription::NotifyGroup($arNotifyParams);
}
}
} else {
//.........这里部分代码省略.........