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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/administrator/components/com_djcatalog2/controllers/combination.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\MVC\Controller\FormController;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.application.component.controllerform');

class Djcatalog2ControllerCombination extends FormController {
	
	protected function allowAdd($data = array())
	{
		$user = Factory::getUser();
		return $user->authorise('core.create', $this->option) || $user->authorise('djcatalog2.admin.catalogue', $this->option);
	}
	
	protected function allowEdit($data = array(), $key = 'id')
	{
		$canDo = Factory::getUser()->authorise('core.edit', $this->option) || Factory::getUser()->authorise('djcatalog2.admin.catalogue', $this->option);
		
		if (!$canDo) {
			$task = Factory::getApplication()->input->getCmd('task');
			if ($task == 'edit' && Factory::getUser()->authorise('djcatalog2.access.catalogue', $this->option)) {
				return true;
			} else if ($task == 'cancel') {
				return true;
			}
		}
		
		return $canDo;
	}
	

	protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
	{

		return  parent::getRedirectToItemAppend($recordId, $urlVar) . '&layout=edit'; // TODO: Change the autogenerated stub
	}


	protected function getRedirectToListAppend()
	{
		$app = Factory::getApplication();
		$parent = $app->getUserStateFromRequest('com_djcatalog2.items.filter.parent', 'filter_parent', 0) ;

		return 'index.php?option=com_djcatalog2&view=items&layout=combinations&filter_parent=' . $parent;
	}

	public function saveImages() {
		$app   = Factory::getApplication();
		$model = $this->getModel();
		$table = $model->getTable();
		$data  = $this->input->post->get('jform', array(), 'array');
		$checkin = false;
		$context = "$this->option.edit.$this->context";
		$params = ComponentHelper::getParams('com_djcatalog2');


		$recordId = $this->input->getInt('id');

		if (!$recordId) {
			throw new Exception(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 403);
		}
		
		if (Factory::getUser()->authorise('core.edit', $this->option) == false) {
			throw new Exception(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 403);
		}
		
		if ($table->load($recordId)) {
			$table->alias = $table->id.'-'.$table->sku.'-combination';
			if (!DJCatalog2ImageHelper::saveImages('combination', $table, $params, false)) {
				$app->enqueueMessage(Text::_('COM_DJCATALOG2_ERROR_SAVING_IMAGES'),'error');
			}
		} else {
			throw new Exception($table->getError(), 403);
		}
		
		$this->setRedirect(Route::_('index.php?option=com_djcatalog2&view=combination&layout=images&tmpl=component&id='.$recordId, false), Text::_('JLIB_APPLICATION_SAVE_SUCCESS'));
		return true;
	}

	public function generate() {
		$app   = Factory::getApplication();
		$json =$app->input->json->getRaw('combinations');
		$combinations = json_decode($json);

		$data = [
			'id' => 0,
			'sku' => null,
			'stock' => 0,
			'width' => 0,
			'height' => 0,
			'length' => 0,
			'weight' => 0,
			'item_id' => $app->input->get('item_id'),
			'fields' =>(array) $combinations,
		];
		$model = $this->getModel('Combination');
		if($model->save($data)) {
			echo json_encode([
				'success' => true,
				'message' => \Joomla\CMS\Language\Text::_('COM_DJCATALOG2_COMBINATION_GENERATED'),
				'data' => $data
			]);
		}
		exit();
	}
}
?>

Anon7 - 2022
AnonSec Team