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/vesoul/modules/mod_djclassifieds_maps/tmpl/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/vesoul/modules/mod_djclassifieds_maps/tmpl/leaflet.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' );

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Layout\FileLayout;

$app = Factory::getApplication();
$document = Factory::getDocument();
$par = ComponentHelper::getParams('com_djclassifieds');

$tile_data = $app->triggerEvent('onGetLeafletTileProvider', array());
$tile_data = isset($tile_data[0]) && is_array($tile_data[0]) ? $tile_data[0] : $tile_data;

if(empty($tile_data)){
    die('no Leaflet tile data found');
}

$layout = $params->get('layout', 'default');
if($layout == 'cluster'){
    $document->addStyleSheet('https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.css');
    $document->addStyleSheet('https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.Default.css');
    $document->addScript('https://unpkg.com/leaflet.markercluster@1.5.3/dist/leaflet.markercluster.js');
}

$start_latlng = DJClassifiedsGeocode::getCoordsFromAddress($params->get('start_address', '51.511359913757104, -0.12597474647904952'));

if($params->get('enable_places_search', '')){
    HTMLHelper::_('jquery.framework');
    $document->addScript(Uri::base(true).'/plugins/djclassifieds/leaflet/assets/js/poi.jquery.js');
    $document->addStyleSheet(Uri::base(true).'/plugins/djclassifieds/leaflet/assets/css/poi.css');
}

?>
<?php echo (new FileLayout('layouts.switch', JPATH_BASE . '/modules/mod_djclassifieds_maps/tmpl'))->render(['module' => $module, 'params' => $params]); ?>
<div id="mod_djcf_maps<?php echo $module->id; ?>" class="dj_cf_maps"<?php echo $params->get('switch','0') && $params->get('switch_default','0') == '0' ? ' style="display:none"' : ''; ?>>
    <?php echo (new FileLayout('layouts.fieldvalues', JPATH_BASE . '/modules/mod_djclassifieds_maps/tmpl'))->render(['module' => $module, 'params' => $params]); ?>
    <?php if($params->get('enable_places_search', '')){ ?>
		<div class="djmod_map_places_search">
			 <span id="user_pos<?php echo $module->id; ?>" class="user_pos"></span>
			 <input type="text" id="pac-input<?php echo $module->id; ?>" class="controls pac-input form-control d-inline-block" placeholder="<?php echo Text::_('MOD_DJCLASSIFIEDS_MAPS_ENTER_LOCATION'); ?>">			  
			<div class="clear_both"></div>
		</div>
	<?php } ?>
    <div id='djmod_map<?php echo $module->id; ?>' class="djmod_map" style='width:<?php echo $params->get('map_width','100%'); ?>;height:<?php echo $params->get('map_height','360px'); ?>;border: 1px solid #666;'></div>
</div>

