本文整理汇总了PHP中CSocNetUser::IsUserModuleAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUser::IsUserModuleAdmin方法的具体用法?PHP CSocNetUser::IsUserModuleAdmin怎么用?PHP CSocNetUser::IsUserModuleAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetUser
的用法示例。
在下文中一共展示了CSocNetUser::IsUserModuleAdmin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BanUser
function BanUser($senderUserID, $targetUserID)
{
global $APPLICATION, $DB;
$senderUserID = IntVal($senderUserID);
if ($senderUserID <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_SENDER_USER_ID"), "ERROR_SENDER_USER_ID");
return false;
}
$targetUserID = IntVal($targetUserID);
if ($targetUserID <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_EMPTY_TARGET_USER_ID"), "ERROR_TARGET_USER_ID");
return false;
}
elseif (CSocNetUser::IsUserModuleAdmin($targetUserID, false))
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_ERROR_CREATE_RELATION"), "ERROR_TARGET_USER_ID");
return false;
}
$strSql =
"SELECT UR.ID, UR.FIRST_USER_ID, UR.SECOND_USER_ID, UR.RELATION ".
"FROM b_sonet_user_relations UR ".
"WHERE UR.FIRST_USER_ID = ".$senderUserID." ".
" AND UR.SECOND_USER_ID = ".$targetUserID." ".
"UNION ".
"SELECT UR.ID, UR.FIRST_USER_ID, UR.SECOND_USER_ID, UR.RELATION ".
"FROM b_sonet_user_relations UR ".
"WHERE UR.FIRST_USER_ID = ".$targetUserID." ".
" AND UR.SECOND_USER_ID = ".$senderUserID." ";
$dbResult = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
if ($arResult = $dbResult->Fetch())
{
if ($arResult["RELATION"] != SONET_RELATIONS_BAN)
{
$arFields = array(
"RELATION" => SONET_RELATIONS_BAN,
"=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
);
if ($arResult["FIRST_USER_ID"] == $senderUserID)
$arFields["INITIATED_BY"] = "F";
else
$arFields["INITIATED_BY"] = "S";
if (CSocNetUserRelations::Update($arResult["ID"], $arFields))
{
$arMessageFields = array(
"FROM_USER_ID" => $senderUserID,
"TO_USER_ID" => $targetUserID,
"MESSAGE" => GetMessage("SONET_UR_BANUSER_MESSAGE"),
"=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
"MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM
);
CSocNetMessages::Add($arMessageFields);
if ($arResult["RELATION"] == SONET_RELATIONS_FRIEND)
$GLOBALS["DB"]->Query("DELETE FROM b_sonet_event_user_view WHERE
ENTITY_TYPE = '".SONET_ENTITY_USER."'
AND (
(USER_ID = ".$arRelation["FIRST_USER_ID"]." AND ENTITY_ID = ".$arRelation["SECOND_USER_ID"].")
OR (USER_ID = ".$arRelation["SECOND_USER_ID"]." AND ENTITY_ID = ".$arRelation["FIRST_USER_ID"].")
OR (ENTITY_ID = ".$arRelation["FIRST_USER_ID"]." AND USER_IM_ID = ".$arRelation["SECOND_USER_ID"].")
OR (ENTITY_ID = ".$arRelation["SECOND_USER_ID"]." AND USER_IM_ID = ".$arRelation["FIRST_USER_ID"].")
OR (USER_ID = ".$arRelation["FIRST_USER_ID"]." AND USER_IM_ID = ".$arRelation["SECOND_USER_ID"].")
OR (USER_ID = ".$arRelation["SECOND_USER_ID"]." AND USER_IM_ID = ".$arRelation["FIRST_USER_ID"].")
)", true);
}
else
{
$errorMessage = "";
if ($e = $APPLICATION->GetException())
$errorMessage = $e->GetString();
if (StrLen($errorMessage) <= 0)
$errorMessage = GetMessage("SONET_UR_ERROR_UPDATE_RELATION");
$GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_UPDATE_RELATION");
return false;
}
}
else
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_UR_ALREADY_BAN"), "ERROR_ALREADY_BAN");
return false;
}
}
else
{
$arFields = array(
"FIRST_USER_ID" => $senderUserID,
"SECOND_USER_ID" => $targetUserID,
"RELATION" => SONET_RELATIONS_BAN,
"=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
"=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
"INITIATED_BY" => "F",
);
if (CSocNetUserRelations::Add($arFields))
//.........这里部分代码省略.........
示例2: array
$rsIBlock = CIBlock::GetList(array(), array("ACTIVE" => "Y", "CHECK_PERMISSIONS" => "N", "CODE" => "user_files%"));
while ($arIBlock = $rsIBlock->Fetch()) {
$rsSite = CIBlock::GetSite($arIBlock["ID"]);
while ($arSite = $rsSite->Fetch()) {
if ($arSite["SITE_ID"] == $extranetSiteId && intval($extranet_iblock_id) <= 0) {
$extranet_iblock_id = $arIBlock["ID"];
} elseif ($arSite["SITE_ID"] != $extranetSiteId && intval($intranet_iblock_id) <= 0) {
$intranet_iblock_id = $arIBlock["ID"];
}
}
if (intval($intranet_iblock_id) > 0 && intval($extranet_iblock_id) > 0) {
break;
}
}
if (intval($intranet_iblock_id) > 0 && intval($extranet_iblock_id) > 0) {
if (CSocNetUser::IsUserModuleAdmin($arResult["VARIABLES"]["user_id"])) {
$bIsUserExtranet = false;
} else {
$rsUser = CUser::GetList($by = "id", $order = "asc", array("ID" => $arResult["VARIABLES"]["user_id"]), array("SELECT" => array("UF_DEPARTMENT"), "FIELDS" => array("ID")));
if ($arUser = $rsUser->Fetch()) {
$bIsUserExtranet = is_array($arUser["UF_DEPARTMENT"]) && count($arUser["UF_DEPARTMENT"]) <= 0 || !is_array($arUser["UF_DEPARTMENT"]) && intval($arUser["UF_DEPARTMENT"]) <= 0;
}
}
$arCachedResult["FILES_USER_IBLOCK_ID"] = $bIsUserExtranet ? $extranet_iblock_id : $intranet_iblock_id;
} else {
$arCachedResult["FILES_USER_IBLOCK_ID"] = intval($extranet_iblock_id) > 0 ? intval($extranet_iblock_id) : (intval($intranet_iblock_id) > 0 ? intval($intranet_iblock_id) : 0);
}
$obCache->EndDataCache($arCachedResult);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
示例3: GetMessage
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);
}
$arImage = CSocNetTools::InitImage($arResult["User"]["PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $arResult["Urls"]["User"], $arResult["CanViewProfile"]);
$arResult["User"]["PERSONAL_PHOTO_FILE"] = $arImage["FILE"];
示例4: while
$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"])));
}
$arResult["NAV_STRING"] = $dbMessages->GetPageNavStringEx($navComponentObject, GetMessage("SONET_C30_NAV"), "", false);
$arResult["NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData();
$arResult["NAV_RESULT"] = $dbMessages;
}
$this->IncludeComponentTemplate();
示例5: array
}
$dbMessages = CSocNetMessages::GetList(array("DATE_CREATE" => "DESC"), $arFilter, false, $arNavParams, array("ID", "FROM_USER_ID", "TITLE", "MESSAGE", "DATE_CREATE", "DATE_VIEW", "MESSAGE_TYPE", "FROM_USER_NAME", "FROM_USER_LAST_NAME", "FROM_USER_SECOND_NAME", "FROM_USER_LOGIN_NAME", "FROM_USER_PERSONAL_PHOTO", "FROM_USER_PERSONAL_GENDER"));
while ($arMessages = $dbMessages->GetNext()) {
if ($arResult["Events"] == false) {
$arResult["Events"] = array();
}
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arMessages["FROM_USER_ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arMessages["FROM_USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$canAnsver = IsModuleInstalled("im") || CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arMessages["FROM_USER_ID"], "message", CSocNetUser::IsCurrentUserModuleAdmin());
$relation = CSocNetUserRelations::GetRelation($GLOBALS["USER"]->GetID(), $arMessages["FROM_USER_ID"]);
if (intval($arMessages["FROM_USER_PERSONAL_PHOTO"]) <= 0) {
switch ($arMessages["FROM_USER_PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arMessages["FROM_USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
$arImage = CSocNetTools::InitImage($arMessages["FROM_USER_PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfile);
$arResult["Events"][] = array("ID" => $arMessages["ID"], "USER_ID" => $arMessages["FROM_USER_ID"], "USER_NAME" => $arMessages["FROM_USER_NAME"], "USER_LAST_NAME" => $arMessages["FROM_USER_LAST_NAME"], "USER_SECOND_NAME" => $arMessages["FROM_USER_SECOND_NAME"], "USER_LOGIN" => $arMessages["FROM_USER_LOGIN"], "USER_PERSONAL_PHOTO" => $arMessages["FROM_USER_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_MESS"], array("user_id" => $arMessages["FROM_USER_ID"], "message_id" => $arMessages["ID"])), "READ_LINK" => htmlspecialcharsbx($APPLICATION->GetCurUri("eventID=" . $arMessages["ID"] . "&action=close&" . bitrix_sessid_get() . "")), "DELETE_LINK" => htmlspecialcharsbx($APPLICATION->GetCurUri("eventID=" . $arMessages["ID"] . "&action=delete&" . bitrix_sessid_get() . "")), "BAN_LINK" => htmlspecialcharsbx($APPLICATION->GetCurUri("userID=" . $arMessages["FROM_USER_ID"] . "&action=ban&" . bitrix_sessid_get() . "")), "SHOW_BAN_LINK" => (!$relation || $relation != SONET_RELATIONS_BAN) && !CSocNetUser::IsUserModuleAdmin($arMessages["FROM_USER_ID"]), "ALL_USER_MESSAGES_LINK" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_INPUT_USER"], array("user_id" => $arMessages["FROM_USER_ID"])), "DATE_CREATE" => $arMessages["DATE_CREATE"], "IS_READ" => StrLen($arMessages["DATE_VIEW"]) > 0, "TITLE" => $arMessages["TITLE"], "MESSAGE" => $parser->convert($arMessages["~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")));
}
$arResult["NAV_STRING"] = $dbMessages->GetPageNavStringEx($navComponentObject, GetMessage("SONET_C27_NAV"), "", false);
$arResult["NAV_CACHED_DATA"] = $navComponentObject->GetTemplateCachedData();
$arResult["NAV_RESULT"] = $dbMessages;
}
$this->IncludeComponentTemplate();
示例6: elseif
} else {
$arTmpData["DATE_TIME_FORMATTED"] = "";
}
if (date("d", $arTmpData["DATE_TIMESTAMP"]) == date("d") && date("n", $arTmpData["DATE_TIMESTAMP"]) == date("n") && date("Y", $arTmpData["DATE_TIMESTAMP"]) == date("Y")) {
$arTmpData["DATE_DAY"] = "TODAY";
} elseif (mktime(0, 0, 0, date("n"), date("d"), date("Y")) - $arTmpData["DATE_TIMESTAMP"] < 60 * 60 * 24) {
$arTmpData["DATE_DAY"] = "YESTERDAY";
} else {
$arTmpData["DATE_DAY"] = "";
}
$arTmpData["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"));
$arTmpData["MESSAGE"] = str_replace("#BR#", "<br />", $arTmpData["MESSAGE"]);
$arTmpData["URL_MESSAGE"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGE_FORM_MESS"], array("user_id" => $arUserRequests["FROM_USER_ID"], "message_id" => $arUserRequests["ID"]));
$arTmpData["URL_BAN"] = "EventType=Message&userID=" . $arUserRequests["FROM_USER_ID"] . "&action=ban";
$arTmpData["CAN_ANSWER"] = $arUserRequests["MESSAGE_TYPE"] == SONET_MESSAGE_PRIVATE && $canAnsver ? "Y" : "N";
$arTmpData["CAN_BAN"] = !CSocNetUser::IsUserModuleAdmin($arUserRequests["FROM_USER_ID"], $site) && $arUserRequests["MESSAGE_TYPE"] == SONET_MESSAGE_PRIVATE ? "Y" : "N";
if ($arTmpData["CAN_ANSWER"] == "Y") {
$arTmpData["BUTTONS"] = array(array("NAME" => GetMessage("SONET_C2_ANSWER"), "ID" => "reply", "ONCLICK" => "function () \n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\twindow.open('" . $arTmpData["URL_MESSAGE"] . "', '', 'location=yes,status=no,scrollbars=yes,resizable=yes,width=700,height=550,top='+Math.floor((screen.height - 550)/2-14)+',left='+Math.floor((screen.width - 700)/2-5));\n\t\t\t\t\t\t\t\t\t\t_this.Next();\n\t\t\t\t\t\t\t\t\t\t_this.oData.splice(_this.oCurrentMessagePointer-1, 1);\n\t\t\t\t\t\t\t\t\t\tif (_this.oCurrentMessagePointer > 0)\n\t\t\t\t\t\t\t\t\t\t\t_this.oCurrentMessagePointer--;\n\t\t\t\t\t\t\t\t\t\t_this.adjustPaging();\n\t\t\t\t\t\t\t\t\t\t_this.ShowContent(_this.oCurrentMessagePointer);\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}"));
}
$arData[] = $arTmpData;
}
// while
}
// if bGet
}
if (count($arData) <= 0 || $arData[0] != "*") {
CSocNetMessages::__SpeedFileCheckMessages($GLOBALS["USER"]->GetID());
CSocNetUserToGroup::__SpeedFileCheckMessages($GLOBALS["USER"]->GetID());
CSocNetUserRelations::__SpeedFileCheckMessages($GLOBALS["USER"]->GetID());
}
global $tmpSite;
示例7: GetSocNetPostPerms
function GetSocNetPostPerms($postId = 0, $bNeedFull = false, $userId = false, $postAuthor = 0)
{
if (!$userId) {
$userId = IntVal($GLOBALS["USER"]->GetID());
$bByUserId = false;
} else {
$userId = IntVal($userId);
$bByUserId = true;
}
$postId = IntVal($postId);
if ($postId <= 0) {
return false;
}
$cId = md5(serialize(func_get_args()));
if (isset($GLOBALS["BLOG_BP_SOCNETPOSTPERMS"]) && !empty($GLOBALS["BLOG_BP_SOCNETPOSTPERMS"][$cId])) {
return $GLOBALS["BLOG_BP_SOCNETPOSTPERMS"][$cId];
}
if (!CModule::IncludeModule("socialnetwork")) {
return false;
}
$perms = BLOG_PERMS_DENY;
$arAvailPerms = array_keys($GLOBALS["AR_BLOG_PERMS"]);
if (!$bByUserId) {
$blogModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("blog");
if ($blogModulePermissions >= "W" || CSocNetUser::IsCurrentUserModuleAdmin()) {
$perms = $arAvailPerms[count($arAvailPerms) - 1];
}
} else {
if (CSocNetUser::IsUserModuleAdmin($userId)) {
$perms = $arAvailPerms[count($arAvailPerms) - 1];
}
}
if (IntVal($postAuthor) <= 0) {
$dbPost = CBlogPost::GetList(array(), array("ID" => $postId), false, false, array("ID", "AUTHOR_ID"));
$arPost = $dbPost->Fetch();
} else {
$arPost["AUTHOR_ID"] = $postAuthor;
}
if ($arPost["AUTHOR_ID"] == $userId) {
$perms = BLOG_PERMS_FULL;
}
if ($perms <= BLOG_PERMS_DENY) {
$arPerms = CBlogPost::GetSocNetPerms($postId);
$arEntities = array();
if (isset($GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId]) && !empty($GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId])) {
$arEntities = $GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId];
} else {
$arCodes = CAccess::GetUserCodesArray($userId);
foreach ($arCodes as $code) {
if (preg_match('/^DR([0-9]+)/', $code, $match) || preg_match('/^D([0-9]+)/', $code, $match) || preg_match('/^IU([0-9]+)/', $code, $match)) {
$arEntities["DR"][$code] = $code;
} elseif (preg_match('/^SG([0-9]+)_([A-Z])/', $code, $match)) {
$arEntities["SG"][$match[1]][$match[2]] = $match[2];
}
}
$GLOBALS["BLOG_POST"]["UAC_CACHE_" . $userId] = $arEntities;
}
foreach ($arPerms as $t => $val) {
foreach ($val as $id => $p) {
if (!is_array($p)) {
$p = array();
}
if ($userId > 0 && $t == "U" && $userId == $id) {
$perms = BLOG_PERMS_READ;
if (in_array("US" . $userId, $p)) {
// if author
$perms = BLOG_PERMS_FULL;
}
break;
}
if (in_array("G2", $p)) {
$perms = BLOG_PERMS_READ;
break;
}
if ($userId > 0 && in_array("AU", $p)) {
$perms = BLOG_PERMS_READ;
break;
}
if ($t == "SG") {
if (!empty($arEntities["SG"][$id])) {
foreach ($arEntities["SG"][$id] as $gr) {
if (in_array("SG" . $id . "_" . $gr, $p)) {
$perms = BLOG_PERMS_READ;
break;
}
}
}
}
if ($t == "DR" && !empty($arEntities["DR"])) {
if (in_array("DR" . $id, $arEntities["DR"])) {
$perms = BLOG_PERMS_READ;
break;
}
}
}
if ($perms > BLOG_PERMS_DENY) {
break;
}
}
if ($bNeedFull && $perms <= BLOG_PERMS_FULL) {
//.........这里部分代码省略.........
示例8: array
//5
$arData[6] = $canViewProfile ? "Y" : "N";
//6
$arData[7] = CSocNetUser::IsOnLine($arUserRequests["FROM_USER_ID"]) ? "Y" : "N";
//7
$arData[8] = $arUserRequests["DATE_CREATE"];
//8
$arData[9] = $arUserRequests["MESSAGE_TYPE"];
//9
//$arData[0] = $arUserRequests["TITLE"]; //10
$arData[10] = $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"));
//10
$arData[11] = $arUserRequests["MESSAGE_TYPE"] == SONET_MESSAGE_PRIVATE && $canAnsver ? "Y" : "N";
//11
$arData[12] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGE_FORM_MESS"], array("user_id" => $arUserRequests["FROM_USER_ID"], "message_id" => $arUserRequests["ID"]));
//12
$arData[13] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_CHAT"], array("user_id" => $arUserRequests["FROM_USER_ID"], "message_id" => $arUserRequests["ID"]));
//13
$arData[14] = "EventType=Message&eventID=" . $arUserRequests["ID"] . "&action=close";
//14
$arData[15] = !CSocNetUser::IsUserModuleAdmin($arUserRequests["FROM_USER_ID"]) && $arUserRequests["MESSAGE_TYPE"] == SONET_MESSAGE_PRIVATE ? "Y" : "N";
//15
$arData[16] = "EventType=Message&userID=" . $arUserRequests["FROM_USER_ID"] . "&action=ban";
//16
}
}
}
echo CUtil::PhpToJSObject($arData);
}
define('PUBLIC_AJAX_MODE', true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
示例9: array
if ($arUserRequests = $dbUserRequests->GetNext()) {
$bFound = true;
$arResult["EventType"] = "Message";
$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());
$canAnsver = IsModuleInstalled("im") || CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUserRequests["FROM_USER_ID"], "message", CSocNetUser::IsCurrentUserModuleAdmin());
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_ID);
}
$arImage = CSocNetTools::InitImage($arUserRequests["FROM_USER_PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfile);
$arResult["Event"] = array("ID" => $arUserRequests["ID"], "USER_ID" => $arUserRequests["FROM_USER_ID"], "USER_NAME" => $arUserRequests["FROM_USER_NAME"], "USER_LAST_NAME" => $arUserRequests["FROM_USER_LAST_NAME"], "USER_SECOND_NAME" => $arUserRequests["FROM_USER_SECOND_NAME"], "USER_LOGIN" => $arUserRequests["FROM_USER_LOGIN"], "USER_PERSONAL_PHOTO" => $arUserRequests["FROM_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["FROM_USER_IS_ONLINE"] == "Y", "DATE_CREATE" => $arUserRequests["DATE_CREATE"], "MESSAGE_TYPE" => $arUserRequests["MESSAGE_TYPE"], "TITLE" => $arUserRequests["TITLE"], "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")));
$arResult["Urls"]["Reply"]["Show"] = $arUserRequests["MESSAGE_TYPE"] == SONET_MESSAGE_PRIVATE && $canAnsver;
$arResult["Urls"]["Reply"]["Link"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGE_FORM_MESS"], array("user_id" => $arUserRequests["FROM_USER_ID"], "message_id" => $arUserRequests["ID"]));
$arResult["Urls"]["Chat"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_MESSAGES_CHAT"], array("user_id" => $arUserRequests["FROM_USER_ID"]));
$arResult["Urls"]["Close"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=Message&eventID=" . $arUserRequests["ID"] . "&action=close&" . bitrix_sessid_get() . ""));
$arResult["Urls"]["Ban"]["Show"] = $arUserRequests["MESSAGE_TYPE"] == SONET_MESSAGE_PRIVATE && !CSocNetUser::IsUserModuleAdmin($arUserRequests["FROM_USER_ID"]);
$arResult["Urls"]["Ban"]["Link"] = htmlspecialcharsbx($APPLICATION->GetCurUri("EventType=Message&userID=" . $arUserRequests["FROM_USER_ID"] . "&action=ban&" . bitrix_sessid_get() . ""));
}
}
$this->IncludeComponentTemplate();
}