Fix: kontakt

This commit is contained in:
2026-05-18 09:49:49 +02:00
parent a294675c16
commit d7c5ac64e7
4 changed files with 50 additions and 42 deletions

View File

@@ -68,49 +68,15 @@ class Page_Controller extends Base_Front_Controller
$this->view->meta_keywords = $page->meta_keywords;
}
$gmap = new Gmap('gmap', array
(
#'ScrollWheelZoom' => true,
'DoubleClickZoom' => true,
'ContinuousZoom' => true,
#'InfoWindow' => true,
));
$center = Kohana::config('application.gmaps.center');
// Set the map center point
$gmap->center($center['lat'], $center['lon'], $center['zoom'])->controls('small');
// Add a custom marker icon
/* $gmap->add_icon('tinyIcon', array
(
'image' => 'http://labs.google.com/ridefinder/images/mm_20_red.png',
'shadow' => 'http://labs.google.com/ridefinder/images/mm_20_shadow.png',
'iconSize' => array('12', '20'),
'shadowSize' => array('22', '20'),
'iconAnchor' => array('6', '20'),
'infoWindowAnchor' => array('6', '20')
));
*/
$gmap->add_icon('markerIcon', array
(
'image' => 'http://www.google.com/intl/en_ALL/mapfiles/marker.png',
'shadow' => 'http://www.google.com/intl/en_ALL/mapfiles/shadow50.png',
'iconSize' => array('20', '34'),
'shadowSize' => array('37', '34'),
'iconAnchor' => array('10', '34'),
'infoWindowAnchor' => array('10', '34')
));
$marker = Kohana::config('application.gmaps.marker');
// Add a new marker
$gmap->add_marker($marker['lat'], $marker['lon'], $marker['html'], array('icon' => 'markerIcon', 'title' => $marker['title']));
$page_view->page = $page;
$page_view->map_center = $center;
$page_view->map_marker = $marker;
$this->view->content = $page_view;
$this->view->api_url = Gmap::api_url();
$this->view->gmap = $gmap->render();
$this->view->message = $this->session->get('message');
$this->view->render(true);
}
}
}

View File

@@ -4,6 +4,27 @@
<?php endif;?>
<div class="text"><?php echo $page->content ?></div>
<div id="gmap-frame">
<div id="gmap">mapa</div>
<?php
$map_lat = isset($map_marker['lat']) ? $map_marker['lat'] : $map_center['lat'];
$map_lon = isset($map_marker['lon']) ? $map_marker['lon'] : $map_center['lon'];
$map_zoom = isset($map_center['zoom']) ? $map_center['zoom'] : 14;
$map_query = $map_lat.','.$map_lon;
$map_src = 'https://maps.google.com/maps?'.http_build_query(array(
'q' => $map_query,
'll' => $map_query,
'z' => $map_zoom,
'output' => 'embed',
));
?>
<iframe
id="gmap"
src="<?php echo html::specialchars($map_src) ?>"
title="Centrum Copy - mapa dojazdu"
width="500"
height="400"
frameborder="0"
scrolling="no"
marginheight="0"
marginwidth="0"></iframe>
</div>
</div>

View File

@@ -285,6 +285,8 @@ bottom: 5px;
#gmap {
width: 500px;
height: 400px;
border: 0;
display: block;
overflow: hidden;
color: #000;
}
@@ -327,4 +329,4 @@ bottom: 5px;
#created a {
color: #eee;
}
}

View File

@@ -75,9 +75,28 @@ class valid_Core {
* @param string URL
* @return boolean
*/
public static function url($url)
public static function url($url, $scheme = NULL)
{
return (bool) filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED);
if ( ! is_string($url) OR $url === '')
return FALSE;
$parts = @parse_url($url);
if ( ! is_array($parts) OR empty($parts['scheme']) OR empty($parts['host']))
return FALSE;
if ( ! preg_match('/^[a-z][a-z0-9+.-]*$/iD', $parts['scheme']))
return FALSE;
if ($scheme !== NULL)
{
$url_scheme = strtolower($parts['scheme']);
$schemes = array_map('strtolower', (array) $scheme);
return in_array($url_scheme, $schemes, TRUE);
}
return TRUE;
}
/**
@@ -335,4 +354,4 @@ class valid_Core {
return (bool) preg_match($pattern, (string) $str);
}
} // End valid
} // End valid