本文整理汇总了PHP中CSocNetUserRelations类的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUserRelations类的具体用法?PHP CSocNetUserRelations怎么用?PHP CSocNetUserRelations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSocNetUserRelations类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: OnUserDelete
public static function OnUserDelete($ID)
{
global $DB;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$bSuccess = True;
if (!CSocNetGroup::DeleteNoDemand($ID)) {
if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
$err = $ex->GetString();
}
$GLOBALS["APPLICATION"]->ThrowException($err);
$bSuccess = false;
}
if ($bSuccess) {
CSocNetUserRelations::DeleteNoDemand($ID);
CSocNetUserPerms::DeleteNoDemand($ID);
CSocNetUserEvents::DeleteNoDemand($ID);
CSocNetMessages::DeleteNoDemand($ID);
CSocNetUserToGroup::DeleteNoDemand($ID);
CSocNetLogEvents::DeleteNoDemand($ID);
CSocNetLog::DeleteNoDemand($ID);
CSocNetLogComments::DeleteNoDemand($ID);
CSocNetFeatures::DeleteNoDemand($ID);
CSocNetSubscription::DeleteEx($ID);
CUserOptions::DeleteOption("socialnetwork", "~menu_" . SONET_ENTITY_USER . "_" . $ID, false, 0);
}
return $bSuccess;
}
开发者ID:rasuldev,项目名称:torino,代码行数:30,代码来源:user.php
示例2: getRelatedUser
function getRelatedUser($firstUserID, $relationID)
{
$arRel = CSocNetUserRelations::GetByID($relationID);
if ($arRel) {
$secondUserID = $firstUserID == $arRel["FIRST_USER_ID"] ? $arRel["SECOND_USER_ID"] : $arRel["FIRST_USER_ID"];
$dbUser = CUser::GetByID($secondUserID);
if ($arUser = $dbUser->Fetch()) {
return CUser::FormatName(CSite::GetNameFormat(false), $arUser, true);
} else {
return false;
}
} else {
false;
}
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:15,代码来源:component.php
示例3: AddUser
public function AddUser($chatId, $userId)
{
global $DB;
$chatId = intval($chatId);
if ($chatId <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_EMPTY_CHAT_ID"), "EMPTY_CHAT_ID");
return false;
}
$arUserId = array();
if (is_array($userId)) {
$arUserId = \CIMContactList::PrepareUserIds($userId);
} else {
if (intval($userId) > 0) {
$arUserId[intval($userId)] = intval($userId);
}
}
if ($this->user_id > 0) {
$arUserId[$this->user_id] = $this->user_id;
}
if (count($arUserId) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_EMPTY_USER_ID"), "EMPTY_USER_ID");
return false;
}
if ($this->user_id > 0 && !IsModuleInstalled('intranet') && CModule::IncludeModule('socialnetwork') && CSocNetUser::IsFriendsAllowed()) {
$arFriendUsers = array();
$dbFriends = CSocNetUserRelations::GetList(array(), array("USER_ID" => $this->user_id, "RELATION" => SONET_RELATIONS_FRIEND), false, false, array("ID", "FIRST_USER_ID", "SECOND_USER_ID", "DATE_CREATE", "DATE_UPDATE", "INITIATED_BY"));
while ($arFriends = $dbFriends->Fetch()) {
$friendId = $this->user_id == $arFriends["FIRST_USER_ID"] ? $arFriends["SECOND_USER_ID"] : $arFriends["FIRST_USER_ID"];
$arFriendUsers[$friendId] = $friendId;
}
foreach ($arUserId as $id => $userId) {
if ($userId == $this->user_id) {
continue;
}
if (!isset($arFriendUsers[$userId]) && CIMSettings::GetPrivacy(CIMSettings::PRIVACY_CHAT, $userId) == CIMSettings::PRIVACY_RESULT_CONTACT) {
unset($arUserId[$id]);
}
}
if (count($arUserId) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_EMPTY_USER_ID_BY_PRIVACY"), "EMPTY_USER_ID_BY_PRIVACY");
return false;
}
}
$strSql = "\n\t\t\tSELECT\n\t\t\t\tR.CHAT_ID, C.TITLE CHAT_TITLE, C.AUTHOR_ID CHAT_AUTHOR_ID, C.EXTRANET CHAT_EXTRANET, C.TYPE CHAT_TYPE\n\t\t\tFROM b_im_relation R\n\t\t\tLEFT JOIN b_im_chat C ON R.CHAT_ID = C.ID\n\t\t\tWHERE\n\t\t\t\t" . ($this->user_id > 0 ? "R.USER_ID = " . $this->user_id . " AND " : "") . "\n\t\t\t\tR.MESSAGE_TYPE IN ('" . IM_MESSAGE_OPEN . "','" . IM_MESSAGE_CHAT . "')\n\t\t\t\tAND R.CHAT_ID = " . $chatId . "\n\t\t";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arRes = $dbRes->Fetch()) {
$extranetFlag = $arRes["CHAT_EXTRANET"] == "" ? "" : ($arRes["CHAT_EXTRANET"] == "Y" ? true : false);
$chatTitle = $arRes['CHAT_TITLE'];
$chatAuthorId = intval($arRes['CHAT_AUTHOR_ID']);
$chatType = intval($arRes['CHAT_TYPE']);
$arRelation = self::GetRelationById($chatId);
$arExistUser = array();
foreach ($arRelation as $relation) {
$arExistUser[] = $relation['USER_ID'];
}
if (count($arRelation) + count($arUserId) > 500) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_MAX_USER", array('#COUNT#' => 500)), "MAX_USER");
return false;
}
$arUserId = array_diff($arUserId, $arExistUser);
if (empty($arUserId)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("IM_ERROR_NOTHING_TO_ADD"), "NOTHING_TO_ADD");
return false;
}
$arUserSelect = $arUserId;
if ($this->user_id > 0) {
$arUserSelect[] = $this->user_id;
}
$arUsers = CIMContactList::GetUserData(array('ID' => array_values($arUserSelect), 'DEPARTMENT' => 'N', 'USE_CACHE' => 'N'));
$arUsers = $arUsers['users'];
if ($extranetFlag !== true) {
$isExtranet = false;
foreach ($arUsers as $userData) {
if ($userData['extranet']) {
$isExtranet = true;
break;
}
}
if ($isExtranet || $extranetFlag === "") {
IM\ChatTable::update($chatId, array('EXTRANET' => $isExtranet ? "Y" : "N"));
}
$extranetFlag = $isExtranet;
}
$arUsersName = array();
foreach ($arUserId as $userId) {
$arUsersName[] = htmlspecialcharsback($arUsers[$userId]['name']);
}
if ($this->user_id > 0) {
$message = GetMessage("IM_CHAT_JOIN_" . $arUsers[$this->user_id]['gender'], array('#USER_1_NAME#' => htmlspecialcharsback($arUsers[$this->user_id]['name']), '#USER_2_NAME#' => implode(', ', $arUsersName)));
} else {
if (count($arUsersName) > 1) {
$message = GetMessage("IM_CHAT_SELF_JOIN", array('#USERS_NAME#' => implode(', ', $arUsersName)));
} else {
$arUserList = array_values($arUserId);
$message = GetMessage("IM_CHAT_SELF_JOIN_" . $arUsers[$arUserList[0]]['gender'], array('#USER_NAME#' => implode(', ', $arUsersName)));
}
}
$fileMaxId = CIMDisk::GetMaxFileId($chatId);
$maxId = 0;
$strSql = "SELECT MAX(ID) ID FROM b_im_message WHERE CHAT_ID = " . $chatId . " GROUP BY CHAT_ID";
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:im_chat.php
示例4: array
}
if (count($arResult["UserPropertiesContact"]["DATA"]) > 0) {
$arResult["UserPropertiesContact"]["SHOW"] = "Y";
}
if (count($arResult["UserPropertiesPersonal"]["DATA"]) > 0) {
$arResult["UserPropertiesPersonal"]["SHOW"] = "Y";
}
}
if (!$arParams["SHORT_FORM"]) {
// USER FRIENDS
$arResult["Friends"] = false;
if (CSocNetUser::IsFriendsAllowed() && $arResult["CurrentUserPerms"]["Operations"]["viewfriends"]) {
$dbFriends = CSocNetUserRelations::GetRelatedUsers($arResult["User"]["ID"], SONET_RELATIONS_FRIEND, array("nTopCount" => $arParams["ITEMS_COUNT"]));
if ($dbFriends) {
$arResult["Friends"] = array();
$arResult["Friends"]["Count"] = CSocNetUserRelations::GetList(array(), array("USER_ID" => $arResult["User"]["ID"], "RELATION" => SONET_RELATIONS_FRIEND), array());
$arResult["Friends"]["List"] = false;
while ($arFriends = $dbFriends->GetNext()) {
if ($arResult["Friends"]["List"] == false) {
$arResult["Friends"]["List"] = array();
}
$pref = IntVal($arResult["User"]["ID"]) == $arFriends["FIRST_USER_ID"] ? "SECOND" : "FIRST";
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arFriends[$pref . "_USER_ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arFriends[$pref . "_USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
if (intval($arParams["THUMBNAIL_LIST_SIZE"]) > 0) {
if (intval($arFriends[$pref . "_USER_PERSONAL_PHOTO"]) <= 0) {
switch ($arFriends[$pref . "_USER_PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
case "F":
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php
示例5: Update
function Update($ID, $arFields)
{
global $DB;
if (!CSocNetGroup::__ValidateID($ID)) {
return false;
}
$ID = IntVal($ID);
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetUserRelations::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetUserRelationsUpdate");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID, $arFields)) === false) {
return false;
}
}
$arUserRelationOld = CSocNetUserRelations::GetByID($ID);
$strUpdate = $DB->PrepareUpdate("b_sonet_user_relations", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
if (strlen($strUpdate) > 0) {
$strSql = "UPDATE b_sonet_user_relations SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$events = GetModuleEvents("socialnetwork", "OnSocNetUserRelationsUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
if ((!array_key_exists("SEND_MAIL", $arFields) || $arFields["SEND_MAIL"] != "N") && !IsModuleInstalled("im")) {
$mailType = "";
if ($arUserRelationOld["RELATION"] != SONET_RELATIONS_FRIEND && $arFields["RELATION"] == SONET_RELATIONS_FRIEND) {
$mailType = "AGREE_FRIEND";
} elseif ($arUserRelationOld["RELATION"] != SONET_RELATIONS_BAN && $arFields["RELATION"] == SONET_RELATIONS_BAN) {
$mailType = "BAN_FRIEND";
} elseif ($arUserRelationOld["RELATION"] != SONET_RELATIONS_REQUEST && $arFields["RELATION"] == SONET_RELATIONS_REQUEST) {
$mailType = "INVITE_FRIEND";
}
if (StrLen($mailType) > 0) {
CSocNetUserRelations::SendEvent($ID, $mailType);
}
}
CSocNetSearch::OnUserRelationsChange($arUserRelationOld["FIRST_USER_ID"]);
CSocNetSearch::OnUserRelationsChange($arUserRelationOld["SECOND_USER_ID"]);
} else {
$ID = False;
}
return $ID;
}
开发者ID:Satariall,项目名称:izurit,代码行数:58,代码来源:user_relations.php
示例6: UpdateCodes
public function UpdateCodes($USER_ID)
{
global $DB;
if (CSocNetUser::IsFriendsAllowed()) {
$USER_ID = intval($USER_ID);
$dbFriends = CSocNetUserRelations::GetRelatedUsers($USER_ID, SONET_RELATIONS_FRIEND);
while ($arFriends = $dbFriends->Fetch()) {
$friendID = $USER_ID == $arFriends["FIRST_USER_ID"] ? $arFriends["SECOND_USER_ID"] : $arFriends["FIRST_USER_ID"];
$DB->Query("INSERT INTO b_user_access (USER_ID, PROVIDER_ID, ACCESS_CODE) VALUES \n\t\t\t\t\t(" . $friendID . ", '" . $DB->ForSQL($this->id) . "', 'SU" . $USER_ID . "_" . SONET_RELATIONS_TYPE_FRIENDS . "')");
$dbFriends2 = CSocNetUserRelations::GetRelatedUsers($friendID, SONET_RELATIONS_FRIEND);
while ($arFriends2 = $dbFriends2->Fetch()) {
$friendID2 = $friendID == $arFriends2["FIRST_USER_ID"] ? $arFriends2["SECOND_USER_ID"] : $arFriends2["FIRST_USER_ID"];
if ($friendID2 != $USER_ID) {
$DB->Query("INSERT INTO b_user_access (USER_ID, PROVIDER_ID, ACCESS_CODE) VALUES \n\t\t\t\t\t\t\t(" . $friendID2 . ", '" . $DB->ForSQL($this->id) . "', 'SU" . $USER_ID . "_" . SONET_RELATIONS_TYPE_FRIENDS2 . "')");
}
}
}
}
}
开发者ID:rasuldev,项目名称:torino,代码行数:19,代码来源:authproviders.php
示例7: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
$arResult["ITEMS_TOTAL"] = 0;
$arResult["ITEMS_MESSAGES"] = 0;
$arResult["ITEMS_REQUESTS_USER"] = 0;
$arResult["ITEMS_REQUESTS_GROUP"] = 0;
/* friends requests */
$arFilter = array("SECOND_USER_ID" => $GLOBALS["USER"]->GetID(), "RELATION" => SONET_RELATIONS_REQUEST);
$dbUserRequests = CSocNetUserRelations::GetList(array(), $arFilter, array("SECOND_USER_ID"), false, array("COUNT" => "ID"));
if ($arUserRequests = $dbUserRequests->Fetch()) {
$arResult["ITEMS_TOTAL"] += intval($arUserRequests["CNT"]);
$arResult["ITEMS_REQUESTS_USER"] += intval($arUserRequests["CNT"]);
}
/* group requests */
$arFilter = array("USER_ID" => $GLOBALS["USER"]->GetID(), "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP);
$dbUserRequests = CSocNetUserToGroup::GetList(array(), $arFilter, array("USER_ID"), false, array("COUNT" => "ID"));
if ($arUserRequests = $dbUserRequests->Fetch()) {
$arResult["ITEMS_TOTAL"] += intval($arUserRequests["CNT"]);
$arResult["ITEMS_REQUESTS_GROUP"] += intval($arUserRequests["CNT"]);
}
/* messages */
$arFilter = array("TO_USER_ID" => $GLOBALS["USER"]->GetID(), "DATE_VIEW" => "", "TO_DELETED" => "N", "IS_LOG_ALL" => "Y");
$dbUserRequests = CSocNetMessages::GetList(array(), $arFilter, array("TO_USER_ID"), false, array("COUNT" => "ID"));
if ($arUserRequests = $dbUserRequests->Fetch()) {
$arResult["ITEMS_TOTAL"] += intval($arUserRequests["CNT"]);
$arResult["ITEMS_MESSAGES"] += intval($arUserRequests["CNT"]);
}
开发者ID:webgksupport,项目名称:alpina,代码行数:30,代码来源:result_modifier.php
示例8: ReceiveMessage
public function ReceiveMessage($senderJId, array $arMessage, CXMPPClient $senderClient)
{
if (!$senderClient->IsAuthenticated()) {
return false;
}
if (strlen($senderJId) <= 0) {
return false;
}
if (!array_key_exists("iq", $arMessage)) {
return false;
}
if ($arMessage['iq']['query']['.']['xmlns'] != 'jabber:iq:roster' && ($arMessage['iq']['query']['.']['xmlns'] != 'jabber:iq:private' || $arMessage['iq']['query']['roster']['.']['xmlns'] != 'roster:delimiter')) {
return false;
}
if ($arMessage['iq']['query']['.']['xmlns'] == 'jabber:iq:roster') {
$arResult = array("iq" => array("." => array("type" => "result", "to" => $senderJId, "id" => $arMessage['iq']['.']['id']), "query" => array("." => array("xmlns" => $arMessage['iq']['query']['.']['xmlns']))));
if ($this->intranet) {
$clientDomain = $senderClient->GetClientDomain();
if (!array_key_exists($clientDomain, $this->rosterCache)) {
$this->rosterCache[$clientDomain] = array();
}
if (!array_key_exists($clientDomain, $this->rosterCacheAlt)) {
$this->rosterCacheAlt[$clientDomain] = array();
}
if ($senderClient->IsSubGroupsSupported() && count($this->rosterCache[$clientDomain]) <= 0 || !$senderClient->IsSubGroupsSupported() && count($this->rosterCacheAlt[$clientDomain]) <= 0) {
$arDepCache = array();
$arDepCacheValue = array();
$dbUsers = CUser::GetList($b = "LAST_NAME", $o = "asc", array("ACTIVE" => "Y", "!UF_DEPARTMENT" => false), array('SELECT' => array('UF_*')));
while ($arUser = $dbUsers->Fetch()) {
$arT = array("." => array("subscription" => "both", "name" => CUser::FormatName($this->nameTemplate, $arUser), "jid" => CXMPPUtility::GetJId($arUser, $clientDomain)));
if (is_array($arUser['UF_DEPARTMENT']) && count($arUser['UF_DEPARTMENT']) > 0) {
$arNewDep = array_diff($arUser['UF_DEPARTMENT'], $arDepCache);
if (count($arNewDep) > 0) {
$dbRes = CIBlockSection::GetList(array('SORT' => 'ASC'), array('ID' => $arNewDep));
while ($arSect = $dbRes->Fetch()) {
$arDepCache[] = $arSect['ID'];
$dbRes1 = CIBlockSection::GetNavChain($arSect['IBLOCK_ID'], $arSect['ID']);
while ($arSect1 = $dbRes1->Fetch()) {
if ($senderClient->IsSubGroupsSupported()) {
if (strlen($arDepCacheValue[$arSect['ID']]) > 0) {
$arDepCacheValue[$arSect['ID']] .= "/";
}
$arDepCacheValue[$arSect['ID']] .= htmlspecialcharsbx($arSect1['NAME']);
} else {
if (strlen($arDepCacheValue[$arSect['ID']]) > 0) {
$arDepCacheValue[$arSect['ID']] = "/" . $arDepCacheValue[$arSect['ID']];
}
$arDepCacheValue[$arSect['ID']] = htmlspecialcharsbx($arSect1['NAME']) . $arDepCacheValue[$arSect['ID']];
}
}
}
}
foreach ($arUser['UF_DEPARTMENT'] as $key => $sect) {
if (strlen($arDepCacheValue[$sect]) > 0) {
$arT["group"][] = array("#" => $arDepCacheValue[$sect]);
if (!is_array($GLOBALS["BX_JHGDHGFJKDFSDG67"])) {
$GLOBALS["BX_JHGDHGFJKDFSDG67"] = array();
}
if (!is_array($GLOBALS["BX_JHGDHGFJKDFSDG67"][$clientDomain])) {
$GLOBALS["BX_JHGDHGFJKDFSDG67"][$clientDomain] = array();
}
if (!in_array($arDepCacheValue[$sect], $GLOBALS["BX_JHGDHGFJKDFSDG67"][$clientDomain])) {
$GLOBALS["BX_JHGDHGFJKDFSDG67"][$clientDomain][] = $arDepCacheValue[$sect];
}
}
}
}
if ($senderClient->IsSubGroupsSupported()) {
$this->rosterCache[$clientDomain][] = $arT;
} else {
$this->rosterCacheAlt[$clientDomain][] = $arT;
}
}
}
if ($senderClient->IsSubGroupsSupported()) {
foreach ($this->rosterCache[$clientDomain] as $ar) {
if ($senderClient->GetJId() != $ar["."]["jid"]) {
$arResult["iq"]["query"]["item"][] = $ar;
}
}
} else {
foreach ($this->rosterCacheAlt[$clientDomain] as $ar) {
if ($senderClient->GetJId() != $ar["."]["jid"]) {
$arResult["iq"]["query"]["item"][] = $ar;
}
}
}
} else {
$ar = array();
$dbFriends = CSocNetUserRelations::GetRelatedUsers($senderClient->GetId(), SONET_RELATIONS_FRIEND);
while ($arFriends = $dbFriends->GetNext()) {
$pref = $senderClient->GetId() == $arFriends["FIRST_USER_ID"] ? "SECOND" : "FIRST";
$name = CUser::FormatName($this->nameTemplate, array("NAME" => $arFriends[$pref . "_USER_NAME"], "LAST_NAME" => $arFriends[$pref . "_USER_LAST_NAME"], "SECOND_NAME" => $arFriends[$pref . "_USER_SECOND_NAME"], "LOGIN" => $arFriends[$pref . "_USER_LOGIN"]), true);
$arT = array("." => array("subscription" => "both", "name" => $name, "jid" => CXMPPUtility::GetJId(array("LOGIN" => $arFriends[$pref . "_USER_LOGIN"]), $senderClient->GetClientDomain())));
$ar[] = $arT;
}
$arResult["iq"]["query"]["item"] = $ar;
}
$senderClient->Send($arResult);
$server = CXMPPServer::GetServer();
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:roster.php
示例9: array
$APPLICATION->SetTitle($arResult["User"]["NAME"]." ".$arResult["User"]["LAST_NAME"].": ".GetMessage("SONET_C33_PAGE_TITLE"));
if ($arParams["SET_NAV_CHAIN"] != "N")
{
$APPLICATION->AddChainItem($arResult["User"]["NAME"]." ".$arResult["User"]["LAST_NAME"], CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arResult["User"]["ID"])));
$APPLICATION->AddChainItem(GetMessage("SONET_C33_PAGE_TITLE"));
}
*/
if ($arResult["CurrentUserPerms"] && $arResult["CurrentUserPerms"]["Operations"]["viewprofile"] && $arResult["CurrentUserPerms"]["Operations"]["viewfriends"]) {
$arNavParams = array("nPageSize" => $arParams["ITEMS_COUNT"], "bDescPageNumbering" => false);
$arNavigation = CDBResult::GetNavParams($arNavParams);
$nowDay = IntVal(Date("d"));
$nowMonth = IntVal(Date("m"));
$arResult["Users"] = false;
$cnt = 0;
$dbFriends = CSocNetUserRelations::GetListBirthday($arResult["User"]["ID"], 0);
if ($dbFriends) {
$arResult["Users"] = array();
$arResult["Users"]["List"] = false;
while ($arFriends = $dbFriends->GetNext()) {
if (StrLen($arFriends["PB"]) <= 0) {
continue;
}
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arFriends["ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arFriends["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
if (intval($arParams["THUMBNAIL_LIST_SIZE"]) > 0) {
if (intval($arFriends["PERSONAL_PHOTO"]) <= 0) {
switch ($arFriends["PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php
示例10: foreach
if (!in_array($arRelation["FIRST_USER_ID"], $arFriendID) && !in_array($arRelation["SECOND_USER_ID"], $arFriendID)) {
continue;
}
$arRelationID[] = $arRelation["ID"];
$arRelationUserID[] = $arRelation[($user_id == $arRelation["FIRST_USER_ID"] ? "SECOND" : "FIRST") . "_USER_ID"];
}
if (count(array_diff($arFriendID, $arRelationUserID)) > 0) {
echo CUtil::PhpToJsObject(array('ERROR' => 'FRIEND_ID_INCORRECT_2'));
die;
}
if ($_POST['ACTION'] == "BAN") {
foreach ($arRelationUserID as $relation_user_id) {
if (!CSocNetUserRelations::BanUser($user_id, $relation_user_id)) {
echo CUtil::PhpToJsObject(array('ERROR' => 'USER_ACTION_FAILED: ' . (($e = $APPLICATION->GetException()) ? $e->GetString() : "")));
die;
}
}
} else {
foreach ($arRelationID as $relation_id) {
if ($_POST['ACTION'] == "EX" && !CSocNetUserRelations::Delete($relation_id) || $_POST['ACTION'] == "UNBAN" && !CSocNetUserRelations::UnBanMember($user_id, $relation_id)) {
echo CUtil::PhpToJsObject(array('ERROR' => 'USER_ACTION_FAILED: ' . (($e = $APPLICATION->GetException()) ? $e->GetString() : "")));
die;
}
}
}
}
echo CUtil::PhpToJsObject(array('SUCCESS' => 'Y'));
} else {
echo CUtil::PhpToJsObject(array('ERROR' => 'SESSION_ERROR'));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:ajax.php
示例11: GetMessage
$strTitleFormatted = CUser::FormatName($arParams['TITLE_NAME_TEMPLATE'], $arTmpUser, $bUseLogin);
}
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle($strTitleFormatted . ": " . GetMessage("SONET_C31_PAGE_TITLE"));
}
$arResult["Urls"]["User"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arResult["User"]["ID"]));
$arResult["Urls"]["Message"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGE_FORM"], array("user_id" => $arResult["User"]["ID"]));
$arResult["Urls"]["Chat"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_CHAT"], array("user_id" => $arResult["User"]["ID"]));
if ($arParams["SET_NAV_CHAIN"] != "N") {
$APPLICATION->AddChainItem($strTitleFormatted, $arResult["Urls"]["User"]);
$APPLICATION->AddChainItem(GetMessage("SONET_C31_PAGE_TITLE"));
}
$arResult["IS_ONLINE"] = $arResult["User"]["IS_ONLINE"] == "Y";
$arResult["CanViewProfile"] = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$arResult["CanMessage"] = $arResult["User"]["ACTIVE"] != "N" && (IsModuleInstalled("im") || CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], "message", CSocNetUser::IsCurrentUserModuleAdmin()));
$arResult["UsersRelation"] = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"]);
$arResult["Urls"]["BanLink"] = htmlspecialcharsbx($APPLICATION->GetCurUri("userID=" . $arResult["User"]["ID"] . "&action=ban&" . bitrix_sessid_get() . ""));
$arResult["ShowBanLink"] = !CSocNetUser::IsUserModuleAdmin($arResult["User"]["ID"]) && $arResult["User"]["ID"] != $GLOBALS["USER"]->GetID() && (!$arResult["UsersRelation"] || $arResult["UsersRelation"] != SONET_RELATIONS_BAN);
if (intval($arResult["User"]["PERSONAL_PHOTO"]) <= 0) {
switch ($arResult["User"]["PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arResult["User"]["PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php
示例12: GetUsersFromUserGroup
public function GetUsersFromUserGroup($group, $documentId)
{
$diskId = self::processGetDiskIdByDocId((int) $documentId);
if ($diskId !== null) {
return self::proxyToDisk(__FUNCTION__, array($group, $diskId));
}
$arResult = array();
$arParameters = array("IBlockId" => 0, "OwnerType" => "", "OwnerId" => 0);
if (strLen($documentId) <= 0) {
return $arResult;
}
$res = explode("_", $documentId);
if (count($res) == 4) {
$arParameters = array("IBlockId" => $res[1], "OwnerType" => $res[2], "OwnerId" => $res[3]);
} elseif (intVal($documentId) > 0) {
$db_res = CIBlockElement::GetList(array(), array("ID" => $documentId, "SHOW_NEW" => "Y", "SHOW_HISTORY" => "Y"), false, false, array("ID", "IBLOCK_ID", "CREATED_BY", "IBLOCK_SECTION_ID"));
$arElement = $db_res->Fetch();
if (!$arElement) {
return false;
}
$arParameters["IBlockId"] = $arElement["IBLOCK_ID"];
$arParameters["CreatedBy"] = $arElement["CREATED_BY"];
$dbSectionsChain = CIBlockSection::GetNavChain($arElement["IBLOCK_ID"], $arElement["IBLOCK_SECTION_ID"]);
if ($arSect = $dbSectionsChain->Fetch()) {
$arParameters["OwnerType"] = intVal($arSect["SOCNET_GROUP_ID"]) > 0 ? "group" : "user";
$arParameters["OwnerId"] = intVal($arSect["SOCNET_GROUP_ID"]) > 0 ? $arSect["SOCNET_GROUP_ID"] : $arSect["CREATED_BY"];
}
}
$sGroup = strtoupper($group);
if ($sGroup == "AUTHOR") {
return array($arParameters["CreatedBy"]);
} elseif ($sGroup == SONET_RELATIONS_TYPE_NONE) {
return array($arParameters["OwnerId"]);
} elseif ($arParameters["OwnerId"] <= 0) {
return array();
}
if ($arParameters["OwnerType"] == "user") {
$db_res = CSocNetUserRelations::GetRelatedUsers($arParameters["OwnerId"], SONET_RELATIONS_FRIEND);
if ($db_res && ($res = $db_res->Fetch())) {
do {
if ($res["FIRST_USER_ID"] == $arParameters["OwnerId"]) {
$arResult[] = $res["SECOND_USER_ID"];
} else {
$arResult[] = $res["FIRST_USER_ID"];
}
} while ($res = $db_res->Fetch());
}
} else {
if ($sGroup == SONET_ROLES_OWNER) {
$arGroup = CSocNetGroup::GetByID($arParameters["OwnerId"]);
if ($arGroup) {
$arResult[] = $arGroup["OWNER_ID"];
}
} elseif ($sGroup == SONET_ROLES_MODERATOR) {
$db = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $arParameters["OwnerId"], "<=ROLE" => SONET_ROLES_MODERATOR, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
while ($ar = $db->Fetch()) {
$arResult[] = $ar["USER_ID"];
}
} elseif ($sGroup == SONET_ROLES_USER) {
$db = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $arParameters["OwnerId"], "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("USER_ID"));
while ($ar = $db->Fetch()) {
$arResult[] = $ar["USER_ID"];
}
}
}
return $arResult;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:iblocksocnetbizproc.php
示例13: 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
示例14: Invite
public static function Invite($arParams)
{
$arConfig['CHAT_ID'] = intval($arParams['CHAT_ID']);
if ($arConfig['CHAT_ID'] <= 0) {
return false;
}
global $DB, $USER;
$arConfig['RECIPIENT_ID'] = intval($arParams['RECIPIENT_ID']);
$arConfig['USER_ID'] = intval($arParams['USER_ID']) > 0 ? intval($arParams['USER_ID']) : IntVal($USER->GetID());
$arConfig['VIDEO'] = isset($arParams['VIDEO']) && $arParams['VIDEO'] == 'N' ? 'N' : 'Y';
$arChat = CIMChat::GetChatData(array('ID' => $arConfig['CHAT_ID']));
if (empty($arChat['chat'])) {
return false;
}
$arConfig['CALL_TO_GROUP'] = $arChat['chat'][$arConfig['CHAT_ID']]['type'] == IM_MESSAGE_GROUP;
$arConfig['STATUS_TYPE'] = intval($arChat['chat'][$arConfig['CHAT_ID']]['call']);
if (!$arConfig['CALL_TO_GROUP'] && !IsModuleInstalled('intranet') && CIMSettings::GetPrivacy(CIMSettings::PRIVACY_CALL, $arConfig['RECIPIENT_ID']) == CIMSettings::PRIVACY_RESULT_CONTACT && CModule::IncludeModule('socialnetwork') && CSocNetUser::IsFriendsAllowed() && !CSocNetUserRelations::IsFriends($arConfig['USER_ID'], $arConfig['RECIPIENT_ID'])) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage('IM_ERROR_CALL_PRIVACY'), "ERROR_FROM_PRIVACY");
return false;
}
if ($arConfig['STATUS_TYPE'] != IM_CALL_NONE) {
if ($arConfig['CALL_TO_GROUP']) {
self::MessageToChat($arConfig['CHAT_ID'], "IM_CALL_CHAT_START_", $arConfig['USER_ID'], true);
}
$strSql = "UPDATE b_im_relation SET CALL_STATUS = " . IM_CALL_STATUS_ANSWER . " WHERE CHAT_ID = " . $arConfig['CHAT_ID'] . " AND USER_ID = " . $arConfig['USER_ID'];
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$arUserData = CIMContactList::GetUserData(array('ID' => $arChat['userInChat'][$arConfig['CHAT_ID']], 'DEPARTMENT' => 'N', 'HR_PHOTO' => 'Y'));
$arConfig['USER_DATA']['USERS'] = $arUserData['users'];
$arConfig['USER_DATA']['HR_PHOTO'] = $arUserData['hrphoto'];
foreach ($arChat['userCallStatus'][$arConfig['CHAT_ID']] as $userId => $callStatus) {
if ($userId != $arConfig['USER_ID'] && in_array($callStatus, array(IM_CALL_STATUS_WAIT, IM_CALL_STATUS_ANSWER))) {
$arUserToConnect[$userId] = $callStatus;
}
}
$arConfig['USERS_CONNECT'] = $arUserToConnect;
$arSend['users'] = $arUserData['users'];
$arSend['hrphoto'] = $arUserData['hrphoto'];
$arSend['video'] = $arConfig['VIDEO'] == 'Y' ? true : false;
$arSend['callToGroup'] = $arConfig['CALL_TO_GROUP'];
$arSend['chat'] = $arChat['chat'];
$arSend['userChatBlockStatus'] = $arChat['userChatBlockStatus'];
$arSend['userInChat'] = $arChat['userInChat'];
foreach ($arChat['userCallStatus'][$arConfig['CHAT_ID']] as $userId => $callStatus) {
if ($userId != $arConfig['USER_ID'] && !in_array($callStatus, array(IM_CALL_STATUS_DECLINE))) {
self::Command($arConfig['CHAT_ID'], $userId, 'invite_join', $arSend);
}
}
} else {
if ($arConfig['CALL_TO_GROUP']) {
self::MessageToChat($arConfig['CHAT_ID'], "IM_CALL_CHAT_INIT_", $arConfig['USER_ID'], true);
}
$strSql = "UPDATE b_im_chat SET CALL_TYPE = " . ($arConfig['VIDEO'] == 'Y' ? IM_CALL_VIDEO : IM_CALL_AUDIO) . " WHERE ID = " . $arConfig['CHAT_ID'];
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$strSql = "UPDATE b_im_relation SET CALL_STATUS = " . IM_CALL_STATUS_ANSWER . " WHERE CHAT_ID = " . $arConfig['CHAT_ID'] . " AND USER_ID = " . $arConfig['USER_ID'];
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$arUserToConnect = array();
foreach ($arChat['userCallStatus'][$arConfig['CHAT_ID']] as $userId => $callStatus) {
if ($userId != $arConfig['USER_ID']) {
$arUserToConnect[$userId] = $callStatus;
}
}
$arUserData = CIMContactList::GetUserData(array('ID' => $arChat['userInChat'][$arConfig['CHAT_ID']], 'DEPARTMENT' => 'N', 'HR_PHOTO' => 'Y'));
$arSend['users'] = $arUserData['users'];
$arSend['hrphoto'] = $arUserData['hrphoto'];
$arSend['video'] = $arConfig['VIDEO'] == 'Y' ? true : false;
$arSend['callToGroup'] = $arConfig['CALL_TO_GROUP'];
$arSend['chat'] = $arChat['chat'];
$arSend['userChatBlockStatus'] = $arChat['userChatBlockStatus'];
$arSend['userInChat'] = $arChat['userInChat'];
foreach ($arUserToConnect as $userId => $callStatus) {
self::Command($arConfig['CHAT_ID'], $userId, 'invite', $arSend);
}
$arConfig['USER_DATA']['USERS'] = $arUserData['users'];
$arConfig['USER_DATA']['HR_PHOTO'] = $arUserData['hrphoto'];
if (!$arConfig['CALL_TO_GROUP'] && CModule::IncludeModule('pull') && CPullOptions::GetPushStatus()) {
$arSelect = array("ID", "LAST_NAME", "NAME", "LOGIN", "SECOND_NAME");
$dbUsers = CUser::GetList($sort_by = false, $dummy = '', array('ID' => $USER->GetID()), array('FIELDS' => $arSelect));
if ($arUser = $dbUsers->GetNext(true, false)) {
$sName = CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false);
$pushText = GetMessage('IM_CALL_INVITE', array('#USER_NAME#' => $sName));
} else {
$pushText = GetMessage('IM_CALL_INVITE', array('#USER_NAME#' => GetMessage('IM_CALL_INVITE_NA')));
}
$CPushManager = new CPushManager();
foreach ($arUserToConnect as $sendTouserId => $callStatus) {
$CPushManager->AddQueue(array('USER_ID' => $sendTouserId, 'MESSAGE' => $pushText, 'EXPIRY' => 0, 'PARAMS' => 'IMINV_' . $USER->GetID() . "
|
请发表评论