本文整理汇总了PHP中CSocNetUserRelations::IsFriends2方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUserRelations::IsFriends2方法的具体用法?PHP CSocNetUserRelations::IsFriends2怎么用?PHP CSocNetUserRelations::IsFriends2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetUserRelations
的用法示例。
在下文中一共展示了CSocNetUserRelations::IsFriends2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CanPerformOperation
function CanPerformOperation($fromUserID, $toUserID, $operation, $bCurrentUserIsAdmin = false)
{
global $arSocNetUserOperations;
$fromUserID = IntVal($fromUserID);
$toUserID = IntVal($toUserID);
if ($toUserID <= 0) {
return false;
}
$operation = StrToLower(Trim($operation));
if (!array_key_exists($operation, $arSocNetUserOperations)) {
return false;
}
// use no profile private permission restrictions at the extranet site
if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
return true;
}
if ($bCurrentUserIsAdmin) {
return true;
}
if ($fromUserID == $toUserID) {
return true;
}
$usersRelation = CSocNetUserRelations::GetRelation($fromUserID, $toUserID);
if ($usersRelation == SONET_RELATIONS_BAN && !IsModuleInstalled("im")) {
return false;
}
$toUserOperationPerms = CSocNetUserPerms::GetOperationPerms($toUserID, $operation);
if ($toUserOperationPerms == SONET_RELATIONS_TYPE_NONE) {
return false;
}
if ($toUserOperationPerms == SONET_RELATIONS_TYPE_ALL) {
return true;
}
if ($toUserOperationPerms == SONET_RELATIONS_TYPE_AUTHORIZED) {
if ($fromUserID > 0) {
return true;
} else {
return false;
}
}
if ($toUserOperationPerms == SONET_RELATIONS_TYPE_FRIENDS) {
if (CSocNetUserRelations::IsFriends($fromUserID, $toUserID)) {
return true;
} else {
return false;
}
}
if ($toUserOperationPerms == SONET_RELATIONS_TYPE_FRIENDS2) {
if (CSocNetUserRelations::IsFriends2($fromUserID, $toUserID)) {
return true;
} elseif (CSocNetUserRelations::IsFriends($fromUserID, $toUserID)) {
return true;
} else {
return false;
}
}
return false;
}
示例2: GetListEx
//.........这里部分代码省略.........
for ($i = 0, $cnt = count($arPropertyValue); $i < $cnt; $i++) {
$arResult["PROPERTY_" . $propertyKey][$arPropertyKey[$i]] = $arPropertyValue[$i];
}
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = $arResult["PROPERTY_" . $propertyKey];
} elseif ($propertyValue["PROPERTY_TYPE"] == "S" && $propertyValue["ROW_COUNT"] > 1) {
if (is_array($propertyValue["VALUE"])) {
$arResult["PROPERTY_" . $propertyKey] = array();
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = array();
if ($isInSecurity) {
foreach ($propertyValue["~VALUE"] as $k => $v) {
$filter = new CSecurityFilter();
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$k] = $filter->TestXSS($v);
$arResult["PROPERTY_" . $propertyKey][$k] = $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$k];
}
} else {
foreach ($propertyValue["VALUE"] as $k => $v) {
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"][$k] = nl2br($v);
$arResult["PROPERTY_" . $propertyKey][$k] = $v;
}
}
} else {
if ($isInSecurity) {
$filter = new CSecurityFilter();
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = $filter->TestXSS($propertyValue["~VALUE"]);
$arResult["PROPERTY_" . $propertyKey] = $arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"];
} else {
$arResult["PROPERTY_" . $propertyKey . "_PRINTABLE"] = nl2br($propertyValue["VALUE"]);
$arResult["PROPERTY_" . $propertyKey] = $propertyValue["VALUE"];
}
}
}
}
$arResult["ROOT_SECTION_ID"] = 0;
$arResult["IBLOCK_SECTION_ID_PRINTABLE"] = array();
$v = CIntranetTasks::PrepareSectionForPrint($arResult["IBLOCK_SECTION_ID"]);
foreach ($v as $k1 => $v1) {
if ($arResult["ROOT_SECTION_ID"] == 0) {
$arResult["ROOT_SECTION_ID"] = $k1;
$taskType = $v1["XML_ID"] == "users_tasks" ? "user" : "group";
$ownerId = $taskType == "user" ? $arResult["PROPERTY_TaskAssignedTo"] : $v1["XML_ID"];
} else {
$arResult["IBLOCK_SECTION_ID_PRINTABLE"][$k1] = $v1["NAME"];
}
}
if (!array_key_exists($taskType . "_" . $ownerId, $arCache)) {
$arCurrentUserGroups = array();
if ($taskType == "group") {
$arCurrentUserGroups[] = SONET_ROLES_ALL;
if ($GLOBALS["USER"]->IsAuthorized()) {
$arCurrentUserGroups[] = SONET_ROLES_AUTHORIZED;
}
$r = CSocNetUserToGroup::GetUserRole($USER->GetID(), $ownerId);
if (strlen($r) > 0) {
$arCurrentUserGroups[] = $r;
}
} else {
$arCurrentUserGroups[] = SONET_RELATIONS_TYPE_ALL;
if ($GLOBALS["USER"]->IsAuthorized()) {
$arCurrentUserGroups[] = SONET_RELATIONS_TYPE_AUTHORIZED;
}
if (CSocNetUserRelations::IsFriends($USER->GetID(), $ownerId)) {
$arCurrentUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS;
} elseif (CSocNetUserRelations::IsFriends2($USER->GetID(), $ownerId)) {
$arCurrentUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS2;
}
}
$arCache[$taskType . "_" . $ownerId] = $arCurrentUserGroups;
}
$arCurrentUserGroups = $arCache[$taskType . "_" . $ownerId];
if ($USER->GetID() == $arResult["CREATED_BY"]) {
$arCurrentUserGroups[] = "author";
}
if ($USER->GetID() == $arResult["PROPERTY_TaskAssignedTo"]) {
$arCurrentUserGroups[] = "responsible";
}
if (is_array($arResult["PROPERTY_TaskTrackers"]) && in_array($USER->GetID(), $arResult["PROPERTY_TaskTrackers"])) {
$arCurrentUserGroups[] = "trackers";
}
$arResult["DocumentState"] = array();
$arDocumentStates = CBPDocument::GetDocumentStates(array("intranet", "CIntranetTasksDocument", "x" . $iblockId), array("intranet", "CIntranetTasksDocument", $arResult["ID"]));
$kk = array_keys($arDocumentStates);
foreach ($kk as $k) {
$arResult["DocumentState"] = $arDocumentStates[$k];
$arResult["DocumentState"]["AllowableEvents"] = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, $arDocumentStates[$k]);
}
$arResult["TaskType"] = $taskType;
$arResult["OwnerId"] = $ownerId;
$arResult["CurrentUserCanViewTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_READ_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
$arResult["CurrentUserCanCommentTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_COMMENT_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
$arResult["CurrentUserCanDeleteTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_DELETE_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
$arResult["CurrentUserCanWriteTask"] = CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_WRITE_DOCUMENT, $GLOBALS["USER"]->GetID(), $arResult["ID"], array("TaskType" => $taskType, "OwnerId" => $ownerId, "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates));
//$hFileTmp = fopen($_SERVER["DOCUMENT_ROOT"]."/+++++++.+++", "a"); // DUMPING
//fwrite($hFileTmp, "arResult:\n".print_r($arResult, true)."\n");
//fclose($hFileTmp);
$arResultList[] = $arResult;
}
$dbTasksList1 = new CDBResult();
$dbTasksList1->InitFromArray($arResultList);
return array($dbTasksList1, $dbTasksList);
}
示例3: CanPerformOperation
//.........这里部分代码省略.........
}
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) {
if ($userID > 0) {
$arReturn[$entity_id] = true;
} else {
$arReturn[$entity_id] = false;
}
continue;
}
if ($featureOperationPerms[$entity_id] == SONET_RELATIONS_TYPE_FRIENDS) {
if (CSocNetUserRelations::IsFriends($userID, $entity_id)) {
$arReturn[$entity_id] = true;
continue;
} else {
$arReturn[$entity_id] = false;
continue;
}
}
if ($featureOperationPerms[$entity_id] == SONET_RELATIONS_TYPE_FRIENDS2) {
if (CSocNetUserRelations::IsFriends($userID, $entity_id)) {
$arReturn[$entity_id] = true;
continue;
} elseif (CSocNetUserRelations::IsFriends2($userID, $entity_id)) {
$arReturn[$entity_id] = true;
continue;
} else {
$arReturn[$entity_id] = false;
continue;
}
}
}
return $arReturn;
} else {
if ($featureOperationPerms == false) {
return false;
}
if ($type == SONET_ENTITY_USER && $userID == $id) {
return true;
}
if ($bCurrentUserIsAdmin) {
return true;
}
if ($userID == $id) {
return true;
}
$usersRelation = CSocNetUserRelations::GetRelation($userID, $id);
if ($usersRelation == SONET_RELATIONS_BAN && !IsModuleInstalled("im")) {
return false;
}
if ($featureOperationPerms == SONET_RELATIONS_TYPE_NONE) {
return false;
}
if ($featureOperationPerms == SONET_RELATIONS_TYPE_ALL) {
return true;
}
if ($featureOperationPerms == SONET_RELATIONS_TYPE_AUTHORIZED) {
if ($userID > 0) {
return true;
} else {
return false;
}
}
if ($featureOperationPerms == SONET_RELATIONS_TYPE_FRIENDS) {
if (CSocNetUserRelations::IsFriends($userID, $id)) {
return true;
} else {
return false;
}
}
if ($featureOperationPerms == SONET_RELATIONS_TYPE_FRIENDS2) {
if (CSocNetUserRelations::IsFriends($userID, $id)) {
return true;
} elseif (CSocNetUserRelations::IsFriends2($userID, $id)) {
return true;
} else {
return false;
}
}
}
}
return false;
}
示例4: elseif
$arCurrentUserGroups[] = SONET_ROLES_ALL;
if ($GLOBALS["USER"]->IsAuthorized()) {
$arCurrentUserGroups[] = SONET_ROLES_AUTHORIZED;
}
$r = CSocNetUserToGroup::GetUserRole($USER->GetID(), $arTaskTmp["OwnerId"]);
if (strlen($r) > 0) {
$arCurrentUserGroups[] = $r;
}
} else {
$arCurrentUserGroups[] = SONET_RELATIONS_TYPE_ALL;
if ($GLOBALS["USER"]->IsAuthorized()) {
$arCurrentUserGroups[] = SONET_RELATIONS_TYPE_AUTHORIZED;
}
if (CSocNetUserRelations::IsFriends($USER->GetID(), $arTaskTmp["ownerId"])) {
$arCurrentUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS;
} elseif (CSocNetUserRelations::IsFriends2($USER->GetID(), $arTaskTmp["ownerId"])) {
$arCurrentUserGroups[] = SONET_RELATIONS_TYPE_FRIENDS2;
}
}
if ($USER->GetID() == $arTaskTmp["CREATED_BY"]) {
$arCurrentUserGroups[] = "author";
}
if ($USER->GetID() == $arTaskTmp["PROPERTY_TaskAssignedTo"]) {
$arCurrentUserGroups[] = "responsible";
}
if (is_array($arTaskTmp["PROPERTY_TaskTrackers"]) && in_array($USER->GetID(), $arTaskTmp["PROPERTY_TaskTrackers"])) {
$arCurrentUserGroups[] = "trackers";
}
}
if (count($arErrorsTmp) <= 0) {
$iblockElementObject = new CIBlockElement();