本文整理汇总了PHP中CSocNetUser类的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUser类的具体用法?PHP CSocNetUser怎么用?PHP CSocNetUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSocNetUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _FormatUser
function _FormatUser(&$arUser, $arPath)
{
global $USER, $CACHE_ABSENCE;
if ($arUser['PERSONAL_PHOTO']) {
$arImage = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
$arUser['PERSONAL_PHOTO'] = $arImage['IMG'];
}
if ($arPath['DETAIL_URL']) {
$arUser['DETAIL_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['DETAIL_URL']);
}
$arUser["canViewProfile"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$arUser["canMessage"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "message", CSocNetUser::IsCurrentUserModuleAdmin());
if ($arPath['MESSAGES_CHAT_URL']) {
$arUser['MESSAGES_CHAT_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['MESSAGES_CHAT_URL']);
}
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
$arUser['IS_ONLINE'] = CSocNetUser::IsOnLine($arUser['ID']);
if ($arUser['IS_ABSENT']) {
$maxAbsence = 0;
foreach ($CACHE_ABSENCE[$arUser["ID"]] as $arAbsence) {
if (MakeTimeStamp($arAbsence["DATE_TO"]) > $maxAbsence) {
$arUser['ABSENT_TILL'] = $arAbsence["DATE_TO"];
}
}
}
$arFilter = array("TO_USER_ID" => $arUser['ID'], "MESSAGE_TYPE" => SONET_MESSAGE_PRIVATE, "FROM_USER_ID" => $USER->GetID());
$dbMessages = CSocNetMessages::GetList(array("DATE_CREATE" => "DESC"), $arFilter, false, array("nTopCount" => 1), array("ID", "DATE_CREATE"));
if ($arMessages = $dbMessages->GetNext()) {
$arUser['LAST_CHAT'] = $arMessages["DATE_CREATE"];
}
return true;
}
示例2: onPrepareComponentParams
public function onPrepareComponentParams($params)
{
$this->arIBlock = CIBlock::GetArrayByID($params["IBLOCK_ID"]);
$this->arResult["IBLOCK"] = htmlspecialcharsex($this->arIBlock);
$this->arResult["IBLOCK_ID"] = $this->arIBlock["ID"];
$this->arResult["GRID_ID"] = "lists_list_elements_" . $this->arResult["IBLOCK_ID"];
$this->arResult["ANY_SECTION"] = isset($_GET["list_section_id"]) && strlen($_GET["list_section_id"]) == 0;
$this->arResult["SECTIONS"] = array();
$this->arResult["SECTION_ID"] = false;
$this->arResult["LIST_SECTIONS"] = array();
if (isset($_GET["list_section_id"])) {
$sectionId = intval($_GET["list_section_id"]);
} else {
$sectionId = intval($params["SECTION_ID"]);
}
$rsSections = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $this->arIBlock["ID"], "GLOBAL_ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y"));
while ($arSection = $rsSections->GetNext()) {
$this->arResult["SECTIONS"][$arSection["ID"]] = array("ID" => $arSection["ID"], "NAME" => $arSection["NAME"]);
if ($arSection["ID"] == $sectionId) {
$this->arResult["SECTION"] = $arSection;
$this->arResult["SECTION_ID"] = $arSection["ID"];
}
$this->arResult["LIST_SECTIONS"][$arSection["ID"]] = str_repeat(" . ", $arSection["DEPTH_LEVEL"]) . $arSection["NAME"];
}
$this->arResult["IS_SOCNET_GROUP_CLOSED"] = false;
if (intval($params["~SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule("socialnetwork")) {
$arSonetGroup = CSocNetGroup::GetByID(intval($params["~SOCNET_GROUP_ID"]));
if (is_array($arSonetGroup) && $arSonetGroup["CLOSED"] == "Y" && !CSocNetUser::IsCurrentUserModuleAdmin() && ($arSonetGroup["OWNER_ID"] != $GLOBALS["USER"]->GetID() || COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y")) {
$this->arResult["IS_SOCNET_GROUP_CLOSED"] = true;
}
}
return $params;
}
示例3: OnGetNotifySchema
public static function OnGetNotifySchema()
{
$arResult = array("socialnetwork" => array("invite_group" => array("NAME" => GetMessage("SONET_NS_INVITE_GROUP")), "inout_group" => array("NAME" => GetMessage("SONET_NS_INOUT_GROUP")), "moderators_group" => array("NAME" => GetMessage("SONET_NS_MODERATORS_GROUP")), "owner_group" => array("NAME" => GetMessage("SONET_NS_OWNER_GROUP")), "sonet_group_event" => array("NAME" => GetMessage("SONET_NS_SONET_GROUP_EVENT"))));
if (CSocNetUser::IsFriendsAllowed()) {
/*
$arResult["socialnetwork"]["invite_user"] = Array(
"NAME" => GetMessage("SONET_NS_INVITE_USER")
);
*/
$arResult["socialnetwork"]["inout_user"] = array("NAME" => GetMessage("SONET_NS_FRIEND"));
}
return $arResult;
}
示例4: OnFillSocNetMenu
public static function OnFillSocNetMenu(&$arResult, $arParams = array())
{
global $USER;
$arResult["AllowSettings"]["group_lists"] = true;
$arResult["CanView"]["group_lists"] = (array_key_exists("ActiveFeatures", $arResult) ? array_key_exists("group_lists", $arResult["ActiveFeatures"]) : true) && CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), $arParams["ENTITY_TYPE"], $arParams["ENTITY_ID"], "group_lists", "view", CSocNetUser::IsCurrentUserModuleAdmin());
$arResult["Title"]["group_lists"] = array_key_exists("ActiveFeatures", $arResult) && array_key_exists("group_lists", $arResult["ActiveFeatures"]) && strlen($arResult["ActiveFeatures"]["group_lists"]) > 0 ? $arResult["ActiveFeatures"]["group_lists"] : GetMessage("LISTS_SOCNET_TAB");
if (!array_key_exists("SEF_MODE", $arResult) || $arResult["SEF_MODE"] != "N") {
if (isset($arResult["Urls"])) {
$arResult["Urls"]["group_lists"] = $arResult["Urls"]["view"] . "lists/";
}
} else {
if (!array_key_exists("PAGE_VAR", $arResult)) {
$arResult["PAGE_VAR"] = "page";
}
if (!array_key_exists("GROUP_VAR", $arResult)) {
$arResult["GROUP_VAR"] = "group_id";
}
$arResult["Urls"]["group_lists"] = "?" . $arResult["PAGE_VAR"] . "=group_lists&" . $arResult["GROUP_VAR"] . "=" . $arResult["Group"]["ID"];
}
}
示例5: canRead
public function canRead($userId)
{
if ($this->canRead !== null) {
return $this->canRead;
}
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if (\CSocNetUser::isCurrentUserModuleAdmin()) {
$this->canRead = true;
return $this->canRead;
}
if ($comment = $this->loadLogCommentData()) {
if (strpos($comment["EVENT_ID"], "crm_") === 0) {
$queryLog = \CSocNetLog::getList(array(), array("ID" => intval($comment["LOG_ID"])), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID"));
if (($log = $queryLog->fetch()) && Loader::includeModule("crm")) {
$userPermissions = \CCrmPerms::getUserPermissions($userId);
if ($log["ENTITY_TYPE"] == "CRMACTIVITY") {
$bindings = \CCRMActivity::getBindings($log["ENTITY_ID"]);
foreach ($bindings as $binding) {
if (\CCrmAuthorizationHelper::checkReadPermission(\CCrmOwnerType::resolveName($binding["OWNER_TYPE_ID"]), $binding["OWNER_ID"], $userPermissions)) {
$this->canRead = true;
return $this->canRead;
}
}
} else {
if (\CCrmAuthorizationHelper::checkReadPermission(\CCrmLiveFeedEntity::resolveEntityTypeID($log["ENTITY_TYPE"]), $log["ENTITY_ID"], $userPermissions)) {
$this->canRead = true;
return $this->canRead;
} elseif (intval($comment["LOG_ID"]) > 0 && \CSocNetLogRights::checkForUser($comment["LOG_ID"], $userId)) {
$this->canRead = true;
return $this->canRead;
}
}
}
} elseif (intval($comment["LOG_ID"]) > 0 && \CSocNetLogRights::checkForUser($comment["LOG_ID"], $userId)) {
$this->canRead = true;
return $this->canRead;
}
}
$this->canRead = false;
return $this->canRead;
}
示例6: __GCEGetGroup
function __GCEGetGroup(&$group_id, &$arGroupProperties = array(), &$arGroupTmp = array(), $tab = false)
{
if (!CModule::IncludeModule("socialnetwork")) {
$group_id = 0;
return;
}
$arGroup = CSocNetGroup::GetByID($group_id);
if ($arGroup && ($tab == "edit" && ($arGroup["OWNER_ID"] == $GLOBALS["USER"]->GetID() || CSocNetUser::IsCurrentUserModuleAdmin()) || $tab == "invite" && (CSocNetUser::IsCurrentUserModuleAdmin() || CSocNetGroup::CanUserInitiate($GLOBALS["USER"]->GetID(), $group_id)))) {
$arGroupTmp["NAME"] = $arGroup["NAME"];
$arGroupTmp["DESCRIPTION"] = $arGroup["DESCRIPTION"];
$arGroupTmp["IMAGE_ID_DEL"] = "N";
$arGroupTmp["SUBJECT_ID"] = $arGroup["SUBJECT_ID"];
$arGroupTmp["VISIBLE"] = $arGroup["VISIBLE"];
$arGroupTmp["OPENED"] = $arGroup["OPENED"];
$arGroupTmp["CLOSED"] = $arGroup["CLOSED"];
$arGroupTmp["KEYWORDS"] = $arGroup["KEYWORDS"];
$arGroupTmp["OWNER_ID"] = $arGroup["OWNER_ID"];
$arGroupTmp["INITIATE_PERMS"] = $arGroup["INITIATE_PERMS"];
$arGroupTmp["SPAM_PERMS"] = $arGroup["SPAM_PERMS"];
$arGroupTmp["IMAGE_ID"] = $arGroup["IMAGE_ID"];
$arGroupTmp["IMAGE_ID_FILE"] = CFile::GetFileArray($arGroup["IMAGE_ID"]);
$arGroupTmp["IMAGE_ID_IMG"] = '<img src="' . ($arGroupTmp["IMAGE_ID_FILE"] != false ? $arGroupTmp["IMAGE_ID_FILE"]["SRC"] : "/bitrix/images/1.gif") . '" height="60" class="sonet-group-create-popup-image" id="sonet_group_create_popup_image" border="0">';
foreach ($arGroupProperties as $field => $arUserField) {
if (array_key_exists($field, $arGroup)) {
$arGroupProperties[$field]["VALUE"] = $arGroup["~" . $field];
$arGroupProperties[$field]["ENTITY_VALUE_ID"] = $arGroup["ID"];
}
}
$arGroupTmp["IS_EXTRANET_GROUP"] = "N";
if (CModule::IncludeModule("extranet") && CExtranet::IsExtranetSocNetGroup($group_id)) {
$arGroupTmp["IS_EXTRANET_GROUP"] = "Y";
}
} else {
$arGroupTmp["VISIBLE"] = "Y";
$arGroupTmp["IS_EXTRANET_GROUP"] = "N";
$group_id = 0;
}
}
示例7: GetStatus
public static function GetStatus($arParams = Array())
{
if (!is_array($arParams))
$arParams = Array();
$arID = Array();
if (isset($arParams['ID']) && is_array($arParams['ID']) && !empty($arParams['ID']))
{
foreach ($arParams['ID'] as $key => $value)
$arID[] = intval($value);
}
else if (isset($arParams['ID']) && intval($arParams['ID']) > 0)
{
$arID[] = intval($arParams['ID']);
}
global $USER;
if(!isset($arParams['ID']) && !IsModuleInstalled('intranet') && is_object($USER))
{
$arID[] = $USER->GetID();
if (CModule::IncludeModule('socialnetwork') && CSocNetUser::IsFriendsAllowed())
{
$dbFriends = CSocNetUserRelations::GetList(array(),array("USER_ID" => $USER->GetID(), "RELATION" => SONET_RELATIONS_FRIEND), false, false, array("ID", "FIRST_USER_ID", "SECOND_USER_ID"));
if ($dbFriends)
{
while ($arFriends = $dbFriends->GetNext(true, false))
{
$friendId = $pref = (IntVal($USER->GetID()) == $arFriends["FIRST_USER_ID"]) ? $arFriends["SECOND_USER_ID"] : $arFriends["FIRST_USER_ID"];
$arID[] = $friendId;
}
}
}
}
$arUsers = Array();
$dbUsers = CUser::GetList(($sort_by = 'ID'), ($sort_dir = 'asc'), array('LAST_ACTIVITY' => '180'), array('FIELDS' => array("ID")));
while ($arUser = $dbUsers->GetNext(false, false))
{
if (!empty($arID) && !in_array($arUser["ID"], $arID))
continue;
$arUsers[$arUser["ID"]] = Array(
'id' => $arUser["ID"],
'status' => 'online',
);
}
return Array('users' => $arUsers);
}
示例8: inviteGroupUsers
public static function inviteGroupUsers($arFields)
{
global $USER;
$groupID = $arFields['GROUP_ID'];
$arUserID = $arFields['USER_ID'];
$message = $arFields['MESSAGE'];
if(intval($groupID) <= 0)
throw new Exception('Wrong group ID');
if (
(is_array($arUserID) && count($arUserID) <= 0)
|| (!is_array($arUserID) && intval($arUserID) <= 0)
)
throw new Exception('Wrong user IDs');
if (!is_array($arUserID))
$arUserID = array($arUserID);
$arSuccessID = array();
$dbRes = CSocNetGroup::GetList(array(), array(
"ID" => $groupID,
"CHECK_PERMISSIONS" => $USER->GetID(),
));
$arGroup = $dbRes->Fetch();
if(is_array($arGroup))
{
foreach($arUserID as $user_id)
{
$isCurrentUserTmp = ($USER->GetID() == $user_id);
$canInviteGroup = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $user_id, "invitegroup", CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, false));
$user2groupRelation = CSocNetUserToGroup::GetUserRole($user_id, $arGroup["ID"]);
if (
!$isCurrentUserTmp && $canInviteGroup && !$user2groupRelation
&& CSocNetUserToGroup::SendRequestToJoinGroup($USER->GetID(), $user_id, $arGroup["ID"], $message, true)
)
$arSuccessID[] = $user_id;
}
}
else
throw new Exception('Socialnetwork group not found');
return $arSuccessID;
}
示例9: __SLEGetLogRecord
function __SLEGetLogRecord($logID, $arParams, $arCurrentUserSubscribe, $current_page_date)
{
static $isExtranetInstalled, $isExtranetSite, $isExtranetUser, $arUserIdVisible, $arAvailableExtranetUserID, $isExtranetAdmin, $bCurrentUserIsAdmin, $arSocNetFeaturesSettings;
if (!$isExtranetInstalled) {
$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";
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
if ($isExtranetUser == "Y") {
$arUserIdVisible = CExtranet::GetMyGroupsUsersSimple(SITE_ID);
} elseif ($isExtranetInstalled == "Y" && $isExtranetUser != "Y") {
if ($isExtranetAdmin == "Y" && $bCurrentUserIsAdmin) {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsers(SITE_ID);
} else {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
}
}
}
$cache_time = 31536000;
$arEvent = array();
$cache = new CPHPCache();
$arCacheID = array();
$arKeys = array("AVATAR_SIZE", "DESTINATION_LIMIT", "CHECK_PERMISSIONS_DEST", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT", "PATH_TO_USER", "PATH_TO_GROUP", "PATH_TO_CONPANY_DEPARTMENT");
foreach ($arKeys as $param_key) {
if (array_key_exists($param_key, $arParams)) {
$arCacheID[$param_key] = $arParams[$param_key];
} else {
$arCacheID[$param_key] = false;
}
}
$cache_id = "log_post_" . $logID . "_" . md5(serialize($arCacheID)) . "_" . SITE_TEMPLATE_ID . "_" . SITE_ID . "_" . LANGUAGE_ID . "_" . FORMAT_DATETIME . "_" . CTimeZone::GetOffset();
$cache_path = "/sonet/log/" . intval(intval($logID) / 1000) . "/" . $logID . "/entry/";
if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arEvent["FIELDS_FORMATTED"] = $arCacheVars["FIELDS_FORMATTED"];
if (array_key_exists("CACHED_CSS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) && strlen($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) > 0) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"] as $css_path) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($css_path);
}
}
}
if (array_key_exists("CACHED_JS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]) && $arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] !== '') {
$GLOBALS['APPLICATION']->AddHeadScript($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] as $js_path) {
$GLOBALS['APPLICATION']->AddHeadScript($js_path);
}
}
}
} else {
if (is_object($cache)) {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
}
$arFilter = array("ID" => $logID);
$arListParams = array("CHECK_RIGHTS" => "N", "USE_FOLLOW" => "N", "USE_SUBSCRIBE" => "N");
$arSelect = array("ID", "TMP_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "LOG_DATE", "LOG_UPDATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "EXTERNAL_ID", "SITE_ID", "PARAMS", "COMMENTS_COUNT", "ENABLE_COMMENTS", "SOURCE_ID", "GROUP_NAME", "GROUP_OWNER_ID", "GROUP_INITIATE_PERMS", "GROUP_VISIBLE", "GROUP_OPENED", "GROUP_IMAGE_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER", "CREATED_BY_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LOGIN", "CREATED_BY_PERSONAL_PHOTO", "CREATED_BY_PERSONAL_GENDER", "RATING_TYPE_ID", "RATING_ENTITY_ID", "SOURCE_TYPE");
$dbEvent = CSocNetLog::GetList(array(), $arFilter, false, false, $arSelect, $arListParams);
if ($arEvent = $dbEvent->GetNext()) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arEvent["USER_ID"]));
$GLOBALS["CACHE_MANAGER"]->RegisterTag("SONET_LOG_" . intval($arEvent["ID"]));
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $arEvent["ENTITY_ID"]);
}
}
$arEvent["EVENT_ID_FULLSET"] = CSocNetLogTools::FindFullSetEventIDByEventID($arEvent["EVENT_ID"]);
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
static $arSiteWorkgroupsPage;
if (!$arSiteWorkgroupsPage && (IsModuleInstalled("extranet") || is_set($arEvent["URL"]) && strpos($arEvent["URL"], "#GROUPS_PATH#") !== false)) {
$rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $rsSite->Fetch()) {
$arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroups_page", $arSite["DIR"] . "workgroups/", $arSite["ID"]);
}
}
if (is_set($arEvent["URL"]) && isset($arSiteWorkgroupsPage[SITE_ID])) {
$arEvent["URL"] = str_replace("#GROUPS_PATH#", $arSiteWorkgroupsPage[SITE_ID], $arEvent["URL"]);
}
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arEvent["EVENT_ID"]);
if ($arEventTmp && isset($arEventTmp["CLASS_FORMAT"]) && isset($arEventTmp["METHOD_FORMAT"])) {
$arEvent["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_LOG", $arEvent["ID"], LANGUAGE_ID);
$arEvent["FIELDS_FORMATTED"] = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arEvent, $arParams);
if (is_array($arEvent["FIELDS_FORMATTED"])) {
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"])) {
if (in_array($arEvent["EVENT_ID"], array('calendar'))) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]);
} else {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = CSocNetTextParser::closetags(htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]));
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$arFields2Cache = array("URL", "STYLE", "DESTINATION", "DESTINATION_MORE", "TITLE_24", "TITLE_24_2", "TITLE_24_2_STYLE", "IS_IMPORTANT", "MESSAGE", "FOOTER_MESSAGE", "MESSAGE_TITLE_24", "DATETIME_FORMATTED", "LOG_DATE_FORMAT", "MENU", "COMMENT_URL");
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"] as $field => $value) {
//.........这里部分代码省略.........
示例10: InitUsersTmp
public static function InitUsersTmp($message, $titleTemplate1, $titleTemplate2, $arParams, $bCurrentUserIsAdmin = "unknown", $bRSS = false)
{
$arUsersID = explode(",", $message);
$message = "";
$title = "";
$bFirst = true;
$count = 0;
if ($bCurrentUserIsAdmin == "unknown")
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
foreach ($arUsersID as $userID)
{
list($titleTmp, $messageTmp) = CSocNetLog::InitUserTmp($userID, $arParams, $bCurrentUserIsAdmin, $bRSS);
if (StrLen($titleTmp) > 0)
{
if (!$bFirst)
$title .= ", ";
$title .= $titleTmp;
$count++;
}
if (StrLen($messageTmp) > 0)
{
if (!$bFirst)
$message .= " ";
$message .= $messageTmp;
}
$bFirst = false;
}
return array(Str_Replace("#TITLE#", $title, (($count > 1) ? $titleTemplate2 : $titleTemplate1)), $message);
}
示例11: ParseDateTime
if ($arUser['PERSONAL_BIRTHDAY']) {
$arBirthDate = ParseDateTime($arUser['PERSONAL_BIRTHDAY'], CSite::GetDateFormat('SHORT'));
$arUser['IS_BIRTHDAY'] = intval($arBirthDate['MM']) == date('n') && intval($arBirthDate['DD']) == date('j');
}
$arUser['IS_FEATURED'] = CIntranetUtils::IsUserHonoured($arUser['ID']);
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
$arResult["SEARCH"][$i]["USER"] = $arUser;
}
}
}
$arResult['USER_PROP'] = array();
$arRes = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID);
if (!empty($arRes)) {
foreach ($arRes as $key => $val) {
$arResult['USER_PROP'][$val["FIELD_NAME"]] = strLen($val["EDIT_FORM_LABEL"]) > 0 ? $val["EDIT_FORM_LABEL"] : $val["FIELD_NAME"];
}
}
}
$arrDropdown = array();
$arResult["DROPDOWN_SONET"] = array();
$EntityType = array_key_exists("arrFILTER", $arParams) && in_array("socialnetwork_group", $arParams["arrFILTER"]) ? SONET_ENTITY_GROUP : SONET_ENTITY_USER;
$EntityID = $EntityType == SONET_ENTITY_GROUP ? $arParams["arrFILTER_socialnetwork"][0] : $arParams["arrFILTER_socialnetwork_user"];
$arActiveFeaturesNames = CSocNetFeatures::GetActiveFeaturesNames($EntityType, $EntityID);
foreach ($arParams["arrWHERE_SONET"] as $feature_id) {
if (strlen($feature_id) > 0 && array_key_exists($feature_id, $arActiveFeaturesNames) && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $EntityType, $EntityID, $feature_id, $arSocNetFeaturesSettings[$feature_id]["minoperation"][0], CSocNetUser::IsCurrentUserModuleAdmin()) && array_key_exists($feature_id, $arSocNetFeaturesSettings)) {
$arrDropdown[$feature_id] = strlen($arActiveFeaturesNames[$feature_id]) > 0 ? $arActiveFeaturesNames[$feature_id] : GetMessage("SEARCH_CONTENT_TYPE_" . strtoupper($feature_id) . "_" . $EntityType);
}
}
if (count($arrDropdown) > 0) {
$arResult["DROPDOWN_SONET"] = htmlspecialcharsex($arrDropdown);
}
示例12: array
/********************************************************************
Default params # 1
********************************************************************/
$arResult["TOPIC"] = array();
$arResult["FORUM"] = CForumNew::GetByID($arParams["FID"]);
$arParams["PERMISSION_ORIGINAL"] = ForumCurrUserPermissions($arParams["FID"]);
$arParams["PERMISSION"] = "A";
$arError = array();
$arNote = array();
/********************************************************************
/Default params #1
********************************************************************/
/********************************************************************
Main Data & Permissions
********************************************************************/
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
if (empty($arResult["FORUM"])) {
ShowError(GetMessage("F_FID_IS_LOST"));
CHTTP::SetStatus("404 Not Found");
return false;
} elseif ($arParams["MODE"] == "GROUP" && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum") || $arParams["MODE"] != "GROUP" && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $arParams["USER_ID"], "forum")) {
ShowError(GetMessage("FORUM_SONET_MODULE_NOT_AVAIBLE"));
return false;
} else {
$user_id = $USER->GetID();
if ($arParams["MODE"] == "GROUP") {
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "full", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "Y";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "newtopic", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "M";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "answer", $bCurrentUserIsAdmin)) {
示例13: LocalRedirect
LocalRedirect($APPLICATION->GetCurPageParam("invite_sent=Y", array("invite_user_id", "employee")));
}
}
}
$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_GROUP), 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) {
$arResult["Requests"]["List"] = array();
}
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arRequests["USER_ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arRequests["USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
if (intval($arRequests["USER_PERSONAL_PHOTO"]) <= 0) {
switch ($arRequests["USER_PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arRequests["USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
$arImage = CSocNetTools::InitImage($arRequests["USER_PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfile);
$arResult["Requests"]["List"][] = array("ID" => $arRequests["ID"], "USER_ID" => $arRequests["USER_ID"], "USER_NAME" => $arRequests["USER_NAME"], "USER_LAST_NAME" => $arRequests["USER_LAST_NAME"], "USER_SECOND_NAME" => $arRequests["USER_SECOND_NAME"], "USER_LOGIN" => $arRequests["USER_LOGIN"], "USER_PERSONAL_PHOTO" => $arRequests["USER_PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "DATE_CREATE" => FormatDateFromDB($arRequests["DATE_CREATE"]), "MESSAGE" => $parser->convert($arRequests["~MESSAGE"], false, array(), array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "Y", "UPLOAD" => "N", "NL2BR" => "N")));
示例14: 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;
}
示例15: GetSocNetUserPerms
public static function GetSocNetUserPerms($postId = 0, $authorId = 0)
{
global $APPLICATION, $USER, $AR_BLOG_PERMS, $BLOG_POST;
$userId = IntVal($USER->GetID());
$postId = IntVal($postId);
$authorId = IntVal($authorId);
if($postId <= 0)
return false;
$perms = BLOG_PERMS_DENY;
$blogModulePermissions = $APPLICATION->GetGroupRight("blog");
if($authorId > 0 && $userId == $authorId)
$perms = BLOG_PERMS_FULL;
elseif ($blogModulePermissions >= "W" || CSocNetUser::IsCurrentUserModuleAdmin())
{
end($AR_BLOG_PERMS);
$perms = key($AR_BLOG_PERMS);
reset($AR_BLOG_PERMS);
}
if($perms <= BLOG_PERMS_DENY)
{
$arPerms = CBlogPost::GetSocNetPerms($postId);
$arEntities = Array();
if (isset($BLOG_POST["UAC_CACHE_".$userId]) && !empty($BLOG_POST["UAC_CACHE_".$userId]))
{
$arEntities = $BLOG_POST["UAC_CACHE_".$userId];
}
else
{
$dbA = CAccess::GetUserCodes($userId);
while($arA = $dbA->Fetch())
{
if($arA["PROVIDER_ID"] == "intranet")
{
$arEntities["DR"][$arA["ACCESS_CODE"]] = $arA["ACCESS_CODE"];
}
elseif($arA["PROVIDER_ID"] == "socnetgroup")
{
$g = substr($arA["ACCESS_CODE"], 2);
$gId = IntVal($g);
$gR = substr($g, strpos($g, "_")+1);
$arEntities["SG"][$gId][$gR] = $gR;
}
}
$BLOG_POST["UAC_CACHE_".$userId] = $arEntities;
}
if(!empty($arEntities["DR"]) && !empty($arPerms["DR"]))
{
foreach($arPerms["DR"] as $id => $val)
{
if(isset($arEntities["DR"]["DR".$id]))
{
$perms = BLOG_PERMS_READ;
break;
}
}
}
if((!empty($arPerms["U"][$userId]) && in_array("US".$userId, $arPerms["U"][$userId])) || ($authorId >0 && $userId == $authorId)) // if author
$perms = BLOG_PERMS_FULL;
else
{
if($authorId <= 0)
{
foreach($arPerms["U"] as $id => $p)
{
if(in_array("US".$id, $p))
{
$authorId = $id;
break;
}
}
}
if(!empty($arPerms["U"][$userId]) || (!empty($arPerms["U"][$authorId]) && in_array("US".$authorId, $arPerms["U"][$authorId])) || $perms == BLOG_PERMS_READ)
{
if (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "write_comment"))
$perms = BLOG_PERMS_WRITE;
elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "premoderate_comment"))
$perms = BLOG_PERMS_PREMODERATE;
elseif (CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $authorId, "blog", "view_comment"))
$perms = BLOG_PERMS_READ;
}
}
if($perms <= BLOG_PERMS_FULL)
{
$arGroupsId = Array();
if(!empty($arPerms["SG"]))
{
foreach($arPerms["SG"] as $gid => $val)
{
//if(!empty($arEntities["SG"][$gid]))
$arGroupsId[] = $gid;
}
//.........这里部分代码省略.........