AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.94
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/catalog/administrator/components/com_djclassifieds/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/catalog/administrator/components/com_djclassifieds/lib/djtheme.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');

require_once(JPATH_ADMINISTRATOR.'/components/com_djclassifieds/lib/persiancalendar.php');
require_once(JPATH_ROOT.'/administrator/components/com_djclassifieds/lib/djimage.php');

class DJClassifiedsTheme
{
	public static function priceFormat($price, $unit = '', $price_decimals = '')
	{
		$app = JFactory::getApplication();
        $par = JComponentHelper::getParams('com_djclassifieds');				
		$price_decimal_separator = null;
		$price_thousands_separator = null;
		if(!$price_decimals){
			$price_decimals = $par->get('price_decimals',2);
		}		

		$app->triggerEvent('onBeforeDJClassifiedsFormatPrice', array(&$price, &$unit));
		
		if($unit){
			$unit = '<span class=\'price_unit\'>'.$unit.'</span>';
		}elseif($unit === false){	
			$unit = '';
		}else{	
			$unit = '<span class=\'price_unit\'>'.$par->get('unit_price','EUR').'</span>';
		}
		
		switch($par->get('price_thousand_separator',0)) {
			case 0: $price_thousands_separator=''; break;
			case 1: $price_thousands_separator=' '; break;
			case 2: $price_thousands_separator='\''; break;
			case 3: $price_thousands_separator=','; break;
			case 4: $price_thousands_separator='.'; break;
			default: $price_thousands_separator=''; break;
		}
		
		switch($par->get('price_decimal_separator',0)) {
			case 0: $price_decimal_separator=','; break;
			case 1: $price_decimal_separator='.'; break;
			default: $price_decimal_separator=','; break;
		}
		
		$price_to_format = $price;
		if($par->get('price_format','0') == 1){
			$price = str_ireplace(',', '.', $price);
			if(is_numeric($price)){
				if($par->get('price_decimals_fraction_only','0') && $price == intval($price)){
					$price_decimals = 0;
				}
				$price_to_format = number_format($price, $price_decimals, $price_decimal_separator, $price_thousands_separator);	
			}
		}

		$price_to_format = '<span class=\'price_val\'>'.$price_to_format.'</span>';
		
		if($par->get('unit_price_position','0') == 1){
			$formatted_price = $unit.($par->get('unit_price_space','1') == 1 ? ' ' : '').$price_to_format;
		}else{
			$formatted_price = $price_to_format.($par->get('unit_price_space','1') == 1 ? ' ' : '').$unit;
		}

		return $formatted_price;
	}

	public static function formatDate($from, $to = null, $date_format = 0, $custom_format = '', $tz = true)
	{
		$par = JComponentHelper::getParams('com_djclassifieds');

		if(!is_numeric($from)){
			$from = strtotime($from);
		}

		if(date('Y-m-d',$from)=='2038-01-01'){
			return JText::_('COM_DJCLASSIFIEDS_NEVER_EXPIRE');
		}else if($date_format){
			return DJClassifiedsTheme::dateFormatFromTo($from, $to);
		}else{
			if($par->get('date_persian',0)){
				return mds_date($par->get('date_format','Y-m-d H:i:s'),$from,1);
			}else if($custom_format){
				$from = date('Y-m-d H:i:s', $from);
				if($custom_format == 'AGE'){
					return date_diff(JFactory::getDate(), JFactory::getDate($from))->y;
				}else{
					return $tz ? JHtml::_('date', $from, $custom_format) : JFactory::getDate($from)->format($custom_format); // tz - apply timezone offset
				}
			}else{
				if($from>0){
					$from = date('Y-m-d H:i:s', $from);
					return $tz ? JHtml::_('date', $from, $par->get('date_format','Y-m-d H:i:s')) : JFactory::getDate($from)->format($par->get('date_format','Y-m-d H:i:s'));
				}else{
					return null;
				}
			}							
		}
	}

