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


PHP CSocNetUserPerms::CanPerformOperation方法代码示例

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


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

示例1: _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;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:32,代码来源:index.php

示例2: array

         }
         $arResult['SEARCH_RESULT'][$i] = $arUser;
     }
 } else {
     $arListParam = array("NAV_PARAMS" => $arNavParams);
     if ($arParams["ALLOW_RATING_SORT"] == 'Y') {
         $by = "RATING_" . $arParams["RATING_ID"];
     }
     if ($arParams["SHOW_RATING"] == 'Y') {
         $arListParam["SELECT"][] = "RATING_" . $arParams["RATING_ID"];
     }
     $dbUsers = CUser::GetList($by, $order = "desc", $arFilter, $arListParam);
     while ($arUser = $dbUsers->GetNext()) {
         $arUser["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
         $arUser["SHOW_PROFILE_LINK"] = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
         $arUser["CAN_MESSAGE"] = $GLOBALS["USER"]->IsAuthorized() && $GLOBALS["USER"]->GetID() != $arUser["ID"] && (IsModuleInstalled("im") || CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "message", CSocNetUser::IsCurrentUserModuleAdmin()));
         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"], $iSize, "/bitrix/images/socialnetwork/nopic_user_" . $iSize . ".gif", $iSize, $arUser["URL"], $arUser["SHOW_PROFILE_LINK"]);
         $arUser["IMAGE_FILE"] = $arImage["FILE"];
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例3: InitUserPerms

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

示例4: InitUserPerms

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

示例5: 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;
                         }
                     }
                 }
             }
         }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:add_message.php

示例6: 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();
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例7: 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);
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:43,代码来源:log.php

