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


PHP CExtranet::GetExtranetSiteID方法代码示例

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


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

示例1: RequestToSonetGroups

 public static function RequestToSonetGroups($arUserId, $arGroupCode, $arGroupName, $bExtranetUser = false)
 {
     $arGroupToAdd = array();
     $strError = false;
     if (!is_array($arUserId)) {
         $arUserId = array($arUserId);
     }
     if (is_array($arGroupCode) && !empty($arGroupCode) && CModule::IncludeModule("socialnetwork")) {
         foreach ($arGroupCode as $group_code) {
             if ($bExtranetUser && preg_match('/^(SGN\\d+)$/', $group_code, $match) && is_array($arGroupName) && isset($arGroupName[$match[1]]) && strlen($arGroupName[$match[1]]) > 0 && CModule::IncludeModule("extranet") && (CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false) || $GLOBALS["APPLICATION"]->GetGroupRight("socialnetwork", false, "Y", "Y", array(CExtranet::GetExtranetSiteID(), false)) >= "K")) {
                 // check and create group, for extranet only
                 $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => CExtranet::GetExtranetSiteID()), false, false, array("ID"));
                 if ($arSubject = $dbSubjects->GetNext()) {
                     $arSocNetGroupFields = array("NAME" => $arGroupName[$match[1]], "DESCRIPTION" => "", "VISIBLE" => "N", "OPENED" => "N", "CLOSED" => "N", "SUBJECT_ID" => $arSubject["ID"], "INITIATE_PERMS" => "E", "SPAM_PERMS" => "K", "SITE_ID" => array($SITE_ID, CExtranet::GetExtranetSiteID()));
                     if ($group_id = CSocNetGroup::CreateGroup($GLOBALS["USER"]->GetID(), $arSocNetGroupFields, false)) {
                         $arGroupToAdd[] = $group_id;
                     } elseif ($e = $GLOBALS["APPLICATION"]->GetException()) {
                         $strError = $e->GetString();
                     }
                 }
             } elseif (preg_match('/^SG(\\d+)$/', $group_code, $match)) {
                 $group_id = $match[1];
                 if (($arGroup = CSocNetGroup::GetByID($group_id)) && ($arCurrentUserPerms = CSocNetUserToGroup::InitUserPerms($GLOBALS["USER"]->GetID(), $arGroup, CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false))) && $arCurrentUserPerms["UserCanInitiate"] && $arGroup["CLOSED"] != "Y") {
                     $arGroupToAdd[] = $group_id;
                 }
             }
         }
         if (!$strError) {
             foreach ($arGroupToAdd as $group_id) {
                 foreach ($arUserId as $user_id) {
                     if (!CSocNetUserToGroup::SendRequestToJoinGroup($GLOBALS["USER"]->GetID(), $user_id, $group_id, "", false)) {
                         if ($e = $GLOBALS["APPLICATION"]->GetException()) {
                             $strError .= $e->GetString();
                         }
                     }
                 }
             }
         }
     }
     return $strError;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:41,代码来源:invite_dialog.php

