本文整理汇总了PHP中CSocNetFeaturesPerms::CanPerformOperation方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetFeaturesPerms::CanPerformOperation方法的具体用法?PHP CSocNetFeaturesPerms::CanPerformOperation怎么用?PHP CSocNetFeaturesPerms::CanPerformOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetFeaturesPerms
的用法示例。
在下文中一共展示了CSocNetFeaturesPerms::CanPerformOperation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CanUserDeletePost
public static function CanUserDeletePost($ID, $userID, $blogOwnerID, $groupOwnerID)
{
$ID = IntVal($ID);
$userID = IntVal($userID);
$blogOwnerID = IntVal($blogOwnerID);
$groupOwnerID = IntVal($groupOwnerID);
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions >= "W") {
return True;
}
$arPost = CBlogPost::GetByID($ID);
if (empty($arPost)) {
return False;
}
if ($groupOwnerID > 0) {
$arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
return False;
}
$perms = BLOG_PERMS_DENY;
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "view_post")) {
$perms = BLOG_PERMS_READ;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "write_post")) {
$perms = BLOG_PERMS_WRITE;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $groupOwnerID, "blog", "full_post")) {
$perms = BLOG_PERMS_FULL;
}
if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
return true;
}
if ($perms > BLOG_PERMS_WRITE) {
return true;
}
} else {
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
$arBlogUser = CBlogUser::GetByID($userID, BLOG_BY_USER_ID);
if ($arBlogUser && $arBlogUser["ALLOW_POST"] != "Y") {
return False;
}
$perms = BLOG_PERMS_DENY;
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "view_post")) {
$perms = BLOG_PERMS_READ;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "write_post")) {
$perms = BLOG_PERMS_WRITE;
}
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $blogOwnerID, "blog", "full_post")) {
$perms = BLOG_PERMS_FULL;
}
if ($perms >= BLOG_PERMS_WRITE && $arPost["AUTHOR_ID"] == $userID) {
return true;
}
if ($perms > BLOG_PERMS_WRITE) {
return true;
}
}
return False;
}
示例2: __InTaskDeleteView
function __InTaskDeleteView($delViewId, $iblockId, $taskType, $ownerId)
{
$delViewId = IntVal($delViewId);
$iblockId = IntVal($iblockId);
$ownerId = IntVal($ownerId);
if ($delViewId <= 0 || $iblockId <= 0 || $ownerId <= 0) {
return "";
}
$errorMessage = "";
$userSettingsCategory = "IntranetTasks";
$userSettingsNamePart = "Settings_";
$arUserSettings = CUserOptions::GetOption($userSettingsCategory, $userSettingsNamePart . $delViewId, false, $GLOBALS["USER"]->GetID());
if (!$arUserSettings) {
$errorMessage .= GetMessage("INTL_VIEW_NOT_FOUND") . ".";
}
if (StrLen($errorMessage) <= 0) {
if ($arUserSettings["IBLOCK_ID"] != $iblockId || $arUserSettings["TASK_TYPE"] != $taskType || $arUserSettings["OWNER_ID"] != $ownerId) {
$errorMessage .= GetMessage("INTL_WRONG_VIEW") . ".";
}
}
if (StrLen($errorMessage) <= 0) {
if ($arUserSettings["COMMON"] != "N") {
$canModifyCommon = $taskType == 'user' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $ownerId, "tasks", 'modify_common_views') || $taskType == 'group' && CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $ownerId, "tasks", 'modify_common_views');
if (!$canModifyCommon) {
$errorMessage .= GetMessage("INTL_NO_VIEW_PERMS") . ".";
}
}
}
if (StrLen($errorMessage) <= 0) {
CUserOptions::DeleteOption($userSettingsCategory, $userSettingsNamePart . $delViewId, $arUserSettings["COMMON"] == "Y" ? true : false, $GLOBALS["USER"]->GetID());
}
return $errorMessage;
}
示例3: __ShowGroupField
function __ShowGroupField($name, $propertyField, $value, $taskType = "group")
{
if (!is_array($value)) {
$value = array($value);
}
$flag = 0;
$ha = false;
$res = "";
$bWas = false;
$dbSections = CIBlockSection::GetTreeList(array("IBLOCK_ID" => $propertyField["IBLOCK_ID"]));
while ($arSections = $dbSections->GetNext()) {
if ($taskType == "group") {
if ($flag == 0) {
if ($arSections["EXTERNAL_ID"] != $propertyField["ROOT_ID"]) {
continue;
}
$flag = $arSections["DEPTH_LEVEL"];
continue;
} else {
if ($flag == $arSections["DEPTH_LEVEL"]) {
break;
}
}
} else {
$flag = 1;
if ($arSections["DEPTH_LEVEL"] == 1) {
if ($arSections["XML_ID"] == "users_tasks") {
$ha = true;
} else {
$ha = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arSections["XML_ID"], "tasks", $arResult["arSocNetFeaturesSettings"]["tasks"]["minoperation"][0]);
}
}
if (!$ha) {
continue;
}
}
$res .= '<option value="' . $arSections["ID"] . '"';
if (in_array($arSections["ID"], $value)) {
$bWas = true;
$res .= ' selected';
}
$res .= '>' . str_repeat(" . ", $arSections["DEPTH_LEVEL"] - $flag) . $arSections["NAME"] . '</option>';
}
echo '<select name="' . $name . '" style="width:98%">';
echo '<option value=""' . (!$bWas ? ' selected' : '') . '>' . GetMessage("INTVT_NOT_SET") . '</option>';
echo $res;
echo '</select>';
}
示例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: getAllowedActionsArrayInternal
private static function getAllowedActionsArrayInternal($executiveUserId, array $arTaskData, $bmUserRoles)
{
$arBaseAllowedActions = self::getBaseAllowedActions();
$arActualBaseAllowedActions = $arBaseAllowedActions[$arTaskData['REAL_STATUS']];
// actions allowed on read-access
$arAllowedActions = array(self::ACTION_TOGGLE_FAVORITE);
if ($arTaskData['FAVORITE'] == 'Y') {
$arAllowedActions[] = self::ACTION_DELETE_FAVORITE;
} else {
$arAllowedActions[] = self::ACTION_ADD_FAVORITE;
}
$mergesCount = 0;
if (is_array($arActualBaseAllowedActions)) {
foreach ($arActualBaseAllowedActions as $userRole => $arActions) {
if ($userRole & $bmUserRoles) {
$arAllowedActions = array_merge($arAllowedActions, $arActions);
++$mergesCount;
}
}
}
if ($mergesCount > 1) {
$arAllowedActions = array_unique($arAllowedActions);
}
$isAdmin = CTasksTools::IsAdmin($executiveUserId) || CTasksTools::IsPortalB24Admin($executiveUserId);
if (self::$bSocialNetworkModuleIncluded === null) {
self::$bSocialNetworkModuleIncluded = CModule::IncludeModule('socialnetwork');
}
// Admin always can edit and remove, also implement rights from task group
if (!in_array(self::ACTION_REMOVE, $arAllowedActions, true)) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if ($isAdmin || $arTaskData['GROUP_ID'] > 0 && self::$bSocialNetworkModuleIncluded && CSocNetFeaturesPerms::CanPerformOperation($executiveUserId, SONET_ENTITY_GROUP, $arTaskData['GROUP_ID'], 'tasks', 'delete_tasks')) {
$arAllowedActions[] = self::ACTION_REMOVE;
}
}
if (!in_array(self::ACTION_EDIT, $arAllowedActions, true)) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if ($isAdmin || $arTaskData['GROUP_ID'] > 0 && self::$bSocialNetworkModuleIncluded && CSocNetFeaturesPerms::CanPerformOperation($executiveUserId, SONET_ENTITY_GROUP, $arTaskData['GROUP_ID'], 'tasks', 'edit_tasks')) {
$arAllowedActions[] = self::ACTION_EDIT;
}
}
// Precache result of slow 'in_array' function
$bCanEdit = in_array(self::ACTION_EDIT, $arAllowedActions, true);
// User can change deadline, if ...
if ($isAdmin || $bCanEdit || $arTaskData['ALLOW_CHANGE_DEADLINE'] === 'Y' && self::ROLE_RESPONSIBLE & $bmUserRoles) {
$arAllowedActions[] = self::ACTION_CHANGE_DEADLINE;
}
// If user can edit task, he can also add elapsed time and checklist items
if ($isAdmin || $bCanEdit) {
$arAllowedActions[] = self::ACTION_ELAPSED_TIME_ADD;
$arAllowedActions[] = self::ACTION_CHECKLIST_ADD_ITEMS;
}
// Director can change director, and user who can edit can
if ($isAdmin || $bCanEdit || self::ROLE_DIRECTOR & $bmUserRoles) {
$arAllowedActions[] = self::ACTION_CHANGE_DIRECTOR;
}
if ($arTaskData['ALLOW_TIME_TRACKING'] === 'Y') {
// User can do time tracking, if he is participant in the task
if ($executiveUserId == $arTaskData['RESPONSIBLE_ID'] || !empty($arTaskData['ACCOMPLICES']) && in_array($executiveUserId, $arTaskData['ACCOMPLICES'])) {
$arAllowedActions[] = self::ACTION_START_TIME_TRACKING;
}
}
return array_values(array_unique($arAllowedActions));
}
示例6: MkFilter
//.........这里部分代码省略.........
$MODULE_ID = "iblock";
$ENTITY = "CIBlockDocument";
$PERMISSION = $val;
$arUserGroups = false;
$USER_ID = 0;
}
if ($PERMISSION == "read" || $PERMISSION == "write") {
if (!is_array($arUserGroups) && is_object($USER)) {
$USER_ID = intval($USER->GetID());
$arUserGroups = $USER->GetUserGroupArray();
}
if (!is_array($arUserGroups) || count($arUserGroups) <= 0) {
$arUserGroups = array(2);
}
$arSqlSearch[] = "EXISTS (\n\t\t\t\t\t\t\tSELECT S.DOCUMENT_ID_INT\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\tb_bp_workflow_state S\n\t\t\t\t\t\t\tINNER JOIN b_bp_workflow_permissions P ON S.ID = P.WORKFLOW_ID\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tS.DOCUMENT_ID_INT = BE.ID\n\t\t\t\t\t\t\t\tAND S.MODULE_ID = '{$MODULE_ID}'\n\t\t\t\t\t\t\t\tAND S.ENTITY = '{$ENTITY}'\n\t\t\t\t\t\t\t\tAND P.PERMISSION = '{$PERMISSION}'\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\tP.OBJECT_ID IN ('" . implode("', '", $arUserGroups) . "')\n\t\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = 'Author' AND BE.CREATED_BY = {$USER_ID})\n\t\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = " . $DB->Concat("'USER_'", "'{$USER_ID}'") . ")\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)";
}
}
break;
case "CHECK_BP_TASKS_PERMISSIONS":
if (IsModuleInstalled('bizproc') && CModule::IncludeModule("socialnetwork") && (!is_object($USER) || !$USER->IsAdmin())) {
$val = explode("_", $val);
$taskType = $val[0];
if (!in_array($taskType, array("user", "group"))) {
$taskType = "user";
}
$ownerId = intval($val[1]);
$val = $val[2];
if (!in_array($val, array("read", "write", "comment"))) {
$val = "write";
}
$userId = is_object($USER) ? intval($USER->GetID()) : 0;
$arUserGroups = array();
if ($taskType == "group") {
$r = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $ownerId, "tasks", $val == "write" ? "edit_tasks" : "view_all");
if ($r) {
break;
}
$arUserGroups[] = SONET_ROLES_ALL;
$r = CSocNetUserToGroup::GetUserRole($userId, $ownerId);
if (strlen($r) > 0) {
$arUserGroups[] = $r;
}
} else {
// $arUserGroups[] = SONET_RELATIONS_TYPE_ALL;
// if (CSocNetUserRelations::IsFriends($userId, $ownerId))
// $arUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS;
// elseif (CSocNetUserRelations::IsFriends2($userId, $ownerId))
// $arUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS2;
}
$arSqlSearch[] = "EXISTS (\n\t\t\t\t\t\tSELECT S.DOCUMENT_ID_INT\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\tb_bp_workflow_state S\n\t\t\t\t\t\tINNER JOIN b_bp_workflow_permissions P ON S.ID = P.WORKFLOW_ID\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tS.DOCUMENT_ID_INT = BE.ID\n\t\t\t\t\t\t\tAND S.MODULE_ID = 'intranet'\n\t\t\t\t\t\t\tAND S.ENTITY = 'CIntranetTasksDocument'\n\t\t\t\t\t\t\tAND P.PERMISSION = '" . $val . "'\n\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t" . ($taskType == "group" ? "P.OBJECT_ID IN ('" . implode("', '", $arUserGroups) . "') OR" : "") . "\n\t\t\t\t\t\t\t\t(P.OBJECT_ID = 'author' AND BE.CREATED_BY = " . $userId . ")\n\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = 'responsible' AND " . $userId . " IN (\n\t\t\t\t\t\t\t\t\tSELECT SFPV0.VALUE_NUM\n\t\t\t\t\t\t\t\t\tFROM b_iblock_element_property SFPV0\n\t\t\t\t\t\t\t\t\t\tINNER JOIN b_iblock_property SFP0 ON (SFPV0.IBLOCK_PROPERTY_ID = SFP0.ID)\n\t\t\t\t\t\t\t\t\tWHERE " . CIBlock::_Upper("SFP0.CODE") . "='TASKASSIGNEDTO'\n\t\t\t\t\t\t\t\t\t\tAND SFP0.IBLOCK_ID = BE.IBLOCK_ID\n\t\t\t\t\t\t\t\t\t\tAND SFPV0.IBLOCK_ELEMENT_ID = BE.ID\n\t\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = 'trackers' AND " . $userId . " IN (\n\t\t\t\t\t\t\t\t\tSELECT SFPV0.VALUE_NUM\n\t\t\t\t\t\t\t\t\tFROM b_iblock_element_property SFPV0\n\t\t\t\t\t\t\t\t\t\tINNER JOIN b_iblock_property SFP0 ON (SFPV0.IBLOCK_PROPERTY_ID = SFP0.ID)\n\t\t\t\t\t\t\t\t\tWHERE " . CIBlock::_Upper("SFP0.CODE") . "='TASKTRACKERS'\n\t\t\t\t\t\t\t\t\t\tAND SFP0.IBLOCK_ID = BE.IBLOCK_ID\n\t\t\t\t\t\t\t\t\t\tAND SFPV0.IBLOCK_ELEMENT_ID = BE.ID\n\t\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = '" . ("USER_" . $userId) . "')\n\t\t\t\t\t\t\t)\n\t\t\t\t\t)";
}
break;
case "CHECK_BP_VIRTUAL_PERMISSIONS":
if (IsModuleInstalled('bizproc') && (!is_object($USER) || !$USER->IsAdmin())) {
if (!in_array($val, array("read", "create", "admin"))) {
$val = "admin";
}
$userId = is_object($USER) ? intval($USER->GetID()) : 0;
if (is_object($USER)) {
$arUserGroups = $USER->GetUserGroupArray();
}
if (!is_array($arUserGroups) || count($arUserGroups) <= 0) {
$arUserGroups = array(2);
}
$arSqlSearch[] = "EXISTS (\n\t\t\t\t\t\tSELECT S.DOCUMENT_ID_INT\n\t\t\t\t\t\tFROM b_bp_workflow_state S\n\t\t\t\t\t\t\tINNER JOIN b_bp_workflow_permissions P ON S.ID = P.WORKFLOW_ID\n\t\t\t\t\t\tWHERE S.DOCUMENT_ID_INT = BE.ID\n\t\t\t\t\t\t\tAND S.MODULE_ID = 'bizproc'\n\t\t\t\t\t\t\tAND S.ENTITY = 'CBPVirtualDocument'\n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t(P.PERMISSION = '" . $val . "'\n\t\t\t\t\t\t\t\tAND (\n\t\t\t\t\t\t\t\t\tP.OBJECT_ID IN ('" . implode("', '", $arUserGroups) . "')\n\t\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = 'Author' AND BE.CREATED_BY = " . $userId . ")\n\t\t\t\t\t\t\t\t\tOR (P.OBJECT_ID = " . $DB->Concat("'USER_'", "'" . $userId . "'") . ")\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t)";
}
示例7: intVal
Default params
********************************************************************/
$arParams["IBLOCK_ID"] = intVal($object == "user" ? $arParams["PHOTO_USER_IBLOCK_ID"] : $arParams["PHOTO_GROUP_IBLOCK_ID"]);
$cache = new CPHPCache();
/************** Permission *****************************************/
$arParams["PERMISSION"] = "D";
if ($object == "user") {
if (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["VARIABLES"]["user_id"], "photo", "write", CSocNetUser::IsCurrentUserModuleAdmin())) {
$arParams["PERMISSION"] = "W";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["VARIABLES"]["user_id"], "photo", "view", CSocNetUser::IsCurrentUserModuleAdmin())) {
$arParams["PERMISSION"] = "R";
}
} else {
if (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_GROUP, $arResult["VARIABLES"]["group_id"], "photo", "write", CSocNetUser::IsCurrentUserModuleAdmin())) {
$arParams["PERMISSION"] = "W";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_GROUP, $arResult["VARIABLES"]["group_id"], "photo", "view", CSocNetUser::IsCurrentUserModuleAdmin())) {
$arParams["PERMISSION"] = "R";
}
}
$user_alias = $arResult["VARIABLES"]["user_alias"];
if (empty($user_alias)) {
$arFilter = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "IBLOCK_ACTIVE" => "Y", "SECTION_ID" => 0, "SOCNET_GROUP_ID" => false);
if ($object == "user") {
$uid = $arResult["VARIABLES"]["user_id"];
if ($uid <= 0 && $componentPage == "user_photo_my" && $GLOBALS["USER"]->IsAuthorized()) {
$uid = $GLOBALS["USER"]->GetId();
}
if ($uid <= 0) {
$arParams["ERROR_MESSAGE"] = "User is not exists.";
return 0;
}
示例8: __SLEGetLogRecord
//.........这里部分代码省略.........
$arEvent["FIELDS_FORMATTED"]["LOG_UPDATE_DAY"] = ConvertTimeStamp(MakeTimeStamp($arEvent["LOG_UPDATE"]), "SHORT");
$arEvent["FIELDS_FORMATTED"]["COMMENTS_COUNT"] = $arEvent["COMMENTS_COUNT"];
$arEvent["FIELDS_FORMATTED"]["TMP_ID"] = $arEvent["TMP_ID"];
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["EVENT_ID"]);
if (!array_key_exists("HAS_COMMENTS", $arEvent["FIELDS_FORMATTED"]) || $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] != "N") {
$arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] = $arCommentEvent && (!array_key_exists("ENABLE_COMMENTS", $arEvent) || $arEvent["ENABLE_COMMENTS"] != "N") ? "Y" : "N";
}
}
}
if (is_object($cache)) {
$arCacheData = array("FIELDS_FORMATTED" => $arEvent["FIELDS_FORMATTED"]);
$cache->EndDataCache($arCacheData);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
}
if ($bEmpty) {
return false;
}
$feature = CSocNetLogTools::FindFeatureByEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
if ($feature && (!array_key_exists($feature, $arSocNetFeaturesSettings) || array_key_exists("allowed", $arSocNetFeaturesSettings[$feature]) && is_array($arSocNetFeaturesSettings[$feature]["allowed"]) && !in_array($arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"], $arSocNetFeaturesSettings[$feature]["allowed"]))) {
return false;
}
if (!array_key_exists("COMMENTS_PARAMS", $arEvent["FIELDS_FORMATTED"])) {
$arForumMetaData = CSocNetLogTools::GetForumCommentMetaData($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
if ($arForumMetaData && $arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"] > 0) {
$arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => $arForumMetaData[1], "ENTITY_XML_ID" => $arForumMetaData[0] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"], "NOTIFY_TAGS" => $arForumMetaData[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" => "");
}
}
foreach (GetModuleEvents("socialnetwork", "OnSonetLogEntryMenuCreate", true) as $arModuleEvent) {
if (!array_key_exists("FIELDS_FORMATTED", $arEvent)) {
$arEvent["FIELDS_FORMATTED"] = array();
}
if (!array_key_exists("MENU", $arEvent["FIELDS_FORMATTED"])) {
$arEvent["FIELDS_FORMATTED"]["MENU"] = array();
}
$arMenuItems = ExecuteModuleEventEx($arModuleEvent, array($arEvent));
if (!empty($arMenuItems)) {
$arEvent["FIELDS_FORMATTED"]["MENU"] = array_merge($arEvent["FIELDS_FORMATTED"]["MENU"], $arMenuItems);
}
}
if (is_array($arCurrentUserSubscribe)) {
$arEvent["FIELDS_FORMATTED"]["TRANSPORT"] = __SLEGetTransport($arEvent, $arCurrentUserSubscribe);
}
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
if (!$GLOBALS["USER"]->IsAuthorized()) {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = "N";
} elseif ($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 {
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"], $bCurrentUserIsAdmin) ? "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" && !$bCurrentUserIsAdmin && is_object($GLOBALS["USER"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && (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;
$arGroupID = CSocNetLogTools::GetAvailableGroups();
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) || in_array($arDestination["TYPE"], array("CRMCOMPANY", "CRMLEAD", "CRMCONTACT", "CRMDEAL")) && CModule::IncludeModule("crm") && !CCrmAuthorizationHelper::CheckReadPermission(CCrmLiveFeedEntity::ResolveEntityTypeID($arDestination["TYPE"]), $arDestination["ID"]) || in_array($arDestination["TYPE"], array("DR", "D")) && $isExtranetUser == "Y" || $arDestination["TYPE"] == "U" && isset($arUserIdVisible) && is_array($arUserIdVisible) && !in_array(intval($arDestination["ID"]), $arUserIdVisible) || $arDestination["TYPE"] == "U" && isset($arDestination["IS_EXTRANET"]) && $arDestination["IS_EXTRANET"] == "Y" && isset($arAvailableExtranetUserID) && is_array($arAvailableExtranetUserID) && !in_array(intval($arDestination["ID"]), $arAvailableExtranetUserID))) {
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"]) - $arParams["DESTINATION_LIMIT_SHOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] = array_slice($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"], 0, $arParams["DESTINATION_LIMIT_SHOW"]);
}
} elseif (array_key_exists("DESTINATION_CODE", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"] as $key => $right_tmp) {
if (preg_match('/^SG(\\d+)$/', $right_tmp, $matches) && !in_array(intval($matches[1]), $arGroupID)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"][$key]);
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"]++;
}
}
}
}
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"]);
}
return $arEvent["FIELDS_FORMATTED"];
}
示例9: foreach
if ($gadget["BLOG_ONLY"] == true && $gadget["SG_ONLY"] == true && intval($arParams["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "blog")) {
continue;
}
if ($gadget["FORUM_ONLY"] == true && $gadget["SU_ONLY"] == true && intval($arParams["USER_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $arParams["USER_ID"], "forum")) {
continue;
}
if ($gadget["FORUM_ONLY"] == true && $gadget["SG_ONLY"] == true && intval($arParams["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum")) {
continue;
}
if ($gadget["SEARCH_ONLY"] == true && $gadget["SU_ONLY"] == true && intval($arParams["USER_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $arParams["USER_ID"], "search")) {
continue;
}
if ($gadget["SEARCH_ONLY"] == true && $gadget["SG_ONLY"] == true && intval($arParams["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && !CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "search")) {
continue;
}
if ($gadget["WIKI_ONLY"] == true && $gadget["SG_ONLY"] == true && intval($arParams["SOCNET_GROUP_ID"]) > 0 && CModule::IncludeModule('socialnetwork') && (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "wiki") || !CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "wiki", "view", CSocNetUser::IsCurrentUserModuleAdmin()))) {
continue;
}
if ($gadget["GROUP"]["ID"] == "") {
$gadget["GROUP"]["ID"] = "other";
}
if (!isset($gadget["TOTALLY_FIXED"]) || !$gadget["TOTALLY_FIXED"]) {
if (!is_array($gadget["GROUP"]["ID"])) {
$arGroups[$gadget["GROUP"]["ID"]]["GADGETS"][] = $gadget["ID"];
} else {
foreach ($gadget["GROUP"]["ID"] as $group_id) {
if (in_array($arParams["MODE"], array("SU", "SG")) && $group_id != "sonet" || !in_array($arParams["MODE"], array("SU", "SG")) && $group_id == "sonet" || $arParams["MODE"] == "AI" && $group_id != "admin" || $arParams["MODE"] != "AI" && $group_id == "admin") {
continue;
}
$arGroups[$group_id]["GADGETS"][] = $gadget["ID"];
}
示例10: elseif
$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)) {
$arParams["PERMISSION"] = "I";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_GROUP, $arParams["SOCNET_GROUP_ID"], "forum", "view", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "E";
}
} else {
if (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $arParams["USER_ID"], "forum", "full", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "Y";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $arParams["USER_ID"], "forum", "newtopic", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "M";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $arParams["USER_ID"], "forum", "answer", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "I";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($user_id, SONET_ENTITY_USER, $arParams["USER_ID"], "forum", "view", $bCurrentUserIsAdmin)) {
$arParams["PERMISSION"] = "E";
}
}
}
if ($arParams["SHOW_VOTE"] == "Y") {
// A - NO ACCESS E - READ I - ANSWER
// M - NEW TOPIC Q - MODERATE U - EDIT Y - FULL_ACCESS
$arResult["VOTE_PERMISSION"] = $arParams['PERMISSION'] === 'A' ? 0 : ($arParams['PERMISSION'] === 'E' ? 1 : 2);
$arParams["SHOW_VOTE"] = $arResult["VOTE_PERMISSION"] <= 'A' ? "N" : "Y";
}
if (!CForumNew::CanUserViewForum($arParams["FID"], $USER->GetUserGroupArray(), $arParams["PERMISSION"])) {
ShowError(GetMessage("FORUM_SONET_NO_ACCESS"));
return false;
}
$arResult["CURRENT_PAGE"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC"], array("UID" => $arParams["USER_ID"], "TID" => $arParams["TID"], "GID" => $arParams["SOCNET_GROUP_ID"], "FID" => $arParams["FID"]));
示例11: array
$arResult["BLOG"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_BLOG_TITLE"));
if (array_key_exists("blog", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "blog", "view_post", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("blog") >= "W") && CModule::IncludeModule("blog")) {
$arResult["BLOG"]["SHOW"] = true;
if (StrLen($arResult["ActiveFeatures"]["blog"]) > 0) {
$arResult["BLOG"]["TITLE"] = $arResult["ActiveFeatures"]["blog"];
}
}
$arResult["forum"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_FORUM_TITLE"));
if (array_key_exists("forum", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "forum", "view", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("forum") >= "W") && CModule::IncludeModule("forum")) {
$arResult["forum"]["SHOW"] = true;
if (StrLen($arResult["ActiveFeatures"]["forum"]) > 0) {
$arResult["forum"]["TITLE"] = $arResult["ActiveFeatures"]["forum"];
}
}
$arResult["tasks"] = array("SHOW" => false, "TITLE" => GetMessage("SONET_C39_TASKS_TITLE"));
if (array_key_exists("tasks", $arResult["ActiveFeatures"]) && (CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_USER, $arResult["User"]["ID"], "tasks", "view", CSocNetUser::IsCurrentUserModuleAdmin()) || $APPLICATION->GetGroupRight("intranet") >= "W") && CModule::IncludeModule("intranet")) {
$arResult["tasks"]["SHOW"] = true;
if (StrLen($arResult["ActiveFeatures"]["tasks"]) > 0) {
$arResult["tasks"]["TITLE"] = $arResult["ActiveFeatures"]["tasks"];
}
}
}
}
if (array_key_exists("RatingMultiple", $arResult) && count($arResult["RatingMultiple"]) > 0) {
foreach ($arParams["RATING_ID_ARR"] as $rating_id) {
if (array_key_exists($rating_id, $arResult["RatingMultiple"])) {
$arResult["RatingMultiple"][$rating_id]["VALUE"] = $arResult["User"]["RATING_" . $rating_id . "_CURRENT_VALUE"];
}
}
}
}
示例12: CheckAccess
/**
* <p>Метод проверяет доступ пользователя.</p>
*
*
*
*
* @param string $access Тип проверяемого доступа (view, write, delete)
*
*
*
* @return bool
*
*
* <h4>See Also</h4>
* <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/IsReadable.php">CWikiUtils::isReadable</a>
* </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/IsWriteable.php">CWikiUtils::isWriteable</a> </li> <li>
* <a href="http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/IsDeleteable.php">CWikiUtils::IsDeleteable</a> </li>
* <li> <a href="http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/IsAllowHTML.php">CWikiUtils::isAllowHTML</a>
* </li> </ul><br><br>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/wiki/classes/cwikiutils/CheckAccess.php
* @author Bitrix
*/
static function CheckAccess($access = 'view')
{
global $APPLICATION, $USER, $arParams;
if ($USER->IsAdmin()) {
return true;
}
if (CWikiSocnet::IsSocNet()) {
$arSonetGroup = CSocNetGroup::GetByID($iSocNetId);
if ($arSonetGroup && CSocNetUser::IsCurrentUserModuleAdmin($arSonetGroup['SITE_ID'])) {
return true;
}
if (!CSocNetFeaturesPerms::CanPerformOperation($USER->GetID(), SONET_ENTITY_GROUP, CWikiSocnet::$iSocNetId, 'wiki', $access)) {
return false;
}
return true;
} else {
$letter = 'R';
$letterI = 'R';
switch ($access) {
case 'write':
$letter = 'W';
$letterI = 'W';
break;
case 'delete':
$letter = 'Y';
$letterI = 'W';
break;
case 'perm':
$letter = 'Z';
$letterI = 'X';
break;
}
$wikiModulePermission = $APPLICATION->GetGroupRight('wiki');
$iblockPermission = CIBlock::GetPermission($arParams['IBLOCK_ID']);
return $wikiModulePermission >= $letter && $iblockPermission >= $letterI;
}
}
示例13: GetSocNetUserPerms
function GetSocNetUserPerms($postId = 0, $authorId = 0)
{
global $APPLICATION, $USER, $AR_BLOG_PERMS;
$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 (!empty(CBlogPost::$arUACCache[$userId])) {
$arEntities = CBlogPost::$arUACCache[$userId];
} else {
$arCodes = CAccess::GetUserCodesArray($userId);
foreach ($arCodes as $code) {
if (preg_match('/^DR([0-9]+)/', $code, $match) || preg_match('/^D([0-9]+)/', $code, $match) || preg_match('/^IU([0-9]+)/', $code, $match)) {
$arEntities["DR"][$code] = $code;
} elseif (preg_match('/^SG([0-9]+)_([A-Z])/', $code, $match)) {
$arEntities["SG"][$match[1]][$match[2]] = $match[2];
}
}
CBlogPost::$arUACCache[$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;
}
$operation = array("full_comment", "moderate_comment", "write_comment", "premoderate_comment");
if ($perms < BLOG_PERMS_READ) {
$operation[] = "view_comment";
}
}
if (!empty($arGroupsId)) {
foreach ($operation as $v) {
if ($perms <= BLOG_PERMS_READ) {
$f = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $arGroupsId, "blog", $v);
if (!empty($f)) {
foreach ($f as $gid => $val) {
if (!empty($arEntities["SG"][$gid]) && in_array($val, $arEntities["SG"][$gid]) || $val == SONET_ROLES_ALL || $userId > 0 && $val == SONET_ROLES_AUTHORIZED) {
switch ($v) {
case "full_comment":
$perms = BLOG_PERMS_FULL;
break;
case "moderate_comment":
$perms = BLOG_PERMS_MODERATE;
break;
case "write_comment":
$perms = BLOG_PERMS_WRITE;
break;
case "premoderate_comment":
$perms = BLOG_PERMS_PREMODERATE;
break;
case "view_comment":
$perms = BLOG_PERMS_READ;
break;
}
//.........这里部分代码省略.........
示例14: GetSuperposedList
public static function GetSuperposedList($Params = array())
{
global $DB;
$checkPermissions = $Params['checkPermissions'] !== false;
$checkSocnetPermissions = $Params['checkSocnetPermissions'] !== false;
$userId = isset($Params['userId']) ? intVal($Params['userId']) : self::$userId;
$arResult = array();
$arSectionIds = array();
$sqlSearch = "";
// Common types
$strTypes = "";
if (isset($Params['TYPES']) && is_array($Params['TYPES'])) {
foreach ($Params['TYPES'] as $type) {
$strTypes .= ",'" . CDatabase::ForSql($type) . "'";
}
$strTypes = trim($strTypes, ", ");
if ($strTypes != "") {
$sqlSearch .= "(CS.CAL_TYPE in (" . $strTypes . "))";
}
}
// Group's calendars
$strGroups = "0";
if (is_array($Params['GROUPS']) && count($Params['GROUPS']) > 0) {
foreach ($Params['GROUPS'] as $ownerId) {
if (IntVal($ownerId) > 0) {
$strGroups .= "," . IntVal($ownerId);
}
}
if ($strGroups != "0") {
if ($sqlSearch != "") {
$sqlSearch .= " OR ";
}
$sqlSearch .= "(CS.OWNER_ID in (" . $strGroups . ") AND CS.CAL_TYPE='group')";
}
}
if ($sqlSearch != "") {
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tCS.*,\n\t\t\t\t\tCT.NAME AS TYPE_NAME, CT.DESCRIPTION AS TYPE_DESC\n\t\t\t\tFROM\n\t\t\t\t\tb_calendar_section CS\n\t\t\t\t\tLEFT JOIN b_calendar_type CT ON (CS.CAL_TYPE=CT.XML_ID)\n\t\t\t\tWHERE\n\t\t\t\t\t(\n\t\t\t\t\t\tCT.ACTIVE='Y'\n\t\t\t\t\tAND\n\t\t\t\t\t\tCS.ACTIVE='Y'\n\t\t\t\t\tAND\n\t\t\t\t\t(\n\t\t\t\t\t\t{$sqlSearch}\n\t\t\t\t\t))";
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($arRes = $res->Fetch()) {
$arSectionIds[] = $arRes['ID'];
$arResult[] = $arRes;
}
}
// User's calendars
$strUsers = "0";
if (is_array($Params['USERS']) && count($Params['USERS']) > 0) {
foreach ($Params['USERS'] as $ownerId) {
if (IntVal($ownerId) > 0) {
$strUsers .= "," . IntVal($ownerId);
}
}
if ($strUsers != "0") {
$strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tCS.*,\n\t\t\t\t\tU.LOGIN AS USER_LOGIN, U.NAME AS USER_NAME, U.LAST_NAME AS USER_LAST_NAME, U.SECOND_NAME AS USER_SECOND_NAME\n\t\t\t\tFROM\n\t\t\t\t\tb_calendar_section CS\n\t\t\t\t\tLEFT JOIN b_user U ON (CS.OWNER_ID=U.ID)\n\t\t\t\tWHERE\n\t\t\t\t\t(\n\t\t\t\t\t\tCS.ACTIVE='Y'\n\t\t\t\t\tAND\n\t\t\t\t\t\tCS.OWNER_ID in (" . $strUsers . ")\n\t\t\t\t\tAND\n\t\t\t\t\t\tCS.CAL_TYPE='user'\n\t\t\t\t\t)";
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
while ($arRes = $res->Fetch()) {
$arSectionIds[] = $arRes['ID'];
$arResult[] = $arRes;
}
}
if ($checkPermissions && count($arSectionIds) > 0) {
if ($checkSocnetPermissions) {
if (isset($Params['USERS']) && count($Params['USERS']) > 0) {
$arFeaturesU = CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $Params['USERS'], "calendar");
$arViewU = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $Params['USERS'], "calendar", 'view');
$arWriteU = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $Params['USERS'], "calendar", 'write');
}
if (isset($Params['GROUPS']) && count($Params['GROUPS']) > 0) {
$arFeaturesG = CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $Params['GROUPS'], "calendar");
$arViewG = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $Params['GROUPS'], "calendar", 'view');
$arWriteG = CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $Params['GROUPS'], "calendar", 'write');
}
}
CCalendarSect::GetArrayPermissions($arSectionIds);
$res = array();
$sectIds = array();
foreach ($arResult as $sect) {
$sectId = $sect['ID'];
$ownerId = $sect['OWNER_ID'];
if (self::CanDo('calendar_view_time', $sectId) && !in_array($sectId, $sectIds)) {
if ($checkSocnetPermissions) {
// Disabled in socialnetwork
if ($sect['CAL_TYPE'] == 'group' && (!$arFeaturesG[$ownerId] || !$arViewG[$ownerId]) || $sect['CAL_TYPE'] == 'user' && (!$arFeaturesU[$ownerId] || !$arViewU[$ownerId])) {
continue;
}
}
$sect['PERM'] = array('view_time' => self::CanDo('calendar_view_time', $sectId), 'view_title' => self::CanDo('calendar_view_title', $sectId), 'view_full' => self::CanDo('calendar_view_full', $sectId), 'add' => self::CanDo('calendar_add', $sectId), 'edit' => self::CanDo('calendar_edit', $sectId), 'edit_section' => self::CanDo('calendar_edit_section', $sectId), 'access' => self::CanDo('calendar_edit_access', $sectId));
if ($checkSocnetPermissions) {
if ($sect['CAL_TYPE'] == 'group' && !$arWriteG[$ownerId] || $sect['CAL_TYPE'] == 'user' && !$arWriteU[$ownerId]) {
$sect['PERM']['add'] = false;
$sect['PERM']['edit'] = false;
$sect['PERM']['edit_section'] = false;
$sect['PERM']['access'] = false;
}
}
if ($sect['CAL_TYPE'] == 'user') {
if (isset($sect['USER_NAME'], $sect['USER_LAST_NAME'])) {
$sect['OWNER_NAME'] = CCalendar::GetUserName(array("NAME" => $sect['USER_NAME'], "LAST_NAME" => $sect['USER_LAST_NAME'], "LOGIN" => $sect['USER_LOGIN'], "ID" => $ownerId, "SECOND_NAME" => $sect['USER_SECOND_NAME']));
unset($sect['USER_LOGIN']);
unset($sect['USER_LAST_NAME']);
//.........这里部分代码省略.........
示例15: elseif
}
if (!$photo_detail_url) {
$photo_detail_url = $arParams["PATH_TO_" . ($arEvent["EVENT"]["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP ? "GROUP" : "USER") . "_PHOTO_ELEMENT"];
}
if (strlen($photo_iblock_type) > 0 && intval($photo_iblock_id) > 0 && intval($photo_section_id) > 0 && count($arPhotoItems) > 0) {
$photo_permission = "D";
if ($arEvent["EVENT"]["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP) {
if (CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arEvent["EVENT"]["ENTITY_ID"], "photo", "write", CSocNetUser::IsCurrentUserModuleAdmin())) {
$photo_permission = "W";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $arEvent["EVENT"]["ENTITY_ID"], "photo", "view", CSocNetUser::IsCurrentUserModuleAdmin())) {
$photo_permission = "R";
}
} else {
if (CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arEvent["EVENT"]["ENTITY_ID"], "photo", "write", CSocNetUser::IsCurrentUserModuleAdmin())) {
$photo_permission = "W";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arEvent["EVENT"]["ENTITY_ID"], "photo", "view", CSocNetUser::IsCurrentUserModuleAdmin())) {
$photo_permission = "R";
}
}
$APPLICATION->IncludeComponent("bitrix:photogallery.detail.list.ex", "", array("IBLOCK_TYPE" => $photo_iblock_type, "IBLOCK_ID" => $photo_iblock_id, "SHOWN_PHOTOS" => count($arPhotoItems) > $arParams["PHOTO_COUNT"] ? array_slice($arPhotoItems, 0, $arParams["PHOTO_COUNT"]) : $arPhotoItems, "DRAG_SORT" => "N", "MORE_PHOTO_NAV" => "N", "PERMISSION" => $photo_permission, "THUMBNAIL_SIZE" => $arParams["PHOTO_THUMBNAIL_SIZE"], "SHOW_CONTROLS" => "Y", "USE_RATING" => $arParams["PHOTO_USE_RATING"] == "Y" || $arParams["SHOW_RATING"] == "Y" ? "Y" : "N", "SHOW_RATING" => $arParams["SHOW_RATING"], "SHOW_SHOWS" => "N", "SHOW_COMMENTS" => "Y", "MAX_VOTE" => $arParams["PHOTO_MAX_VOTE"], "VOTE_NAMES" => isset($arParams["PHOTO_VOTE_NAMES"]) ? $arParams["PHOTO_VOTE_NAMES"] : array(), "DISPLAY_AS_RATING" => $arParams["SHOW_RATING"] == "Y" ? "rating_main" : isset($arParams["PHOTO_DISPLAY_AS_RATING"]) ? $arParams["PHOTO_DISPLAY_AS_RATING"] : "rating", "RATING_MAIN_TYPE" => $arParams["SHOW_RATING"] == "Y" ? $arParams["RATING_TYPE"] : "", "BEHAVIOUR" => "SIMPLE", "SET_TITLE" => "N", "CACHE_TYPE" => "A", "CACHE_TIME" => $arParams["CACHE_TIME"], "CACHE_NOTES" => "", "SECTION_ID" => $photo_section_id, "ELEMENT_LAST_TYPE" => "none", "ELEMENT_SORT_FIELD" => "ID", "ELEMENT_SORT_ORDER" => "asc", "ELEMENT_SORT_FIELD1" => "", "ELEMENT_SORT_ORDER1" => "asc", "PROPERTY_CODE" => array(), "INDEX_URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_" . ($arEvent["EVENT"]["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP ? "GROUP" : "USER") . "_PHOTO"], array("user_id" => $arEvent["EVENT"]["ENTITY_ID"], "group_id" => $arEvent["EVENT"]["ENTITY_ID"])), "DETAIL_URL" => CComponentEngine::MakePathFromTemplate($photo_detail_url, array("user_id" => $arEvent["EVENT"]["ENTITY_ID"], "group_id" => $arEvent["EVENT"]["ENTITY_ID"])), "GALLERY_URL" => "", "SECTION_URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_" . ($arEvent["EVENT"]["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP ? "GROUP" : "USER") . "_PHOTO_SECTION"], array("user_id" => $arEvent["EVENT"]["ENTITY_ID"], "group_id" => $arEvent["EVENT"]["ENTITY_ID"], "section_id" => $EVENT_ID == "photo_photo" ? $photo_section_id : $arEvent["EVENT"]["SOURCE_ID"])), "PATH_TO_USER" => $arParams["PATH_TO_USER"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "GROUP_PERMISSIONS" => array(), "PAGE_ELEMENTS" => $arParams["PHOTO_COUNT"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT_DETAIL"], "SET_STATUS_404" => "N", "ADDITIONAL_SIGHTS" => array(), "PICTURES_SIGHT" => "real", "USE_COMMENTS" => $arParams["PHOTO_USE_COMMENTS"], "COMMENTS_TYPE" => $arParams["PHOTO_COMMENTS_TYPE"] == "blog" ? "blog" : "forum", "FORUM_ID" => $arParams["PHOTO_FORUM_ID"], "BLOG_URL" => $arParams["PHOTO_BLOG_URL"], "USE_CAPTCHA" => $arParams["PHOTO_USE_CAPTCHA"], "SHOW_LINK_TO_FORUM" => "N", "IS_SOCNET" => "Y", "USER_ALIAS" => $alias ? $alias : ($arEvent["EVENT"]["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP ? "group" : "user") . "_" . $arEvent["EVENT"]["ENTITY_ID"], "~UNIQUE_COMPONENT_ID" => 'bxfg_ucid_from_req_' . $photo_iblock_id . '_' . ($EVENT_ID == "photo_photo" ? $photo_section_id : $arEvent["EVENT"]["SOURCE_ID"]) . "_" . $arEvent["EVENT"]["ID"], "ACTION_URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_" . ($arEvent["EVENT"]["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP ? "GROUP" : "USER") . "_PHOTO_SECTION"], array("user_id" => $arEvent["EVENT"]["ENTITY_ID"], "group_id" => $arEvent["EVENT"]["ENTITY_ID"], "section_id" => $EVENT_ID == "photo_photo" ? $photo_section_id : $arEvent["EVENT"]["SOURCE_ID"]))), $component, array("HIDE_ICONS" => "Y"));
}
}
?>
</div><?php
} elseif ($EVENT_ID === "tasks") {
?>
<div class="feed-post-info-block-wrap"><?php
echo $arEvent["EVENT_FORMATTED"]["MESSAGE"];
?>
</div><?php
} elseif ($EVENT_ID === "timeman_entry" || $EVENT_ID === "report") {