示例8: 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")));
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例9: __RSSCheckServerName

        $this->IncludeComponentTemplate();
        $r = $APPLICATION->EndBufferContentMan();
        echo $r;
        die;
    }
    if (intval($arGroup["IMAGE_ID"]) <= 0) {
        $arGroup["IMAGE_ID"] = COption::GetOptionInt("socialnetwork", "default_group_picture", false, SITE_ID);
    }
    $arResult["PICTURE"] = CSocNetTools::InitImage($arGroup["IMAGE_ID"], 100, "/bitrix/images/socialnetwork/nopic_group_100.gif", 100, "", false);
    $arResult["PICTURE"]["FILE"]["SRC"] = __RSSCheckServerName($arResult["PICTURE"]["FILE"]["SRC"], $arResult["SERVER_NAME"]);
    $arResult["NAME"] = $arGroup["NAME"];
    $arResult["DESCRIPTION"] = $arGroup["DESCRIPTION"];
    $arResult["URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arParams["ENTITY_ID"]));
    $arResult["URL"] = htmlspecialcharsbx(__RSSCheckServerName($arResult["URL"], $arResult["SERVER_NAME"]));
} else {
    $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), ${$arParams}["ENTITY_ID"], "viewprofile", $bCurrentUserIsAdmin);
    if (!$canViewProfile) {
        $APPLICATION->RestartBuffer();
        $arResult["NAME"] = GetMessage("SONET_LOG_RSS_ERROR");
        $arResult["Events"] = array(array("LOG_DATE" => date("r"), "TITLE_FORMAT" => htmlspecialcharsbx(GetMessage("SONET_LOG_RSS_USER_NO_PERMS_TITLE")), "MESSAGE_FORMAT" => htmlspecialcharsbx(GetMessage("SONET_LOG_RSS_USER_NO_PERMS_MESSAGE")), "URL" => ""));
        $this->IncludeComponentTemplate();
        $r = $APPLICATION->EndBufferContentMan();
        echo $r;
        die;
    }
    $rsUser = CUser::GetByID($arParams["ENTITY_ID"]);
    if ($arUser = $rsUser->GetNext()) {
        if (intval($arUser["PERSONAL_PHOTO"]) <= 0) {
            switch ($arUser["PERSONAL_GENDER"]) {
                case "M":
                    $suffix = "male";
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例10: ReceiveMessage

 public function ReceiveMessage($senderJId, array $arMessage, CXMPPClient $senderClient)
 {
     if (!$senderClient->IsAuthenticated()) {
         return false;
     }
     if (strlen($senderJId) <= 0) {
         return false;
     }
     if (!array_key_exists("message", $arMessage) || !array_key_exists(".", $arMessage["message"])) {
         return false;
     }
     $type = "normal";
     if (array_key_exists("type", $arMessage["message"]["."])) {
         $type = $arMessage["message"]["."]["type"];
     }
     if ($type == "error") {
         return false;
     }
     $mid = "";
     if (array_key_exists("id", $arMessage["message"]["."])) {
         $mid = $arMessage["message"]["."]["id"];
     }
     if (!in_array($type, array("chat", "groupchat", "headline", "normal"))) {
         return CXMPPUtility::GetErrorArray($senderJId, "message", "modify", "bad-request", "", $mid, "", $senderClient->GetClientDomain());
     }
     $recipientJId = "";
     if (array_key_exists("to", $arMessage["message"]["."])) {
         $recipientJId = $arMessage["message"]["."]["to"];
     }
     if (strlen($recipientJId) <= 0) {
         return CXMPPUtility::GetErrorArray($senderJId, "message", "modify", "bad-request", "", $mid, "", $senderClient->GetClientDomain());
     }
     $body = "";
     if (array_key_exists("body", $arMessage["message"])) {
         $body = $arMessage["message"]["body"]["#"];
     }
     if (strlen($body) <= 0) {
         return true;
     }
     //$body = CXMPPReceiveMessage::htmlspecialcharsback($body);
     //$body = html_entity_decode($body);
     $body = html_entity_decode($body, ENT_COMPAT, SITE_CHARSET);
     $body = str_replace("&apos;", "'", $body);
     $arSender = CXMPPUtility::GetUserByJId($senderJId);
     if (!$arSender) {
         return CXMPPUtility::GetErrorArray($senderJId, "message", "auth", "forbidden", $recipientJId, $mid, "", $senderClient->GetClientDomain());
     }
     $arRecipient = CXMPPUtility::GetUserByJId($recipientJId);
     if (!$arRecipient) {
         return CXMPPUtility::GetErrorArray($senderJId, "message", "cancel", "item-not-found", $recipientJId, $mid, "", $senderClient->GetClientDomain());
     }
     if (!CSocNetUserPerms::CanPerformOperation($arSender["ID"], $arRecipient["ID"], "message", false)) {
         return CXMPPUtility::GetErrorArray($senderJId, "message", "auth", "forbidden", $recipientJId, $mid, "", $senderClient->GetClientDomain());
     }
     if (IsModuleInstalled("im") && CModule::IncludeModule("im")) {
         $arMessageFields = array("FROM_USER_ID" => $arSender["ID"], "TO_USER_ID" => $arRecipient["ID"], "MESSAGE" => $body);
         CIMMessage::Add($arMessageFields);
     } else {
         $arMessageFields = array("=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_PRIVATE, "FROM_USER_ID" => $arSender["ID"], "TO_USER_ID" => $arRecipient["ID"], "MESSAGE" => $body);
         CSocNetMessages::Add($arMessageFields);
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:63,代码来源:message.php

示例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"));
        }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例12: 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) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:get_message_2.php

示例13: 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);
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例14: foreach

             $arUserIDs[] = $ID_ADDED;
         }
     }
 }
 // send invitations
 if (is_array($arUserIDs) && count($arUserIDs) > 0) {
     foreach ($arUserIDs as $user_id) {
         $isCurrentUserTmp = $USER->GetID() == $user_id;
         $canInviteGroup = CSocNetUserPerms::CanPerformOperation($USER->GetID(), $user_id, "invitegroup", CSocNetUser::IsCurrentUserModuleAdmin());
         $user2groupRelation = CSocNetUserToGroup::GetUserRole($user_id, $arResult["GROUP_ID"]);
         if (!$isCurrentUserTmp && $canInviteGroup && !$user2groupRelation) {
             $bMail = !is_array($arInvitedExtranetUsers) || !in_array($user_id, $arInvitedExtranetUsers);
             if (!CSocNetUserToGroup::SendRequestToJoinGroup($USER->GetID(), $user_id, $arResult["GROUP_ID"], $_POST["MESSAGE"], $bMail)) {
                 $rsUser = CUser::GetByID($user_id);
                 if ($arUser = $rsUser->Fetch()) {
                     $arErrorUsers[] = array(CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $bUseLogin), CSocNetUserPerms::CanPerformOperation($USER->GetID(), $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin()) ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"])) : "");
                     if ($e = $APPLICATION->GetException()) {
                         $warningMessage .= $e->GetString();
                     }
                 }
             } elseif (is_array($arResult["POST"]["USER_IDS"]) && in_array($user_id, $arResult["POST"]["USER_IDS"])) {
                 $bInvited = true;
                 // delete from uninvited users list
                 $arKeysFound = array_keys($arResult["POST"]["USER_IDS"], $user_id);
                 foreach ($arKeysFound as $key) {
                     unset($arResult["POST"]["USER_IDS"][$key]);
                 }
             }
         } else {
             if (!$isCurrentUserTmp && $canInviteGroup && $user2groupRelation) {
                 $rsUser = CUser::GetByID($user_id);
开发者ID:vim84,项目名称:b-markt,代码行数:31,代码来源:component.php

示例15: array

         if (in_array($arUser["ID"], $arUsersInListID)) {
             continue;
         }
         $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
         $canViewProfile = CSocNetUserPerms::CanPerformOperation($arResult["UserSelf"]["ID"], $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
         $strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin);
         $arResult["Friends"][] = array("USER_ID" => $arUser["ID"], "USER_NAME" => $arUser["NAME"], "USER_LAST_NAME" => $arUser["LAST_NAME"], "USER_SECOND_NAME" => $arUser["SECOND_NAME"], "USER_LOGIN" => $arUser["LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "PATH_TO_MESSAGES_CHAT" => str_replace("#user_id#", $arUser["ID"], $arParams["PATH_TO_MESSAGES_CHAT"]), "IS_ONLINE" => $arUser["IS_ONLINE"] == "Y");
     }
 }
 //Recent users
 $arResult["RecentUsers"] = array();
 $arNavParams = array("nPageSize" => 20, "bDescPageNumbering" => false);
 $dbMessages = CSocNetMessages::GetMessagesUsers($GLOBALS["USER"]->GetID(), $arNavParams);
 while ($arMessages = $dbMessages->GetNext()) {
     $pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arMessages["ID"]));
     $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arMessages["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
     $arTmpUser = array("NAME" => $arMessages["~NAME"], "LAST_NAME" => $arMessages["~LAST_NAME"], "SECOND_NAME" => $arMessages["~SECOND_NAME"], "LOGIN" => $arMessages["~LOGIN"]);
     $strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin);
     $arResult["RecentUsers"][] = 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_NAME_FORMATTED" => $strNameFormatted, "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "PATH_TO_MESSAGES_CHAT" => str_replace("#user_id#", $arMessages["ID"], $arParams["PATH_TO_MESSAGES_CHAT"]), "IS_ONLINE" => $arMessages["IS_ONLINE"] == "Y");
 }
 $arResult["PrintSmilesList"] = CSocNetSmile::PrintSmilesList(0, LANGUAGE_ID, $arParams["PATH_TO_SMILE"]);
 $strNow = CSocNetMessages::Now();
 $strNow_ts = MakeTimeStamp($strNow, "YYYY-MM-DD HH:MI:SS") + CTimeZone::GetOffset();
 $arResult["Now"] = date("Y-m-d H:i:s", $strNow_ts);
 //user options
 require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/" . strtolower($GLOBALS['DB']->type) . "/favorites.php";
 $arResult["USER_OPTIONS"] = CUserOptions::GetOption('socnet', 'chat', array());
 if ($arResult["USER_OPTIONS"]["sound"] != "N") {
     $arResult["USER_OPTIONS"]["sound"] = "Y";
 }
 if ($arResult["USER_OPTIONS"]["contacts"] != "Y") {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php


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