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/amisdesseniors-fr/nice/components/com_djcatalog2/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/nice/components/com_djcatalog2/helpers/association.php
<?php
/**
 * @package DJ-Catalog2
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 */
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Associations;
use Joomla\CMS\Language\Multilanguage;


abstract class DJCatalog2HelperAssociation
{
	/**
	 * Method to get the associations for a given item
	 *
	 * @param integer $id Id of the item (helloworld id or catid, depending on view)
	 * @param string $view Name of the view ('helloworld' or 'category')
	 *
	 * @return  array   Array of associations for the item
	 */
	public static function getAssociations($id = 0, $view = null)
	{
		$input = Factory::getApplication()->input;
		$view = $view === null ? $input->get('view') : $view;
		$id = empty($id) ? $input->getInt('id') : $id;
		$pid = empty($id) ? $input->getInt('pid') : $id;
		$cid = $input->getInt('cid', 0);
		$pcid = $input->getInt('pcid', 0);
		
		if ($view === 'item') {
			if ($id) {
				$user	  = Factory::getUser();
				$groups	= implode(',', $user->getAuthorisedViewLevels());
				$db		= Factory::getDbo();
				
				$advClausuleItem = array();
				$advClausuleItem[] = 'c2.access IN (' . $groups . ')';
				$advClausuleItem[] = 'c2.language != ' . $db->quote(Factory::getApplication()->getLanguage()->getTag());
				$advClausuleItem[] = 'c2.published = 1';
				
				$associationsItem = Associations::getAssociations('com_djcatalog2', '#__djc2_items', 'com_djcatalog2.item', $id, 'id', 'alias', '', $advClausuleItem);
				$associationsCategory = Associations::getAssociations('com_djcatalog2', '#__djc2_categories', 'com_djcatalog2.category', $cid, 'id', 'alias', '');
				
				$return = array();
				
				
				foreach ($associationsItem as $tag => $item) {
					$cid = ((isset($associationsCategory[$tag])) ? $associationsCategory[$tag]->id : 0);
					
					$link = DJCatalog2HelperRoute::getItemRoute($item->id, $cid);
					
					
					if ($item->language && $item->language !== '*' && Multilanguage::isEnabled()) {
						$link .= '&lang=' . $item->language;
					}
					$return[$tag] = $link;
				}
				
				
				return $return;
			}
		} else if ($view === 'producer') {
			if ($pid) {
				$user	  = Factory::getUser();
				$groups	= implode(',', $user->getAuthorisedViewLevels());
				$db		= Factory::getDbo();
				
				$advClausuleItem = array();
				//$advClausuleItem[] = 'c2.access IN (' . $groups . ')';
				$advClausuleItem[] = 'c2.language != ' . $db->quote(Factory::getApplication()->getLanguage()->getTag());
				$advClausuleItem[] = 'c2.published = 1';
				
				$associationsItem = Associations::getAssociations('com_djcatalog2', '#__djc2_producers', 'com_djcatalog2.producer', $pid, 'id', 'alias', '', $advClausuleItem);
				$associationsCategory = Associations::getAssociations('com_djcatalog2', '#__djc2_producer_categories', 'com_djcatalog2.producercategory', $pcid, 'id', 'alias', '');
				
				$return = array();
				
				
				foreach ($associationsItem as $tag => $item) {
					$cid = ((isset($associationsCategory[$tag])) ? $associationsCategory[$tag]->id : 0);
					
					$link = DJCatalog2HelperRoute::getProducerRoute($item->id);
					
					
					if ($item->language && $item->language !== '*' && Multilanguage::isEnabled()) {
						$link .= '&lang=' . $item->language;
					}
					$return[$tag] = $link;
				}
				
				
				return $return;
			}
		}
		
		if ($view === 'items' || $view === 'categories') {
			if ($cid) {
				$associations = Associations::getAssociations('com_djcatalog2', '#__djc2_categories', 'com_djcatalog2.category', $cid, 'id', 'alias', '');
				
				$return = array();
				foreach ($associations as $tag => $item) {
					$link = DJCatalog2HelperRoute::getCategoryRoute($item->id);
					if ($item->language && $item->language !== '*' && Multilanguage::isEnabled()) {
						$link .= '&lang=' . $item->language;
					}
					$return[$tag] = $link;
				}
				
				return $return;
			}
		} else if ($view === 'producers') {
			$associations = Associations::getAssociations('com_djcatalog2', '#__djc2_producer_categories', 'com_djcatalog2.producercategory', $pcid, 'id', 'alias', '');
			
			$return = array();
			foreach ($associations as $tag => $item) {
				$link = DJCatalog2HelperRoute::getProducerCategoryRoute($item->id);
				if ($item->language && $item->language !== '*' && Multilanguage::isEnabled()) {
					$link .= '&lang=' . $item->language;
				}
				$return[$tag] = $link;
			}
			
			return $return;
		}
		
		return array();
	}
}

Anon7 - 2022
AnonSec Team