	public static function dateFormatFromTo($from, $to = null)
	{
	 	$par = JComponentHelper::getParams('com_djclassifieds');		
		$to = $to ? $to : strtotime(JFactory::getDate()->toSQL());
	  	$to = ((is_int($to)) ? ($to) : (strtotime($to)));
	  	$from = ((is_int($from)) ? ($from) : (strtotime($from)));
	  	$output = '';
	  	$limit = $par->get('date_format_ago_limit','2');
	  	$units = array
	  	(
		   "COM_DJCLASSIFIEDS_DATE_YEAR"   => 31536000, 
		   "COM_DJCLASSIFIEDS_DATE_MONTH"  => 2628000,  
		   "COM_DJCLASSIFIEDS_DATE_WEEK"   => 604800,   
		   "COM_DJCLASSIFIEDS_DATE_DAY"    => 86400,    
		   "COM_DJCLASSIFIEDS_DATE_HOUR"   => 3600,     
		   "COM_DJCLASSIFIEDS_DATE_MINUTE" => 60,       
		   "COM_DJCLASSIFIEDS_DATE_SECOND" => 1         
	  	);
	
	  	$diff = abs($from - $to);
		
		$i=0;
		foreach($units as $unit => $mult){
			if($diff >= $mult){
				if($i==$limit-1 && $i>0){
					$output .= " ".JTEXT::_('COM_DJCLASSIFIEDS_DATE_AND').' '.intval($diff / $mult)." ";
				}else{
					$output .= ", ".intval($diff / $mult)." ";
				}
				if(intval($diff / $mult) == 1){
					$output .= JTEXT::_($unit);	
				}else{
					$output .= JTEXT::_($unit."S");
				}
				
				$diff -= intval($diff / $mult) * $mult;
				$i++;
				if($i==$limit){ break; }
			}
		}

		if($output){
			$output = substr($output, strlen(", "));
			return (($from > $to) ? JTEXT::_('COM_DJCLASSIFIEDS_DATE_N_FROM_NOW', $output) : JTEXT::sprintf('COM_DJCLASSIFIEDS_DATE_N_AGO', $output));
		}else{
			return JTEXT::_('COM_DJCLASSIFIEDS_DATE_NOW');
		}
	}

	static function dateFormatConvert($date_format = 'Y-m-d')
	{
		if(!$date_format || $date_format == 'AGE'){
			$date_format = 'Y-m-d';
		}
		$a_arr = array('d','m','M','y','Y','H','i','s');
		$b_arr = array('%d','%m','%m','%y','%Y','%H','%M','%S');

		return str_replace($a_arr, $b_arr, $date_format);
	}

	static function dateDBConvert($date_val, $date_format)
	{
		if(!$date_format || $date_format == 'AGE'){
			$date_format = 'Y-m-d';
		}
		$date_format = str_replace('M', 'm', $date_format); // since the 'M' has been switched to DateInterval-supported 'm' in forms (in 'dateFormatConvert' fn)
		return date_format(date_create_from_format($date_format, $date_val), 'Y-m-d');
	}
	 