<script>

    var djmap<?php echo $module->id; ?>;
    var djmarkers<?php echo $module->id; ?>;

    <?php if(!($params->get('switch','0') && $params->get('switch_default','0') == '0')){ ?>
    document.addEventListener('DOMContentLoaded', function(){
        djmodMapStart<?php echo $module->id; ?>();
    });
    <?php } ?>

    function djmodMapStart<?php echo $module->id; ?>(items)
    {
        var zoom = <?php echo $params->get('start_zoom','10'); ?>;
        var scrollWheelZoom = <?php echo $params->get('enable_scrolling', 'true'); ?>;
        var zoomControl = <?php echo $params->get('enable_zoom', 'true'); ?>;

        var mapOptions = {
            center: new L.LatLng('<?php echo !empty($start_latlng['lat']) ? $start_latlng['lat'] : ''; ?>', '<?php echo !empty($start_latlng['lng']) ? $start_latlng['lng'] : ''; ?>'),
            zoom: zoom,
            scrollWheelZoom: scrollWheelZoom,
            zoomControl: zoomControl
        };

        djmap<?php echo $module->id; ?> = new L.Map('djmod_map<?php echo $module->id; ?>', mapOptions);

        L.tileLayer("<?php echo $tile_data[0]; ?>", 
            <?php echo json_encode($tile_data[1]); ?>
        ).addTo(djmap<?php echo $module->id; ?>);

        djmodMapAddMarkers<?php echo $module->id; ?>('<?php echo base64_encode(json_encode($items)); ?>');

        <?php if($params->get('start_geoloc','0')==1){ ?>
                if(navigator.geolocation){
                    navigator.geolocation.getCurrentPosition(modSearchShowDJPosition<?php echo $module->id; ?>,
                        function(error){
                            console.log(error);         			
                    }, {
                        timeout: 30000, enableHighAccuracy: true, maximumAge: 90000
                    });
                } 	
                function modSearchShowDJPosition<?php echo $module->id; ?>(position)
                {
                    djmap<?php echo $module->id; ?>.panTo(new L.LatLng(position.coords.latitude, position.coords.longitude));
                }
        <?php } ?>

        <?php if($params->get('enable_places_search', '')){ ?>
                document.getElementById('user_pos<?php echo $module->id; ?>').addEventListener('click', function(event){		
                    if(navigator.geolocation){
                        navigator.geolocation.getCurrentPosition(modSearchShowDJPosition2<?php echo $module->id; ?>);
                    }
				});
				
				function modSearchShowDJPosition2<?php echo $module->id; ?>(position)
                {
                    setDJLocationCookie(position);
                    djmap<?php echo $module->id; ?>.panTo(new L.LatLng(position.coords.latitude, position.coords.longitude));			  	
			  	}
		<?php } ?>
    }

    function djmodMapAddMarkers<?php echo $module->id; ?>(items)
    {
        items = JSON.parse(atob(items));

        if(djmarkers<?php echo $module->id; ?>){
            djmap<?php echo $module->id; ?>.removeLayer(djmarkers<?php echo $module->id; ?>);
        }

        if('<?php echo $layout; ?>' == 'cluster' && typeof L.markerClusterGroup !== 'undefined'){
            djmarkers<?php echo $module->id; ?> = new L.markerClusterGroup();
        }else{
            djmarkers<?php echo $module->id; ?> = new L.featureGroup();
            
            // Create a map to count markers at same coordinates - only when not using clusters
            var coordsCount = new Map();
            items.forEach(function(item) {
                let coords = item.latitude + ',' + item.longitude;
                coordsCount.set(coords, (coordsCount.get(coords) || 0) + 1);
            });
        }

        var markers_count = 0;

        for (let i = 0; i < items.length; i++) {
            var myIcon = L.icon({
                iconUrl: items[i].icon_img,
                iconSize: [items[i].icon_size[0], items[i].icon_size[1]],
                iconAnchor: items[i].icon_img ? [items[i].icon_size[0]/2, items[i].icon_size[1]] : null
            });
            
            let markerText = items[i].marker_txt;
            
            // Add count information if there are multiple markers at this location and not using clusters
            if('<?php echo $layout; ?>' != 'cluster' && coordsCount) {
                let coords = items[i].latitude + ',' + items[i].longitude;
                if (coordsCount.get(coords) > 1) {
                    markerText = markerText.replace('</div>', '<br><br>+ <b>' + (coordsCount.get(coords) - 1) + '</b> <?php echo Text::_('MOD_DJCLASSIFIEDS_MAPS_MORE'); ?></div>');
                }
            }

            if(items[i].icon_img){
                var marker = new L.Marker([items[i].latitude, items[i].longitude], {icon: items[i].icon_img ? myIcon : null});
                marker.bindPopup(markerText, {offset: items[i].icon_img ? L.point(0, - items[i].icon_size[0]/2) : null});
            }else{
                var marker = new L.Marker([items[i].latitude, items[i].longitude]);
                marker.bindPopup(markerText);
            }

            djmarkers<?php echo $module->id; ?>.addLayer(marker);
            markers_count++;
        }

        if(markers_count){
            djmap<?php echo $module->id; ?>.addLayer(djmarkers<?php echo $module->id; ?>);
            <?php if($params->get('fit_to_items', '0')){ ?>
                djmap<?php echo $module->id; ?>.fitBounds(djmarkers<?php echo $module->id; ?>.getBounds());
                djmap<?php echo $module->id; ?>.zoomOut(1, {animate: false});
            <?php } ?>
        }
    }

</script>

Anon7 - 2022
AnonSec Team