| 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/nice/plugins/kunena/comprofiler/ |
Upload File : |
<?php
/**
* Kunena Plugin
*
* @package Kunena.Plugins
* @subpackage Comprofiler
*
* @copyright Copyright (C) 2008 - 2025 Kunena Team. All rights reserved.
* @license https://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
**/
namespace Kunena\Forum\Plugin\Kunena\Comprofiler;
\defined('_JEXEC') or die();
use CB\Plugin\PMS\PMSHelper;
use CB\Plugin\PMS\UddeIM;
use CBLib\Application\Application;
use Joomla\CMS\Language\Text;
use Kunena\Forum\Libraries\Factory\KunenaFactory;
use Kunena\Forum\Libraries\Integration\KunenaPrivate;
/**
* Class KunenaPrivateComprofiler
*
* @since Kunena 6.0
*/
class KunenaPrivateComprofiler extends KunenaPrivate
{
/**
* @var null
* @since Kunena 6.0
*/
protected $params = null;
/**
* KunenaPrivateComprofiler constructor.
*
* @param object $params params
*
* @since Kunena 6.0
*/
public function __construct(object $params)
{
$this->params = $params;
}
/**
* @param integer $userid userid
*
* @return integer
*
* @since Kunena 6.0
*/
public function getUnreadCount(int $userid): int
{
global $_CB_PMS;
if (! $userid) {
return 0;
}
return ( $_CB_PMS->getPMSunreadCount( $userid )[0] ?? 0 );
}
/**
* @return void|string
*
* @since Kunena 6.0
*/
public function getInboxURL()
{
global $_CB_PMS;
$userid = Application::MyUser()->getUserId();
if (! $userid) {
return '';
}
return ( $_CB_PMS->getPMSlinks( $userid, 0, '', '', 2 )[0]['url'] ?? '' );
}
/**
* @param string $text text
*
* @return void|string
*
* @since Kunena 6.0
*/
public function getInboxLink(string $text)
{
if (!$text) {
$text = Text::_('COM_KUNENA_PMS_INBOX');
}
if (! Application::MyUser()->getUserId()) {
return;
}
$url = $this->getInboxURL();
if (! $url) {
return;
}
return '<a href="' . $url . '" rel="follow">' . $text . '</a>';
}
/**
* @param int $userid userid
*
* @return string
*
* @since Kunena 6.0
*/
protected function getURL(int $userid): string
{
global $_CB_PMS;
$user = KunenaFactory::getUser($userid);
if (! $user->exists()) {
return '';
}
$myid = Application::MyUser()->getUserId();
if (UddeIM::isUddeIM()) {
if (! $myid || $myid === $user->userid) {
return '';
}
} elseif (! PMSHelper::canMessage( $myid, $user->userid )) {
return '';
}
return ( $_CB_PMS->getPMSlinks( $user->userid, $myid, '', '', 1 )[0]['url'] ?? '' );
}
}