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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/lyon/administrator/components/com_djcatalog2/models/pricerule.php
<?php
/**
 * @package DJ-Catalog2
 * @copyright Copyright (C) 2012 DJ-Extensions.com LTD, 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\Registry\Registry;

class Djcatalog2ModelPriceRule extends JModelAdmin
{
	protected $text_prefix = 'COM_DJCATALOG2';

	public function __construct($config = array()) {
		parent::__construct($config);
	}

	public function getTable($type = 'PriceRules', $prefix = 'Djcatalog2Table', $config = array())
	{
		return JTable::getInstance($type, $prefix, $config);
	}
	public function getForm($data = array(), $loadData = true)
	{
		// Initialise variables.
		$app	= JFactory::getApplication();

		// Get the form.
		$form = $this->loadForm('com_djcatalog2.pricerule', 'pricerule', array('control' => 'jform', 'load_data' => $loadData));
		if (empty($form)) {
			return false;
		}
		return $form;
	}

	protected function loadFormData()
	{
		$data = JFactory::getApplication()->getUserState('com_djcatalog2.edit.pricerule.data', array());

		if (empty($data)) {
			$data = $this->getItem();
		}
		
		return $data;
	}

	public function getItem($pk = null) {
		$item = parent::getItem($pk);
		
		if (!empty($item)) {
			if (property_exists($item, 'product_id'))
			{
				$registry = new Registry;
				$registry->loadString($item->product_id);
				$item->product_id = $registry->toArray();
			}
			if (property_exists($item, 'category_id'))
			{
				$registry = new Registry;
				$registry->loadString($item->category_id);
				$item->category_id = $registry->toArray();
			}
			
			if (property_exists($item, 'countries'))
			{
				$registry = new Registry;
				$registry->loadString($item->countries);
				$item->countries = $registry->toArray();
			}
			
			if (property_exists($item, 'customer_groups') && !is_array($item->customer_groups))
			{
				$item->customer_groups = json_decode((string)$item->customer_groups, true);
			}

			if(!isset($item->labels) || !is_array($item->labels) || !count($item->labels)) {
			    $db = JFactory::getDbo();
                $db = JFactory::getDbo();
                $db->setQuery('select label_id from #__djc2_price_rules_labels where price_rule_id='.(int)$item->id);
                $item->labels = $db->loadColumn();
            }
		}
		
		return $item;
	}
	
	protected function prepareTable($table)
	{
		$table->start_date = (trim((string)$table->start_date) == '') ? null : $table->start_date;
		$table->expire_date = (trim((string)$table->expire_date) == '') ? null : $table->expire_date;
	}
	
	protected function getReorderConditions($table = null)
	{
		$condition = array();
		return $condition;
	}

	public function delete(&$cid) {
		return parent::delete($cid);
	}
	/**
	 * Method to test whether a record can be deleted.
	 *
	 * @param   object  $record  A record object.
	 *
	 * @return  boolean  True if allowed to delete the record. Defaults to the permission for the component.
	 *
	 * @since   1.6
	 */
	protected function canDelete($record)
	{
		return JFactory::getUser()->authorise('core.delete', $this->option) || JFactory::getUser()->authorise('djcatalog2.admin.misc_settings', $this->option);
	}
	
	/**
	 * Method to test whether a record can have its state changed.
	 *
	 * @param   object  $record  A record object.
	 *
	 * @return  boolean  True if allowed to change the state of the record. Defaults to the permission for the component.
	 *
	 * @since   1.6
	 */
	protected function canEditState($record)
	{
		return JFactory::getUser()->authorise('core.edit.state', $this->option)  || JFactory::getUser()->authorise('djcatalog2.admin.misc_settings', $this->option);
	}
}

Anon7 - 2022
AnonSec Team