本文整理汇总了PHP中CSocNetGroup::GetSite方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetGroup::GetSite方法的具体用法?PHP CSocNetGroup::GetSite怎么用?PHP CSocNetGroup::GetSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetGroup
的用法示例。
在下文中一共展示了CSocNetGroup::GetSite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BeforeIndex
function BeforeIndex($arFields)
{
global $USER;
//Check if we in right context
if (!is_object($this) || !is_array($this->_params)) {
return $arFields;
}
if (isset($arFields["REINDEX_FLAG"])) {
return $arFields;
}
//This was group modification
if ($this->_group_id) {
if ($arFields["MODULE_ID"] == "forum" && intval($arFields["PARAM1"]) == intval($this->_params["FORUM_ID"])) {
// forum feature
$arFields["LID"] = array();
$rsGroupSite = CSocNetGroup::GetSite($this->_group_id);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arFields["LID"][$arGroupSite["LID"]] = $arFields["URL"];
}
$arFields = $this->BeforeIndexForum($arFields, SONET_ENTITY_GROUP, $this->_group_id, "forum", "view", $this->_params["PATH_TO_GROUP_FORUM_MESSAGE"]);
} elseif ($arFields["MODULE_ID"] == "forum" && intval($arFields["PARAM1"]) == intval($this->_params["FILES_FORUM_ID"])) {
$arFields = $this->BeforeIndexForum($arFields, SONET_ENTITY_GROUP, $this->_group_id, "files", "view", $this->Url($this->_params["PATH_TO_GROUP_FILES_ELEMENT"], array("MID" => "#message_id#"), "message#message_id#"));
} elseif ($arFields["MODULE_ID"] == "forum" && intval($arFields["PARAM1"]) == intval($this->_params["TASK_FORUM_ID"]) && !preg_match('/^EVENT_[0-9]+/', $arFields["TITLE"], $match)) {
$arFields = $this->BeforeIndexForum($arFields, SONET_ENTITY_GROUP, $this->_group_id, "tasks", "view", $this->Url($this->_params["PATH_TO_GROUP_TASK_ELEMENT"], array("MID" => "#message_id#"), "message#message_id#"));
} elseif ($arFields["MODULE_ID"] == "forum" && preg_match('/^EVENT_[0-9]+/', $arFields["TITLE"], $match)) {
$arFields = array("TITLE" => "", "BODY" => "");
} elseif ($arFields["MODULE_ID"] == "forum" && intval($arFields["PARAM1"]) == intval($this->_params["PHOTO_FORUM_ID"])) {
$arFields = $this->BeforeIndexForum($arFields, SONET_ENTITY_GROUP, $this->_group_id, "photo", "view", $this->Url($this->_params["PATH_TO_GROUP_PHOTO_ELEMENT"], array("MID" => "#message_id#"), "message#message_id#"));
} elseif ($arFields["MODULE_ID"] == "blog" && ($arFields["PARAM1"] == "POST" || $arFields["PARAM1"] == "MICROBLOG")) {
/*
$paramsTmp = $this->GetSearchParams(
SONET_ENTITY_GROUP, $this->_group_id,
'blog', 'view_post'
);
$arFields["PARAMS"] = (!empty($arFields["PARAMS"]) ? array_merge($paramsTmp, $arFields["PARAMS"]) : $paramsTmp);
*/
} elseif ($arFields["MODULE_ID"] == "blog" && $arFields["PARAM1"] == "COMMENT") {
/*
$paramsTmp = $this->GetSearchParams(
SONET_ENTITY_GROUP, $this->_group_id,
'blog', 'view_comment'
);
$arFields["PARAMS"] = (!empty($arFields["PARAMS"]) ? array_merge($paramsTmp, $arFields["PARAMS"]) : $paramsTmp);
*/
}
} elseif ($this->_user_id) {
if ($arFields["MODULE_ID"] == "forum" && intval($arFields["PARAM1"]) == intval($this->_params["FORUM_ID"])) {
// forum feature
$arFields["LID"] = array(SITE_ID => $arFields["URL"]);
$arFields = $this->BeforeIndexForum($arFields, SONET_ENTITY_USER, $this->_user_id, "forum", "view", $this->_params["PATH_TO_USER_FORUM_MESSAGE"]);
} elseif ($arFields["MODULE_ID"] == "forum" && intval($arFields["PARAM1"]) == intval($this->_params["FILES_FORUM_ID"])) {
$arFields = $this->BeforeIndexForum($arFields, SONET_ENTITY_USER, $this->_user_id, "files", "view", $this->Url($this->_params["PATH_TO_USER_FILES_ELEMENT"], array("MID" => "#message_id#"), "message#message_id#"));
} elseif ($arFields["MODULE_ID"] == "forum" && intval($arFields["PARAM1"]) == intval($this->_params["TASK_FORUM_ID"])) {
if (!preg_match('/^EVENT_[0-9]+/', $arFields["TITLE"], $match)) {
$arFields = $this->BeforeIndexForum($arFields, SONET_ENTITY_USER, $this->_user_id, "tasks", "view_all", $this->Url($this->_params["PATH_TO_USER_TASK_ELEMENT"], array("MID" => "#message_id#"), "message#message_id#"));
}
} elseif ($arFields["MODULE_ID"] == "forum" && preg_match('/^EVENT_[0-9]+/', $arFields["TITLE"], $match)) {
$arFields = array("TITLE" => "", "BODY" => "");
} elseif ($arFields["MODULE_ID"] == "forum" && intval($arFields["PARAM1"]) == intval($this->_params["PHOTO_FORUM_ID"])) {
$arFields = $this->BeforeIndexForum($arFields, SONET_ENTITY_USER, $this->_user_id, "photo", "view", $this->Url($this->_params["PATH_TO_USER_PHOTO_ELEMENT"], array("MID" => "#message_id#"), "message#message_id#"));
} elseif ($arFields["MODULE_ID"] == "blog" && ($arFields["PARAM1"] == "POST" || $arFields["PARAM1"] == "MICROBLOG")) {
$paramsTmp = $this->GetSearchParams(SONET_ENTITY_USER, $this->_user_id, 'blog', 'view_post');
$arFields["PARAMS"] = !empty($arFields["PARAMS"]) ? array_merge($paramsTmp, $arFields["PARAMS"]) : $paramsTmp;
} elseif ($arFields["MODULE_ID"] == "blog" && $arFields["PARAM1"] == "COMMENT") {
$paramsTmp = $this->GetSearchParams(SONET_ENTITY_USER, $this->_user_id, 'blog', 'view_comment');
$arFields["PARAMS"] = !empty($arFields["PARAMS"]) ? array_merge($paramsTmp, $arFields["PARAMS"]) : $paramsTmp;
}
}
foreach (GetModuleEvents("socialnetwork", "BeforeIndexSocNet", true) as $arEvent) {
$arEventResult = ExecuteModuleEventEx($arEvent, array($this, $arFields));
if (is_array($arEventResult)) {
$arFields = $arEventResult;
}
}
return $arFields;
}
示例2: unserialize
}
if (!array_key_exists("SHOW_FIELDS_TOOLTIP", $arParams)) {
$arParams["SHOW_FIELDS_TOOLTIP"] = unserialize(COption::GetOptionString("socialnetwork", "tooltip_fields", $arTooltipFieldsDefault));
}
if (!array_key_exists("USER_PROPERTY_TOOLTIP", $arParams)) {
$arParams["USER_PROPERTY_TOOLTIP"] = unserialize(COption::GetOptionString("socialnetwork", "tooltip_properties", $arTooltipPropertiesDefault));
}
if (!$USER->IsAuthorized()) {
$arResult["NEED_AUTH"] = "Y";
} else {
$arGroup = CSocNetGroup::GetByID($arParams["GROUP_ID"]);
if (!$arGroup || !is_array($arGroup) || $arGroup["ACTIVE"] != "Y") {
$arResult["FatalError"] = GetMessage("SONET_P_USER_NO_GROUP");
} else {
$arGroupSites = array();
$rsGroupSite = CSocNetGroup::GetSite($arGroup["ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arGroupSites[] = $arGroupSite["LID"];
}
if (!in_array(SITE_ID, $arGroupSites)) {
$arResult["FatalError"] = GetMessage("SONET_P_USER_NO_GROUP");
} else {
$arResult["Group"] = $arGroup;
$arResult["CurrentUserPerms"] = CSocNetUserToGroup::InitUserPerms($USER->GetID(), $arResult["Group"], CSocNetUser::IsCurrentUserModuleAdmin());
if (!$arResult["CurrentUserPerms"] || !$arResult["CurrentUserPerms"]["UserCanViewGroup"]) {
$arResult["FatalError"] = GetMessage("SONET_C12_NO_PERMS") . ". ";
} else {
$arResult["Urls"]["Group"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arResult["Group"]["ID"]));
$arResult["Urls"]["RequestSearch"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_REQUEST_SEARCH"], array("group_id" => $arResult["Group"]["ID"]));
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle($arResult["Group"]["NAME"] . ": " . GetMessage("SONET_C12_TITLE"));
示例3: foreach
foreach ($arParams['VALUE'] as &$id) {
$id = intval(trim($id));
}
unset($id);
$arParams['VALUE'] = array_unique($arParams['VALUE']);
$GLOBALS['GROUP_SITE_ID'] = $arParams['GROUP_SITE_ID'];
$bSubordinateOnly = isset($arParams["SUBORDINATE_ONLY"]) && $arParams["SUBORDINATE_ONLY"] == "Y";
$arResult["NAME"] = htmlspecialcharsbx($arParams["NAME"]);
$arResult["~NAME"] = $arParams["NAME"];
if (!isset($arParams["NAME_TEMPLATE"]) || strlen($arParams["NAME_TEMPLATE"]) <= 0) {
$arParams["NAME_TEMPLATE"] = CSite::GetNameFormat();
}
$arSubDeps = CIntranetUtils::getSubordinateDepartments($USER->GetID(), true);
if ($arParams["GROUP_ID_FOR_SITE"] && CModule::IncludeModule("extranet") && CModule::IncludeModule("socialnetwork")) {
$arSites = array();
$rsGroupSite = CSocNetGroup::GetSite($arParams["GROUP_ID_FOR_SITE"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arSites[] = $arGroupSite["LID"];
}
$extranetSiteId = CExtranet::GetExtranetSiteID();
if ($extranetSiteId && in_array($extranetSiteId, $arSites)) {
$GLOBALS['GROUP_SITE_ID'] = $extranetSiteId;
}
}
$arManagers = array();
if (($arDepartments = CIntranetUtils::getUserDepartments($USER->GetID())) && is_array($arDepartments) && count($arDepartments) > 0) {
$arManagers = array_keys(CIntranetUserSelectorHelper::getDepartmentManagersId($arDepartments, $USER->getID(), true));
}
$iBlockId = COption::GetOptionInt('intranet', 'iblock_structure');
$arSecFilter = array('IBLOCK_ID' => $iBlockId);
if ($bSubordinateOnly) {
示例4: array
$bAll = false;
$arResult["Post"]["SPERM"] = array();
if ($arPost["HAS_SOCNET_ALL"] != "Y") {
$arSPERM = CBlogPost::GetSocnetPermsName($arResult["Post"]["ID"]);
foreach ($arSPERM as $type => $v) {
foreach ($v as $vv) {
$name = "";
$link = "";
$id = "";
$isExtranet = false;
if ($type == "SG") {
if ($arSocNetGroup = CSocNetGroup::GetByID($vv["ENTITY_ID"])) {
$name = $arSocNetGroup["NAME"];
$link = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $vv["ENTITY_ID"]));
$groupSiteID = false;
$rsGroupSite = CSocNetGroup::GetSite($vv["ENTITY_ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
if (!$arResult["bExtranetInstalled"] || $arGroupSite["LID"] != CExtranet::GetExtranetSiteID()) {
$groupSiteID = $arGroupSite["LID"];
break;
}
}
if ($groupSiteID) {
$arTmp = CSocNetLogTools::ProcessPath(array("GROUP_URL" => $link), $user_id, $groupSiteID);
// user_id is not important parameter
$link = strlen($arTmp["URLS"]["GROUP_URL"]) > 0 ? $arTmp["SERVER_NAME"] . $arTmp["URLS"]["GROUP_URL"] : $link;
}
$isExtranet = is_array($GLOBALS["arExtranetGroupID"]) && in_array($vv["ENTITY_ID"], $GLOBALS["arExtranetGroupID"]);
}
} elseif ($type == "U") {
if (in_array("US" . $vv["ENTITY_ID"], $vv["ENTITY"])) {
示例5: OnSearchReindex
function OnSearchReindex($NS = Array(), $oCallback = NULL, $callback_method = "")
{
global $DB;
$arResult = array();
if ($NS["MODULE"]=="socialnetwork" && strlen($NS["ID"]) > 0)
$id = intval($NS["ID"]);
else
$id = 0;//very first id
if($NS["SITE_ID"]!="")
{
$strNSJoin1 .= " INNER JOIN b_sonet_group_site sgs ON sgs.GROUP_ID=g.ID ";
$strNSFilter1 .= " AND sgs.SITE_ID='".$DB->ForSQL($NS["SITE_ID"])."' ";
}
$strSql = "
SELECT
g.ID
,".$DB->DateToCharFunction("g.DATE_UPDATE")." as DATE_UPDATE
,g.NAME
,g.DESCRIPTION
,g.SUBJECT_ID
,g.KEYWORDS
,g.VISIBLE
FROM
b_sonet_group g
".$strNSJoin1."
WHERE
g.ACTIVE = 'Y'
".$strNSFilter1."
AND g.ID > ".$id."
ORDER BY
g.ID
";
$rs = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
while ($ar = $rs->Fetch())
{
$arSearchIndexSiteID = array();
$rsGroupSite = CSocNetGroup::GetSite($ar["ID"]);
while($arGroupSite = $rsGroupSite->Fetch())
$arSearchIndexSiteID[$arGroupSite["LID"]] = str_replace("#group_id#", $ar["ID"], COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", $arGroupSite["LID"]));
$Result = Array(
"ID" => "G".$ar["ID"],
"LAST_MODIFIED" => $ar["DATE_UPDATE"],
"TITLE" => $ar["NAME"],
"BODY" => CSocNetTextParser::killAllTags($ar["DESCRIPTION"]),
"SITE_ID" => $arSearchIndexSiteID,
"PARAM1" => $ar["SUBJECT_ID"],
"PARAM2" => $ar["ID"],
"PARAM3" => "GROUP",
"PERMISSIONS" => (
$ar["VISIBLE"] == "Y"?
array('G2')://public
array(
'SG'.$ar["ID"].'_A',//admins
'SG'.$ar["ID"].'_E',//moderators
'SG'.$ar["ID"].'_K',//members
)
),
"PARAMS" =>array(
"socnet_group" => $ar["ID"],
"entity" => "socnet_group",
),
"TAGS" => $ar["KEYWORDS"],
);
if($oCallback)
{
$res = call_user_func(array(&$oCallback, $callback_method), $Result);
if(!$res)
return $Result["ID"];
}
else
$arResult[] = $Result;
}
if ($oCallback)
return false;
return $arResult;
}
示例6: RejectRequestToBeMember
function RejectRequestToBeMember($userID, $groupID, $arRelationID)
{
global $APPLICATION, $DB;
$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;
}
if (!is_array($arRelationID)) {
return true;
}
$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($userID, $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 && $userID == $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;
}
$bSuccess = true;
$tmp_count = count($arRelationID);
for ($i = 0; $i < $tmp_count; $i++) {
$arRelationID[$i] = IntVal($arRelationID[$i]);
if ($arRelationID[$i] <= 0) {
continue;
}
$arRelation = CSocNetUserToGroup::GetByID($arRelationID[$i]);
if (!$arRelation) {
continue;
}
if ($arRelation["GROUP_ID"] != $groupID || $arRelation["INITIATED_BY_TYPE"] != SONET_INITIATED_BY_USER || $arRelation["ROLE"] != SONET_ROLES_REQUEST) {
continue;
}
if (CSocNetUserToGroup::Delete($arRelation["ID"])) {
$arMessageFields = array("FROM_USER_ID" => $userID, "TO_USER_ID" => $arRelation["USER_ID"], "MESSAGE" => str_replace("#NAME#", $arGroup["NAME"], GetMessage("SONET_UG_REJECT_MEMBER_MESSAGE_G")), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM);
CSocNetMessages::Add($arMessageFields);
} 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_CONFIRM_MEMBER");
$bSuccess = false;
}
}
return $bSuccess;
}
示例7: GetDefaultSiteId
function GetDefaultSiteId($groupId, $siteId = false)
{
$groupSiteId = $siteId ? $siteId : SITE_ID;
if (CModule::IncludeModule("extranet")) {
$extranetSiteId = CExtranet::GetExtranetSiteID();
$rsGroupSite = CSocNetGroup::GetSite($groupId);
while ($arGroupSite = $rsGroupSite->Fetch()) {
if (!$extranetSiteId || $arGroupSite["LID"] != $extranetSiteId) {
$groupSiteId = $arGroupSite["LID"];
break;
}
}
}
return $groupSiteId;
}
示例8: getSocNetGroupSite
private static function getSocNetGroupSite($id)
{
if (!CModule::IncludeModule('socialnetwork')) {
return array();
}
if (!isset(self::$cache['GROUP_SITE'][$id]) || !self::$cacheData) {
$item = CSocNetGroup::GetSite($id)->fetch();
if (!empty($item)) {
self::$cache['GROUP_SITE'][$id] = $item;
}
}
return self::$cache['GROUP_SITE'][$id];
}
示例9: array
$arPost = CBlogTools::htmlspecialcharsExArray($arPost);
$arResult["Post"] = $arPost;
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
$arBlog = CBlogTools::htmlspecialcharsExArray($arBlog);
$arResult["USER_ID"] = $USER->GetID();
$arResult["PostPerm"] = CBlogPost::GetBlogUserPostPerms($arParams["ID"], $arResult["USER_ID"]);
$arResult["Blog"] = $arBlog;
$arBlogUrl = CBlog::GetByUrl($arParams["BLOG_URL"]);
if (!empty($arBlogUrl) && $arBlogUrl["URL"] == $arBlog["URL"]) {
if ($arPost["ENABLE_TRACKBACK"] == "Y") {
if ($arResult["PostPerm"] > BLOG_PERMS_DENY) {
if (check_bitrix_sessid() && IntVal($_GET["delete_trackback_id"]) > 0 && CBlogPost::CanUserDeletePost(IntVal($arPost["ID"]), IntVal($USER->GetID()))) {
CBlogTrackback::Delete(IntVal($_GET["delete_trackback_id"]));
if (intval($arBlog["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork") && method_exists("CSocNetGroup", "GetSite")) {
$arSites = array();
$rsGroupSite = CSocNetGroup::GetSite($arBlog["SOCNET_GROUP_ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arSites[] = $arGroupSite["LID"];
}
} else {
$arSites = array(SITE_ID);
}
foreach ($arSites as $site_id_tmp) {
BXClearCache(True, "/" . $site_id_tmp . "/blog/" . $arBlog["URL"] . "/trackback/" . $arPost["ID"] . "/");
}
}
$cache = new CPHPCache();
$cache_id = "blog_trackback_" . serialize($arParams) . "_" . $arResult["PostPerm"];
if (($tzOffset = CTimeZone::GetOffset()) != 0) {
$cache_id .= "_" . $tzOffset;
}
示例10: SetSoNetFeaturePermIndexSearch
function SetSoNetFeaturePermIndexSearch($ID, $arFields)
{
$featurePerm = CSocNetFeaturesPerms::GetByID($ID);
if ($featurePerm["OPERATION_ID"] == "view_post") {
if (CModule::IncludeModule("socialnetwork")) {
$feature = CSocNetFeatures::GetByID($featurePerm["FEATURE_ID"]);
if ($feature["FEATURE"] == "blog" && IntVal($feature["ENTITY_ID"]) > 0) {
if ($feature["ACTIVE"] == "Y" && ($feature["ENTITY_TYPE"] == "U" && $arFields["ROLE"] == "A" || $feature["ENTITY_TYPE"] == "G" && $arFields["ROLE"] == "N")) {
$arFilter = array("USE_SOCNET" => "Y");
if ($feature["ENTITY_TYPE"] == "U") {
$arFilter["OWNER_ID"] = $feature["ENTITY_ID"];
} else {
$arFilter["SOCNET_GROUP_ID"] = $feature["ENTITY_ID"];
}
$dbBlog = CBlog::GetList(array(), $arFilter, false, array("nTopCount" => 1), array("ID", "SOCNET_GROUP_ID"));
if ($arBlog = $dbBlog->Fetch()) {
CBlog::AddSocnetRead($arBlog["ID"]);
}
} else {
$arFilter = array("USE_SOCNET" => "Y");
if ($feature["ENTITY_TYPE"] == "U") {
$arFilter["OWNER_ID"] = $feature["ENTITY_ID"];
} else {
$arFilter["SOCNET_GROUP_ID"] = $feature["ENTITY_ID"];
}
$dbBlog = CBlog::GetList(array(), $arFilter, false, array("nTopCount" => 1), array("ID", "SOCNET_GROUP_ID"));
if ($arBlog = $dbBlog->Fetch()) {
CBlog::DeleteSocnetRead($arBlog["ID"]);
}
}
if ($arBlog && intval($arBlog["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork") && method_exists("CSocNetGroup", "GetSite")) {
$arSites = array();
$rsGroupSite = CSocNetGroup::GetSite($arBlog["SOCNET_GROUP_ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arSites[] = $arGroupSite["LID"];
}
} else {
$arSites = array(SITE_ID);
}
foreach ($arSites as $site_id_tmp) {
BXClearCache(True, "/" . $site_id_tmp . "/blog/sonet/");
}
}
}
}
}
示例11: Update
//.........这里部分代码省略.........
$arSiteID = array();
if (is_set($arFields, "SITE_ID")) {
if (is_array($arFields["SITE_ID"])) {
$arSiteID = $arFields["SITE_ID"];
} else {
$arSiteID[] = $arFields["SITE_ID"];
}
$arFields["SITE_ID"] = false;
$str_SiteID = "''";
foreach ($arSiteID as $v) {
$arFields["SITE_ID"] = $v;
$str_SiteID .= ", '" . $DB->ForSql($v) . "'";
}
}
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetGroupUpdate");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
return false;
}
}
if (array_key_exists("IMAGE_ID", $arFields) && is_array($arFields["IMAGE_ID"]) && (!array_key_exists("MODULE_ID", $arFields["IMAGE_ID"]) || strlen($arFields["IMAGE_ID"]["MODULE_ID"]) <= 0)) {
$arFields["IMAGE_ID"]["MODULE_ID"] = "socialnetwork";
}
CFile::SaveForDB($arFields, "IMAGE_ID", "socialnetwork");
$strUpdate = $DB->PrepareUpdate("b_sonet_group", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
$strSql = "UPDATE b_sonet_group SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (count($arSiteID) > 0) {
$strSql = "DELETE FROM b_sonet_group_site WHERE GROUP_ID=" . $ID;
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
$strSql = "INSERT INTO b_sonet_group_site(GROUP_ID, SITE_ID) " . "SELECT " . $ID . ", LID " . "FROM b_lang " . "WHERE LID IN (" . $str_SiteID . ") ";
$DB->Query($strSql, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
$arLogID = array();
$dbResult = CSocNetLog::GetList(array(), array("LOG_RIGHTS" => "SG" . $ID), false, false, array("ID"));
while ($arResult = $dbResult->Fetch()) {
$DB->Query("DELETE FROM b_sonet_log_site WHERE LOG_ID = " . $arResult["ID"] . "", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
$DB->Query("\n\t\t\t\t\t\tINSERT INTO b_sonet_log_site(LOG_ID, SITE_ID)\n\t\t\t\t\t\tSELECT " . $arResult["ID"] . ", LID\n\t\t\t\t\t\tFROM b_lang\n\t\t\t\t\t\tWHERE LID IN (" . $str_SiteID . ")\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
$arLogID[] = $arResult["ID"];
}
$dbResult = CSocNetLog::GetList(array(), array("!ID" => $arLogID, "ENTITY_ID" => $ID, "ENTITY_TYPE" => SONET_ENTITY_GROUP), false, false, array("ID"));
while ($arResult = $dbResult->Fetch()) {
$DB->Query("DELETE FROM b_sonet_log_site WHERE LOG_ID = " . $arResult["ID"] . "", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
$DB->Query("\n\t\t\t\t\t\tINSERT INTO b_sonet_log_site(LOG_ID, SITE_ID)\n\t\t\t\t\t\tSELECT " . $arResult["ID"] . ", LID\n\t\t\t\t\t\tFROM b_lang\n\t\t\t\t\t\tWHERE LID IN (" . $str_SiteID . ")\n\t\t\t\t\t", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
}
}
unset($GLOBALS["SONET_GROUP_CACHE"][$ID]);
if (defined("BX_COMP_MANAGED_CACHE")) {
if ($bClearCommonTag) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group");
}
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_group_" . $ID);
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group_G" . $ID);
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_user2group");
}
$GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_GROUP", $ID, $arFields);
$events = GetModuleEvents("socialnetwork", "OnSocNetGroupUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, &$arFields));
}
if (CModule::IncludeModule("search")) {
$arGroupNew = CSocNetGroup::GetByID($ID);
if ($arGroupNew) {
if ($arGroupNew["ACTIVE"] == "N" && $arGroupOld["ACTIVE"] == "Y") {
CSearch::DeleteIndex("socialnetwork", "G" . $ID);
} elseif ($arGroupNew["ACTIVE"] == "Y") {
$BODY = CSocNetTextParser::killAllTags($arGroupNew["~DESCRIPTION"]);
$BODY .= $GLOBALS["USER_FIELD_MANAGER"]->OnSearchIndex("SONET_GROUP", $ID);
$arSearchIndexSiteID = array();
$rsGroupSite = CSocNetGroup::GetSite($ID);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arSearchIndexSiteID[$arGroupSite["LID"]] = str_replace("#group_id#", $ID, COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", $arGroupSite["LID"]));
}
$arSearchIndex = array("SITE_ID" => $arSearchIndexSiteID, "LAST_MODIFIED" => $arGroupNew["DATE_ACTIVITY"], "PARAM1" => $arGroupNew["SUBJECT_ID"], "PARAM2" => $ID, "PARAM3" => "GROUP", "PERMISSIONS" => $arGroupNew["VISIBLE"] == "Y" ? array('G2') : array('SG' . $ID . '_A', 'SG' . $ID . '_E', 'SG' . $ID . '_K'), "PARAMS" => array("socnet_group" => $ID, "entity" => "socnet_group"), "TITLE" => $arGroupNew["~NAME"], "BODY" => $BODY, "TAGS" => $arGroupNew["~KEYWORDS"]);
CSearch::Index("socialnetwork", "G" . $ID, $arSearchIndex, True);
}
if ($arGroupNew["OPENED"] == "Y" && $arGroupOld["OPENED"] == "N") {
$dbRequests = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $ID, "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_USER), false, false, array("ID"));
if ($dbRequests) {
$arIDs = array();
while ($arRequests = $dbRequests->GetNext()) {
$arIDs[] = $arRequests["ID"];
}
CSocNetUserToGroup::ConfirmRequestToBeMember($GLOBALS["USER"]->GetID(), $ID, $arIDs, $bAutoSubscribe);
}
}
}
}
} elseif (!$GLOBALS["USER_FIELD_MANAGER"]->Update("SONET_GROUP", $ID, $arFields)) {
$ID = False;
}
return $ID;
}
示例12: 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;
}
}
//.........这里部分代码省略.........
示例13: foreach
$arResult["POST"]["OPENED"] = $arGroup["OPENED"];
$arResult["POST"]["CLOSED"] = $arGroup["CLOSED"];
$arResult["POST"]["KEYWORDS"] = $arGroup["KEYWORDS"];
$arResult["POST"]["OWNER_ID"] = $arGroup["OWNER_ID"];
$arResult["POST"]["INITIATE_PERMS"] = $arGroup["INITIATE_PERMS"];
$arResult["POST"]["SPAM_PERMS"] = $arGroup["SPAM_PERMS"];
$arResult["POST"]["IMAGE_ID"] = $arGroup["IMAGE_ID"];
$arResult["POST"]["IMAGE_ID_FILE"] = CFile::GetFileArray($arGroup["IMAGE_ID"]);
$arResult["POST"]["IMAGE_ID_IMG"] = $arResult["POST"]["IMAGE_ID_FILE"] != false ? CFile::ShowImage($arResult["POST"]["IMAGE_ID_FILE"]["ID"], 100, 100, "border=0", false, true) : false;
foreach ($arResult["GROUP_PROPERTIES"] as $field => $arUserField) {
if (array_key_exists($field, $arGroup)) {
$arResult["GROUP_PROPERTIES"][$field]["VALUE"] = $arGroup["~" . $field];
$arResult["GROUP_PROPERTIES"][$field]["ENTITY_VALUE_ID"] = $arGroup["ID"];
}
}
$rsGroupSite = CSocNetGroup::GetSite($arParams["GROUP_ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
$arSites[] = $arGroupSite["LID"];
}
} else {
$arParams["GROUP_ID"] = 0;
$arResult["POST"]["VISIBLE"] = "Y";
}
} else {
$arParams["GROUP_ID"] = 0;
$arResult["POST"]["VISIBLE"] = "Y";
if ($arResult["bExtranet"]) {
$arResult["POST"]["INITIATE_PERMS"] = "E";
} else {
$arResult["POST"]["INITIATE_PERMS"] = "K";
}
示例14: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
static $arSiteWorkgroupsPage;
global $DB, $arSocNetAllowedEntityTypes, $arSocNetAllowedSubscribeEntityTypes, $arSocNetFeaturesSettings, $arSocNetLogEvents;
if (!$arSiteWorkgroupsPage && IsModuleInstalled("extranet") && $arFields["ENTITY_TYPE"] == SONET_ENTITY_GROUP)
{
$rsSite = CSite::GetList($by="sort", $order="desc", Array("ACTIVE" => "Y"));
while($arSite = $rsSite->Fetch())
$arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroup_page", $arSite["DIR"]."workgroups/", $arSite["ID"]);
}
if ($ACTION != "ADD" && IntVal($ID) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException("System error 870164", "ERROR");
return false;
}
$newEntityType = "";
if ((is_set($arFields, "ENTITY_TYPE") || $ACTION=="ADD") && StrLen($arFields["ENTITY_TYPE"]) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GL_EMPTY_ENTITY_TYPE"), "EMPTY_ENTITY_TYPE");
return false;
}
elseif (is_set($arFields, "ENTITY_TYPE"))
{
if (!in_array($arFields["ENTITY_TYPE"], $arSocNetAllowedSubscribeEntityTypes))
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GL_ERROR_NO_ENTITY_TYPE"), "ERROR_NO_ENTITY_TYPE");
return false;
}
$newEntityType = $arFields["ENTITY_TYPE"];
}
if ((is_set($arFields, "ENTITY_ID") || $ACTION=="ADD") && IntVal($arFields["ENTITY_ID"]) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GL_EMPTY_ENTITY_ID"), "EMPTY_ENTITY_ID");
return false;
}
elseif (is_set($arFields, "ENTITY_ID"))
{
if (StrLen($newEntityType) <= 0 && $ID > 0)
{
$arRe = CAllSocNetLog::GetByID($ID);
if ($arRe)
$newEntityType = $arRe["ENTITY_TYPE"];
}
if (StrLen($newEntityType) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GL_ERROR_CALC_ENTITY_TYPE"), "ERROR_CALC_ENTITY_TYPE");
return false;
}
if ($newEntityType == SONET_ENTITY_GROUP)
{
$arResult = CSocNetGroup::GetByID($arFields["ENTITY_ID"]);
if ($arResult == false)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GL_ERROR_NO_ENTITY_ID"), "ERROR_NO_ENTITY_ID");
return false;
}
}
elseif ($newEntityType == SONET_ENTITY_USER)
{
$dbResult = CUser::GetByID($arFields["ENTITY_ID"]);
if (!$dbResult->Fetch())
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GL_ERROR_NO_ENTITY_ID"), "ERROR_NO_ENTITY_ID");
return false;
}
}
}
if (
$ACTION == "ADD"
&& (
!is_set($arFields, "SITE_ID")
|| (
(is_array($arFields["SITE_ID"]) && count($arFields["SITE_ID"]) <= 0)
|| (!is_array($arFields["SITE_ID"]) && StrLen($arFields["SITE_ID"]) <= 0)
)
)
)
{
if ($newEntityType == SONET_ENTITY_GROUP)
{
$arSites = array();
$rsGroupSite = CSocNetGroup::GetSite($arFields["ENTITY_ID"]);
while($arGroupSite = $rsGroupSite->Fetch())
$arSites[] = $arGroupSite["LID"];
$arFields["SITE_ID"] = $arSites;
}
else
$arFields["SITE_ID"] = array(SITE_ID);
}
if ((is_set($arFields, "EVENT_ID") || $ACTION=="ADD") && StrLen($arFields["EVENT_ID"]) <= 0)
//.........这里部分代码省略.........
示例15: getGroup
public static function getGroup($arFields, $n, $server)
{
$arOrder = $arFields['ORDER'];
if (!is_array($arOrder)) {
$arOrder = array("ID" => "DESC");
}
if ($arFields['IS_ADMIN'] == 'Y') {
if (!CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false)) {
unset($arFields['IS_ADMIN']);
}
}
$arFilter = self::checkGroupFilter($arFields['FILTER']);
if ($arFields['IS_ADMIN'] != 'Y') {
$arFilter['CHECK_PERMISSIONS'] = $GLOBALS["USER"]->GetID();
}
$result = array();
$dbRes = CSocNetGroup::GetList($arOrder, $arFilter, false, self::getNavData($n));
while ($arRes = $dbRes->Fetch()) {
$arRes['DATE_CREATE'] = CRestUtil::ConvertDateTime($arRes['DATE_CREATE']);
$arRes['DATE_UPDATE'] = CRestUtil::ConvertDateTime($arRes['DATE_UPDATE']);
$arRes['DATE_ACTIVITY'] = CRestUtil::ConvertDateTime($arRes['DATE_ACTIVITY']);
if ($arRes['IMAGE_ID'] > 0) {
$arRes['IMAGE'] = self::getFile($arRes['IMAGE_ID']);
}
if (CModule::IncludeModule("extranet") && ($extranet_site_id = CExtranet::GetExtranetSiteID())) {
$arRes["IS_EXTRANET"] = "N";
$rsGroupSite = CSocNetGroup::GetSite($arRes["ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
if ($arGroupSite["LID"] == $extranet_site_id) {
$arRes["IS_EXTRANET"] = "Y";
break;
}
}
}
unset($arRes['INITIATE_PERMS']);
unset($arRes['SPAM_PERMS']);
unset($arRes['IMAGE_ID']);
$result[] = $arRes;
}
return self::setNavData($result, $dbRes);
}