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/components/com_djclassifieds/views/payment/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/brest/components/com_djclassifieds/views/payment/view.html.php
<?php
/**
 * @package DJ-Classifieds
 * @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');

class DJClassifiedsViewPayment extends JViewLegacy
{
	private static $_viewname = 'payment';

	public function __construct($config = array())
	{
		parent::__construct($config);
		$par = JFactory::getApplication()->getParams('com_djclassifieds');
		
		$this->_addPath('template', JPATH_ROOT.'/components/com_djclassifieds/themes/'.$par->get('theme','default').'/views/'.self::$_viewname);
	}

	function display($tpl = null)
	{
		$app = JFactory::getApplication();
		$user = JFactory::getUser();
		$document = JFactory::getDocument();
		$par = $app->getParams('com_djclassifieds');
		$model = $this->getModel();

		JPluginHelper::importPlugin('djclassifiedspayment');

		$id = $app->input->getInt('id', 0);
		$layout	= $app->input->getVar('layout');
		$type = $app->input->getVar('type');

		$app->triggerEvent('onBeforeDJClassifiedsPreparePaymentList', array(&$id, &$layout, &$type, &$par));

		if($layout == 'process'){		
			$app->triggerEvent('onProcessPayment');
			$app->close();
		}elseif($layout == 'info_bt'){
			$this->pdetails = $app->getUserState('payment_info_bt');
		}elseif($layout == 'info'){
			$this->plugin_content = $app->triggerEvent('onDJClassifiedsDisplayPaymentInfo', array());
		}else{
			$this->terms_link = '';
			if($par->get('terms',1)>0 && $par->get('terms_article_id',0)>0){
				$this->terms_link = $model->getTermsLink($par->get('terms_article_id',0), $par->get('terms',0)==2);
			}
			
			$this->privacy_policy_link = '';
			if($par->get('privacy_policy',0)>0 && $par->get('privacy_policy_article_id',0)>0){
				$this->privacy_policy_link = $model->getTermsLink($par->get('privacy_policy_article_id',0), $par->get('privacy_policy',0)==2);
			}

			$document->addScriptDeclaration("jQuery(function(){
				if(document.paymentForm){
					jQuery('.paymentdetails .payment_td .td3 .button:not(.buy-points)').each(function(i, pbutton){
						jQuery(pbutton).click(function(e){
							if(!document.formvalidator.isValid(document.paymentForm)){
								e.preventDefault();
								jQuery('html, body').animate({
									scrollTop: jQuery('#dj-classifieds').offset().top
								}, 500);
							}else{
								jQuery(this).css('pointer-events','none').css('cursor','not-allowed').css('opacity','0.65').css('filter','alpha(opacity=65)').css('box-shadow','none');
							}
						});
					});
				}
			});");
			
			if($type=='prom_top'){
				$item = $model->getItemById($id);
				if(!$item){
					DJClassifiedsSEO::handleItemNotFound();
				}

				$move_top_price_arr = DJClassifiedsPayment::getMoveTopPriceArr($par);
				
				if(DJClassifiedsPayment::isFree($move_top_price_arr['price'], $move_top_price_arr['points'], $par)){
					if(!$user->id){
						DJClassifiedsSEO::redirectLogIn();
					}elseif($item->user_id != $user->id){
						DJCLassifiedsSEO::redirectWrongItem();
					}
			
					DJCLassifiedsPayment::activateMoveToTop($item->id);
			
					$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_PROMOTION_MOVE_TO_TOP_ACTIVATED'), 'success');
					$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('useritems'), false));
				}else{
					$price_total = $move_top_price_arr['price'];
					$points_total = $move_top_price_arr['points'];

					$plugin_payments = $app->triggerEvent('onPreparePaymentList', array(&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), null, 1, &$points_total));
					$plugin_sections = $app->triggerEvent('onPreparePaymentSection', array(&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), null, 1, &$points_total));
					
					$val["id"] = $id;
					$val["total"] = $price_total;
					$val["type"] = 'prom_top';
					$val["direct_payment"] = false;				
					
					$paymentMethodDetails = $app->triggerEvent('onPaymentMethodList', array($val));
			
					$this->item = $item;
					$this->move_top_price_arr = $move_top_price_arr;
					$tpl = 'prom';
				}
			}else if($type=='points'){
				if($user->id == 0){
					DJClassifiedsSEO::redirectLogIn();
				}
				
				$points = $model->getPointsPackage($id);
				$price_total = $points->price;
				$points_total = null;

				$plugin_payments = $app->triggerEvent('onPreparePaymentList', array(&$points, &$par, $type, &$price_total, $par->get('unit_price','EUR'), null, 1, &$points_total));
				$plugin_sections = $app->triggerEvent('onPreparePaymentSection', array(&$points, &$par, $type, &$price_total, $par->get('unit_price','EUR'), null, 1, &$points_total));

				if($points && $price_total==0){
					DJClassifiedsPayment::activatePoints($points, $user->id);
		
					$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_POINTS_PACKAGES_ADDED'), 'success');
					$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('userpoints'), false));
				}
				
				$val["id"] = $id;
				$val["total"] = $price_total;
				$val["type"] = 'points';
				$val["direct_payment"] = false;
			
				$paymentMethodDetails = $app->triggerEvent('onPaymentMethodList', array($val));
					
				$this->points = $points;
				$tpl = 'points';
			
			}else if($type=='plan'){
				if($user->id == 0){
					DJClassifiedsSEO::redirectLogIn();
				}								
				
				$plan = $model->getPlan($id);
				if($plan){
					$has_access = DJClassifiedsAccess::hasAccessToPlan($plan);
				}
				if(!$plan || empty($has_access)){
					$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_WRONG_SUBSCRIPTION_PLAN'), 'error');
					$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('plans'), false));
				}
				
				$plans_plugin = JPluginHelper::getPlugin('djclassifieds', 'plans');
				$plugin_params = new JRegistry($plans_plugin->params);			
		
				$user_active_plans = $model->getUserActivePlans($user->id);
				foreach($user_active_plans as $key => $sub){
					if(!DJClassifiedsPayment::isFree($sub->price, $sub->points, $par) && !$sub->adverts_available){ // removing paid plans with 0 adverts limit to allow renewing them
						unset($user_active_plans[$key]);
					}
				}
				if($plugin_params->get('one_active_plan', '0') && $user_active_plans){
					$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_ONLY_ONE_ACTIVE_PLAN_ALLOWED'), 'warning');
					$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('userplans'), false));
				}
				if(isset($user_active_plans[$plan->id])){
					$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_YOU_ALREADY_HAVE_THIS_PLAN_ACTIVE'), 'warning');
					$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('userplans'), false));
				}
				if($plan->one_time){
					$user_plans = $model->getUserPlans($user->id);
					if(isset($user_plans[$plan->id])){
						$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_PLAN_ALLOWED_ONLY_ONCE'), 'warning');
						$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('userplans'), false));
					}
				}

				$price_total = $plan->price;
				$points_total = $plan->points;
			
				$plugin_payments = $app->triggerEvent('onPreparePaymentList', array(&$plan, &$par, $type, &$price_total, $par->get('unit_price','EUR'), null, 1, &$points_total));
				$plugin_sections = $app->triggerEvent('onPreparePaymentSection', array(&$plan, &$par, $type, &$price_total, $par->get('unit_price','EUR'), null, 1, &$points_total));
			
				if(DJClassifiedsPayment::isFree($price_total, $points_total, $par)){
					$user_plans = $model->getUserActivePlans($user->id);
		
					if(isset($user_plans[$plan->id])){
						$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_YOU_ALREADY_HAVE_THIS_PLAN_ACTIVE'), 'warning');
						$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('userplans'), false));
					}
		
					DJClassifiedsPayment::activatePlan($plan, $user->id);
					$app->triggerEvent('onDJCLassifiedsAfterActivateFreePlan', array($plan));
		
					$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_SUBSCRIPTION_PLAN_ACTIVATED'), 'success');
					$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('userplans'), false));
				}
				
				$val["id"] = $id;
				$val["total"] = $price_total;
				$val["type"] = 'plan';			
				$val["direct_payment"] = false;
				$val["recurring"] = $plan->recurring;
				
				$paymentMethodDetails = $app->triggerEvent('onPaymentMethodList', array($val));
				
				if($plan->recurring){ // displaying only plugins supporting recurring payments
					foreach($paymentMethodDetails as $key => $pm){
						if(strpos($pm, 'data-recurring') === false){
							unset($paymentMethodDetails[$key]);
						}
					}
					if(!$paymentMethodDetails){
						$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_NO_PAYMENT_METHODS_FOR_RECURRING_PLANS_INFO'), 'warning');
					}
					$points_total = null;
				}
			
				$this->plan = $plan;
				$tpl = 'plan';
			
			}else if($type=='order'){
				if(!$user->id){
					DJClassifiedsSEO::redirectLogIn();
				}

				$order = $model->getOrder($id);
				if(!$order || $order->user_id != $user->id){
					DJClassifiedsSEO::redirectWrongItem();
				}

				$item = $model->getItemById($order->item_id);
				$item_images = DJClassifiedsImage::getAdsImages($item->id);				
				
				$price_total = $order->quantity * $order->price;
				$points_total = null;
				
				$plugin_payments = $app->triggerEvent('onPreparePaymentList', array(&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), $order, $order->quantity, &$points_total));
				$plugin_sections = $app->triggerEvent('onPreparePaymentSection', array(&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), $order, $order->quantity, &$points_total));
				
				$val["id"] = $id;
				$val["quantity"] = $order->quantity;
				$val["price"] = $order->price;				
				$val["total"] = $price_total;
				$val["type"] = 'order';

				$direct_payment_id = DJClassifiedsPayment::getUserPaypal($item->user_id);

				$val["direct_payment"] = $par->get('buynow_direct_payment', 0); // backward compatibility
				$val["payment_email"] = $direct_payment_id; // backward compatibility
				
				$paymentMethodDetails = $app->triggerEvent('onPaymentMethodList', array($val));
				foreach($paymentMethodDetails as $key => $pm){
					if($par->get('buynow_direct_payment', 0) == 0 || strpos($pm, 'data-direct') === false || !$direct_payment_id){
						unset($paymentMethodDetails[$key]);
					}
				}
			
				$this->item = $item;
				$this->order = $order;				
				$this->item_images = $item_images;
				$this->quantity = $order->quantity;
				$tpl = 'order';
			
			}else if($type=='offer'){
				if(!$user->id){
					DJClassifiedsSEO::redirectLogIn();
				}

				$offer = $model->getOffer($id);
				if(!$offer || $offer->user_id != $user->id){
					DJClassifiedsSEO::redirectWrongItem();
				}

				$item = $model->getItemById($offer->item_id);
				$item_images = DJClassifiedsImage::getAdsImages($item->id);				
				
				$price_total = $offer->price;
				$points_total = null;
			
				$plugin_payments = $app->triggerEvent('onPreparePaymentList', array (&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), $offer, $offer->quantity, &$points_total));
				$plugin_sections = $app->triggerEvent('onPreparePaymentSection', array (&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), $offer, $offer->quantity, &$points_total));
				
				$val["id"] = $id;
				$val["quantity"] = $offer->quantity;
				$val["price"] = $offer->price;				
				$val["total"] = $price_total;
				$val["type"] = 'offer';

				$direct_payment_id = DJClassifiedsPayment::getUserPaypal($item->user_id);

				$val["direct_payment"] = true; // backward compatibility
				$val["payment_email"] = $direct_payment_id; // backward compatibility
				
				$paymentMethodDetails = $app->triggerEvent('onPaymentMethodList', array($val));
				foreach($paymentMethodDetails as $key => $pm){
					if(strpos($pm, 'data-direct') === false || !$direct_payment_id){
						unset($paymentMethodDetails[$key]);
					}
				}
						
				$this->item = $item;
				$this->offer = $offer;				
				$this->item_images = $item_images;
				$this->quantity = $offer->quantity;
				$tpl = 'offer';
			
			}elseif($type == ''){
				$item = $model->getItemById($id);
				if(!$item){
					DJClassifiedsSEO::handleItemNotFound();
				}
			
				$promotions = $model->getPromotionsPrices();
				$categories = $model->getCategories();
			
				$duration = null;
				if(strstr($item->pay_type, 'duration_renew') || strstr($item->pay_type, 'duration')){
					$duration = $model->getDuration($item->exp_days, $item->cat_id, $item->user_id);
					if(!$duration){
						$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_WRONG_DURATION_LIMIT'), 'error');
						$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('useritems'), false));
					}
				}

				$itype = null;
				if(strstr($item->pay_type, 'type')){
					$itype = DJClassifiedsPayment::getTypePrice($item->user_id, $item->type_id);
				}
			
				$item_price_det = DJClassifiedsPayment::getItemPriceDetails($item);
				$price_total = $item_price_det['price_total'];
						
				$points_extra = 0;
				$app->triggerEvent('onPreparePaymentListExtraPoints', array (&$item, &$par, $type, &$points_extra));
				$points_total = $item_price_det['points_total'] + $points_extra;
				
				$plugin_payments = $app->triggerEvent('onPreparePaymentList', array (&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), '', 1, &$points_total));
				$plugin_sections = $app->triggerEvent('onPreparePaymentSection', array (&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), '', 1, &$points_total));
					
				$val["id"] = $id;
				$val["total"] = $price_total;
				$val["type"] = '';
				$val["direct_payment"] = false;
				
				$paymentMethodDetails = $app->triggerEvent('onPaymentMethodList', array($val));
			
				$this->item = $item;
				$this->duration = $duration; // view backward compatibility
				$this->promotions = $promotions;
				$this->itype = $itype; // view backward compatibility
				$this->categories = $categories;
				$this->points_extra = $points_extra; // view backward compatibility
				$this->points_total = $points_total;
				$this->item_price_det = $item_price_det;
				
				$pre_edit_page = $app->getUserState('djcf.pre_edit_page');
				$this->back_to_edit_link = null;
				if(!($pre_edit_page && $pre_edit_page['view'] == 'useritems')){
					if($this->item->user_id && $user->id){
						$this->back_to_edit_link = DJClassifiedsSEO::getViewUri('additem').'&id='.$this->item->id;
					}else if($this->item->token && $par->get('guest_can_edit','1')=='1'){
						$this->back_to_edit_link = DJClassifiedsSEO::getViewUri('additem').'&token='.$this->item->token;
					}
				}

			}else{
				$tpl = 'other';
				$item = new stdClass();
				$val = array();
				$price_total = null;
				$points_total = null;
				$app->triggerEvent('onDJClassifiedsPrepareOtherPayment', array(&$item, &$par, &$tpl, &$price_total, &$val, &$points_total));
				$plugin_payments = $app->triggerEvent('onPreparePaymentList', array (&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), '', 1, &$points_total));
				$plugin_sections = $app->triggerEvent('onPreparePaymentSection', array (&$item, &$par, $type, &$price_total, $par->get('unit_price','EUR'), '', 1, &$points_total));
				$paymentMethodDetails = $app->triggerEvent('onPaymentMethodList', array($val));
				$this->item = $item;
			}

			$paymentMethodDetails = array_filter($paymentMethodDetails);
			if(($par->get('points',0)==2 && !in_array($type, array('points','order','offer'))) || ($points_total && !$price_total)){
				foreach($paymentMethodDetails as $key => $pm){
					if(strpos($pm, 'ptype=djcfaltauserpoints') === false && strpos($pm, 'data-points') === false){
						unset($paymentMethodDetails[$key]);
					}
				}
			}
			
			$user_points = $model->getUserPoints();
				
			$this->price_total = $price_total;
			$this->points_total = $points_total;
			$this->price_net = $par->get('vat_value','-1')>-1 ? round($this->price_total/(1+($par->get('vat_value','-1')*0.01)),2) : null;
			$this->PaymentMethodDetails = $paymentMethodDetails;
			$this->user_points = $user_points;
			$this->plugin_payments = $plugin_payments;
			$this->plugin_sections = $plugin_sections;
			$this->dispatcher = new DJClassifiedsDispatcher(); // backward compatibility
			$this->par = $par;

			$jview = $this;
			$app->triggerEvent('onDJClassifiedsAfterPreparePaymentList', array(&$item, &$par, $type, &$tpl, &$jview));
			$app->triggerEvent('onBeforeShowPaymentsList', array(&$par)); // backward compatibility
		}

		DJClassifiedsSEO::setSiteNameInPageTitle();

		parent::display($tpl);
	}
}

Anon7 - 2022
AnonSec Team