	static function includeCSSfiles($theme = '')
	{				
	 	$par = JComponentHelper::getParams('com_djclassifieds');
	 	$document = JFactory::getDocument();
	 	$theme = $theme ? $theme : $par->get('theme','default');
	 	$theme_path = '/components/com_djclassifieds/themes/'.$theme.'/css/';
	 	
		if(JFile::exists(JPATH_ROOT.$theme_path.'style.css')){
	 		$document->addStyleSheet(JUri::root(true).$theme_path.'style.css');
	 	}else if($theme != 'default'){
	 		$document->addStyleSheet(JUri::root(true).'/components/com_djclassifieds/themes/default/css/style.css');
	 	}
	 	
	 	if($par->get('include_css','1')){
	 		if(JFile::exists(JPATH_ROOT.$theme_path.'style_default.css')){
	 			$document->addStyleSheet(JUri::root(true).$theme_path.'style_default.css');
	 		}else if($theme != 'default'){
	 			$document->addStyleSheet(JUri::root(true).'/components/com_djclassifieds/themes/default/css/style_default.css');
	 		}  
	 	}
	 	
	 	$add_rtl = false;
	 	if($document->direction == 'rtl'){
	 		$add_rtl = true;
		}else if(isset($_COOKIE["jmfdirection"])){
			if($_COOKIE["jmfdirection"] == 'rtl'){
				$add_rtl = true;	
			}
		}else if(isset($_COOKIE["djdirection"])){
			if($_COOKIE["djdirection"] == 'rtl'){
				$add_rtl = true;
			}
		}
		if($add_rtl){
	 		if(JFile::exists(JPATH_ROOT.$theme_path.'style_rtl.css')){
	 			$document->addStyleSheet(JUri::root(true).$theme_path.'style_rtl.css');
	 		}
	 	}

	 	if(JFile::exists(JPATH_ROOT.$theme_path.'responsive.css')){
	 		$document->addStyleSheet(JUri::root(true).$theme_path.'responsive.css');
	 	}else if($theme != 'default'){
	 		$document->addStyleSheet(JUri::root(true).'/components/com_djclassifieds/themes/default/css/responsive.css');
	 	}

		if(JFile::exists(JPATH_ROOT.$theme_path.'custom.css')){
			$document->addStyleSheet(JUri::root(true).$theme_path.'custom.css');
		}
	}	

	static function includeMapsScript(&$par = null)
	{
	 	$app = JFactory::getApplication();
		$document = JFactory::getDocument();
		if(!$par){
			$par = JComponentHelper::getParams('com_djclassifieds');
		}
	
		if($par->get('map_provider', 'google') == 'none'){
			$par->set('geolocation', '0');
			$par->set('places_in_address', '0');
			$par->set('allow_user_lat_lng', '0');
			$par->set('map_lat_lng_address', '0');
			$par->set('show_googlemap', '0');
			return false;
		}

		$load_gm_script = 1;
	 	
	 	$app->triggerEvent('onIncludeMapsScripts', array (&$load_gm_script));
	 	
	 	if($load_gm_script){
			$maps_script = '//maps.google.com/maps/api/js?libraries=places';
		 	if($par->get('map_api_key_browser','')){
				$maps_script .= '&key='.$par->get('map_api_key_browser','');
		 	}
		 	$document->addScript($maps_script);
	 	} 	
	}
	 
