当前位置: 首页>>代码示例>>PHP>>正文


PHP CSocNetUserRelations::GetRelation方法代码示例

本文整理汇总了PHP中CSocNetUserRelations::GetRelation方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUserRelations::GetRelation方法的具体用法?PHP CSocNetUserRelations::GetRelation怎么用?PHP CSocNetUserRelations::GetRelation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSocNetUserRelations的用法示例。


在下文中一共展示了CSocNetUserRelations::GetRelation方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

             break;
         case "F":
             $suffix = "female";
             break;
         default:
             $suffix = "unknown";
     }
     $arUser["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
 }
 $arImage = CSocNetTools::InitImage($arUser["PERSONAL_PHOTO"], $iSize, "/bitrix/images/socialnetwork/nopic_user_" . $iSize . ".gif", $iSize, $arUser["URL"], $arUser["SHOW_PROFILE_LINK"]);
 $arUser["IMAGE_FILE"] = $arImage["FILE"];
 $arUser["IMAGE_IMG"] = $arImage["IMG"];
 $arUser["NAME_FORMATED"] = CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin);
 $arUser["IS_ONLINE"] = $arUser["IS_ONLINE"] == "Y";
 if ($GLOBALS["USER"]->IsAuthorized() && $GLOBALS["USER"]->GetID() != $arUser["ID"] && CSocNetUser::IsFriendsAllowed()) {
     $rel = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arUser["ID"]);
     $arUser["CAN_ADD2FRIENDS"] = !$rel && $arUser["ID"] != $GLOBALS["USER"]->GetID() ? true : false;
 } else {
     $arUser["CAN_ADD2FRIENDS"] = false;
 }
 $arUser["ADD_TO_FRIENDS_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_FRIENDS_ADD"], array("user_id" => $arUser["ID"]));
 $arUser["MESSAGE_FORM_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGE_FORM"], array("user_id" => $arUser["ID"]));
 $arUser["MESSAGE_LINK"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_CHAT"], array("user_id" => $arUser["ID"]));
 $arUser["UserFieldsMain"] = array("SHOW" => "N", "DATA" => array());
 if (count($arParams["USER_FIELDS_LIST"]) > 0) {
     foreach ($arUser as $userFieldName => $userFieldValue) {
         if (in_array($userFieldName, $arParams["USER_FIELDS_LIST"])) {
             $val = $userFieldValue;
             switch ($userFieldName) {
                 case 'EMAIL':
                     if (StrLen($val) > 0) {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例2: GetMessage

}
$bUseLogin = $arParams['SHOW_LOGIN'] != "N" ? true : false;
if (!CSocNetUser::IsFriendsAllowed()) {
    $arResult["FatalError"] = GetMessage("SONET_C35_NO_FR_FUNC") . ". ";
} else {
    if (!$GLOBALS["USER"]->IsAuthorized()) {
        $arResult["NEED_AUTH"] = "Y";
    } else {
        $dbUser = CUser::GetByID($arParams["ID"]);
        $arResult["User"] = $dbUser->GetNext();
        if (!is_array($arResult["User"])) {
            $arResult["FatalError"] = GetMessage("SONET_P_USER_NO_USER") . ". ";
        } else {
            $arResult["CurrentUserPerms"] = CSocNetUserPerms::InitUserPerms($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], CSocNetUser::IsCurrentUserModuleAdmin());
            if (!$arResult["CurrentUserPerms"]["IsCurrentUser"]) {
                $arResult["CurrentUserRelation"] = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"]);
            }
            $arResult["Urls"]["User"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arResult["User"]["ID"]));
            $arResult["User"]["NAME_FORMATTED"] = CUser::FormatName($arParams['NAME_TEMPLATE'], $arResult["User"], $bUseLogin);
            if ($arParams["SET_TITLE"] == "Y" || $arParams["SET_NAV_CHAIN"] != "N") {
                $arParams["TITLE_NAME_TEMPLATE"] = str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
                $strTitleFormatted = CUser::FormatName($arParams['TITLE_NAME_TEMPLATE'], $arResult["User"], $bUseLogin);
            }
            if ($arParams["SET_TITLE"] == "Y") {
                $APPLICATION->SetTitle($strTitleFormatted . ": " . GetMessage("SONET_C35_PAGE_TITLE"));
            }
            if ($arParams["SET_NAV_CHAIN"] != "N") {
                $APPLICATION->AddChainItem($strTitleFormatted, $arResult["Urls"]["User"]);
                $APPLICATION->AddChainItem(GetMessage("SONET_C35_PAGE_TITLE"));
            }
            if ($arResult["CurrentUserPerms"]["IsCurrentUser"]) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例3: InitUserPerms

 /**
  * <p>Метод инициализирует массив прав пользователя на операции над профайлом заданного пользователя.</p>
  *
  *
  * @param int $currentUserID  Код пользователя, права которого проверяются.
  *
  * @param int $userID  Код пользователя, к профайлу которого осуществляется доступ.
  *
  * @param bool $bCurrentUserIsAdmin  Флаг, является ли администратором пользователь, права которого
  * проверяются.
  *
  * @return array <p>Массив с ключами:<br><b>IsCurrentUser</b> - флаг, осуществляется ли доступ к
  * собственному профайлу,<br><b>Relation</b> - отношения между
  * пользователями,<br><b>Operations</b> - массив операций: <br> modifyuser - право на
  * изменение профайла, если в главном модуле разрешено
  * редактировать профиль,<br> modifyuser_main - право на изменение
  * профайла,<br> viewcontacts - право на просмотр контактной информации,<br>
  * invitegroup - приглашение в группу, <br> message - отправка персонального
  * сообщения, <br> viewfriends - просмотр друзей, <br> viewgroups - просмотр групп,
  * <br> viewprofile - просмотр профиля. </p> <a name="examples"></a>
  *
  * <h4>Example</h4> 
  * <pre>
  * Array 
  * ( 
  *  [Operations] =&gt; Array 
  * 	 ( 
  * 		 [modifyuser] =&gt; 1 
  * 		 [viewcontacts] =&gt; 1 
  * 		 [invitegroup] =&gt; 1 
  * 		 [message] =&gt; 1 
  * 		 [viewfriends] =&gt; 1 
  * 		 [viewgroups] =&gt; 1 
  * 		 [viewprofile] =&gt; 1 
  * 		 [modifyuser_main] =&gt; 
  * 	 ) 
  * 
  *  [IsCurrentUser] =&gt; 
  *  [Relation] =&gt; 
  * )
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/csocnetuserperms/inituserperms.php
  * @author Bitrix
  */
 public static function InitUserPerms($currentUserID, $userID, $bCurrentUserIsAdmin)
 {
     global $arSocNetUserOperations, $USER;
     $arReturn = array();
     $currentUserID = IntVal($currentUserID);
     $userID = IntVal($userID);
     if ($userID <= 0) {
         return false;
     }
     $arReturn["Operations"] = array();
     if ($currentUserID <= 0) {
         $arReturn["IsCurrentUser"] = false;
         $arReturn["Relation"] = false;
         $arReturn["Operations"]["modifyuser"] = false;
         $arReturn["Operations"]["viewcontacts"] = false;
         foreach ($arSocNetUserOperations as $operation => $defPerm) {
             $arReturn["Operations"][$operation] = CSocNetUserPerms::CanPerformOperation($currentUserID, $userID, $operation, false);
         }
     } else {
         $arReturn["IsCurrentUser"] = $currentUserID == $userID;
         if ($arReturn["IsCurrentUser"]) {
             $arReturn["Relation"] = false;
         } else {
             $arReturn["Relation"] = CSocNetUserRelations::GetRelation($currentUserID, $userID);
         }
         if ($bCurrentUserIsAdmin || $arReturn["IsCurrentUser"]) {
             $arReturn["Operations"]["modifyuser"] = true;
             $arReturn["Operations"]["viewcontacts"] = true;
             foreach ($arSocNetUserOperations as $operation => $defPerm) {
                 $arReturn["Operations"][$operation] = true;
             }
         } else {
             $arReturn["Operations"]["modifyuser"] = false;
             if (CSocNetUser::IsFriendsAllowed()) {
                 $arReturn["Operations"]["viewcontacts"] = $arReturn["Relation"] == SONET_RELATIONS_FRIEND;
             } else {
                 $arReturn["Operations"]["viewcontacts"] = true;
             }
             foreach ($arSocNetUserOperations as $operation => $defPerm) {
                 $arReturn["Operations"][$operation] = CSocNetUserPerms::CanPerformOperation($currentUserID, $userID, $operation, false);
             }
         }
         $arReturn["Operations"]["modifyuser_main"] = false;
         if ($arReturn["IsCurrentUser"]) {
             if ($USER->CanDoOperation('edit_own_profile')) {
                 $arReturn["Operations"]["modifyuser_main"] = true;
             }
         } elseif ($USER->CanDoOperation('edit_all_users') || $USER->CanDoOperation('edit_subordinate_users') && count(array_diff(CUser::GetUserGroup($userID), CSocNetTools::GetSubordinateGroups($currentUserID))) <= 0) {
             $arReturn["Operations"]["modifyuser_main"] = true;
         }
     }
     return $arReturn;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:100,代码来源:user_perms.php

示例4: InitUserPerms

 function InitUserPerms($currentUserID, $userID, $bCurrentUserIsAdmin)
 {
     global $arSocNetUserOperations, $USER;
     $arReturn = array();
     $currentUserID = IntVal($currentUserID);
     $userID = IntVal($userID);
     if ($userID <= 0) {
         return false;
     }
     $arReturn["Operations"] = array();
     if ($currentUserID <= 0) {
         $arReturn["IsCurrentUser"] = false;
         $arReturn["Relation"] = false;
         $arReturn["Operations"]["modifyuser"] = false;
         $arReturn["Operations"]["viewcontacts"] = false;
         foreach ($arSocNetUserOperations as $operation => $defPerm) {
             $arReturn["Operations"][$operation] = CSocNetUserPerms::CanPerformOperation($currentUserID, $userID, $operation, false);
         }
     } else {
         $arReturn["IsCurrentUser"] = $currentUserID == $userID;
         if ($arReturn["IsCurrentUser"]) {
             $arReturn["Relation"] = false;
         } else {
             $arReturn["Relation"] = CSocNetUserRelations::GetRelation($currentUserID, $userID);
         }
         if ($bCurrentUserIsAdmin || $arReturn["IsCurrentUser"]) {
             $arReturn["Operations"]["modifyuser"] = true;
             $arReturn["Operations"]["viewcontacts"] = true;
             foreach ($arSocNetUserOperations as $operation => $defPerm) {
                 $arReturn["Operations"][$operation] = true;
             }
         } else {
             $arReturn["Operations"]["modifyuser"] = false;
             if (CSocNetUser::IsFriendsAllowed()) {
                 $arReturn["Operations"]["viewcontacts"] = $arReturn["Relation"] == SONET_RELATIONS_FRIEND;
             } else {
                 $arReturn["Operations"]["viewcontacts"] = true;
             }
             foreach ($arSocNetUserOperations as $operation => $defPerm) {
                 $arReturn["Operations"][$operation] = CSocNetUserPerms::CanPerformOperation($currentUserID, $userID, $operation, false);
             }
         }
         $arReturn["Operations"]["modifyuser_main"] = false;
         if ($arReturn["IsCurrentUser"]) {
             if ($USER->CanDoOperation('edit_own_profile')) {
                 $arReturn["Operations"]["modifyuser_main"] = true;
             }
         } elseif ($USER->CanDoOperation('edit_all_users')) {
             $arReturn["Operations"]["modifyuser_main"] = true;
         } elseif ($USER->CanDoOperation('edit_subordinate_users')) {
             $arUserGroups = CUser::GetUserGroup($userID);
             if (array_key_exists("SONET_SUBORD_GROUPS_BY_USER_ID", $GLOBALS) && !array_key_exists("SONET_ALLOW_FRIENDS_CACHE", $_REQUEST)) {
                 $arUserSubordinateGroups = $GLOBALS["SONET_SUBORD_GROUPS_BY_USER_ID"][$currentUserID];
             } else {
                 $arUserSubordinateGroups = array(2);
                 $arUserGroups_u = CUser::GetUserGroup($currentUserID);
                 for ($j = 0, $len = count($arUserGroups_u); $j < $len; $j++) {
                     $arSubordinateGroups = CGroup::GetSubordinateGroups($arUserGroups_u[$j]);
                     $arUserSubordinateGroups = array_merge($arUserSubordinateGroups, $arSubordinateGroups);
                 }
                 $arUserSubordinateGroups = array_unique($arUserSubordinateGroups);
                 if (!array_key_exists("SONET_SUBORD_GROUPS_BY_USER_ID", $GLOBALS)) {
                     $GLOBALS["SONET_SUBORD_GROUPS_BY_USER_ID"] = array();
                 }
                 $GLOBALS["SONET_SUBORD_GROUPS_BY_USER_ID"][$currentUserID] = $arUserSubordinateGroups;
             }
             if (count(array_diff($arUserGroups, $arUserSubordinateGroups)) <= 0) {
                 $arReturn["Operations"]["modifyuser_main"] = true;
             }
         }
     }
     return $arReturn;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:73,代码来源:user_perms.php

示例5: while

 if ($arParams["SET_TITLE"] == "Y") {
     $APPLICATION->SetTitle(GetMessage("SONET_C30_PAGE_TITLE"));
 }
 if ($arParams["SET_NAV_CHAIN"] != "N") {
     $APPLICATION->AddChainItem(GetMessage("SONET_C30_PAGE_TITLE"));
 }
 $arResult["Events"] = false;
 $dbMessages = CSocNetMessages::GetMessagesUsers($GLOBALS["USER"]->GetID(), $arNavParams);
 while ($arMessages = $dbMessages->GetNext()) {
     if ($arResult["Events"] == false) {
         $arResult["Events"] = array();
     }
     $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arMessages["ID"]));
     $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arMessages["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
     $canAnsver = $arMessages["ACTIVE"] != "N" && (IsModuleInstalled("im") || CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arMessages["ID"], "message", CSocNetUser::IsCurrentUserModuleAdmin()));
     $relation = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arMessages["ID"]);
     if (intval($arMessages["PERSONAL_PHOTO"]) <= 0) {
         switch ($arMessages["PERSONAL_GENDER"]) {
             case "M":
                 $suffix = "male";
                 break;
             case "F":
                 $suffix = "female";
                 break;
             default:
                 $suffix = "unknown";
         }
         $arMessages["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
     }
     $arImage = CSocNetTools::InitImage($arMessages["PERSONAL_PHOTO"], 100, "/bitrix/images/socialnetwork/nopic_user_100.gif", 100, $pu, $canViewProfile);
     $arResult["Events"][] = array("USER_ID" => $arMessages["ID"], "USER_NAME" => $arMessages["NAME"], "USER_LAST_NAME" => $arMessages["LAST_NAME"], "USER_SECOND_NAME" => $arMessages["SECOND_NAME"], "USER_LOGIN" => $arMessages["LOGIN"], "USER_PERSONAL_PHOTO" => $arMessages["PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "SHOW_ANSWER_LINK" => $canAnsver, "ANSWER_LINK" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGE_FORM"], array("user_id" => $arMessages["ID"])), "CHAT_LINK" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_CHAT"], array("user_id" => $arMessages["ID"])), "BAN_LINK" => htmlspecialcharsbx($APPLICATION->GetCurUri("userID=" . $arMessages["ID"] . "&action=ban&" . bitrix_sessid_get() . "")), "SHOW_BAN_LINK" => !CSocNetUser::IsUserModuleAdmin($arMessages["ID"]) && $arMessages["ID"] != $GLOBALS["USER"]->GetID() && (!$relation || $relation != SONET_RELATIONS_BAN), "IS_ONLINE" => $arMessages["IS_ONLINE"] == "Y", "TOTAL" => $arMessages["TOTAL"], "MAX_DATE" => $arMessages["MAX_DATE"], "MAX_DATE_FORMAT" => $arMessages["MAX_DATE_FORMAT"], "UNREAD" => $arMessages["UNREAD"], "USER_MESSAGES_LINK" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_USERS_MESSAGES"], array("user_id" => $arMessages["ID"])));
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例6: array

 if (!IsModuleInstalled("im")) {
     $arResult["Banned"] = false;
     $dbBan = CSocNetUserRelations::GetRelatedUsers($arResult["User"]["ID"], SONET_RELATIONS_BAN, $arNavParams, $bActiveOnly);
     if ($dbBan) {
         $arResult["Banned"] = array();
         $arResult["Banned"]["List"] = false;
         while ($arBan = $dbBan->GetNext()) {
             if ($arResult["Banned"]["List"] == false) {
                 $arResult["Banned"]["List"] = array();
             }
             $pref = IntVal($arResult["User"]["ID"]) == $arBan["FIRST_USER_ID"] ? "SECOND" : "FIRST";
             $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arBan[$pref . "_USER_ID"]));
             $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arBan[$pref . "_USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
             $bInitiated = $GLOBALS["USER"]->GetID() == $arBan["FIRST_USER_ID"] && $arBan["INITIATED_BY"] == "F" || $GLOBALS["USER"]->GetID() == $arBan["SECOND_USER_ID"] && $arBan["INITIATED_BY"] == "S";
             if (!$arResult["CurrentUserPerms"]["IsCurrentUser"]) {
                 $rel = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arBan[$pref . "_USER_ID"]);
             } else {
                 $rel = SONET_RELATIONS_FRIEND;
             }
             if (intval($arParams["THUMBNAIL_LIST_SIZE"]) > 0) {
                 if (intval($arBan[$pref . "_USER_PERSONAL_PHOTO"]) <= 0) {
                     switch ($arBan[$pref . "_USER_PERSONAL_GENDER"]) {
                         case "M":
                             $suffix = "male";
                             break;
                         case "F":
                             $suffix = "female";
                             break;
                         default:
                             $suffix = "unknown";
                     }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例7: CanPerformOperation


//.........这里部分代码省略.........
                 }
             }
             if ($bCurrentUserIsAdmin) {
                 return true;
             }
             if ($featureOperationPerms == SONET_ROLES_ALL) {
                 if ($arGroupTmp["VISIBLE"] == "N") {
                     $featureOperationPerms = SONET_ROLES_USER;
                 } else {
                     return true;
                 }
             }
             if ($featureOperationPerms == SONET_ROLES_AUTHORIZED) {
                 return $userID > 0;
             }
             if ($userRoleInGroup == false) {
                 return false;
             }
             if ($featureOperationPerms == SONET_ROLES_MODERATOR) {
                 return in_array($userRoleInGroup, array(SONET_ROLES_MODERATOR, SONET_ROLES_OWNER));
             } elseif ($featureOperationPerms == SONET_ROLES_USER) {
                 return in_array($userRoleInGroup, array(SONET_ROLES_MODERATOR, SONET_ROLES_OWNER, SONET_ROLES_USER));
             } elseif ($featureOperationPerms == SONET_ROLES_OWNER) {
                 return $userRoleInGroup == SONET_ROLES_OWNER;
             }
         }
     } else {
         if (is_array($id)) {
             foreach ($id as $entity_id) {
                 if ($featureOperationPerms[$entity_id] == false) {
                     $arReturn[$entity_id] = false;
                     continue;
                 }
                 $usersRelation = CSocNetUserRelations::GetRelation($userID, $entity_id);
                 if ($type == SONET_ENTITY_USER && $userID == $entity_id) {
                     $arReturn[$entity_id] = true;
                     continue;
                 }
                 if ($bCurrentUserIsAdmin) {
                     $arReturn[$entity_id] = true;
                     continue;
                 }
                 if ($userID == $entity_id) {
                     $arReturn[$entity_id] = true;
                     continue;
                 }
                 if ($usersRelation == SONET_RELATIONS_BAN) {
                     if (!IsModuleInstalled("im")) {
                         $arReturn[$entity_id] = false;
                         continue;
                     }
                 }
                 if ($featureOperationPerms[$entity_id] == SONET_RELATIONS_TYPE_NONE) {
                     $arReturn[$entity_id] = false;
                     continue;
                 }
                 if ($featureOperationPerms[$entity_id] == SONET_RELATIONS_TYPE_ALL) {
                     $arReturn[$entity_id] = true;
                     continue;
                 }
                 if ($featureOperationPerms[$entity_id] == SONET_RELATIONS_TYPE_AUTHORIZED) {
                     $arReturn[$entity_id] = $userID > 0;
                     continue;
                 }
                 if ($featureOperationPerms[$entity_id] == SONET_RELATIONS_TYPE_FRIENDS || $featureOperationPerms[$entity_id] == SONET_RELATIONS_TYPE_FRIENDS2) {
                     $arReturn[$entity_id] = CSocNetUserRelations::IsFriends($userID, $entity_id);
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:group_features_perms.php


注:本文中的CSocNetUserRelations::GetRelation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。