本文整理汇总了PHP中CSocNetUserPerms类的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUserPerms类的具体用法?PHP CSocNetUserPerms怎么用?PHP CSocNetUserPerms使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSocNetUserPerms类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: _FormatUser
function _FormatUser(&$arUser, $arPath)
{
global $USER, $CACHE_ABSENCE;
if ($arUser['PERSONAL_PHOTO']) {
$arImage = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
$arUser['PERSONAL_PHOTO'] = $arImage['IMG'];
}
if ($arPath['DETAIL_URL']) {
$arUser['DETAIL_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['DETAIL_URL']);
}
$arUser["canViewProfile"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$arUser["canMessage"] = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser['ID'], "message", CSocNetUser::IsCurrentUserModuleAdmin());
if ($arPath['MESSAGES_CHAT_URL']) {
$arUser['MESSAGES_CHAT_URL'] = str_replace('#ID#', $arUser['ID'], $arPath['MESSAGES_CHAT_URL']);
}
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
$arUser['IS_ONLINE'] = CSocNetUser::IsOnLine($arUser['ID']);
if ($arUser['IS_ABSENT']) {
$maxAbsence = 0;
foreach ($CACHE_ABSENCE[$arUser["ID"]] as $arAbsence) {
if (MakeTimeStamp($arAbsence["DATE_TO"]) > $maxAbsence) {
$arUser['ABSENT_TILL'] = $arAbsence["DATE_TO"];
}
}
}
$arFilter = array("TO_USER_ID" => $arUser['ID'], "MESSAGE_TYPE" => SONET_MESSAGE_PRIVATE, "FROM_USER_ID" => $USER->GetID());
$dbMessages = CSocNetMessages::GetList(array("DATE_CREATE" => "DESC"), $arFilter, false, array("nTopCount" => 1), array("ID", "DATE_CREATE"));
if ($arMessages = $dbMessages->GetNext()) {
$arUser['LAST_CHAT'] = $arMessages["DATE_CREATE"];
}
return true;
}
示例3: Add
/**
* <p>Метод добавляет новую запись в таблицу прав на доступ к профайлу пользователя.</p>
*
*
*
*
* @param array $arFields Массив параметров записи с ключами<br><b>USER_ID</b> - код
* пользователя,<br><b>OPERATION_ID</b> - операция,<br><b>RELATION_TYPE</b> - тип отношений
* между пользователями.
*
*
*
* @return int <p>Код добавленной записи или false в случае ошибки.</p> <br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetUserPerms/Add.php
* @author Bitrix
*/
public static function Add($arFields)
{
global $DB;
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetUserPerms::CheckFields("ADD", $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_sonet_user_perms", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($arInsert[0]) > 0) {
$arInsert[0] .= ", ";
}
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0) {
$arInsert[1] .= ", ";
}
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0) {
$strSql = "INSERT INTO b_sonet_user_perms(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
}
return $ID;
}
示例4: array
$arImage = CSocNetTools::InitImage($arUserRequests["FIRST_USER_PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfile);
$arTmpUser = array("NAME" => $arUserRequests["FIRST_USER_NAME"], "LAST_NAME" => $arUserRequests["FIRST_USER_LAST_NAME"], "SECOND_NAME" => $arUserRequests["FIRST_USER_SECOND_NAME"], "LOGIN" => $arUserRequests["FIRST_USER_LOGIN"]);
$strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin);
$arEventTmp["Event"] = array("ID" => $arUserRequests["ID"], "USER_ID" => $arUserRequests["FIRST_USER_ID"], "USER_NAME" => $arUserRequests["FIRST_USER_NAME"], "USER_LAST_NAME" => $arUserRequests["FIRST_USER_LAST_NAME"], "USER_SECOND_NAME" => $arUserRequests["FIRST_USER_SECOND_NAME"], "USER_LOGIN" => $arUserRequests["FIRST_USER_LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PERSONAL_PHOTO" => $arUserRequests["FIRST_USER_PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "IS_ONLINE" => $arUserRequests["FIRST_USER_IS_ONLINE"] == "Y", "DATE_UPDATE" => $arUserRequests["DATE_UPDATE"], "MESSAGE" => $parser->convert($arUserRequests["~MESSAGE"], false, array(), array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "Y", "UPLOAD" => "N", "NL2BR" => "N")));
$arEventTmp["Urls"]["FriendAdd"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=FriendRequest&eventID=" . $arUserRequests["ID"] . "&action=add&" . bitrix_sessid_get() . "&backurl=" . urlencode($GLOBALS["APPLICATION"]->GetCurPageParam("", array("EventType", "eventID", "action")))));
$arEventTmp["Urls"]["FriendReject"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=FriendRequest&eventID=" . $arUserRequests["ID"] . "&action=reject&" . bitrix_sessid_get() . "&backurl=" . urlencode($GLOBALS["APPLICATION"]->GetCurPageParam("", array("EventType", "eventID", "action")))));
$arResult["Events"][] = $arEventTmp;
}
$dbUserRequests = CSocNetUserToGroup::GetList(array("DATE_CREATE" => "ASC"), array("USER_ID" => $GLOBALS["USER"]->GetID(), "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, false, array("ID", "INITIATED_BY_USER_ID", "MESSAGE", "INITIATED_BY_USER_NAME", "DATE_CREATE", "INITIATED_BY_USER_LAST_NAME", "INITIATED_BY_USER_SECOND_NAME", "INITIATED_BY_USER_LOGIN", "INITIATED_BY_USER_PHOTO", "GROUP_ID", "GROUP_NAME", "GROUP_IMAGE_ID", "GROUP_VISIBLE"));
while ($arUserRequests = $dbUserRequests->GetNext()) {
if ($arResult["Events"] == false) {
$arResult["Events"] = array();
}
$arEventTmp["EventType"] = "GroupRequest";
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUserRequests["INITIATED_BY_USER_ID"]));
$canViewProfileU = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUserRequests["INITIATED_BY_USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$arImage = CSocNetTools::InitImage($arUserRequests["INITIATED_BY_USER_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfileU);
$pg = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arUserRequests["GROUP_ID"]));
$canViewProfileG = CSocNetUser::IsCurrentUserModuleAdmin() || $arUserRequests["GROUP_VISIBLE"] == "Y";
if (intval($arUserRequests["GROUP_IMAGE_ID"]) <= 0) {
$arUserRequests["GROUP_IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID);
}
$arImageG = CSocNetTools::InitImage($arUserRequests["GROUP_IMAGE_ID"], 150, "/bitrix/images/socialnetwork/nopic_group_150.gif", 150, $pg, $canViewProfileG);
$arTmpUser = array("NAME" => $arUserRequests["INITIATED_BY_USER_NAME"], "LAST_NAME" => $arUserRequests["INITIATED_BY_USER_LAST_NAME"], "SECOND_NAME" => $arUserRequests["INITIATED_BY_USER_SECOND_NAME"], "LOGIN" => $arUserRequests["INITIATED_BY_USER_LOGIN"]);
$strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin);
$arEventTmp["Event"] = array("ID" => $arUserRequests["ID"], "USER_ID" => $arUserRequests["INITIATED_BY_USER_ID"], "USER_NAME" => $arUserRequests["INITIATED_BY_USER_NAME"], "USER_LAST_NAME" => $arUserRequests["INITIATED_BY_USER_LAST_NAME"], "USER_SECOND_NAME" => $arUserRequests["INITIATED_BY_USER_SECOND_NAME"], "USER_LOGIN" => $arUserRequests["INITIATED_BY_USER_LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PERSONAL_PHOTO" => $arUserRequests["INITIATED_BY_USER_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfileU, "DATE_CREATE" => $arUserRequests["DATE_CREATE"], "GROUP_NAME" => $arUserRequests["GROUP_NAME"], "GROUP_IMAGE_ID" => $arUserRequests["GROUP_IMAGE_ID"], "GROUP_IMAGE_ID_FILE" => $arImageG["FILE"], "GROUP_IMAGE_ID_IMG" => $arImageG["IMG"], "GROUP_PROFILE_URL" => $pg, "SHOW_GROUP_LINK" => $canViewProfileG, "MESSAGE" => $parser->convert($arUserRequests["~MESSAGE"], false, array(), array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "Y", "UPLOAD" => "N", "NL2BR" => "N")));
$arEventTmp["Urls"]["FriendAdd"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=GroupRequest&eventID=" . $arUserRequests["ID"] . "&action=add&" . bitrix_sessid_get() . "&backurl=" . urlencode($GLOBALS["APPLICATION"]->GetCurPageParam("", array("EventType", "eventID", "action")))));
$arEventTmp["Urls"]["FriendReject"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=GroupRequest&eventID=" . $arUserRequests["ID"] . "&action=reject&" . bitrix_sessid_get() . "&backurl=" . urlencode($GLOBALS["APPLICATION"]->GetCurPageParam("", array("EventType", "eventID", "action")))));
$arResult["Events"][] = $arEventTmp;
}
$this->IncludeComponentTemplate();
示例5: InitUserTmp
public static function InitUserTmp($userID, $arParams, $bCurrentUserIsAdmin = "unknown", $bRSS = false)
{
$title = "";
$message = "";
$bUseLogin = $arParams['SHOW_LOGIN'] != "N" ? true : false;
$dbUser = CUser::GetByID($userID);
if ($arUser = $dbUser->Fetch())
{
if ($bCurrentUserIsAdmin == "unknown")
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
$canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "viewprofile", $bCurrentUserIsAdmin);
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
if (!$bRSS && $canViewProfile)
$title .= "<a href=\"".$pu."\">";
$title .= CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin);
if (!$bRSS && $canViewProfile)
$title .= "</a>";
if (intval($arUser["PERSONAL_PHOTO"]) <= 0)
{
switch ($arUser["PERSONAL_GENDER"])
{
case "M":
$suffix = "male";
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"], 100, "/bitrix/images/socialnetwork/nopic_user_100.gif", 100, $pu, $canViewProfile);
$message = $arImage["IMG"];
}
return array($title, $message);
}
示例6: LocalRedirect
LocalRedirect($APPLICATION->GetCurPageParam("invite_sent=Y", array("invite_user_id", "employee")));
}
}
}
$parser = new CSocNetTextParser(LANGUAGE_ID, $arParams["PATH_TO_SMILE"]);
$arResult["Requests"] = false;
$dbRequests = CSocNetUserToGroup::GetList(array("DATE_CREATE" => "ASC"), array("GROUP_ID" => $arResult["Group"]["ID"], "ROLE" => SONET_ROLES_REQUEST, "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP), false, $arNavParams, array("ID", "USER_ID", "DATE_CREATE", "DATE_UPDATE", "MESSAGE", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER"));
if ($dbRequests) {
$arResult["Requests"] = array();
$arResult["Requests"]["List"] = false;
while ($arRequests = $dbRequests->GetNext()) {
if ($arResult["Requests"]["List"] == false) {
$arResult["Requests"]["List"] = array();
}
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arRequests["USER_ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arRequests["USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
if (intval($arRequests["USER_PERSONAL_PHOTO"]) <= 0) {
switch ($arRequests["USER_PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arRequests["USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
$arImage = CSocNetTools::InitImage($arRequests["USER_PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfile);
$arResult["Requests"]["List"][] = array("ID" => $arRequests["ID"], "USER_ID" => $arRequests["USER_ID"], "USER_NAME" => $arRequests["USER_NAME"], "USER_LAST_NAME" => $arRequests["USER_LAST_NAME"], "USER_SECOND_NAME" => $arRequests["USER_SECOND_NAME"], "USER_LOGIN" => $arRequests["USER_LOGIN"], "USER_PERSONAL_PHOTO" => $arRequests["USER_PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "DATE_CREATE" => FormatDateFromDB($arRequests["DATE_CREATE"]), "MESSAGE" => $parser->convert($arRequests["~MESSAGE"], false, array(), array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LIST" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "SMILES" => "Y", "UPLOAD" => "N", "NL2BR" => "N")));
示例7: array
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":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arFriends[$pref . "_USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
$arImage = CSocNetTools::InitImage($arFriends[$pref . "_USER_PERSONAL_PHOTO"], $arParams["THUMBNAIL_LIST_SIZE"], "/bitrix/images/socialnetwork/nopic_30x30.gif", 30, $pu, $canViewProfile);
示例8: str_replace
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'], $arTmpUser, $bUseLogin);
}
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle($strTitleFormatted . ": " . GetMessage("SONET_C40_PAGE_TITLE"));
}
if ($arParams["SET_NAV_CHAIN"] != "N") {
$APPLICATION->AddChainItem($strTitleFormatted, $arResult["Urls"]["User"]);
$APPLICATION->AddChainItem(GetMessage("SONET_C40_PAGE_TITLE"));
}
$arResult["ShowForm"] = "Input";
if ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["save"]) > 0 && check_bitrix_sessid()) {
$errorMessage = "";
foreach ($arResult["Features"] as $feature => $perm) {
$idTmp = CSocNetUserPerms::SetPerm($arResult["User"]["ID"], $feature, $_REQUEST[$feature . "_perm"]);
if (!$idTmp) {
if ($e = $APPLICATION->GetException()) {
$errorMessage .= $e->GetString();
}
}
}
if (strlen($errorMessage) > 0) {
$arResult["ErrorMessage"] = $errorMessage;
} else {
if ($_REQUEST['backurl']) {
LocalRedirect($_REQUEST['backurl']);
} else {
LocalRedirect($arResult["Urls"]["User"]);
}
}
示例9: SetPerm
/**
* <p>Изменяет право на операцию, если таковое есть. Иначе добавляет новую запись.</p>
*
*
* @param int $userID Код пользователя. </h
*
* @param string $feature Название функционала. </ht
*
* @param string $perm Право.</b
*
* @return int <p>Код записи при успешном сохранении и false - в случае ошибки.</p>
* <br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/csocnetuserperms/setperm.php
* @author Bitrix
*/
public static function SetPerm($userID, $feature, $perm)
{
$userID = IntVal($userID);
$feature = Trim($feature);
$perm = Trim($perm);
$dbResult = CSocNetUserPerms::GetList(array(), array("USER_ID" => $userID, "OPERATION_ID" => $feature), false, false, array("ID"));
if ($arResult = $dbResult->Fetch()) {
$r = CSocNetUserPerms::Update($arResult["ID"], array("RELATION_TYPE" => $perm));
} else {
$r = CSocNetUserPerms::Add(array("USER_ID" => $userID, "OPERATION_ID" => $feature, "RELATION_TYPE" => $perm));
}
if (!$r) {
$errorMessage = "";
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$errorMessage = $e->GetString();
}
if (StrLen($errorMessage) <= 0) {
$errorMessage = GetMessage("SONET_GF_ERROR_SET") . ".";
}
$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_SET_RECORD");
return false;
} elseif ($feature == "viewprofile") {
unset($GLOBALS["SONET_USER_PERMS_" . $userID]);
}
return $r;
}
示例10: GetMessage
echo "*";
} else {
if (!check_bitrix_sessid()) {
echo GetMessage("SONET_C50_ERR_PERMS") . ".";
} else {
$message = $_REQUEST["data"];
CUtil::decodeURIComponent($message);
$message = Trim($message);
if (StrLen($message) <= 0) {
echo GetMessage("SONET_C50_NO_TEXT") . ".";
} else {
if (empty($aUserId)) {
echo GetMessage("SONET_C50_NO_USER_ID") . ".";
} else {
foreach ($aUserId as $userID) {
if (!CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $userID, "message", CSocNetUser::IsCurrentUserModuleAdmin(false))) {
echo GetMessage("SONET_C50_CANT_WRITE") . ".";
} else {
$errorMessage = "";
if (!CSocNetMessages::CreateMessage($GLOBALS["USER"]->GetID(), $userID, $message)) {
if ($e = $GLOBALS["APPLICATION"]->GetException()) {
$errorMessage .= $e->GetString();
}
}
if (strlen($errorMessage) > 0) {
echo $errorMessage;
}
}
}
}
}
示例11: GetMessage
$arParams["NAME_TEMPLATE"] = CSite::GetNameFormat();
}
$bUseLogin = $arParams['SHOW_LOGIN'] != "N" ? true : false;
if (!$USER->IsAuthorized()) {
$arResult["NEED_AUTH"] = "Y";
} else {
$dbUser = CUser::GetByID($arParams["USER_ID"]);
$arResult["User"] = $dbUser->GetNext();
if (!is_array($arResult["User"])) {
$arResult["FatalError"] = GetMessage("SONET_P_USER_NO_USER") . ". ";
} else {
$arResult["IsCurrentUser"] = $GLOBALS["USER"]->GetID() == $arResult["User"]["ID"];
$arResult["CurrentUserRelation"] = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"]);
$arResult["CurrentUserPerms"]["ViewProfile"] = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$arResult["CurrentUserPerms"]["ModifyUser"] = $GLOBALS["USER"]->GetID() == $arResult["User"]["ID"] || CSocNetUser::IsCurrentUserModuleAdmin();
$arResult["CurrentUserPerms"]["Message"] = IsModuleInstalled("im") || CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arResult["User"]["ID"], "message", CSocNetUser::IsCurrentUserModuleAdmin());
$arResult["Urls"]["User"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arResult["User"]["ID"]));
$arResult["Urls"]["MessagesInput"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_INPUT"], array());
$arResult["Urls"]["MessagesOutput"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_OUTPUT"], array());
$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_C26_PAGE_TITLE"));
}
if ($arParams["SET_NAV_CHAIN"] != "N") {
$APPLICATION->AddChainItem($strTitleFormatted, $arResult["Urls"]["User"]);
$APPLICATION->AddChainItem(GetMessage("SONET_C26_PAGE_TITLE"));
}
示例12: SetSonetLogRights
function SetSonetLogRights($logID, $entity_type, $entity_id, $event_id)
{
if (!CModule::IncludeModule("socialnetwork")) {
return;
}
if (in_array($entity_type, array(SONET_SUBSCRIBE_ENTITY_USER, SONET_SUBSCRIBE_ENTITY_GROUP))) {
if (in_array($event_id, array("blog_post", "forum", "photo", "blog_post_micro", "files", "wiki"))) {
$arLogEventTmp = CSocNetLogTools::FindLogEventByID($event_id);
CSocNetLogRights::SetForSonet($logID, $entity_type, $entity_id, CSocNetLogTools::FindFeatureByEventID($event_id), $arLogEventTmp["OPERATION"]);
} elseif (in_array($event_id, array("data", "system")) && $entity_type == SONET_SUBSCRIBE_ENTITY_GROUP) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
} elseif (in_array($event_id, array("data", "system")) && $entity_type == SONET_SUBSCRIBE_ENTITY_USER) {
$perm = CSocNetUserPerms::GetOperationPerms($entity_id, "viewprofile");
if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS))) {
CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id, "S" . SONET_SUBSCRIBE_ENTITY_USER . $entity_id . "_" . $perm));
} elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
CSocNetLogRights::Add($logID, array("SA", "AU"));
} elseif ($perm == SONET_RELATIONS_TYPE_ALL) {
CSocNetLogRights::Add($logID, array("SA", "G2"));
}
}
} elseif ($entity_type == SONET_SUBSCRIBE_ENTITY_PROVIDER) {
$arRights = array("SA");
$rsSchemeRights = CXDILFSchemeRights::GetList(array(), array("SCHEME_ID" => $entity_id));
while ($arSchemeRights = $rsSchemeRights->Fetch()) {
if (substr($arSchemeRights["GROUP_CODE"], 0, 1) == "U") {
if (substr($arSchemeRights["GROUP_CODE"], 1) == "A") {
$arRights[] = "AU";
break;
} elseif (substr($arSchemeRights["GROUP_CODE"], 1) == "N") {
$arRights[] = "G2";
break;
} elseif (intval(substr($arSchemeRights["GROUP_CODE"], 1)) > 0) {
$arRights[] = "U" . substr($arSchemeRights["GROUP_CODE"], 1);
}
}
}
if (count($arRights) > 0) {
CSocNetLogRights::Add($logID, $arRights);
}
} elseif (defined("SONET_SUBSCRIBE_ENTITY_NEWS") && $entity_type == SONET_SUBSCRIBE_ENTITY_NEWS) {
CSocNetLogRights::Add($logID, array("SA", "G2"));
}
}
示例13: array
$arData[] = $arTmpData;
}
// while
$arFilter = array("TO_USER_ID" => $GLOBALS["USER"]->GetID(), "DATE_VIEW" => "", "TO_DELETED" => "N");
if ($log == "Y") {
$arFilter["IS_LOG_ALL"] = "Y";
}
$dbUserRequests = CSocNetMessages::GetList(array("DATE_CREATE" => "ASC"), $arFilter, false, array("nTopCount" => 50), array("ID", "FROM_USER_ID", "TITLE", "MESSAGE", "DATE_CREATE", "MESSAGE_TYPE", "FROM_USER_NAME", "FROM_USER_LAST_NAME", "FROM_USER_SECOND_NAME", "FROM_USER_LOGIN", "FROM_USER_PERSONAL_PHOTO", "FROM_USER_PERSONAL_GENDER", "FROM_USER_IS_ONLINE", "IS_LOG"));
while ($arUserRequests = $dbUserRequests->GetNext()) {
$arTmpData = array();
$arTmpData["TYPE"] = "M";
$arTmpData["IS_LOG"] = $arUserRequests["IS_LOG"];
$arTmpData["MESSAGE_TYPE"] = $arUserRequests["MESSAGE_TYPE"];
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUserRequests["FROM_USER_ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUserRequests["FROM_USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin($site));
$canAnsver = IsModuleInstalled("im") || CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUserRequests["FROM_USER_ID"], "message", CSocNetUser::IsCurrentUserModuleAdmin($site));
$arTmpData["IMAGE_USER"] = "/bitrix/images/1.gif";
if (intval($arUserRequests["FROM_USER_PERSONAL_PHOTO"]) <= 0) {
switch ($arUserRequests["FROM_USER_PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arUserRequests["FROM_USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, $site);
}
if (intval($arUserRequests["FROM_USER_PERSONAL_PHOTO"]) > 0) {
示例14: CDBResult
}
}
$rsRequestsIn = new CDBResult();
$rsRequestsIn->InitFromArray($arTmpResult["RequestsIn"]);
$rsRequestsIn->NavStart();
while ($arRecord = $rsRequestsIn->GetNext()) {
$arResult["RequestsIn"]["List"][] = $arRecord;
}
$arResult["RequestsIn"]["NAV_STRING"] = $rsRequestsIn->GetPageNavStringEx($navComponentObject, GetMessage("SONET_URE_NAV"), "", false);
/********************* Outogoing Requests ***********************/
/* Friends Outgoing */
$arResult["RequestsOut"] = array();
$dbUserRequests = CSocNetUserRelations::GetList(array("DATE_UPDATE" => "ASC"), array("FIRST_USER_ID" => $arParams["USER_ID"], "RELATION" => SONET_RELATIONS_REQUEST), false, false, array("ID", "FIRST_USER_ID", "SECOND_USER_ID", "MESSAGE", "SECOND_USER_NAME", "DATE_UPDATE", "SECOND_USER_LAST_NAME", "SECOND_USER_SECOND_NAME", "SECOND_USER_LOGIN", "SECOND_USER_PERSONAL_PHOTO", "SECOND_USER_PERSONAL_GENDER", "SECOND_USER_IS_ONLINE"));
while ($arUserRequest = $dbUserRequests->GetNext()) {
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUserRequest["SECOND_USER_ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($arParams["USER_ID"], $arUserRequest["SECOND_USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
if (intval($arParams["THUMBNAIL_LIST_SIZE"]) > 0) {
if (intval($arUserRequest["SECOND_USER_PERSONAL_PHOTO"]) <= 0) {
switch ($arUserRequest["SECOND_USER_PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arUserRequest["SECOND_USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
$arImage = CFile::ResizeImageGet($arUserRequest["SECOND_USER_PERSONAL_PHOTO"], array("width" => $arParams["THUMBNAIL_LIST_SIZE"], "height" => $arParams["THUMBNAIL_LIST_SIZE"]), BX_RESIZE_IMAGE_EXACT, false);
示例15: array
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arFriends[$pref . "_USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
$arImage = CSocNetTools::InitImage($arFriends[$pref . "_USER_PERSONAL_PHOTO"], $arParams["THUMBNAIL_LIST_SIZE"], "/bitrix/images/socialnetwork/nopic_30x30.gif", 30, $pu, $canViewProfile);
} else {
// old
$arImage = CSocNetTools::InitImage($arFriends[$pref . "_USER_PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfile);
}
$gruLink = "";
$bGruInvite = false;
if ($arParams["GROUP_ID"] > 0) {
if (CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arFriends[$pref . "_USER_ID"], "invitegroup", CSocNetUser::IsCurrentUserModuleAdmin())) {
$gruLink = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP_REQUEST_USER"], array("user_id" => $arFriends[$pref . "_USER_ID"], "group_id" => $arParams["GROUP_ID"]));
}
}
$arResult["Friends"]["List"][] = array("ID" => $arFriends["ID"], "USER_ID" => $arFriends[$pref . "_USER_ID"], "USER_NAME" => $arFriends[$pref . "_USER_NAME"], "USER_LAST_NAME" => $arFriends[$pref . "_USER_LAST_NAME"], "USER_SECOND_NAME" => $arFriends[$pref . "_USER_SECOND_NAME"], "USER_LOGIN" => $arFriends[$pref . "_USER_LOGIN"], "USER_PERSONAL_PHOTO" => $arFriends[$pref . "_USER_PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "IS_ONLINE" => $arFriends[$pref . "_USER_IS_ONLINE"] == "Y", "ADD_TO_FRIENDS_LINK" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_FRIENDS_ADD"], array("user_id" => $arFriends[$pref . "_USER_ID"])), "DELETE_FROM_FRIENDS_LINK" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER_FRIENDS_DELETE"], array("user_id" => $arFriends[$pref . "_USER_ID"])), "CAN_ADD2FRIENDS" => !$arResult["CurrentUserPerms"]["IsCurrentUser"] && !$rel && $arFriends[$pref . "_USER_ID"] != $GLOBALS["USER"]->GetID() ? true : false, "CAN_DELETE_FRIEND" => $arResult["CurrentUserPerms"]["IsCurrentUser"] && $rel == SONET_RELATIONS_FRIEND ? true : false, "REQUEST_GROUP_LINK" => $gruLink);
}
$arResult["NAV_STRING"] = $dbFriends->GetPageNavStringEx($navComponentObject, GetMessage("SONET_C33_NAV"), "", false);
}
}
}
}
}
$this->IncludeComponentTemplate();