| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/lemans/components/com_community/helpers/access/ |
Upload File : |
<?php
/**
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author iJoomla.com <webmaster@ijoomla.com>
* @url https://www.jomsocial.com/license-agreement
* The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
* More info at https://www.jomsocial.com/license-agreement
*/
defined('_JEXEC') or die('Restricted access');
Class CFriendsAccess implements CAccessInterface
{
/**
* Method to check if a user is authorised to perform an action in this class
*
* @param integer $userId Id of the user for which to check authorisation.
* @param string $action The name of the action to authorise.
* @param mixed $asset Name of the asset as a string.
*
* @return boolean True if authorised.
* @since Jomsocial 2.4
*/
static public function authorise()
{
$args = func_get_args();
$assetName = array_shift ( $args );
if (method_exists(__CLASS__,$assetName)) {
return call_user_func_array(array(__CLASS__, $assetName), $args);
} else {
return null;
}
}
/*
* This function will get the permission to view friend list
*
* @return : bool
*/
static public function friendsView($userId, $assetId)
{
$accesAllowed = CPrivacy::isAccessAllowed($userId, $assetId, 'user', 'privacyFriendsView');
if(!$accesAllowed || ($userId == 0 && $assetId == 0)) {
return false;
}
return true;
}
/*
* This function will get the permission to send private message
* @param type $userId
* @param type $assetId
* @return : bool
*/
static public function friendsPmView($userId, $assetId)
{
$config = CFactory::getConfig();
if (($userId != $assetId) && $config->get('enablepm')) {
return true;
} else {
return false;
}
}
/*
* This function will get the add friend permission
*
* @return : bool
*/
static public function friendsRequest($userId, $targetId)
{
if(COwnerHelper::isCommunityAdmin()){
return true;
}
if($userId == $targetId){
return false;
}
$config = CFactory::getConfig();
$targetUser = CFactory::getUser($targetId);
$params = $targetUser->getParams();
$privacyFriendRequest = $params->get('privacyFriendRequest', $config->get('privacyfriendrequest'));
if ($privacyFriendRequest == PRIVACY_PUBLIC) {
return true;
} else if ($privacyFriendRequest == PRIVACY_FRIENDS) {
// friend of friend
$friendsModel = CFactory::getModel('Friends');
$friends = $friendsModel->getFriendIds($targetId);
if (!$friends) {
return false;
} else {
foreach ($friends as $friendId) {
if (CFriendsHelper::isConnected($userId, $friendId)) {
return true;
}
}
}
} else if ($privacyFriendRequest == PRIVACY_PRIVATE) {
return false;
}
return false;
}
}