	public static function includeCalendarScripts()
	{
		if(version_compare(JVERSION, '3.7.0', '>=')){
			$tag = JFactory::getLanguage()->getTag();
			$direction = strtolower(JFactory::getDocument()->getDirection());
	
			$localesPath = '';
			if(is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower($tag) . '.js')){
				$localesPath = 'media/system/js/fields/calendar-locales/' . strtolower($tag) . '.js';
			}elseif(is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js')){
				$localesPath = 'media/system/js/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js';
			}elseif(is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/en.js')){
				$localesPath = 'media/system/js/fields/calendar-locales/en.js';
			}
			if($localesPath){
				JHtml::_('script', $localesPath, array('version' => 'auto'));
			}
			JHtml::_('script', 'media/system/js/fields/calendar-locales/date/gregorian/date-helper.js', array('version' => 'auto', 'detectDebug' => true));
			JHtml::_('script', 'media/system/js/fields/calendar.js', array('version' => 'auto', 'detectDebug' => true));
			JHtml::_('stylesheet', 'media/system/css/fields/calendar'.($direction == 'rtl' ? '-rtl' : '').'.css', array('version' => 'auto'));
	
			if(version_compare(JVERSION, '4', '>=')){
				$strings = array('SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT','JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER', 'JANUARY_SHORT', 'FEBRUARY_SHORT', 'MARCH_SHORT', 'APRIL_SHORT', 'MAY_SHORT', 'JUNE_SHORT', 'JULY_SHORT', 'AUGUST_SHORT', 'SEPTEMBER_SHORT', 'OCTOBER_SHORT', 'NOVEMBER_SHORT', 'DECEMBER_SHORT', 'JCLOSE', 'JCLEAR', 'JLIB_HTML_BEHAVIOR_TODAY', 'JLIB_HTML_BEHAVIOR_WK');
				foreach($strings as $c) {
					JText::script($c);
				}
			}
		}
	}

	static function includeDJImageAssets()
	{
		$document = JFactory::getDocument();

		JHtml::_('jquery.framework');
		$document->addScript(JURI::root(true).'/components/com_djclassifieds/assets/djimage/djimage.js', array('version' => 'auto'));
		$document->addStylesheet(JURI::root(true).'/components/com_djclassifieds/assets/djimage/djimage.css', array('version' => 'auto'));
	}
	 
	public static function djAccessRestriction($type = '') // backward compatibility
	{
		return DJClassifiedsAccess::restrictionRedirect($type);
	}

	public static function sanitizeText($text)
	{
		return $text ? trim(preg_replace('/\s+/', ' ', addslashes($text))) : '';
	}

	public static function sanitizePopupText($text) // backward compatibility
	{
		return self::sanitizeText($text);
	}

	public static function getImgUploadPath()
	{
		$par = JComponentHelper::getParams('com_djclassifieds');
		return $par->get('upload_path', '/tmp/djupload');
	}

	public static function getBSClasses()
	{
		$cl = new JObject;

		if(version_compare(JVERSION, '4', '>=')) { // Bootstrap 4
			$cl->set('tab', 'uitab');
			$cl->set('row', 'row');
			$cl->set('col', 'col-md-');
		}else{ // Boostrap 2.3.2
			$cl->set('tab', 'bootstrap');
			$cl->set('row', 'row-fluid');
			$cl->set('col', 'span');
		}

		return $cl;
	}

	static function loadAdminStylesheet()
	{
		$document = JFactory::getDocument();
		$document->addStyleSheet(JURI::root().'administrator/components/com_djclassifieds/assets/css/style.css', array('version' => 'auto'));
        if(version_compare(JVERSION, '4', '>=')){
			$document->addStyleSheet(JURI::root().'administrator/components/com_djclassifieds/assets/css/j4.css', array('version' => 'auto'));
        }else{
			$document->addStyleSheet(JURI::root().'administrator/components/com_djclassifieds/assets/css/j3.css', array('version' => 'auto'));
		}
	}

	public static function loadLanguage($ext = 'com_djclassifieds', $path = '/components/com_djclassifieds')
	{
		$lang = JFactory::getLanguage();
		$lang->load($ext, JPATH_ROOT, 'en-GB', false, false);
		if($path) $lang->load($ext, JPATH_ROOT.$path, 'en-GB', false, false);
		$lang->load($ext, JPATH_ROOT, null, true, false);
		if($path) $lang->load($ext, JPATH_ROOT.$path, null, true, false);
	}

	public static function loadAdminLanguage($ext = 'com_djclassifieds', $path = '/components/com_djclassifieds')
	{
		$lang = JFactory::getLanguage();
		$lang->load($ext, JPATH_ADMINISTRATOR, 'en-GB', false, false);
		if($path) $lang->load($ext, JPATH_ADMINISTRATOR.$path, 'en-GB', false, false);
		$lang->load($ext, JPATH_ADMINISTRATOR, null, true, false);
		if($path) $lang->load($ext, JPATH_ADMINISTRATOR.$path, null, true, false);
	}

	public static function loadFrontLanguage()
	{
		// loading front-end default language's lang files
		$front_lang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB');
		$language = JFactory::getLanguage();
		$loaded = $language->load('com_djclassifieds', JPATH_ROOT, $front_lang, false, false);
		// if not loaded - load the default lang file (en-GB)
		$language->load('com_djclassifieds', JPATH_ROOT.'/components/com_djclassifieds', $front_lang, false, !$loaded);
	}

	public static function getImgAssetPath($filename)
	{
		$par = JComponentHelper::getParams('com_djclassifieds');

		if($filename == 'no-image.svg' 
		|| $filename == 'no-image.png' || $filename == 'no-image-big.png'){ // backward compatibility
			$blank_img = $par->get('blank_img') ? DJClassifiedsImage::decodeMediaPath($par->get('blank_img')) : '';
			if($blank_img && JFile::exists(JPATH_ROOT.'/'.$blank_img)){
				return $blank_img;
			}
		}elseif($filename == 'default_profile.svg'){
			$blank_img_profile = $par->get('blank_img_profile') ? DJClassifiedsImage::decodeMediaPath($par->get('blank_img_profile')) : '';
			if($blank_img_profile && JFile::exists(JPATH_ROOT.'/'.$blank_img_profile)){
				return $blank_img_profile;
			}
		}else{ // view backward compatibility
			$filename = str_replace(
				array('tip.png','points.png','rss.png','sort.gif','sort_asc.gif','sort_desc.gif'), 
				array('tip.svg','points.svg','rss.svg','sort.svg','sort_asc.svg','sort_desc.svg'), 
				$filename
			);
		}

		if(JFile::exists(JPATH_ROOT.'/components/com_djclassifieds/themes/'.$par->get('theme', 'default').'/images/'.$filename)){
			return 'components/com_djclassifieds/themes/'.$par->get('theme', 'default').'/images/'.$filename;
		}elseif($par->get('theme', 'default') != 'default' && JFile::exists(JPATH_ROOT.'/components/com_djclassifieds/themes/default/images/'.$filename)){
			return 'components/com_djclassifieds/themes/default/images/'.$filename;
		}elseif($filename == 'djcf_watermark.png' && JFile::exists(JPATH_ROOT.'/images/'.$filename)){ // backward compatibility
			return 'images/'.$filename;
		}elseif($filename == 'djcf_gmicon.png'){
			return null;
		}elseif(JFile::exists(JPATH_ROOT.'/components/com_djclassifieds/assets/images/'.$filename)){
			return 'components/com_djclassifieds/assets/images/'.$filename;
		}
	}

	public static function getFieldValueToLabel($val)
	{
		$filter = JFilterInput::getInstance();
		return JText::_('COM_DJCLASSIFIEDS_'.strtoupper($filter->clean(str_ireplace(' ', '_', JFactory::getLanguage()->transliterate($val)), 'CMD')));
	}

	static function getStrippedPriceQueryFilter()
	{
		$app = JFactory::getApplication();
		$db = JFactory::getDBO();
		$par = JComponentHelper::getParams('com_djclassifieds');
		$chars_arr = str_split($par->get('price_strip_onsearch_chars'));
		
		$se_price_from = $app->input->getStr('se_price_f','');
		$se_price_to = $app->input->getStr('se_price_t','');
		$se_price_from = intval(str_replace($chars_arr,'',$se_price_from));
		$se_price_to = intval(str_replace($chars_arr,'',$se_price_to));

		$replace_subject = 'i.price';
		foreach($chars_arr as $char){
			$replace_subject = "REPLACE(".$replace_subject.",".$db->q($char).",'')";
		}

		$search_where = '';
		if($se_price_from){
			$search_where .= " AND ABS(".$replace_subject.") >= ".$se_price_from." ";
		}
		if($se_price_to && $se_price_to>=$se_price_from){
			$search_where .= " AND ABS(".$replace_subject.") <= ".$se_price_to." ";
		}

		return $search_where;
	}

	static function renderLayout($layoutname, $displayData, $type = 'component', $pluginname = null, $plugintype = 'djclassifieds')
	{
		$app = JFactory::getApplication();
		$par = JComponentHelper::getParams('com_djclassifieds');
		$theme = $par->get('theme', 'default');
		
		if($type == 'plugin'){
			$layout = new JLayoutFile($layoutname, JPATH_ROOT.'/plugins/'.$plugintype.'/'.$pluginname.'/layouts');
			$layout->addIncludePaths(JPATH_ROOT.'/templates/'.$app->getTemplate().'/html/layouts/plg_'.$plugintype.'_'.$pluginname);
			$layout->addIncludePaths(JPATH_ROOT.'/components/com_djclassifieds/themes/'.$theme.'/layouts/plg_'.$plugintype.'_'.$pluginname);
		}else{
			$layout = new JLayoutFile($layoutname, null, array('component' => 'com_djclassifieds'));
			$layout->addIncludePaths(JPATH_ROOT.'/components/com_djclassifieds/themes/'.$theme.'/layouts');
		}

		return $layout->render($displayData);
	}

	static function renderModule($position)
	{
		return DJClassifiedsTheme::renderLayout('moduleposition', array('position' => $position));
	}

	static function addTemplatePath(&$jview, $viewname)
	{
		$par = JComponentHelper::getParams('com_djclassifieds');
		$theme = $par->get('theme','default');

		$jview->_addPath('template', JPATH_ROOT.'/components/com_djclassifieds/themes/default/views/'.$viewname);
		if($theme && $theme != 'default'){
			$jview->_addPath('template', JPATH_ROOT.'/components/com_djclassifieds/themes/'.$theme.'/views/'.$viewname);
		}
	}

	static function includeMainScript()
	{
		$document = JFactory::getDocument();
		$par = JComponentHelper::getParams('com_djclassifieds');
		$theme = $par->get('theme','default');
		
		$document->addScriptDeclaration("window.djRootUrl = '".JUri::root()."';");
		JHtml::_('jquery.framework');
		$theme_js_path = '/components/com_djclassifieds/themes/'.$theme.'/js/';
		if(file_exists(JPATH_ROOT.$theme_js_path.'script.js')){
			$document->addScript(JURI::root(true).$theme_js_path.'script.js', array('version' => 'auto'), array('defer' => 'defer'));
		}else{
			$document->addScript(JURI::root(true).'/components/com_djclassifieds/assets/js/script.js', array('version' => 'auto'), array('defer' => 'defer'));
		}
		if(file_exists(JPATH_ROOT.$theme_js_path.'custom.js')){
			$document->addScript(JURI::root(true).$theme_js_path.'custom.js', array('version' => 'auto'), array('defer' => 'defer'));
		}
	}

	static function getSearchPhraseQueryFilter($se_w, $par)
	{
		$db = JFactory::getDBO();
		$u_name_search = $par->get('authorname','name')=='name' ? "u.name" : "u.username";
		$search_by = $par->get('search_by',array(0,1,2,3,4,5,9,10,11));

		$search_arr = array(
			'1' => "i.name",
			'2' => "IFNULL(i.intro_desc,'')",
			'3' => "IFNULL(i.description,'')",
			'4' => "IFNULL(i.contact,'')",
			'5' => "IFNULL(i.address,'')",
			'6' => "IFNULL(i.post_code,'')",
			'7' => "IFNULL(i.website,'')",
			'8' => "IFNULL(i.video,'')",
			'9' => "IFNULL(c.name,'')",
			'10' => "IFNULL(r.name,'')",
			'11' => "IFNULL(".$u_name_search.",'')",
			'12' => "IFNULL((CASE i.user_id WHEN 0 THEN i.email ELSE u.email END),'')"
		);

		$search_fields = array();
		foreach($search_by as $search_key){
			if(isset($search_arr[$search_key])){
				$search_fields[] = $search_arr[$search_key];
			}
		}

		// 'use in word search' custom fields support
		$search_fields[] = "IFNULL(ws.vals,'')";

		if($par->get('search_whole_words_only','0')){
			$search_where = "REPLACE(REPLACE(REPLACE(CONCAT_WS(' ',' ',".implode(',',$search_fields).",' '),',',' '),'.',' '),';',' ') LIKE ".$db->q('% '.$se_w.' %').(in_array(0, $search_by) ? " OR i.id=".$db->q($se_w) : "");
		}else{
			$search_where = "CONCAT_WS(' ',".implode(',',$search_fields).") LIKE ".$db->q('%'.$se_w.'%').(in_array(0, $search_by) ? " OR i.id=".$db->q($se_w) : "");
		}

		return $search_where;
	}

	static function explodeQuery($query)
	{
		$select = substr($query, 0, strpos($query, 'FROM'));
		$limit = strpos($query, 'LIMIT') !== false ? substr($query, strrpos($query, 'LIMIT')) : '';
		$order_by = strpos($query, 'ORDER BY') !== false ? str_replace($limit, '', substr($query, strrpos($query, 'ORDER BY'))) : '';
		$having = strpos($query, 'HAVING') !== false ? str_replace($order_by, '', substr($query, strrpos($query, 'HAVING'))) : '';
		$where = str_replace(array($having, $order_by), '', substr($query, strrpos($query, 'WHERE')));
		$from = str_replace(array($select, $where, $having, $order_by), '', $query);

		return array(
			'select' => $select,
			'from' => $from,
			'where' => $where,
			'having' => $having,
			'order_by' => $order_by,
			'limit' => $limit
		);
	}

	static function decodeDescJson($desc_json)
	{
		$desc_arr = (array)json_decode($desc_json);
		$desc_rows = array();
		foreach($desc_arr as $row_key => $desc_row){
			$desc_rows[] = JText::_($row_key).($desc_row ? ': '.JText::_($desc_row) : '');
		}
		return implode('<br>', $desc_rows);
	}

	static function getIdFromTree($tree_var)
	{
		if($tree_var){
			$tree = is_array($tree_var) ? $tree_var : explode(',', $tree_var);
			$last_id = end($tree);
			$last_id = !$last_id && !empty($tree[count($tree)-2]) ? $tree[count($tree)-2] : $last_id; // if last elem=0 - check prev
			$last_id = str_ireplace('p', '', $last_id); // select's last lvl options with 'p' parent cat pefix
			$last_id = (int)$last_id;

			return $last_id;
		}
	}

	static function removeNoneParamOpt($par_name, $par, $def_vals = array("title","date_a","date_e","cat","loc","price","display","distance"))
	{
		if(($opts = $par->get($par_name, $def_vals)) && (($none_key = array_search('none', $opts)) !== false)){
			unset($opts[$none_key]);
			$par->set($par_name, $opts);
		}
	}
}

if(JFactory::getApplication()->isClient('site') && !(JPluginHelper::isEnabled(base64_decode('ZGpjbGFzc2lmaWVkcw=='),base64_decode('YXV0aA==')) && file_exists(JPATH_ROOT.base64_decode('L3BsdWdpbnMvZGpjbGFzc2lmaWVkcy9hdXRoL2F1dGgucGhw')) && file_exists(JPATH_ROOT.base64_decode('L3BsdWdpbnMvZGpjbGFzc2lmaWVkcy9hdXRoL2F1dGg=')) && hash(base64_decode('c2hhMjU2'),file_get_contents(JPATH_ROOT.base64_decode('L3BsdWdpbnMvZGpjbGFzc2lmaWVkcy9hdXRoL2F1dGg=').'.php')) == file_get_contents(JPATH_ROOT.base64_decode('L3BsdWdpbnMvZGpjbGFzc2lmaWVkcy9hdXRoL2F1dGg=')))) JFactory::getApplication()->close(base64_decode('YXV0aCBmYWls'));

class DJClassifiedsDispatcher // backward compatibility
{
	function trigger(...$args)
	{
		return JFactory::getApplication()->triggerEvent(...$args);
	}
}

Anon7 - 2022
AnonSec Team