本文整理汇总了PHP中CExtranet::IsIntranetUser方法的典型用法代码示例。如果您正苦于以下问题:PHP CExtranet::IsIntranetUser方法的具体用法?PHP CExtranet::IsIntranetUser怎么用?PHP CExtranet::IsIntranetUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CExtranet
的用法示例。
在下文中一共展示了CExtranet::IsIntranetUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FilterViewableUsers
function FilterViewableUsers($var)
{
if (!CModule::IncludeModule("extranet") || CExtranet::IsIntranetUser() || CExtranet::IsProfileViewableByID($var["ID"], $GLOBALS["GROUP_SITE_ID"])) {
return true;
} else {
return false;
}
}
示例2: Enable
public function Enable($number = '')
{
$enable = !IsModuleInstalled('extranet') || CModule::IncludeModule('extranet') && CExtranet::IsIntranetUser();
if ($enable && strlen($number) > 0) {
if (!CVoxImplantPhone::Normalize($number)) {
$enable = false;
}
}
return $enable;
}
示例3: WDUFGetExtranetDir
function WDUFGetExtranetDir()
{
global $APPLICATION, $USER;
$URLPrefix = null;
if ($URLPrefix == null) {
$URLPrefix = '';
if (CModule::IncludeModule('extranet') && strlen(CExtranet::GetExtranetSiteID()) > 0 && $USER->IsAuthorized() && !$USER->IsAdmin() && !CExtranet::IsIntranetUser()) {
$rsSites = CSite::GetByID(CExtranet::GetExtranetSiteID());
if ($arExtranetSite = $rsSites->Fetch()) {
$URLPrefix = $arExtranetSite["DIR"];
}
}
}
return $URLPrefix;
}
示例4: SearchUsers
public static function SearchUsers($search, $nameTemplate = "", $bSelf = true, $bEmployeesOnly = false, $bExtranetOnly = false, $departmentId = false)
{
CUtil::JSPostUnescape();
$arUsers = array();
$search = trim($search);
if (strlen($search) <= 0 || !GetFilterQuery("TEST", $search)) {
return $arUsers;
}
$bIntranetEnable = IsModuleInstalled('intranet');
$bExtranetEnable = CModule::IncludeModule('extranet');
$bBitrix24Enable = IsModuleInstalled('bitrix24');
$bExtranetUser = $bExtranetEnable && !CExtranet::IsIntranetUser();
$current_user_id = intval($GLOBALS["USER"]->GetID());
if ($bExtranetEnable) {
CSocNetTools::InitGlobalExtranetArrays();
}
$arSearchValue = preg_split('/\\s+/', trim($search));
array_walk($arSearchValue, array('CSocNetLogDestination', '__percent_walk'));
$arFilter = array(array('LOGIC' => 'OR', '%=NAME' => $arSearchValue, '%=LAST_NAME' => $arSearchValue, '%=EMAIL' => $search, '%=LOGIN' => $search), 'ACTIVE' => 'Y');
if ($bIntranetEnable || COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y") {
$arFilter["CONFIRM_CODE"] = false;
}
if ($bEmployeesOnly || $bBitrix24Enable && !$bExtranetEnable) {
$arFilter["!UF_DEPARTMENT"] = false;
} elseif ($bExtranetOnly) {
$arFilter["UF_DEPARTMENT"] = false;
}
if ($bIntranetEnable && $bExtranetEnable && ($bExtranetUser || !$bEmployeesOnly)) {
$arFilteredUserIDs = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
if ($bExtranetUser) {
$arFilter["ID"] = array_merge(array($current_user_id), $arFilteredUserIDs);
} else {
$arFilter[] = array('LOGIC' => 'OR', '!UF_DEPARTMENT' => false, 'ID' => array_merge(array($current_user_id), $arFilteredUserIDs));
}
}
$arSelect = array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "LOGIN", "WORK_POSITION", "PERSONAL_PROFESSION", "PERSONAL_PHOTO", "PERSONAL_GENDER");
if ($bIntranetEnable) {
$arSelect[] = 'UF_DEPARTMENT';
}
if (intval($departmentId) > 0) {
$acc = new CAccess();
}
$rsUser = \Bitrix\Main\UserTable::getList(array('order' => array('LAST_NAME' => 'ASC'), 'filter' => $arFilter, 'select' => $arSelect, 'limit' => 20, 'data_doubling' => false));
while ($arUser = $rsUser->fetch()) {
if (!$bSelf && $current_user_id == $arUser['ID']) {
continue;
}
if (is_object($acc)) {
$acc->UpdateCodes(array("USER_ID" => $arUser["ID"]));
$arUserGroupCode = CAccess::GetUserCodesArray($arUser["ID"], array("PROVIDER_ID" => "intranet"));
if (!in_array("DR" . intval($departmentId), $arUserGroupCode)) {
continue;
}
}
$sName = CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat(false) : $nameTemplate, $arUser, true, true);
$arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
$arUsers['U' . $arUser["ID"]] = array('id' => 'U' . $arUser["ID"], 'entityId' => $arUser["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : ($arUser['PERSONAL_PROFESSION'] ? $arUser['PERSONAL_PROFESSION'] : ' '), 'isExtranet' => isset($GLOBALS["arExtranetUserID"]) && is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
$checksum = md5(serialize($arUsers['U' . $arUser["ID"]]));
$arUsers['U' . $arUser["ID"]]['checksum'] = $checksum;
}
return $arUsers;
}
示例5: array
}
}
$arUsersToFilter = array();
$dbRequests = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $group_id, "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("ID", "USER_ID", "ROLE"));
if ($dbRequests) {
while ($arRequests = $dbRequests->Fetch()) {
$arUsersToFilter[] = $arRequests["USER_ID"];
}
}
} elseif ($EXTERNAL == 'A' && strlen($site) > 0 && CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite($site)) {
if ($GLOBALS["APPLICATION"]->GetGroupRight("socialnetwork", false, "Y", "Y", array($site, false)) >= "W") {
$arUsersToFilter = CExtranet::GetExtranetGroupUsers();
} else {
$arUsersToFilter = CExtranet::GetMyGroupsUsers($site);
}
} elseif ($EXTERNAL == 'A' && CModule::IncludeModule("extranet") && CExtranet::IsIntranetUser()) {
$arUsersToFilter = CExtranet::GetIntranetUsers();
} elseif (IsModuleInstalled('extranet')) {
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_after.php";
die;
}
$matches = array();
if (preg_match('/^(.*?)<[a-z0-9.\\-_]+@[a-z0-9.\\-]+> \\[([\\d]+?)\\]/i', $search, $matches)) {
$matches[2] = intval($matches[2]);
if ($matches[2] > 0 && (!is_array($arUsersToFilter) || in_array($matches[2], $arUsersToFilter))) {
$dbRes = CUser::GetByID($matches[2]);
if ($arRes = $dbRes->Fetch()) {
$arUsers = array(array('ID' => $arRes['ID'], 'NAME' => str_replace(array(';', ','), ' ', CIntranetUtils::FormatName($nameTemplate, $arRes, false)) . ' <' . $arRes['EMAIL'] . '>', 'UF_DEPARTMENT' => $arRes['UF_DEPARTMENT'], 'READY' => 'Y'));
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject($arUsers);
die;
示例6: GetMessage
}
$arResult["bResult"] = "E";
}
} else {
$arResult["strMessage"] = GetMessage("SONET_LOG_FAVORITES_INCORRECT_LOG_ID");
$arResult["bResult"] = "E";
}
} elseif ($action == "delete" && CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false)) {
$log_id = intval($_REQUEST["log_id"]);
if ($log_id > 0) {
$arResult["bResult"] = CSocNetLog::Delete($log_id) ? "Y" : "N";
}
} elseif ($action == "get_more_destination") {
$isExtranetInstalled = CModule::IncludeModule("extranet") ? "Y" : "N";
$isExtranetSite = $isExtranetInstalled == "Y" && CExtranet::IsExtranetSite() ? "Y" : "N";
$isExtranetUser = $isExtranetInstalled == "Y" && !CExtranet::IsIntranetUser() ? "Y" : "N";
$isExtranetAdmin = $isExtranetInstalled == "Y" && CExtranet::IsExtranetAdmin() ? "Y" : "N";
if ($isExtranetUser == "Y") {
$arUserIdVisible = CExtranet::GetMyGroupsUsersSimple(SITE_ID);
} elseif ($isExtranetInstalled == "Y" && $isExtranetUser != "Y" && $isExtranetAdmin != "Y") {
if ($isExtranetAdmin == "Y" && $bCurrentUserIsAdmin) {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsers(SITE_ID);
} else {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
}
}
$arResult["arDestinations"] = false;
$log_id = intval($_REQUEST["log_id"]);
$created_by_id = intval($_REQUEST["created_by_id"]);
$iDestinationLimit = intval($_REQUEST["dlim"]);
if ($log_id > 0) {
示例7: isset
$arResult['ENABLE_SOUND'] = isset($arSettings['enableSound']) && $arSettings['enableSound'] == 'N'? 'false': 'true';
$arResult['SEND_BY_ENTER'] = isset($arSettings['sendByEnter']) && $arSettings['sendByEnter'] == 'Y'? 'true': 'false';
$arResult['PANEL_POSTION_HORIZONTAL'] = isset($arSettings['panelPositionHorizontal']) && in_array($arSettings['panelPositionHorizontal'], Array('left', 'center', 'right'))? $arSettings['panelPositionHorizontal']: 'right';
$arResult['PANEL_POSTION_VERTICAL'] = isset($arSettings['panelPositionVertical']) && in_array($arSettings['panelPositionVertical'], Array('top', 'bottom'))? $arSettings['panelPositionVertical']: 'bottom';
$arResult['TRY_NATIVE_NOTIFY'] = isset($arSettings['tryNativeNotify']) && $arSettings['tryNativeNotify'] == 'N'? 'false': 'true';
}
else
{
$arResult['STATUS'] = 'online';
$arResult['ENABLE_SOUND'] = 'false';
}
$arResult['DESKTOP'] = $arParams['DESKTOP'] == 'Y'? 'true': 'false';
$arResult["INIT"] = $arParams['INIT'];
$arResult['DESKTOP_LINK_OPEN'] = $arParams['DESKTOP_LINK_OPEN'] == 'Y'? 'true': 'false';
$arResult['PATH_TO_USER_PROFILE_TEMPLATE'] = COption::GetOptionString('im', 'path_to_user_profile', "", CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()? "ex": false);
$arResult['PATH_TO_USER_PROFILE'] = CComponentEngine::MakePathFromTemplate($arResult['PATH_TO_USER_PROFILE_TEMPLATE'], array('user_id' => $USER->GetId()));
$arResult['TURN_SERVER'] = COption::GetOptionString('im', 'turn_server');
$arResult['TURN_SERVER_FIREFOX'] = COption::GetOptionString('im', 'turn_server_firefox');
$arResult['TURN_SERVER_LOGIN'] = COption::GetOptionString('im', 'turn_server_login');
$arResult['TURN_SERVER_PASSWORD'] = COption::GetOptionString('im', 'turn_server_password');
CJSCore::Init(array('im'));
if (!(isset($arParams['TEMPLATE_HIDE']) && $arParams['TEMPLATE_HIDE'] == 'Y'))
$this->IncludeComponentTemplate();
return $arResult;
?>
示例8: array
}
}
$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) {
if (!$arSubDeps) {
$arSubDeps = array(-1);
}
$arSecFilter["ID"] = $arSubDeps;
}
$arStructure = $arSections = array();
if ($arParams["DISPLAY_TAB_STRUCTURE"] == 'Y' && (!CModule::IncludeModule('extranet') || CExtranet::IsIntranetUser())) {
$arStructure = CIntranetUtils::getSubStructure(0, 1);
$arSections = $arStructure['DATA'];
$arStructure = $arStructure['TREE'];
if ($bSubordinateOnly) {
$arStructure = array();
foreach ($arSections as $k => $item) {
$iblockSectionId = (int) $item['IBLOCK_SECTION_ID'];
if (($isSub = !in_array($iblockSectionId, $arSubDeps)) && !in_array($item['ID'], $arSubDeps)) {
unset($arSections[$k]);
continue;
}
if ($isSub) {
$iblockSectionId = 0;
}
if (!isset($arStructure[$iblockSectionId])) {
示例9: elseif
}
}
//managers
$arResult['MANAGERS'] = CIntranetUtils::GetDepartmentManager($arResult["User"]["UF_DEPARTMENT"], $arResult["User"]["ID"], true);
if ($arParams["CACHE_TIME"] > 0) {
$obCache->EndDataCache(array('DEPARTMENTS' => $arResult['DEPARTMENTS'], 'MANAGERS' => $arResult['MANAGERS']));
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
} elseif ($arParams["CACHE_TIME"] > 0) {
$vars = $obCache->GetVars();
$arResult['DEPARTMENTS'] = $vars['DEPARTMENTS'];
$arResult['MANAGERS'] = $vars['MANAGERS'];
}
if (CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite() && !CExtranet::IsIntranetUser()) {
$arResult['MANAGERS'] = array();
}
}
if ($arResult["User"]['PERSONAL_BIRTHDAY'] != '') {
$arBirthDate = ParseDateTime($arResult["User"]['PERSONAL_BIRTHDAY'], CSite::GetDateFormat('SHORT'));
$arResult['IS_BIRTHDAY'] = intval($arBirthDate['MM']) == date('n') && intval($arBirthDate['DD']) == date('j');
}
if (strlen($arParams["NAME_TEMPLATE"]) <= 0) {
$arParams["NAME_TEMPLATE"] = CSite::GetNameFormat();
}
$arParams["TITLE_NAME_TEMPLATE"] = str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$bUseLogin = $arParams['SHOW_LOGIN'] != "N" ? true : false;
$arTmpUser = array("NAME" => $arResult["User"]["~NAME"], "LAST_NAME" => $arResult["User"]["~LAST_NAME"], "SECOND_NAME" => $arResult["User"]["~SECOND_NAME"], "LOGIN" => $arResult["User"]["~LOGIN"]);
$strTitleFormatted = CUser::FormatName($arParams['TITLE_NAME_TEMPLATE'], $arTmpUser, $bUseLogin);
if ($arParams["SET_TITLE"] == "Y") {
示例10: SearchUsers
public static function SearchUsers($search, $nameTemplate = "", $bSelf = true, $bEmployeesOnly = false)
{
CUtil::JSPostUnescape();
$bIntranetEnable = IsModuleInstalled('intranet');
$bExtranetEnable = IsModuleInstalled('extranet');
$bBitrix24Enable = IsModuleInstalled('bitrix24');
$arUsers = array();
$arTmpUsers = array();
$arExtranetTestUsers = array();
$search = trim($search);
if (
strlen($search) <= 0
|| !GetFilterQuery("TEST", $search)
)
return $arUsers;
$arFilter = array(
"ACTIVE" => "Y",
"NAME_SEARCH" => $search,
);
if (
$bEmployeesOnly
|| ($bBitrix24Enable && !$bExtranetEnable)
)
$arFilter["!UF_DEPARTMENT"] = false;
$arExtParams = Array(
"FIELDS" => Array("ID", "LAST_NAME", "NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "WORK_POSITION", "PERSONAL_PROFESSION", "IS_ONLINE"),
"NAV_PARAMS" => Array("nTopCount" => 20)
);
if ($bIntranetEnable)
$arExtParams['SELECT'] = array('UF_DEPARTMENT');
$dbUsers = CUser::GetList(($sort_by = Array('last_name'=>'asc', 'IS_ONLINE'=>'desc')), ($dummy=''), $arFilter, $arExtParams);
while ($arUser = $dbUsers->Fetch())
{
if (
!$bSelf
&& is_object($GLOBALS["USER"])
&& $GLOBALS["USER"]->GetID() == $arUser['ID']
)
continue;
$arTmpUsers[$arUser["ID"]] = $arUser;
if(
$bIntranetEnable
&& $bExtranetEnable
&& (!is_array($arUser["UF_DEPARTMENT"])
|| empty($arUser["UF_DEPARTMENT"]))
)
$arExtranetTestUsers[$arUser["ID"]] = $arUser["ID"];
}
if (
!empty($arExtranetTestUsers)
&& CModule::IncludeModule('extranet')
&& CExtranet::IsIntranetUser()
)
{
global $USER;
$arUserSocNetGroups = Array();
$rsGroups = CSocNetUserToGroup::GetList(
array("GROUP_NAME" => "ASC"),
array(
"USER_ID" => intval($USER->GetID()),
"<=ROLE" => SONET_ROLES_USER,
"GROUP_SITE_ID" => SITE_ID,
"GROUP_ACTIVE" => "Y",
"!GROUP_CLOSED" => "Y"
),
false,
array("nPageSize" => 500, "bDescPageNumbering" => false),
array("ID", "GROUP_ID")
);
while($arGroup = $rsGroups->Fetch())
$arUserSocNetGroups[] = $arGroup["GROUP_ID"];
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))
$arSelect[$ar["USER_ID"]] = $ar["USER_ID"];
foreach ($arExtranetTestUsers as $userId)
{
if (!isset($arSelect[$userId]))
unset($arTmpUsers[$userId]);
//.........这里部分代码省略.........
示例11: CheckPhoneStatus
public static function CheckPhoneStatus()
{
return IsModuleInstalled('voximplant') && IsModuleInstalled('pull') && CPullOptions::GetNginxStatus() && (!IsModuleInstalled('extranet') || CModule::IncludeModule('extranet') && CExtranet::IsIntranetUser());
}
示例12: str_replace
try {
$nt = $signer->unsign($arParams["nt"]);
$arParams["NAME_TEMPLATE"] = str_replace(array("#EMAIL#", "#LOGIN#", "#NOBR#", "#/NOBR#", "#COMMA#"), array(" ", " ", " ", " ", ","), trim($nt));
} catch (\Bitrix\Main\Security\Sign\BadSignatureException $e) {
$arParams["NAME_TEMPLATE"] = str_replace("#COMMA#", ",", CSite::GetNameFormat(false));
}
$arParams['NAME_TEMPLATE'] .= $bIntranet ? ' <#EMAIL#>' : '';
$arParams['NAME_TEMPLATE'] .= " [#ID#]";
try {
$sl = $signer->unsign($arParams["sl"]);
$bUseLogin = trim($sl) != "N";
} catch (\Bitrix\Main\Security\Sign\BadSignatureException $e) {
$bUseLogin = false;
}
if (CModule::IncludeModule('extranet')) {
if (CExtranet::IsIntranetUser($arParams["site"])) {
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers($arParams["site"]);
$arIntranetUsersID = CExtranet::GetIntranetUsers();
$arUsersToFilter = array_merge($arUsersInMyGroupsID, $arIntranetUsersID);
} else {
$arUsersInMyGroupsID = CExtranet::GetMyGroupsUsers($arParams["site"]);
$arPublicUsersID = CExtranet::GetPublicUsers();
$arUsersToFilter = array_merge($arUsersInMyGroupsID, $arPublicUsersID);
}
}
$arResult = array();
$dbUsers = CSocNetUser::SearchUsers($_REQUEST["search"], $arParams["gf"], $arParams["pe"]);
if ($dbUsers && ($arUser = $dbUsers->Fetch())) {
do {
if (is_array($arUsersToFilter) && in_array($arUser["ID"], $arUsersToFilter) || !is_array($arUsersToFilter)) {
$arResult[] = array("NAME" => CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin));
示例13: IsModuleInstalled
$arResult["bVarsFromForm"] = false;
$arResult["IS_IFRAME"] = $_GET["IFRAME"] == "Y";
$arResult["IS_POPUP"] = $_GET["POPUP"] == "Y";
if (in_array($_GET["CALLBACK"], array("REFRESH", "GROUP"))) {
$arResult["CALLBACK"] = $_GET["CALLBACK"];
}
if (strlen($_GET["tab"]) > 0) {
$arResult["TAB"] = $_GET["tab"];
}
if (!$USER->IsAuthorized()) {
$arResult["NEED_AUTH"] = "Y";
} else {
$arResult["bIntranet"] = IsModuleInstalled("intranet");
$arResult["bExtranetInstalled"] = IsModuleInstalled("extranet");
$arResult["bExtranet"] = $arResult["bExtranetInstalled"] && CExtranet::IsExtranetSite();
$arResult["isCurrentUserIntranet"] = !CModule::IncludeModule('extranet') || CExtranet::IsIntranetUser();
$arResult["POST"] = array("FEATURES" => array(), "USER_IDS" => false, "USERS_FOR_JS" => array(), "USERS_FOR_JS_I" => array(), "USERS_FOR_JS_E" => array(), "EMAILS" => "");
if ($arParams["GROUP_ID"] > 0) {
__GCEGetGroup($arParams["GROUP_ID"], $arResult["GROUP_PROPERTIES"], $arResult["POST"], $arResult["TAB"]);
} else {
$arParams["GROUP_ID"] = 0;
$arResult["POST"]["VISIBLE"] = "Y";
if ($arResult["bExtranet"]) {
$arResult["POST"]["INITIATE_PERMS"] = "E";
} else {
$arResult["POST"]["INITIATE_PERMS"] = "K";
}
$arResult["POST"]["SPAM_PERMS"] = "K";
$arResult["POST"]["IMAGE_ID_IMG"] = '<img src="/bitrix/images/1.gif" height="60" class="sonet-group-create-popup-image" id="sonet_group_create_popup_image" border="0">';
}
$arResult["Urls"]["User"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $USER->GetID()));
示例14: __SLMGetLogRecord
//.........这里部分代码省略.........
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
}
if (!array_key_exists("COMMENTS_PARAMS", $arEvent["FIELDS_FORMATTED"])) {
$entities_xml_id = array("tasks" => array("TASK", "TK", "FORUM|COMMENT"), "forum" => array("FORUM", "FM", "FORUM|COMMENT"), "photo_photo" => array("PHOTO", "PH", "FORUM|COMMENT"), "sonet" => array("SOCNET", "SC", ""), "lists_new_element" => array("WF", "WF", ""));
if (array_key_exists($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"], $entities_xml_id) && intval($arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => $entities_xml_id[$arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]][1], "ENTITY_XML_ID" => $entities_xml_id[$arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]][0] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"], "NOTIFY_TAGS" => $entities_xml_id[$arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]][2]);
} else {
$arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => substr(strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], 0, 2), "ENTITY_XML_ID" => strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], "NOTIFY_TAGS" => "");
}
}
$timestamp = MakeTimeStamp(isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]) ? $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"] : (isset($arParams["FIELDS_FORMATTED"]["EVENT"]["LOG_DATE_FORMAT"]) ? $arEvent["FIELDS_FORMATTED"]["EVENT"]["LOG_DATE_FORMAT"] : $arParams["EVENT"]["LOG_DATE"]));
$timeFormated = FormatDate(GetMessage("SONET_SLM_FORMAT_TIME"), $timestamp);
if (strlen($arParams["DATE_TIME_FORMAT"]) <= 0) {
$dateTimeFormated = __SMLFormatDate($timestamp);
} else {
$dateTimeFormated = FormatDate($arParams["DATE_TIME_FORMAT"] == "FULL" ? $GLOBALS["DB"]->DateFormatToPHP(str_replace(":SS", "", FORMAT_DATETIME)) : $arParams["DATE_TIME_FORMAT"], $timestamp);
}
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$dateTimeFormated = ToLower($dateTimeFormated);
}
// strip current year
if (!empty($arParams["DATE_TIME_FORMAT"]) && ($arParams["DATE_TIME_FORMAT"] == "j F Y G:i" || $arParams["DATE_TIME_FORMAT"] == "j F Y g:i a")) {
$dateTimeFormated = ltrim($dateTimeFormated, "0");
$curYear = date("Y");
$dateTimeFormated = str_replace(array("-" . $curYear, "/" . $curYear, " " . $curYear, "." . $curYear), "", $dateTimeFormated);
}
$arEvent["FIELDS_FORMATTED"]["LOG_TIME_FORMAT"] = $timeFormated;
if (strlen($arParams["DATE_TIME_FORMAT"]) <= 0) {
if (array_key_exists("EVENT_FORMATTED", $arEvent["FIELDS_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && array_key_exists("LOG_DATE_FORMAT", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$bToday = ConvertTimeStamp(MakeTimeStamp($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]), "SHORT") == ConvertTimeStamp();
if ($bToday) {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
} else {
$bToday = $arEvent["FIELDS_FORMATTED"]["LOG_DATE_DAY"] == ConvertTimeStamp();
if ($bToday) {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
}
} else {
$arFormat = array("tommorow" => "tommorow, " . GetMessage("SONET_SLM_FORMAT_TIME"), "today" => "today, " . GetMessage("SONET_SLM_FORMAT_TIME"), "yesterday" => "yesterday, " . GetMessage("SONET_SLM_FORMAT_TIME"), "" => date("Y", $timestamp) == date("Y") ? GetMessage("SONET_SLM_FORMAT_DATE") : GetMessage("SONET_SLM_FORMAT_DATE_YEAR"));
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = FormatDate($arFormat, $timestamp);
}
if (is_array($arEvent["FIELDS_FORMATTED"]["EVENT"])) {
if ($arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && $arCommentEvent["OPERATION_ADD"] == "log_rights") {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = CSocNetLogRights::CheckForUser($arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], $GLOBALS["USER"]->GetID()) ? "Y" : "N";
} else {
$array_key = $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_ID"] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"];
if (array_key_exists($array_key, $GLOBALS["CurUserCanAddComments"])) {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
} else {
$feature = CSocNetLogTools::FindFeatureByEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
if ($feature && $arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && strlen($arCommentEvent["OPERATION_ADD"]) > 0) {
$GLOBALS["CurUserCanAddComments"][$array_key] = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"], $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_ID"], $feature == "microblog" ? "blog" : $feature, $arCommentEvent["OPERATION_ADD"]) ? "Y" : "N";
} else {
$GLOBALS["CurUserCanAddComments"][$array_key] = "Y";
}
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
}
}
}
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = $arParams["EVENT"]["FAVORITES"];
if ($arParams["USE_FOLLOW"] == "Y") {
$arEvent["FIELDS_FORMATTED"]["EVENT"]["FOLLOW"] = $arParams["EVENT"]["FOLLOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW_X1"] = $arParams["EVENT"]["DATE_FOLLOW_X1"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW"] = $arParams["EVENT"]["DATE_FOLLOW"];
}
if ($arParams["CHECK_PERMISSIONS_DEST"] == "N" && is_object($GLOBALS["USER"]) && (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) || array_key_exists("DESTINATION_CODE", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"]))) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"] = 0;
$bExtranetUser = CModule::IncludeModule("extranet") && !CExtranet::IsIntranetUser();
$arGroupID = CSocNetLogTools::GetAvailableGroups($bExtranetUser ? "Y" : "N");
if (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] as $key => $arDestination) {
if (array_key_exists("TYPE", $arDestination) && array_key_exists("ID", $arDestination) && ($arDestination["TYPE"] == "SG" && !in_array(intval($arDestination["ID"]), $arGroupID) || $arDestination["TYPE"] == "DR" && $bExtranetUser)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"][$key]);
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"]++;
}
}
if (intval($arParams["DESTINATION_LIMIT_SHOW"]) > 0 && count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) > $arParams["DESTINATION_LIMIT_SHOW"]) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_MORE"] = count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) + $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"] - $arParams["DESTINATION_LIMIT_SHOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] = array_slice($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"], 0, $arParams["DESTINATION_LIMIT_SHOW"]);
}
}
}
if ($arParams["SHOW_RATING"] == "Y" && strlen($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"]) > 0 && intval($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["RATING"] = CRatings::GetRatingVoteResult($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"], $arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]);
}
if (array_key_exists("FAVORITES_USER_ID", $arEvent) && intval($arEvent["FAVORITES_USER_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = "Y";
} else {
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = "N";
}
return $arEvent["FIELDS_FORMATTED"];
}
示例15: ShowError
/** @var string $componentName */
/** @var string $componentTemplate */
/** @global CDatabase $DB */
/** @global CUser $USER */
/** @global CMain $APPLICATION */
if (!CModule::IncludeModule("blog")) {
if ($arParams["IS_REST"] == "Y") {
$APPLICATION->ThrowException(GetMessage("BLOG_MODULE_NOT_INSTALL"), "BLOG_MODULE_NOT_INSTALL");
} else {
ShowError(GetMessage("BLOG_MODULE_NOT_INSTALL"));
}
return false;
}
$feature = "blog";
$arParams["SOCNET_GROUP_ID"] = IntVal($arParams["SOCNET_GROUP_ID"]);
$arResult["bExtranetUser"] = CModule::IncludeModule("extranet") && !CExtranet::IsIntranetUser();
$arResult["bExtranetSite"] = CModule::IncludeModule("extranet") && CExtranet::IsExtranetSite();
$bCalendar = true;
if (!IsModuleInstalled('intranet')) {
$bCalendar = false;
}
if ($bCalendar && $arResult["bExtranetUser"]) {
$bCalendar = false;
}
if (IntVal($arParams["SOCNET_GROUP_ID"]) > 0) {
$bCalendar = false;
}
$arParams["B_CALENDAR"] = $bCalendar;
$arResult["bGroupMode"] = false;
if (CModule::IncludeModule("socialnetwork") && (IntVal($arParams["SOCNET_GROUP_ID"]) > 0 || IntVal($arParams["USER_ID"]) > 0)) {
if (IntVal($arParams["SOCNET_GROUP_ID"]) > 0) {