示例2: SendEvent

 function SendEvent($ID, $mailTemplate = "SONET_NEW_EVENT")
 {
     $ID = IntVal($ID);
     if ($ID <= 0) {
         return false;
     }
     $arFilter = array("ID" => $ID);
     $dbLogComments = CSocNetLogComments::GetList(array(), $arFilter, false, false, array("ID", "LOG_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "EVENT_ID", "LOG_DATE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "GROUP_NAME", "CREATED_BY_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_LOGIN", "LOG_SITE_ID", "SOURCE_ID", "LOG_SOURCE_ID"));
     $arLogComment = $dbLogComments->Fetch();
     if (!$arLogComment) {
         return false;
     }
     $arLog = array();
     if (intval($arLogComment["LOG_ID"]) > 0) {
         $dbLog = CSocNetLog::GetList(array(), array("ID" => $arLogComment["LOG_ID"]));
         $arLog = $dbLog->Fetch();
         if (!$arLog) {
             $arLog = array();
         }
     }
     $arEvent = CSocNetLogTools::FindLogCommentEventByID($arLogComment["EVENT_ID"]);
     if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent) && strlen($arEvent["CLASS_FORMAT"]) > 0 && strlen($arEvent["METHOD_FORMAT"]) > 0) {
         $dbSiteCurrent = CSite::GetByID(SITE_ID);
         if ($arSiteCurrent = $dbSiteCurrent->Fetch()) {
             if ($arSiteCurrent["LANGUAGE_ID"] != LANGUAGE_ID) {
                 $arLogComment["MAIL_LANGUAGE_ID"] = $arSiteCurrent["LANGUAGE_ID"];
             }
         }
         $arLogComment["FIELDS_FORMATTED"] = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arLogComment, array(), true, $arLog);
     }
     if (array_key_exists($arLogComment["ENTITY_TYPE"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"]) && array_key_exists("HAS_MY", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]) && $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["HAS_MY"] == "Y" && array_key_exists("CLASS_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]) && array_key_exists("METHOD_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]) && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["CLASS_OF"]) > 0 && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["METHOD_OF"]) > 0 && method_exists($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["METHOD_OF"])) {
         $arOfEntities = call_user_func(array($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["METHOD_OF"]), $arLogComment["ENTITY_ID"]);
     }
     $arListParams = array("USE_SUBSCRIBE" => "Y", "ENTITY_TYPE" => $arLogComment["ENTITY_TYPE"], "ENTITY_ID" => $arLogComment["ENTITY_ID"], "EVENT_ID" => $arLogComment["EVENT_ID"], "USER_ID" => $arLogComment["USER_ID"], "OF_ENTITIES" => $arOfEntities, "TRANSPORT" => array("M", "X"));
     $arLogSites = array();
     $rsLogSite = CSocNetLog::GetSite($arLog["ID"]);
     while ($arLogSite = $rsLogSite->Fetch()) {
         $arLogSites[] = $arLogSite["LID"];
     }
     if (CModule::IncludeModule("extranet")) {
         if ($arLogComment["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
             $arSites = array();
             $dbSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
             while ($arSite = $dbSite->Fetch()) {
                 $arSites[$arSite["ID"]] = array("DIR" => strlen(trim($arSite["DIR"])) > 0 ? $arSite["DIR"] : "/", "SERVER_NAME" => strlen(trim($arSite["SERVER_NAME"])) > 0 ? $arSite["SERVER_NAME"] : COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]));
             }
             $intranet_site_id = CSite::GetDefSite();
         }
         $arIntranetUsers = CExtranet::GetIntranetUsers();
         $extranet_site_id = CExtranet::GetExtranetSiteID();
     }
     $dbSubscribers = CSocNetLogEvents::GetList(array("TRANSPORT" => "DESC"), array("USER_ACTIVE" => "Y", "SITE_ID" => array_merge($arLogSites, array(false))), false, false, array("USER_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN", "USER_LID", "USER_EMAIL", "TRANSPORT"), $arListParams);
     $arListParams = array("USE_SUBSCRIBE" => "Y", "ENTITY_TYPE" => $arLogComment["ENTITY_TYPE"], "ENTITY_ID" => $arLogComment["ENTITY_ID"], "EVENT_ID" => $arLogComment["EVENT_ID"], "USER_ID" => $arLogComment["USER_ID"], "OF_ENTITIES" => $arOfEntities, "TRANSPORT" => "N");
     $dbUnSubscribers = CSocNetLogEvents::GetList(array("TRANSPORT" => "DESC"), array("USER_ACTIVE" => "Y", "SITE_ID" => array_merge($arLogSites, array(false))), false, false, array("USER_ID", "SITE_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "TRANSPORT", "EVENT_ID"), $arListParams);
     $arUnSubscribers = array();
     while ($arUnSubscriber = $dbUnSubscribers->Fetch()) {
         $arUnSubscribers[] = $arUnSubscriber["USER_ID"] . "_" . $arUnSubscriber["ENTITY_TYPE"] . "_" . $arUnSubscriber["ENTITY_ID"] . "_" . $arUnSubscriber["ENTITY_MY"] . "_" . $arUnSubscriber["ENTITY_CB"] . "_" . $arUnSubscriber["EVENT_ID"];
     }
     $bHasAccessAll = CSocNetLogRights::CheckForUserAll($arLog["ID"] ? $arLog["ID"] : $arLogComment["LOG_ID"]);
     $arSentUserID = array("M" => array(), "X" => array());
     while ($arSubscriber = $dbSubscribers->Fetch()) {
         if (is_array($arIntranetUsers) && !in_array($arSubscriber["USER_ID"], $arIntranetUsers) && !in_array($extranet_site_id, $arLogSites)) {
             continue;
         }
         if (array_key_exists($arSubscriber["TRANSPORT"], $arSentUserID) && in_array($arSubscriber["USER_ID"], $arSentUserID[$arSubscriber["TRANSPORT"]])) {
             continue;
         }
         if (intval($arSubscriber["ENTITY_ID"]) != 0 && $arSubscriber["EVENT_ID"] == "all" && (in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arSubscriber["ENTITY_ID"] . "_N_" . $arSubscriber["ENTITY_CB"] . "_" . $arLogComment["EVENT_ID"], $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arSubscriber["ENTITY_ID"] . "_Y_" . $arSubscriber["ENTITY_CB"] . "_" . $arLogComment["EVENT_ID"], $arUnSubscribers))) {
             continue;
         } elseif (intval($arSubscriber["ENTITY_ID"]) == 0 && $arSubscriber["ENTITY_CB"] == "N" && $arSubscriber["EVENT_ID"] != "all" && (in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_Y_N_all", $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_N_N_all", $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_Y_N_" . $arLogComment["EVENT_ID"], $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_N_N_" . $arLogComment["EVENT_ID"], $arUnSubscribers))) {
             continue;
         }
         $arSentUserID[$arSubscriber["TRANSPORT"]][] = $arSubscriber["USER_ID"];
         if (!$bHasAccessAll) {
             $bHasAccess = CSocNetLogRights::CheckForUserOnly($arLog["ID"] ? $arLog["ID"] : $arLogComment["LOG_ID"], $arSubscriber["USER_ID"]);
             if (!$bHasAccess) {
                 continue;
             }
         }
         if ($arLogComment["ENTITY_TYPE"] == SONET_ENTITY_GROUP && is_array($arIntranetUsers) && CModule::IncludeModule("extranet")) {
             $server_name = $arSites[!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id ? $extranet_site_id : $intranet_site_id]["SERVER_NAME"];
             $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"] = str_replace(array("#SERVER_NAME#", "#GROUPS_PATH#"), array($server_name, COption::GetOptionString("socialnetwork", "workgroups_page", false, !in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id ? $extranet_site_id : $intranet_site_id)), $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]);
         } else {
             $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"] = $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"];
         }
         switch ($arSubscriber["TRANSPORT"]) {
             case "X":
                 if (array_key_exists("URL_TO_SEND", $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && strlen($arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]) > 0) {
                     $link = GetMessage("SONET_GLC_SEND_EVENT_LINK") . $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"];
                 } else {
                     $link = "";
                 }
                 $arMessageFields = array("FROM_USER_ID" => intval($arLogComment["USER_ID"]) > 0 ? $arLogComment["USER_ID"] : 1, "TO_USER_ID" => $arSubscriber["USER_ID"], "MESSAGE" => $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["TITLE"] . " #BR# " . $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] . (strlen($link) > 0 ? "#BR# " . $link : ""), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "IS_LOG" => "Y");
                 CSocNetMessages::Add($arMessageFields);
                 break;
             case "M":
                 $arFields["SUBSCRIBER_ID"] = $arSubscriber["USER_ID"];
                 $arFields["SUBSCRIBER_NAME"] = $arSubscriber["USER_NAME"];
                 $arFields["SUBSCRIBER_LAST_NAME"] = $arSubscriber["USER_LAST_NAME"];
                 $arFields["SUBSCRIBER_LOGIN"] = $arSubscriber["USER_LOGIN"];
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:log_comments.php

