Beispiel #1
0
    LocalRedirect($backurl);
}
if ($componentTemplate == 'twitpost') {
    $arResult["TWIT_HASH"] = htmlspecialcharsbx(COption::GetOptionString("socialservices", "twitter_search_hash", "#b24"));
}
$arResult['CURRENTURL'] = $APPLICATION->GetCurPageParam($add, $arParamsToDelete);
if (CModule::IncludeModule("socialnetwork")) {
    CJSCore::Init(array('socnetlogdest'));
    // socialnetwork
    if (method_exists('CSocNetLogDestination', 'GetDestinationSort')) {
        $arResult["PostToShow"]["FEED_DESTINATION"] = array('DEST_SORT' => CSocNetLogDestination::GetDestinationSort(array("DEST_CONTEXT" => "SOCSERVICES")), 'LAST' => array());
        CSocNetLogDestination::fillLastDestination($arResult["PostToShow"]["FEED_DESTINATION"]['DEST_SORT'], $arResult["PostToShow"]["FEED_DESTINATION"]['LAST']);
    } else {
        $arResult["PostToShow"]["FEED_DESTINATION"] = array('LAST' => array('SONETGROUPS' => CSocNetLogDestination::GetLastSocnetGroup(), 'DEPARTMENT' => CSocNetLogDestination::GetLastDepartment(), 'LAST' => CSocNetLogDestination::GetLastUser()));
    }
    $arResult["PostToShow"]["FEED_DESTINATION"]['SONETGROUPS'] = CSocNetLogDestination::GetSocnetGroup(array('features' => array("blog", array("premoderate_post", "moderate_post", "write_post", "full_post"))));
    $arDestUser = array();
    $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'] = array();
    if (!empty($arResult["PostToShow"]["SPERM"])) {
        $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'] = array();
        if (empty($arResult["PostToShow"]["SPERM"])) {
            if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) {
                if (!empty($arResult["PostToShow"]["FEED_DESTINATION"]['LAST']['SONETGROUPS'])) {
                    foreach ($arResult["PostToShow"]["FEED_DESTINATION"]['LAST']['SONETGROUPS'] as $val) {
                        $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'][$val] = "sonetgroups";
                    }
                } else {
                    foreach ($arResult["PostToShow"]["FEED_DESTINATION"]['SONETGROUPS'] as $k => $val) {
                        $arResult["PostToShow"]["FEED_DESTINATION"]['SELECTED'][$k] = "sonetgroups";
                    }
                }
Beispiel #2
0
 public static function GetSocNetDestination($user_id = false, $selected = array())
 {
     global $CACHE_MANAGER;
     if (!is_array($selected)) {
         $selected = array();
     }
     $DESTINATION = array('LAST' => array('SONETGROUPS' => CSocNetLogDestination::GetLastSocnetGroup()));
     if (!$user_id) {
         $user_id = CCalendar::GetCurUserId();
     }
     $DESTINATION['LAST']['SONETGROUPS'] = CSocNetLogDestination::GetLastSocnetGroup();
     $cacheTtl = defined("BX_COMP_MANAGED_CACHE") ? 3153600 : 3600 * 4;
     $cacheId = 'blog_post_form_dest_' . $user_id;
     $cacheDir = '/blog/form/dest/' . SITE_ID . '/' . $user_id;
     $obCache = new CPHPCache();
     if ($obCache->InitCache($cacheTtl, $cacheId, $cacheDir)) {
         $DESTINATION['SONETGROUPS'] = $obCache->GetVars();
     } else {
         $obCache->StartDataCache();
         $DESTINATION['SONETGROUPS'] = CSocNetLogDestination::GetSocnetGroup(array('features' => array("blog", array("premoderate_post", "moderate_post", "write_post", "full_post"))));
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->StartTagCache($cacheDir);
             foreach ($DESTINATION['SONETGROUPS'] as $val) {
                 $CACHE_MANAGER->RegisterTag("sonet_features_G_" . $val["entityId"]);
                 $CACHE_MANAGER->RegisterTag("sonet_group_" . $val["entityId"]);
             }
             $CACHE_MANAGER->RegisterTag("sonet_user2group_U" . $user_id);
             $CACHE_MANAGER->EndTagCache();
         }
         $obCache->EndDataCache($DESTINATION['SONETGROUPS']);
     }
     $arDestUser = array();
     $DESTINATION['SELECTED'] = array();
     foreach ($selected as $ind => $code) {
         if (substr($code, 0, 2) == 'DR') {
             $DESTINATION['SELECTED'][$code] = "department";
         } elseif (substr($code, 0, 2) == 'UA') {
             $DESTINATION['SELECTED'][$code] = "groups";
         } elseif (substr($code, 0, 2) == 'SG') {
             $DESTINATION['SELECTED'][$code] = "sonetgroups";
         } elseif (substr($code, 0, 1) == 'U') {
             $DESTINATION['SELECTED'][$code] = "users";
             $arDestUser[] = str_replace('U', '', $code);
         }
     }
     // intranet structure
     $arStructure = CSocNetLogDestination::GetStucture();
     //$arStructure = CSocNetLogDestination::GetStucture(array("LAZY_LOAD" => true));
     $DESTINATION['DEPARTMENT'] = $arStructure['department'];
     $DESTINATION['DEPARTMENT_RELATION'] = $arStructure['department_relation'];
     $DESTINATION['DEPARTMENT_RELATION_HEAD'] = $arStructure['department_relation_head'];
     $DESTINATION['LAST']['DEPARTMENT'] = CSocNetLogDestination::GetLastDepartment();
     // users
     $DESTINATION['LAST']['USERS'] = CSocNetLogDestination::GetLastUser();
     if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) {
         $DESTINATION['EXTRANET_USER'] = '******';
         $DESTINATION['USERS'] = CSocNetLogDestination::GetExtranetUser();
     } else {
         foreach ($DESTINATION['LAST']['USERS'] as $value) {
             $arDestUser[] = str_replace('U', '', $value);
         }
         $DESTINATION['EXTRANET_USER'] = '******';
         $DESTINATION['USERS'] = CSocNetLogDestination::GetUsers(array('id' => $arDestUser));
     }
     $users = array();
     foreach ($DESTINATION['USERS'] as $key => $entry) {
         if ($entry['isExtranet'] == 'N') {
             $users[$key] = $entry;
         }
     }
     $DESTINATION['USERS'] = $users;
     return $DESTINATION;
 }
Beispiel #3
0
<?php

require $_SERVER["DOCUMENT_ROOT"] . "/mobile/headers.php";
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
if (IsModuleInstalled("bitrix24")) {
    GetGlobalID();
}
$arPostProperty = array("UF_BLOG_POST_DOC");
if (IsModuleInstalled("webdav")) {
    $arPostProperty[] = "UF_BLOG_POST_FILE";
}
if (CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite() && CModule::IncludeModule("socialnetwork")) {
    $arSonetGroups = CSocNetLogDestination::GetSocnetGroup(array('features' => array("blog", array("premoderate_post", "moderate_post", "write_post", "full_post"))));
    if (count($arSonetGroups) == 1) {
        foreach ($arSonetGroups as $key => $arGroupTmp) {
            $group_id = intval($arGroupTmp['entityId']);
        }
    }
}
if (!$group_id) {
    $group_id = intval($_REQUEST["group_id"]);
}
$group_id = intval($group_id);
$APPLICATION->IncludeComponent("bitrix:main.post.form", "mobile", array("FORM_ACTION_URL" => SITE_DIR . "mobile/log/" . ($group_id > 0 ? "?group_id=" . $group_id : ""), "SOCNET_GROUP_ID" => $group_id, "POST_PROPERTY" => $arPostProperty, "FORM_ID" => "blogPostForm", "FORM_TARGET" => "_self", "IS_EXTRANET" => "Y"), false, array("HIDE_ICONS" => "Y"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php";
Beispiel #4
0
    }
}
if ($GLOBALS["USER"]->IsAuthorized() && $arParams["USE_FOLLOW"] == "Y") {
    $rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $GLOBALS["USER"]->GetID(), "CODE" => "**"), array("TYPE"));
    if ($arFollow = $rsFollow->Fetch()) {
        $arResult["FOLLOW_DEFAULT"] = $arFollow["TYPE"];
    } else {
        $arResult["FOLLOW_DEFAULT"] = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
    }
}
$bAllowToAll = COption::GetOptionString("socialnetwork", "allow_livefeed_toall", "Y") == "Y";
if ($bAllowToAll) {
    $arToAllRights = unserialize(COption::GetOptionString("socialnetwork", "livefeed_toall_rights", 'a:1:{i:0;s:2:"AU";}'));
    if (!$arToAllRights) {
        $arToAllRights = array("AU");
    }
    $arUserGroupCode = array_merge(array("AU"), CAccess::GetUserCodesArray($GLOBALS["USER"]->GetID()));
    if (count(array_intersect($arToAllRights, $arUserGroupCode)) <= 0) {
        $bAllowToAll = false;
    }
}
$arResult["bExtranetSite"] = CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite();
$arResult["bDenyToAll"] = $arResult["bExtranetSite"] || !$bAllowToAll;
$arResult["bDefaultToAll"] = $bAllowToAll ? COption::GetOptionString("socialnetwork", "default_livefeed_toall", "Y") == "Y" : false;
if ($arResult["bExtranetSite"]) {
    $arResult["arAvailableGroup"] = CSocNetLogDestination::GetSocnetGroup(array('features' => array("blog", array("premoderate_post", "moderate_post", "write_post", "full_post"))));
}
$arResult["bDiskInstalled"] = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && IsModuleInstalled('disk');
$arResult["bWebDavInstalled"] = IsModuleInstalled('webdav');
$arResult["postFormUFCode"] = $arResult["bDiskInstalled"] || IsModuleInstalled('webdav') ? "UF_BLOG_POST_FILE" : "UF_BLOG_POST_DOC";
$this->IncludeComponentTemplate();
Beispiel #5
0
            }
        }
    }
}
//$arResult['FEED_DESTINATION']['LAST']['SONETGROUPS'] = CSocNetLogDestination::GetLastSocnetGroup();
// ALLOWED SONET GROUPS -->
$isManagedCacheEnabled = defined('BX_COMP_MANAGED_CACHE');
$cacheTtl = $isManagedCacheEnabled ? 3153600 : 3600 * 4;
$eventDestCacheID = 'crm_sl_event_dest_' . SITE_ID . '_' . $userID;
$eventDestCacheDir = '/crm/sl_event/dest/' . SITE_ID . '/' . $userID;
$cache = new CPHPCache();
if ($cache->InitCache($arParams['CACHE_TIME'], $eventDestCacheID, $eventDestCacheDir)) {
    $arResult['FEED_DESTINATION']['SONETGROUPS'] = $cache->GetVars();
} else {
    $cache->StartDataCache();
    $arResult['FEED_DESTINATION']['SONETGROUPS'] = CSocNetLogDestination::GetSocnetGroup();
    if ($isManagedCacheEnabled) {
        $cacheManager->StartTagCache($eventDestCacheDir);
        foreach ($arResult['FEED_DESTINATION']['SONETGROUPS'] as $val) {
            $cacheManager->RegisterTag("sonet_features_G_{$val['entityId']}");
            $cacheManager->RegisterTag("sonet_group_{$val['entityId']}");
        }
        $cacheManager->RegisterTag("sonet_user2group_U{$userID}");
        $cacheManager->EndTagCache();
    }
    $cache->EndDataCache($arResult['FEED_DESTINATION']['SONETGROUPS']);
}
// <-- ALLOWED SONET GROUPS
if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()) {
    foreach ($arResult['FEED_DESTINATION']['SONETGROUPS'] as $k => $val) {
        $arResult['FEED_DESTINATION']['SELECTED'][$k] = 'sonetgroups';
Beispiel #6
0
 $iStructureCount = count(CIntranetUtils::GetDeparmentsTree());
 CModule::IncludeModule('socialnetwork');
 $cacheTtl = defined("BX_COMP_MANAGED_CACHE") ? 3153600 : 3600 * 4;
 $cacheId = 'invite_dialog_sonetgroups_' . $SITE_ID . '_' . ($bExtranetInstalled ? 'Y' : 'N') . '_' . $GLOBALS["USER"]->GetID();
 $cacheDir = '/intranet/invite_dialog/' . $SITE_ID . '/' . $GLOBALS["USER"]->GetID();
 $obCache = new CPHPCache();
 if ($obCache->InitCache($cacheTtl, $cacheId, $cacheDir)) {
     $arCacheVars = $obCache->GetVars();
     $arSonetGroups = $arCacheVars["SONET_GROUPS"];
     $arSonetGroupsExtranet = $arCacheVars["SONET_GROUPS_EXTRANET"];
 } else {
     $obCache->StartDataCache();
     $arSonetGroups = CSocNetLogDestination::GetSocnetGroup();
     $arSonetGroupsExtranet = array();
     if ($bExtranetInstalled && CModule::IncludeModule("extranet")) {
         $arSonetGroupsExtranet = CSocNetLogDestination::GetSocnetGroup(array("site_id" => CExtranet::GetExtranetSiteID()));
     }
     if (defined("BX_COMP_MANAGED_CACHE")) {
         $GLOBALS["CACHE_MANAGER"]->StartTagCache($cacheDir);
         foreach ($arSonetGroups as $val) {
             $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $val["entityId"]);
         }
         $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U" . $GLOBALS["USER"]->GetID());
         $GLOBALS["CACHE_MANAGER"]->EndTagCache();
     }
     $obCache->EndDataCache(array("SONET_GROUPS" => $arSonetGroups, "SONET_GROUPS_EXTRANET" => $arSonetGroupsExtranet));
 }
 if (is_array($arSonetGroupsExtranet) && !empty($arSonetGroupsExtranet)) {
     $arExtranetGroupID = array();
     foreach ($arSonetGroupsExtranet as $arSonetGroupTmp) {
         if (is_array($arSonetGroupTmp) && array_key_exists("entityId", $arSonetGroupTmp) && intval($arSonetGroupTmp["entityId"]) > 0) {
Beispiel #7
0
    $tableTitle = GetMessage("MD_EMPLOYEES_TITLE");
    $tableData = AddTableData($tableData, $data, $tableTitle, $tableType);
}
if (in_array($action, array("get_group_list", "get_usergroup_list"))) {
    $cache_id = "mobileAction|get_groups|" . $GLOBALS["USER"]->GetID() . "|" . $detailurl;
    if ($cache->InitCache($cache_time, $cache_id, $cache_path)) {
        $cachedData = $cache->GetVars();
        $data = $cachedData["DATA"];
        $tableType = $cachedData["TYPE"];
    } else {
        if (CModule::IncludeModule("socialnetwork")) {
            $GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
            $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U" . $GLOBALS["USER"]->GetID());
            $GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group");
            $data = array();
            $arSonetGroups = CSocNetLogDestination::GetSocnetGroup(array("features" => array("blog", array("premoderate_post", "moderate_post", "write_post", "full_post")), "THUMBNAIL_SIZE_WIDTH" => 64, "THUMBNAIL_SIZE_HEIGHT" => 64));
            foreach ($arSonetGroups as $arSocnetGroup) {
                $tmpData = array("NAME" => htmlspecialcharsback($arSocnetGroup["name"]), "ID" => $arSocnetGroup["entityId"], "IMAGE" => $arSocnetGroup["avatar"], "bubble_background_color" => "#FFD5D5", "bubble_text_color" => "#B54827");
                if (ToUpper(SITE_CHARSET) != "UTF-8") {
                    $tmpData = $APPLICATION->ConvertCharsetArray($tmpData, SITE_CHARSET, "utf-8");
                }
                $data[] = $tmpData;
            }
            $GLOBALS["CACHE_MANAGER"]->EndTagCache();
            $tableType = "b_groups";
            if ($cache->StartDataCache()) {
                $cache->EndDataCache(array("DATA" => $data, "TYPE" => $tableType));
            }
        }
    }
    $tableTitle = GetMessage("MD_GROUPS_TITLE");