示例3: SendEvent

	public static function SendEvent($ID, $mailTemplate = "SONET_NEW_EVENT", $tmp_id = false, $bAgent = false, $bTransport = false)
	{
		$ID = IntVal($ID);
		if ($ID <= 0)
			return false;

		if (intval($tmp_id) > 0)
			$arFilter = array("ID" => $tmp_id);
		else
			$arFilter = array("ID" => $ID);

		$dbLog = CSocNetLog::GetList(
			array(),
			$arFilter,
			false,
			false,
			array("ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "EVENT_ID", "LOG_DATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "SITE_ID", "PARAMS", "SOURCE_ID", "GROUP_NAME", "CREATED_BY_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_LOGIN", "LOG_SOURCE_ID"),
			array("MIN_ID_JOIN" => true)
		);
		$arLog = $dbLog->Fetch();
		if (!$arLog)
			return $bAgent;

		if (MakeTimeStamp($arLog["LOG_DATE"]) > (time() + CTimeZone::GetOffset()))
		{
			$agent = "CSocNetLog::SendEventAgent(".$ID.", '".$mailTemplate."', ".($tmp_id ? $tmp_id : 'false').");";
			$rsAgents = CAgent::GetList(array("ID"=>"DESC"), array("NAME" => $agent));
			if(!$rsAgents->Fetch())
			{
				$res = CAgent::AddAgent($agent, "socialnetwork", "N", 0, $arLog["LOG_DATE"], "Y", $arLog["LOG_DATE"]);
				if(!$res)
					$GLOBALS["APPLICATION"]->ResetException();
			}
			elseif ($bAgent)
			{
				CAgent::RemoveAgent($agent, "socialnetwork");
				CAgent::AddAgent($agent, "socialnetwork", "N", 0, $arLog["LOG_DATE"], "Y", $arLog["LOG_DATE"]);
				return true;
			}
			return false;
		}

		$arEvent = CSocNetLogTools::FindLogEventByID($arLog["EVENT_ID"], $arLog["ENTITY_TYPE"]);
		if (
			$arEvent
			&& array_key_exists("CLASS_FORMAT", $arEvent)
			&& array_key_exists("METHOD_FORMAT", $arEvent)
		)
		{
			$dbSiteCurrent = CSite::GetByID(SITE_ID);
			if ($arSiteCurrent = $dbSiteCurrent->Fetch())
				if ($arSiteCurrent["LANGUAGE_ID"] != LANGUAGE_ID)
					$arLog["MAIL_LANGUAGE_ID"] = $arSiteCurrent["LANGUAGE_ID"];

			$arLog["FIELDS_FORMATTED"] = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arLog, array(), true);
		}

		if (
			array_key_exists($arLog["ENTITY_TYPE"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"])
			&& array_key_exists("HAS_MY", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]])
			&& $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["HAS_MY"] == "Y"
			&& array_key_exists("CLASS_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]])
			&& array_key_exists("METHOD_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]])
			&& strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"]) > 0
			&& strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"]) > 0
			&& method_exists($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"])
		)
			$arOfEntities = call_user_func(array($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"]), $arLog["ENTITY_ID"]);

		if ($bTransport)
		{
			$arListParams = array(
				"USE_SUBSCRIBE" => "Y",
				"ENTITY_TYPE" => $arLog["ENTITY_TYPE"],
				"ENTITY_ID" => $arLog["ENTITY_ID"],
				"EVENT_ID" => $arLog["EVENT_ID"],
				"USER_ID" => $arLog["USER_ID"],
				"OF_ENTITIES" => $arOfEntities,
				"TRANSPORT" => array("M", "X")
			);

			$arLogSites = array();
			$rsLogSite = CSocNetLog::GetSite($ID);

			while($arLogSite = $rsLogSite->Fetch())
				$arLogSites[] = $arLogSite["LID"];

			if (CModule::IncludeModule("extranet"))
			{
				$arSites = array();
				$dbSite = CSite::GetList($by="sort", $order="desc", array("ACTIVE" => "Y"));
				while($arSite = $dbSite->Fetch())
					$arSites[$arSite["ID"]] = array(
						"DIR" => (strlen(trim($arSite["DIR"])) > 0 ? $arSite["DIR"] : "/"),
						"SERVER_NAME" => (strlen(trim($arSite["SERVER_NAME"])) > 0 ? $arSite["SERVER_NAME"] : COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]))
					);

				$extranet_site_id = CExtranet::GetExtranetSiteID();
				$intranet_site_id = CSite::GetDefSite();

//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:log.php

示例4: SendRequestToJoinGroup

 function SendRequestToJoinGroup($senderID, $userID, $groupID, $message, $bMail = true)
 {
     global $APPLICATION;
     $senderID = IntVal($senderID);
     if ($senderID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_SENDERID");
         return false;
     }
     $userID = IntVal($userID);
     if ($userID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_USERID"), "ERROR_USERID");
         return false;
     }
     $groupID = IntVal($groupID);
     if ($groupID <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_GROUPID"), "ERROR_GROUPID");
         return false;
     }
     $arGroup = CSocNetGroup::GetByID($groupID);
     if (!$arGroup || !is_array($arGroup)) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UG_ERROR_NO_GROUP_ID"), "ERROR_NO_GROUP");
         return false;
     }
     $arGroupSites = array();
     $rsGroupSite = CSocNetGroup::GetSite($groupID);
     while ($arGroupSite = $rsGroupSite->Fetch()) {
         $arGroupSites[] = $arGroupSite["LID"];
     }
     $userRole = CSocNetUserToGroup::GetUserRole($senderID, $groupID);
     $bUserIsMember = $userRole && in_array($userRole, array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR, SONET_ROLES_USER));
     $bCanInitiate = $GLOBALS["USER"]->IsAdmin() || CSocNetUser::IsCurrentUserModuleAdmin($arGroupSites) || $userRole && ($arGroup["INITIATE_PERMS"] == SONET_ROLES_OWNER && $senderID == $arGroup["OWNER_ID"] || $arGroup["INITIATE_PERMS"] == SONET_ROLES_MODERATOR && in_array($userRole, array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR)) || $arGroup["INITIATE_PERMS"] == SONET_ROLES_USER && $bUserIsMember);
     if (!$bCanInitiate) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UG_ERROR_NO_PERMS"), "ERROR_NO_PERMS");
         return false;
     }
     $arFields = array("USER_ID" => $userID, "GROUP_ID" => $groupID, "ROLE" => SONET_ROLES_REQUEST, "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => str_replace(array("#TEXT#", "#GROUP_NAME#"), array($message, $arGroup["NAME"]), empty($message) ? GetMessage("SONET_UG_INVITE_CONFIRM_TEXT_EMPTY") : GetMessage("SONET_UG_INVITE_CONFIRM_TEXT")), "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP, "INITIATED_BY_USER_ID" => $senderID, "SEND_MAIL" => $bMail ? "Y" : "N");
     $ID = CSocNetUserToGroup::Add($arFields);
     if (!$ID) {
         $errorMessage = "";
         if ($e = $APPLICATION->GetException()) {
             $errorMessage = $e->GetString();
         }
         if (StrLen($errorMessage) <= 0) {
             $errorMessage = GetMessage("SONET_UR_ERROR_CREATE_USER2GROUP");
         }
         $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_CREATE_USER2GROUP");
         return false;
     }
     $userIsConfirmed = true;
     $rsInvitedUser = CUser::GetByID($userID);
     $arInvitedUser = $rsInvitedUser->Fetch();
     if ((!is_array($arInvitedUser["UF_DEPARTMENT"]) || intval($arInvitedUser["UF_DEPARTMENT"][0]) <= 0) && $arInvitedUser["LAST_LOGIN"] <= 0 && strlen($arInvitedUser["LAST_ACTIVITY_DATE"]) <= 0) {
         $userIsConfirmed = false;
     }
     if (CModule::IncludeModule("im") && $userIsConfirmed) {
         $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($arFields['USER_ID']), "FROM_USER_ID" => intval($arFields['INITIATED_BY_USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_CONFIRM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => "invite_group_btn", "NOTIFY_TAG" => "SOCNET|INVITE_GROUP|" . intval($arFields['USER_ID']) . "|" . intval($ID), "NOTIFY_TITLE" => str_replace("#GROUP_NAME#", $arGroup["NAME"], GetMessage("SONET_UG_INVITE_CONFIRM_TEXT_EMPTY")), "NOTIFY_MESSAGE" => str_replace(array("#TEXT#", "#GROUP_NAME#"), array($message, $arGroup["NAME"]), empty($message) ? GetMessage("SONET_UG_INVITE_CONFIRM_TEXT_EMPTY") : GetMessage("SONET_UG_INVITE_CONFIRM_TEXT")), "NOTIFY_BUTTONS" => array(array('TITLE' => GetMessage('SONET_UG_INVITE_CONFIRM'), 'VALUE' => 'Y', 'TYPE' => 'accept'), array('TITLE' => GetMessage('SONET_UG_INVITE_REJECT'), 'VALUE' => 'N', 'TYPE' => 'cancel')));
         if ((!is_array($arInvitedUser["UF_DEPARTMENT"]) || intval($arInvitedUser["UF_DEPARTMENT"][0]) <= 0) && CModule::IncludeModule('extranet')) {
             $siteId = CExtranet::GetExtranetSiteID();
         } else {
             $siteId = SITE_ID;
         }
         $dbSite = CSite::GetByID($siteId);
         $arSite = $dbSite->Fetch();
         $serverName = htmlspecialcharsEx($arSite["SERVER_NAME"]);
         if (strlen($serverName) <= 0) {
             $serverName = defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", "");
         }
         if (strlen($serverName) <= 0) {
             $serverName = $_SERVER["SERVER_NAME"];
         }
         $serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . $serverName;
         $requestUrl = COption::GetOptionString("socialnetwork", "user_request_page", IsModuleInstalled("intranet") ? "/company/personal/user/#USER_ID#/requests/" : "/club/user/#USER_ID#/requests/", $siteId);
         $requestUrl = $serverName . str_replace(array("#USER_ID#", "#user_id#"), $userID, $requestUrl);
         $groupUrl = $serverName . str_replace("#group_id#", $groupID, COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", $siteId));
         $arMessageFields['NOTIFY_MESSAGE_OUT'] = $arMessageFields['NOTIFY_MESSAGE'];
         $arMessageFields['NOTIFY_MESSAGE_OUT'] .= "\n\n" . GetMessage('SONET_UG_GROUP_LINK') . $groupUrl;
         $arMessageFields['NOTIFY_MESSAGE_OUT'] .= "\n\n" . GetMessage('SONET_UG_INVITE_CONFIRM') . ": " . $requestUrl . '?INVITE_GROUP=' . $ID . '&CONFIRM=Y';
         $arMessageFields['NOTIFY_MESSAGE_OUT'] .= "\n\n" . GetMessage('SONET_UG_INVITE_REJECT') . ": " . $requestUrl . '?INVITE_GROUP=' . $ID . '&CONFIRM=N';
         CIMNotify::Add($arMessageFields);
     }
     $events = GetModuleEvents("socialnetwork", "OnSocNetSendRequestToJoinGroup");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     CSocNetUserToGroup::__SpeedFileCreate($userID);
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:87,代码来源:user_group.php

示例5: AllowToSend

	public static function AllowToSend($arParams)
	{
		$bResult = false;
		if (isset($arParams['TO_USER_ID']))
		{
			$toUserId = intval($arParams['TO_USER_ID']);

			$bResult = true;
			if(IsModuleInstalled('intranet') && CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser())
			{
				$bResult = false;
				if (CModule::IncludeModule("socialnetwork"))
				{
					global $USER, $CACHE_MANAGER;

					if(defined("BX_COMP_MANAGED_CACHE"))
						$ttl = 2592000;
					else
						$ttl = 600;

					$cache_id = 'im_user_sg_'.$USER->GetID();
					$obSGCache = new CPHPCache;
					$cache_dir = '/bx/imc/sonet';

					if($obSGCache->InitCache($ttl, $cache_id, $cache_dir))
					{
						$tmpVal = $obSGCache->GetVars();
						$bResult = in_array($toUserId, $tmpVal['EXTRANET_USERS']);
					}
					else
					{
						if(defined("BX_COMP_MANAGED_CACHE"))
							$CACHE_MANAGER->StartTagCache($cache_dir);

						$dbUsersInGroup = CSocNetUserToGroup::GetList(
							array(),
							array(
								"USER_ID" => $USER->GetID(),
								"<=ROLE" => SONET_ROLES_USER,
								"GROUP_SITE_ID" => CExtranet::GetExtranetSiteID(),
								"GROUP_ACTIVE" => "Y",
								"GROUP_CLOSED" => "N"
							),
							false,
							false,
							array("ID", "GROUP_ID", "GROUP_NAME")
						);

						$arUserSocNetGroups = Array();
						$arUserSG = Array();
						while ($ar = $dbUsersInGroup->GetNext(true, false))
						{
							$arUserSocNetGroups[] = $ar["GROUP_ID"];
							$arUserSG['SG'.$ar['GROUP_ID']] = array(
								'id' => 'SG'.$ar['GROUP_ID'],
								'status' => 'close',
								'name' => GetMessage('IM_CL_GROUP_SG').$ar['GROUP_NAME']
							);
							if(defined("BX_COMP_MANAGED_CACHE"))
							{
								$CACHE_MANAGER->RegisterTag('sonet_group_'.$ar['GROUP_ID']);
								$CACHE_MANAGER->RegisterTag('sonet_user2group_G'.$ar['GROUP_ID']);
							}
						}

						$arExtranetUsers = Array();
						$arUserInGroup = Array();
						$arWoUserInGroup = Array();
						if (count($arUserSocNetGroups) > 0)
						{
							$dbUsersInGroup = CSocNetUserToGroup::GetList(
								array(),
								array(
									"GROUP_ID" => $arUserSocNetGroups,
									"<=ROLE" => SONET_ROLES_USER,
									"USER_ACTIVE" => "Y"
								),
								false,
								false,
								array("ID", "USER_ID", "GROUP_ID")
							);

							while ($ar = $dbUsersInGroup->GetNext(true, false))
							{
								if($USER->GetID() != $ar["USER_ID"])
								{
									$arExtranetUsers[$ar["USER_ID"]] = $ar["USER_ID"];

									if (isset($arUserInGroup["SG".$ar["GROUP_ID"]]))
										$arUserInGroup["SG".$ar["GROUP_ID"]]['users'][] = $ar["USER_ID"];
									else
										$arUserInGroup["SG".$ar["GROUP_ID"]] = Array('id' => "SG".$ar["GROUP_ID"], 'users' => Array($ar["USER_ID"]));

									if (isset($arWoUserInGroup["extranet"]))
										$arWoUserInGroup["extranet"]['users'][] = $ar["USER_ID"];
									else
										$arWoUserInGroup["extranet"] = Array('id' => "extranet", 'users' => Array($ar["USER_ID"]));
								}
							}
							if (isset($arWoUserInGroup['extranet']) && isset($arWoUserInGroup['extranet']['users']))
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:im_contact_list.php

示例6:

			{
				$tmpVal = $obCache->GetVars();
				$GLOBALS["arExtranetGroupID"] = $tmpVal['EX_GROUP_ID'];
				$GLOBALS["arExtranetUserID"] = $tmpVal['EX_USER_ID'];
				unset($tmpVal);
			}
			elseif (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite())
			{
				global $CACHE_MANAGER;
				if (defined("BX_COMP_MANAGED_CACHE"))
					$CACHE_MANAGER->StartTagCache($cache_dir);

				$dbGroupTmp = CSocNetGroup::GetList(
					array(),
					array(
						"SITE_ID" => CExtranet::GetExtranetSiteID()
					),
					false,
					false,
					array("ID")
				);
				while($arGroupTmp = $dbGroupTmp->Fetch())
				{
					$GLOBALS["arExtranetGroupID"][] = $arGroupTmp["ID"];
					if (defined("BX_COMP_MANAGED_CACHE"))
						$CACHE_MANAGER->RegisterTag('sonet_group_'.$arGroupTmp["ID"]);
				}

				$rsUsers = CUser::GetList(
					($by="ID"),
					($order="asc"),
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:ajax.php

示例7: CPHPCache

     $ttl = 2592000;
 } else {
     $ttl = 600;
 }
 $cache_id = 'sonet_ex_gr_' . SITE_ID;
 $obCache = new CPHPCache();
 $cache_dir = '/bitrix/sonet_log_sg';
 if ($obCache->InitCache($ttl, $cache_id, $cache_dir)) {
     $tmpVal = $obCache->GetVars();
     $GLOBALS["arExtranetGroupID"] = $tmpVal['EX_GROUP_ID'];
     $GLOBALS["arExtranetUserID"] = $tmpVal['EX_USER_ID'];
     unset($tmpVal);
 } elseif (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite()) {
     global $CACHE_MANAGER;
     $CACHE_MANAGER->StartTagCache($cache_dir);
     $dbGroupTmp = CSocNetGroup::GetList(array(), array("SITE_ID" => CExtranet::GetExtranetSiteID()), false, false, array("ID"));
     while ($arGroupTmp = $dbGroupTmp->Fetch()) {
         $GLOBALS["arExtranetGroupID"][] = $arGroupTmp["ID"];
         $CACHE_MANAGER->RegisterTag('sonet_group_' . $arGroupTmp["ID"]);
     }
     $rsUsers = CUser::GetList($by = "ID", $order = "asc", array("GROUPS_ID" => array(CExtranet::GetExtranetUserGroupID()), "UF_DEPARTMENT" => false));
     while ($arUser = $rsUsers->Fetch()) {
         $GLOBALS["arExtranetUserID"][] = $arUser["ID"];
         $CACHE_MANAGER->RegisterTag('sonet_user2group_U' . $arUser["ID"]);
     }
     $CACHE_MANAGER->EndTagCache();
     if ($obCache->StartDataCache()) {
         $obCache->EndDataCache(array('EX_GROUP_ID' => $GLOBALS["arExtranetGroupID"], 'EX_USER_ID' => $GLOBALS["arExtranetUserID"]));
     }
 }
 unset($obCache);
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:ajax.php

示例8: htmlspecialcharsbx

    $arParams["PATH_TO_GROUP_CONTENT_SEARCH"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=group_content_search&" . $arParams["GROUP_VAR"] . "=#group_id#");
}
$arParams["USE_MAIN_MENU"] = isset($arParams["USE_MAIN_MENU"]) ? $arParams["USE_MAIN_MENU"] : false;
if ($arParams["USE_MAIN_MENU"] == "Y" && !array_key_exists("MAIN_MENU_TYPE", $arParams)) {
    $arParams["MAIN_MENU_TYPE"] = "left";
}
$arGroup = CSocNetGroup::GetByID($arParams["GROUP_ID"]);
if ($arGroup && is_array($arGroup) && $arGroup["ACTIVE"] == "Y") {
    $arGroupSites = array();
    $rsGroupSite = CSocNetGroup::GetSite($arGroup["ID"]);
    while ($arGroupSite = $rsGroupSite->Fetch()) {
        $arGroupSites[] = $arGroupSite["LID"];
    }
    if (in_array(SITE_ID, $arGroupSites)) {
        $arResult["Group"] = $arGroup;
        if (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite() && in_array(CExtranet::GetExtranetSiteID(), $arGroupSites)) {
            $arResult["Group"]["IS_EXTRANET"] = "Y";
        }
        if ($arResult["Group"]["CLOSED"] == "Y" && COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y") {
            $arResult["HideArchiveLinks"] = true;
        }
        $arResult["CurrentUserPerms"] = CSocNetUserToGroup::InitUserPerms($GLOBALS["USER"]->GetID(), $arResult["Group"], CSocNetUser::IsCurrentUserModuleAdmin());
        if ($arResult["CurrentUserPerms"] != false && $arResult["CurrentUserPerms"]["UserCanViewGroup"]) {
            if (in_array($arResult["CurrentUserPerms"]["UserRole"], array(SONET_ROLES_OWNER, SONET_ROLES_MODERATOR, SONET_ROLES_USER))) {
                $arResult["bSubscribed"] = CSocNetSubscription::IsUserSubscribed($GLOBALS["USER"]->GetID(), "SG" . $arParams["GROUP_ID"]);
            } else {
                $arResult["bSubscribed"] = false;
            }
            $arResult["Urls"]["Edit"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_EDIT"], array("group_id" => $arResult["Group"]["ID"]));
            $arResult["Urls"]["View"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arResult["Group"]["ID"]));
            $arResult["Urls"]["UserRequestGroup"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_REQUEST_GROUP"], array("group_id" => $arResult["Group"]["ID"], "user_id" => $GLOBALS["USER"]->GetID()));
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例9: GetUserPath

 public static function GetUserPath($userId = false)
 {
     static $extranetSiteID = false;
     $userId = intval($userId);
     if ($extranetSiteID === false && CModule::IncludeModule("extranet")) {
         $extranetSiteID = CExtranet::GetExtranetSiteID();
     }
     if (IsModuleInstalled('intranet')) {
         $strPathTemplate = COption::GetOptionString("socialnetwork", "user_page", SITE_DIR . 'company/personal/', CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser() ? $extranetSiteID : SITE_ID) . "user/#user_id#/";
     } else {
         $strPathTemplate = COption::GetOptionString("im", "path_to_user_profile", "/club/user/#user_id#/", SITE_ID);
     }
     if ($userId <= 0) {
         return $strPathTemplate;
     } else {
         return CComponentEngine::MakePathFromTemplate($strPathTemplate, array("user_id" => $userId));
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:18,代码来源:im_contact_list.php

示例10: __deprecated_Add


//.........这里部分代码省略.........
         // remove [ url] for socialnetwork log
         $MESSAGE = preg_replace("/(\\s\\[\\s(http:\\/\\/|https:\\/\\/|ftp:\\/\\/))(.*?)(\\s\\])/is", "", $MESSAGE);
         $parser->allow = array("HTML" => 'Y', "ANCHOR" => 'Y', "BIU" => 'Y', "IMG" => "Y", "VIDEO" => "Y", "LIST" => 'N', "QUOTE" => 'Y', "CODE" => 'Y', "FONT" => 'Y', "SMILES" => "N", "UPLOAD" => 'N', "NL2BR" => 'N', "TABLE" => "Y");
         $message_notify = $parser->convertText($commentText);
         $arRecipientsIDs = CTaskNotifications::GetRecipientsIDs($arTask);
         // Instant Messages
         if (IsModuleInstalled("im") && CModule::IncludeModule("im") && sizeof($arRecipientsIDs)) {
             $pageNumber = CForumMessage::GetMessagePage($MID, $messagesPerPage, $arUserGroupArray);
             // There are different links for extranet users
             $isExtranetEnabled = false;
             if (CModule::IncludeModule("extranet")) {
                 $isExtranetEnabled = true;
             }
             if ($isExtranetEnabled) {
                 $arSites = array();
                 $dbSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
                 while ($arSite = $dbSite->Fetch()) {
                     if (strlen(trim($arSite["DIR"])) > 0) {
                         $arSites[$arSite['ID']]['DIR'] = $arSite['DIR'];
                     } else {
                         $arSites[$arSite['ID']]['DIR'] = '/';
                     }
                     if (strlen(trim($arSite["SERVER_NAME"])) > 0) {
                         $arSites[$arSite['ID']]['SERVER_NAME'] = $arSite["SERVER_NAME"];
                     } else {
                         $arSites[$arSite['ID']]['SERVER_NAME'] = COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]);
                     }
                     $arSites[$arSite['ID']]['urlPrefix'] = $arSites[$arSite['ID']]['SERVER_NAME'] . $arSites[$arSite['ID']]['DIR'];
                     // remove last '/'
                     if (strlen($arSites[$arSite['ID']]['urlPrefix']) > 0 && substr($arSites[$arSite['ID']]['urlPrefix'], -1) === '/') {
                         $arSites[$arSite['ID']]['urlPrefix'] = substr($arSites[$arSite['ID']]['urlPrefix'], 0, -1);
                     }
                 }
                 $extranet_site_id = CExtranet::GetExtranetSiteID();
                 $intranet_site_id = CSite::GetDefSite();
                 $arIntranetUsers = CExtranet::GetIntranetUsers();
             } else {
                 if ($arTask["GROUP_ID"]) {
                     $pathTemplateWoExtranet = str_replace("#group_id#", $arTask["GROUP_ID"], COption::GetOptionString("tasks", "paths_task_group_entry", "/workgroups/group/#group_id#/tasks/task/view/#task_id#/", $arFields["SITE_ID"]));
                 } else {
                     $pathTemplateWoExtranet = COption::GetOptionString("tasks", "paths_task_user_entry", "/company/personal/user/#user_id#/tasks/task/view/#task_id#/", $arFields["SITE_ID"]);
                 }
             }
             foreach ($arRecipientsIDs as $userID) {
                 $urlPrefixForUser = tasksServerName();
                 if ($isExtranetEnabled) {
                     if (!in_array($userID, $arIntranetUsers) && $extranet_site_id) {
                         $userSiteId = $extranet_site_id;
                     } else {
                         $userSiteId = $intranet_site_id;
                     }
                     if (isset($arSites[$userSiteId]['SERVER_NAME'])) {
                         $urlPrefixForUser = tasksServerName($arSites[$userSiteId]['SERVER_NAME']);
                     }
                     if ($arTask["GROUP_ID"]) {
                         $pathTemplate = str_replace('#group_id#', $arTask['GROUP_ID'], CTasksTools::GetOptionPathTaskGroupEntry($userSiteId, ''));
                     } else {
                         $pathTemplate = CTasksTools::GetOptionPathTaskUserEntry($userSiteId, '');
                     }
                 } else {
                     $pathTemplate = $pathTemplateWoExtranet;
                 }
                 $NOTIFY_MESSAGE_TITLE_TEMPLATE = '';
                 $messageUrl = '';
                 if (strlen($pathTemplate) > 0) {
                     $groupId = 0;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:67,代码来源:taskcomments.php

示例11: array

 if ($arResult["USER"]["PERSONAL_PHOTO"]) {
     $imageFile = CFile::GetFileArray($arResult["USER"]["PERSONAL_PHOTO"]);
     if ($imageFile !== false) {
         $arResult["USER"]["AVATAR"] = CFile::ResizeImageGet($imageFile, array("width" => 1200, "height" => 1020), BX_RESIZE_IMAGE_EXACT, false, false, false, 50);
     }
 }
 $arSGGroup = array();
 $arExtSGGroup = array();
 $arExtSGGroupTmp = array();
 if (CModule::IncludeModule("socialnetwork")) {
     $strGroupSubjectLinkTemplate = SITE_DIR . "mobile/log/?group_id=#group_id#";
     $extGroupID = array();
     $arGroupFilterMy = array("USER_ID" => $USER_ID, "<=ROLE" => SONET_ROLES_USER, "GROUP_ACTIVE" => "Y", "!GROUP_CLOSED" => "Y");
     // Extranet group
     if (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite()) {
         $arGroupFilterMy["GROUP_SITE_ID"] = CExtranet::GetExtranetSiteID();
         $dbGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arGroupFilterMy, false, false, array('ID', 'GROUP_ID', 'GROUP_NAME', 'GROUP_SITE_ID'));
         while ($arGroups = $dbGroups->GetNext()) {
             $arExtSGGroupTmp[$arGroups["GROUP_ID"]] = array($arGroups["GROUP_NAME"], str_replace("#group_id#", $arGroups["GROUP_ID"], $strGroupSubjectLinkTemplate), array(), array("counter_id" => "SG" . $arGroups["GROUP_ID"]), "");
             $extGroupID[] = $arGroups["GROUP_ID"];
         }
     }
     $arGroupIDCurrentSite = array();
     // Socialnetwork
     $arGroupFilterMy["GROUP_SITE_ID"] = SITE_ID;
     $dbGroups = CSocNetUserToGroup::GetList(array("GROUP_NAME" => "ASC"), $arGroupFilterMy, false, false, array('ID', 'GROUP_ID', 'GROUP_NAME', 'GROUP_SITE_ID'));
     while ($arGroups = $dbGroups->GetNext()) {
         $arGroupIDCurrentSite[] = $arGroups['GROUP_ID'];
         if (in_array($arGroups['GROUP_ID'], $extGroupID)) {
             continue;
         }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例12: GetDocumentAdminPage

 /**
  * Метод по коду документа возвращает ссылку на страницу документа в административной части.
  *
  * @param string $documentId - код документа.
  * @return string - ссылка на страницу документа в административной части.
  */
 public function GetDocumentAdminPage($documentId)
 {
     $documentId = intval($documentId);
     if ($documentId <= 0) {
         throw new CBPArgumentNullException("documentId");
     }
     $diskId = self::processGetDiskIdByDocId($documentId);
     if ($diskId !== null) {
         return self::proxyToDisk(__FUNCTION__, array($diskId));
     }
     $db_res = CIBlockElement::GetList(array(), array("ID" => $documentId, "SHOW_NEW" => "Y", "SHOW_HISTORY" => "Y"), false, false, array("ID", "CODE", "EXTERNAL_ID", "IBLOCK_ID", "IBLOCK_TYPE_ID", "IBLOCK_SECTION_ID"));
     if ($db_res && ($arElement = $db_res->Fetch())) {
         $db_res = CIBlock::GetList(array(), array("ID" => $arElement["IBLOCK_ID"], "CHECK_PERMISSIONS" => "N", "SITE_ID" => SITE_ID));
         if ($db_res && ($arIblock = $db_res->Fetch())) {
             $arr = array("LANG_DIR" => SITE_ID, "ID" => $documentId, "CODE" => $arElement["CODE"], "EXTERNAL_ID" => $arElement["EXTERNAL_ID"], "IBLOCK_TYPE_ID" => $arIblock["IBLOCK_TYPE_ID"], "IBLOCK_ID" => $arIblock["IBLOCK_ID"], "IBLOCK_CODE" => $arIblock["IBLOCK_CODE"], "IBLOCK_EXTERNAL_ID" => $arIblock["IBLOCK_EXTERNAL_ID"], "SECTION_ID" => $arElement["IBLOCK_SECTION_ID"]);
             $arIblock["DETAIL_PAGE_URL"] = CIBlock::ReplaceDetailUrl($arIblock["DETAIL_PAGE_URL"], $arr, true, "E");
             if (IsModuleInstalled('extranet') && CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
                 $rsSite = CSite::GetByID(CExtranet::GetExtranetSiteID());
                 if ($arSite = $rsSite->GetNext()) {
                     $arIblock["DETAIL_PAGE_URL"] = str_replace(array("///", "//"), "/", $arSite['DIR'] . $arIblock["DETAIL_PAGE_URL"]);
                 }
             }
             $dbSectionsChain = CIBlockSection::GetNavChain($arElement["IBLOCK_ID"], $arElement["IBLOCK_SECTION_ID"]);
             if ($arSection = $dbSectionsChain->Fetch()) {
                 $arIblock["DETAIL_PAGE_URL"] = str_replace(array("#SOCNET_USER_ID#", "#USER_ID#", "#SOCNET_GROUP_ID#", "#GROUP_ID#", "#SOCNET_OBJECT#", "#SOCNET_OBJECT_ID#"), array($arSection["CREATED_BY"], $arSection["CREATED_BY"], $arSection["SOCNET_GROUP_ID"], $arSection["SOCNET_GROUP_ID"], $arSection["SOCNET_GROUP_ID"] > 0 ? "group" : "user", $arSection["SOCNET_GROUP_ID"] > 0 ? $arSection["SOCNET_GROUP_ID"] : $arSection["CREATED_BY"]), $arIblock["DETAIL_PAGE_URL"]);
             }
             return $arIblock["DETAIL_PAGE_URL"];
         }
     }
     return null;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:37,代码来源:iblocksocnetbizproc.php

示例13: OnAddRatingVote

 public static function OnAddRatingVote($id, $arParams)
 {
     $bSocialnetworkInstalled = CModule::IncludeModule("socialnetwork");
     if ($arParams['ENTITY_TYPE_ID'] == 'LISTS_NEW_ELEMENT' && CModule::IncludeModule("socialnetwork")) {
         $rsLog = CSocNetLog::GetList(array(), array("RATING_TYPE_ID" => $arParams['ENTITY_TYPE_ID'], "RATING_ENTITY_ID" => $arParams['ENTITY_ID']), false, false, array("ID", "USER_ID", "TITLE_TEMPLATE", "TITLE"));
         if ($arLog = $rsLog->Fetch()) {
             if ($arLog['USER_ID'] != $arParams['USER_ID']) {
                 $url = COption::GetOptionString("socialnetwork", "log_entry_page", $arSites[$user_site_id]["DIR"] . "company/personal/log/#log_id#/", SITE_ID);
                 $url = str_replace("#log_id#", $arLog["ID"], $url);
                 $arParams['ENTITY_LINK'] = $url;
                 $arParams['ENTITY_TITLE'] = htmlspecialcharsback($arLog["TITLE"]);
                 $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($arLog['USER_ID']), "FROM_USER_ID" => intval($arParams['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|" . ($arParams['VALUE'] >= 0 ? "" : "DL|") . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], "NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams), "NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true));
                 CIMNotify::Add($arMessageFields);
             }
         }
     } elseif ($arParams['ENTITY_TYPE_ID'] == 'LOG_COMMENT') {
         if ($arComment = CSocNetLogComments::GetByID($arParams['ENTITY_ID'])) {
             preg_match_all("/\\[user\\s*=\\s*([^\\]]*)\\](.+?)\\[\\/user\\]/ies" . BX_UTF_PCRE_MODIFIER, $arComment["TEXT_MESSAGE"], $arMention);
             if (!empty($arMention)) {
                 $arMentionedUserID = $arMention[1];
             }
             if ($arComment['USER_ID'] == $arParams['USER_ID'] && empty($arMentionedUserID)) {
                 return false;
             }
             $arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
             if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) {
                 $arComment["MESSAGE"] = preg_replace(array('|\\[DISK\\sFILE\\sID=[n]*\\d+\\]|', '|\\[DOCUMENT\\sID=[n]*\\d+\\]|'), '', $arComment["MESSAGE"]);
                 $arComment["MESSAGE"] = preg_replace('|\\[QUOTE\\](.+?)\\[\\/QUOTE\\]|is' . BX_UTF_PCRE_MODIFIER, '&quot;\\1&quot;', $arComment["MESSAGE"]);
                 $arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array("IM" => "Y"));
                 $CCTP = new CTextParser();
                 $CCTP->MaxStringLen = 200;
                 $CCTP->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
                 $arComment["MESSAGE"] = $CCTP->convertText($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
             }
             $arComment["MESSAGE"] = preg_replace(array('|\\[DISK\\sFILE\\sID=[n]*\\d+\\]|', '|\\[DOCUMENT\\sID=[n]*\\d+\\]|'), '', $arComment["MESSAGE"]);
             $arParams["ENTITY_TITLE"] = strip_tags(str_replace(array("<br>", "<br/>", "<br />", "#BR#"), array(" ", " ", " ", " "), htmlspecialcharsback($arComment["MESSAGE"])));
             $bExtranetInstalled = CModule::IncludeModule("extranet");
             if ($bExtranetInstalled) {
                 $arSites = array();
                 $extranet_site_id = CExtranet::GetExtranetSiteID();
                 $intranet_site_id = CSite::GetDefSite();
                 $dbSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
                 while ($arSite = $dbSite->Fetch()) {
                     $arSites[$arSite["ID"]] = array("DIR" => strlen(trim($arSite["DIR"])) > 0 ? $arSite["DIR"] : "/", "SERVER_NAME" => strlen(trim($arSite["SERVER_NAME"])) > 0 ? $arSite["SERVER_NAME"] : COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]));
                 }
             }
             if ($arComment['USER_ID'] != $arParams['USER_ID']) {
                 $followValue = "Y";
                 if ($bSocialnetworkInstalled) {
                     $followValue = CSocNetLogFollow::GetExactValueByRating($arComment['USER_ID'], trim($arParams["ENTITY_TYPE_ID"]), intval($arParams["ENTITY_ID"]));
                 }
                 if ($followValue != "N") {
                     $arParams['ENTITY_LINK'] = self::GetMessageRatingLogCommentURL($arComment, intval($arComment['USER_ID']), $arSites, $intranet_site_id, $extranet_site_id);
                     $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($arComment['USER_ID']), "FROM_USER_ID" => intval($arParams['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|" . ($arParams['VALUE'] >= 0 ? "" : "DL|") . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], "NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams), "NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true));
                     CIMNotify::Add($arMessageFields);
                 }
             }
             if (!empty($arMentionedUserID) && is_array($arMentionedUserID)) {
                 $arParams["MENTION"] = true;
                 // for self::GetMessageRatingVote()
                 foreach ($arMentionedUserID as $mentioned_user_id) {
                     if ($mentioned_user_id != $arParams['USER_ID'] && CSocNetLogRights::CheckForUserOnly($arComment["LOG_ID"], $mentioned_user_id)) {
                         $followValue = "Y";
                         if ($bSocialnetworkInstalled) {
                             $followValue = CSocNetLogFollow::GetExactValueByRating(intval($mentioned_user_id), trim($arParams["ENTITY_TYPE_ID"]), intval($arParams["ENTITY_ID"]));
                         }
                         if ($followValue != "N") {
                             $arParams['ENTITY_LINK'] = self::GetMessageRatingLogCommentURL($arComment, intval($mentioned_user_id), $arSites, $intranet_site_id, $extranet_site_id);
                             $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($mentioned_user_id), "FROM_USER_ID" => intval($arParams['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote_mentioned", "NOTIFY_TAG" => "RATING_MENTION|" . ($arParams['VALUE'] >= 0 ? "" : "DL|") . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], "NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams), "NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true));
                             CIMNotify::Add($arMessageFields);
                         }
                     }
                 }
             }
         }
     } else {
         if (!CModule::IncludeModule("search") || BX_SEARCH_VERSION <= 1) {
             return false;
         }
         $CSI = new CSearchItem();
         $arFSearch = array('=ENTITY_TYPE_ID' => $arParams['ENTITY_TYPE_ID'], '=ENTITY_ID' => $arParams['ENTITY_ID']);
         if (defined("SITE_ID") && strlen(SITE_ID) > 0) {
             $arFSearch["=SITE_ID"] = SITE_ID;
         }
         $res = $CSI->GetList(array(), $arFSearch, array('ID', 'URL', 'TITLE', 'BODY', 'PARAM1'));
         if ($arItem = $res->GetNext(true, false)) {
             // notify mentioned users
             $arSearchItemParams = CSearch::GetContentItemParams($arItem['ID'], 'mentioned_user_id');
             if (is_array($arSearchItemParams) && array_key_exists('mentioned_user_id', $arSearchItemParams) && is_array($arSearchItemParams['mentioned_user_id'])) {
                 $arMentionedUserID = $arSearchItemParams['mentioned_user_id'];
             }
             // send to author
             if ($arParams['OWNER_ID'] != $arParams['USER_ID'] || $arMentionedUserID) {
                 $arParams["ENTITY_LINK"] = $arItem['URL'];
                 $arParams["ENTITY_PARAM"] = $arItem['PARAM1'];
                 $arParams["ENTITY_TITLE"] = trim(strip_tags(str_replace(array("\r\n", "\n", "\r"), ' ', htmlspecialcharsback($arItem['TITLE']))));
                 $arParams["ENTITY_MESSAGE"] = trim(strip_tags(str_replace(array("\r\n", "\n", "\r"), ' ', htmlspecialcharsback($arItem['BODY']))));
                 if ((strlen($arParams["ENTITY_TITLE"]) > 0 || strlen($arParams["ENTITY_MESSAGE"]) > 0) && strlen($arParams["ENTITY_LINK"]) > 0) {
                     $originalLink = $arParams["ENTITY_LINK"];
                     $bExtranetInstalled = CModule::IncludeModule("extranet");
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:im_event.php

示例14: array

                                 $arUserIDs[] = $userID;
                             }
                         }
                     }
                 }
             }
             $arResult["POST"]["USER_IDS"] = $arUserIDs;
         }
     }
 }
 if ((!array_key_exists("TAB", $arResult) || $arResult["TAB"] == "edit") && strlen($errorMessage) <= 0) {
     $arFields = array("NAME" => $_POST["GROUP_NAME"], "DESCRIPTION" => $_POST["GROUP_DESCRIPTION"], "VISIBLE" => $_POST["GROUP_VISIBLE"] == "Y" ? "Y" : "N", "OPENED" => $_POST["GROUP_OPENED"] == "Y" ? "Y" : "N", "CLOSED" => $_POST["GROUP_CLOSED"] == "Y" ? "Y" : "N", "SUBJECT_ID" => $_POST["GROUP_SUBJECT_ID"], "KEYWORDS" => $_POST["GROUP_KEYWORDS"], "IMAGE_ID" => $arImageID, "INITIATE_PERMS" => $_POST["GROUP_INITIATE_PERMS"], "SPAM_PERMS" => $_POST["GROUP_SPAM_PERMS"]);
     if (!CModule::IncludeModule("extranet") || !CExtranet::IsExtranetSite()) {
         $arFields["SITE_ID"] = array(SITE_ID);
         if (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite() && $_POST["IS_EXTRANET_GROUP"] == "Y") {
             $arFields["SITE_ID"][] = CExtranet::GetExtranetSiteID();
             $arFields["VISIBLE"] = "N";
             $arFields["OPENED"] = "N";
         }
     } elseif (CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite()) {
         $arFields["SITE_ID"] = array(SITE_ID, CSite::GetDefSite());
     }
     foreach ($arResult["GROUP_PROPERTIES"] as $field => $arUserField) {
         if (array_key_exists($field, $_POST)) {
             $arFields[$field] = $_POST[$field];
         }
     }
     $USER_FIELD_MANAGER->EditFormAddFields("SONET_GROUP", $arFields);
     if ($arParams["GROUP_ID"] <= 0) {
         if (CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite()) {
             $arFields["SITE_ID"][] = CSite::GetDefSite();
开发者ID:vim84,项目名称:b-markt,代码行数:31,代码来源:component.php

示例15: str_replace

                         if ($e = $APPLICATION->GetException()) {
                             $errorMessage .= $e->GetString();
                         }
                         if (StrLen($errorMessage) <= 0) {
                             $errorMessage .= str_replace("#RELATION_ID#", $arRelation["ID"], GetMessage("SONET_GRE_CANT_DELETE_INVITATION"));
                         }
                     }
                 }
                 $APPLICATION->ThrowException($errorMessage, "ERROR_DELETE_RELATION");
             }
         }
     }
     if (strlen($errorMessage) > 0) {
         $arResult["ErrorMessage"] = $errorMessage;
     }
 } elseif (CModule::IncludeModule('extranet') && in_array(CExtranet::GetExtranetSiteID(), $arGroupSites) && intval($_REQUEST["invite_user_id"]) > 0 && check_bitrix_sessid() && CModule::IncludeModule('intranet')) {
     $rsInvitedUser = CUser::GetByID(intval($_REQUEST["invite_user_id"]));
     if (($arInvitedUser = $rsInvitedUser->Fetch()) && (!is_array($arInvitedUser["UF_DEPARTMENT"]) || intval($arInvitedUser["UF_DEPARTMENT"][0]) <= 0) && strlen($arInvitedUser["LAST_LOGIN"]) <= 0 && strlen($arInvitedUser["LAST_ACTIVITY_DATE"]) <= 0) {
         CIntranetInviteDialog::ReinviteUser(SITE_ID, $arInvitedUser["ID"]);
         LocalRedirect($APPLICATION->GetCurPageParam("invite_sent=Y", array("invite_user_id", "employee")));
     }
 }
 $arNavParams = array("nPageSize" => $arParams["ITEMS_COUNT"], "bDescPageNumbering" => false);
 $parser = new CSocNetTextParser(LANGUAGE_ID, $arParams["PATH_TO_SMILE"]);
 $arResult["Requests"] = false;
 $dbRequests = CSocNetUserToGroup::GetList(array("DATE_CREATE" => "ASC"), array("GROUP_ID" => $arResult["Group"]["ID"], "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_USER), false, $arNavParams, array("ID", "USER_ID", "DATE_CREATE", "DATE_UPDATE", "MESSAGE", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER"));
 if ($dbRequests) {
     $arResult["Requests"] = array();
     $arResult["Requests"]["List"] = false;
     while ($arRequests = $dbRequests->GetNext()) {
         if ($arResult["Requests"]["List"] == false) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php


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