Fix: some resources were insecure when using ssl
This commit is contained in:
parent
1fce3f8718
commit
70eecac6be
82
api_gmaps.js
82
api_gmaps.js
@ -16,7 +16,7 @@
|
|||||||
* License along with this program; if not, write to the Free Software
|
* License along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// google maps
|
// google maps
|
||||||
var map;
|
var map;
|
||||||
var polies = new Array();
|
var polies = new Array();
|
||||||
@ -31,25 +31,25 @@ function init() {
|
|||||||
strokeColor: '#FF0000',
|
strokeColor: '#FF0000',
|
||||||
strokeOpacity: 1.0,
|
strokeOpacity: 1.0,
|
||||||
strokeWeight: 2
|
strokeWeight: 2
|
||||||
}
|
}
|
||||||
mapOptions = {
|
mapOptions = {
|
||||||
center: new google.maps.LatLng(init_latitude,init_longitude),
|
center: new google.maps.LatLng(init_latitude,init_longitude),
|
||||||
zoom: 8,
|
zoom: 8,
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||||
scaleControl: true
|
scaleControl: true
|
||||||
};
|
};
|
||||||
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
|
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayTrack(xml,update) {
|
function displayTrack(xml,update) {
|
||||||
altitudes.length = 0;
|
altitudes.length = 0;
|
||||||
var totalMeters = 0;
|
var totalMeters = 0;
|
||||||
var totalSeconds = 0;
|
var totalSeconds = 0;
|
||||||
// init polyline
|
// init polyline
|
||||||
var poly = new google.maps.Polyline(polyOptions);
|
var poly = new google.maps.Polyline(polyOptions);
|
||||||
poly.setMap(map);
|
poly.setMap(map);
|
||||||
var path = poly.getPath();
|
var path = poly.getPath();
|
||||||
var latlngbounds = new google.maps.LatLngBounds( );
|
var latlngbounds = new google.maps.LatLngBounds( );
|
||||||
var positions = xml.getElementsByTagName('position');
|
var positions = xml.getElementsByTagName('position');
|
||||||
var posLen = positions.length;
|
var posLen = positions.length;
|
||||||
for (var i=0; i<posLen; i++) {
|
for (var i=0; i<posLen; i++) {
|
||||||
@ -62,27 +62,27 @@ function displayTrack(xml,update) {
|
|||||||
// set marker
|
// set marker
|
||||||
setMarker(p,i,posLen);
|
setMarker(p,i,posLen);
|
||||||
// update polyline
|
// update polyline
|
||||||
path.push(p.coordinates);
|
path.push(p.coordinates);
|
||||||
latlngbounds.extend(p.coordinates);
|
latlngbounds.extend(p.coordinates);
|
||||||
// save altitudes for chart
|
// save altitudes for chart
|
||||||
altitudes[i] = p.altitude;
|
altitudes[i] = p.altitude;
|
||||||
}
|
}
|
||||||
if (update) {
|
if (update) {
|
||||||
map.fitBounds(latlngbounds);
|
map.fitBounds(latlngbounds);
|
||||||
if (i==1) {
|
if (i==1) {
|
||||||
// only one point, zoom out
|
// only one point, zoom out
|
||||||
zListener =
|
zListener =
|
||||||
google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
|
google.maps.event.addListenerOnce(map, 'bounds_changed', function(event) {
|
||||||
if (this.getZoom()){
|
if (this.getZoom()){
|
||||||
this.setZoom(15);
|
this.setZoom(15);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setTimeout(function(){google.maps.event.removeListener(zListener)}, 2000);
|
setTimeout(function(){google.maps.event.removeListener(zListener)}, 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
latestTime = p.dateoccured;
|
latestTime = p.dateoccured;
|
||||||
polies.push(poly);
|
polies.push(poly);
|
||||||
|
|
||||||
updateSummary(p.dateoccured,totalMeters,totalSeconds);
|
updateSummary(p.dateoccured,totalMeters,totalSeconds);
|
||||||
if (p.tid!=trackid) {
|
if (p.tid!=trackid) {
|
||||||
trackid=p.tid;
|
trackid=p.tid;
|
||||||
@ -121,10 +121,10 @@ function setMarker(p,i,posLen) {
|
|||||||
position: p.coordinates,
|
position: p.coordinates,
|
||||||
title: p.dateoccured
|
title: p.dateoccured
|
||||||
});
|
});
|
||||||
if (latest==1) { marker.setIcon('http://maps.google.com/mapfiles/dd-end.png') }
|
if (latest==1) { marker.setIcon('//maps.google.com/mapfiles/dd-end.png') }
|
||||||
else if (i==0) { marker.setIcon('http://maps.google.com/mapfiles/marker_greenA.png') }
|
else if (i==0) { marker.setIcon('//maps.google.com/mapfiles/marker_greenA.png') }
|
||||||
else if (i==posLen-1) { marker.setIcon('http://maps.google.com/mapfiles/markerB.png') }
|
else if (i==posLen-1) { marker.setIcon('//maps.google.com/mapfiles/markerB.png') }
|
||||||
else { marker.setIcon('http://labs.google.com/ridefinder/images/mm_20_gray.png') }
|
else { marker.setIcon('//maps.gstatic.com/mapfiles/ridefinder-images/mm_20_gray.png') }
|
||||||
// popup
|
// popup
|
||||||
var content = '<div id="popup">'+
|
var content = '<div id="popup">'+
|
||||||
'<div id="pheader">'+lang_user+': '+p.username.toUpperCase()+'<br />'+lang_track+': '+p.trackname.toUpperCase()+
|
'<div id="pheader">'+lang_user+': '+p.username.toUpperCase()+'<br />'+lang_track+': '+p.trackname.toUpperCase()+
|
||||||
@ -139,7 +139,7 @@ function setMarker(p,i,posLen) {
|
|||||||
'<b>'+lang_aspeed+':</b> '+((p.totalSeconds>0)?((p.totalMeters/p.totalSeconds).toKmH()*factor_kmh).toFixed():0)+' '+unit_kmh+'<br />'+
|
'<b>'+lang_aspeed+':</b> '+((p.totalSeconds>0)?((p.totalMeters/p.totalSeconds).toKmH()*factor_kmh).toFixed():0)+' '+unit_kmh+'<br />'+
|
||||||
'<b>'+lang_tdistance+':</b> '+(p.totalMeters.toKm()*factor_km).toFixed(2)+' '+unit_km+'<br />'+'</div>'):'')+
|
'<b>'+lang_tdistance+':</b> '+(p.totalMeters.toKm()*factor_km).toFixed(2)+' '+unit_km+'<br />'+'</div>'):'')+
|
||||||
'<div id="pfooter">'+lang_point+' '+(i+1)+' '+lang_of+' '+(posLen)+'</div>'+
|
'<div id="pfooter">'+lang_point+' '+(i+1)+' '+lang_of+' '+(posLen)+'</div>'+
|
||||||
'</div></div>';
|
'</div></div>';
|
||||||
popup = new google.maps.InfoWindow();
|
popup = new google.maps.InfoWindow();
|
||||||
popup.listener = google.maps.event.addListener(marker, 'click', (function(marker,content) {
|
popup.listener = google.maps.event.addListener(marker, 'click', (function(marker,content) {
|
||||||
return function() {
|
return function() {
|
||||||
@ -149,37 +149,37 @@ function setMarker(p,i,posLen) {
|
|||||||
chart.setSelection([{row:i,column:null}]);
|
chart.setSelection([{row:i,column:null}]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})(marker,content));
|
})(marker,content));
|
||||||
markers.push(marker);
|
markers.push(marker);
|
||||||
popups.push(popup);
|
popups.push(popup);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addChartEvent(chart) {
|
function addChartEvent(chart) {
|
||||||
google.visualization.events.addListener(chart, 'select', function() {
|
google.visualization.events.addListener(chart, 'select', function() {
|
||||||
if (popup) {popup.close(); clearTimeout(altTimeout);}
|
if (popup) {popup.close(); clearTimeout(altTimeout);}
|
||||||
var selection = chart.getSelection()[0];
|
var selection = chart.getSelection()[0];
|
||||||
if (selection) {
|
if (selection) {
|
||||||
var id = selection.row;
|
var id = selection.row;
|
||||||
var icon = markers[id].getIcon();
|
var icon = markers[id].getIcon();
|
||||||
markers[id].setIcon('http://maps.google.com/mapfiles/marker_orange.png');
|
markers[id].setIcon('//maps.google.com/mapfiles/marker_orange.png');
|
||||||
altTimeout = setTimeout(function() { markers[id].setIcon(icon); },2000);
|
altTimeout = setTimeout(function() { markers[id].setIcon(icon); },2000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//((52.20105108685229, 20.789387865580238), (52.292069558807135, 21.172192736185707))
|
//((52.20105108685229, 20.789387865580238), (52.292069558807135, 21.172192736185707))
|
||||||
function getBounds() {
|
function getBounds() {
|
||||||
var b = map.getBounds().toString();
|
var b = map.getBounds().toString();
|
||||||
var bounds = b.split(',',4);
|
var bounds = b.split(',',4);
|
||||||
var lat_sw = bounds[0].replace(/\(/g,'');
|
var lat_sw = bounds[0].replace(/\(/g,'');
|
||||||
var lon_sw = bounds[1].replace(/[ )]/g,'');
|
var lon_sw = bounds[1].replace(/[ )]/g,'');
|
||||||
var lat_ne = bounds[2].replace(/[ (]/g,'');
|
var lat_ne = bounds[2].replace(/[ (]/g,'');
|
||||||
var lon_ne = bounds[3].replace(/[ )]/g,'');
|
var lon_ne = bounds[3].replace(/[ )]/g,'');
|
||||||
return [lon_sw,lat_sw,lon_ne,lat_ne];
|
return [lon_sw,lat_sw,lon_ne,lat_ne];
|
||||||
}
|
}
|
||||||
|
|
||||||
function zoomToBounds(b) {
|
function zoomToBounds(b) {
|
||||||
var sw = new google.maps.LatLng(b[1],b[0]);
|
var sw = new google.maps.LatLng(b[1],b[0]);
|
||||||
var ne = new google.maps.LatLng(b[3],b[2]);
|
var ne = new google.maps.LatLng(b[3],b[2]);
|
||||||
var bounds = new google.maps.LatLngBounds(sw,ne);
|
var bounds = new google.maps.LatLngBounds(sw,ne);
|
||||||
map.fitBounds(bounds);
|
map.fitBounds(bounds);
|
||||||
}
|
}
|
||||||
|
@ -16,70 +16,73 @@
|
|||||||
* License along with this program; if not, write to the Free Software
|
* License along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// openlayers
|
// openlayers
|
||||||
var map;
|
var map;
|
||||||
var layerTrack;
|
var layerTrack;
|
||||||
var layerMarkers;
|
var layerMarkers;
|
||||||
var lineStyle = {strokeColor: '#FF0000', strokeOpacity: 1, strokeWidth: 2};
|
var lineStyle = {strokeColor: '#FF0000', strokeOpacity: 1, strokeWidth: 2};
|
||||||
var wgs84;
|
var wgs84;
|
||||||
var mercator;
|
var mercator;
|
||||||
var loadedAPI = 'openlayers';
|
var loadedAPI = 'openlayers';
|
||||||
function init() {
|
function init() {
|
||||||
wgs84 = new OpenLayers.Projection('EPSG:4326'); // from WGS 1984
|
wgs84 = new OpenLayers.Projection('EPSG:4326'); // from WGS 1984
|
||||||
mercator = new OpenLayers.Projection('EPSG:900913'); // to Mercator
|
mercator = new OpenLayers.Projection('EPSG:900913'); // to Mercator
|
||||||
var options = { controls: [
|
var options = { controls: [
|
||||||
new OpenLayers.Control.ArgParser(), // default
|
new OpenLayers.Control.ArgParser(), // default
|
||||||
new OpenLayers.Control.Attribution(), // default
|
new OpenLayers.Control.Attribution(), // default
|
||||||
new OpenLayers.Control.LayerSwitcher(),
|
new OpenLayers.Control.LayerSwitcher(),
|
||||||
new OpenLayers.Control.Navigation(), // default
|
new OpenLayers.Control.Navigation(), // default
|
||||||
new OpenLayers.Control.PanZoomBar(),// do we need it?
|
new OpenLayers.Control.PanZoomBar(),// do we need it?
|
||||||
new OpenLayers.Control.ScaleLine()
|
new OpenLayers.Control.ScaleLine()
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
map = new OpenLayers.Map('map-canvas', options);
|
map = new OpenLayers.Map('map-canvas', options);
|
||||||
// default layer: OpenStreetMap
|
// default layer: OpenStreetMap
|
||||||
var mapnik = new OpenLayers.Layer.OSM();
|
var mapnik = new OpenLayers.Layer.OSM('OpenStreetMap',
|
||||||
map.addLayer(mapnik);
|
['//a.tile.openstreetmap.org/${z}/${x}/${y}.png',
|
||||||
if (layer_ocm==1) {
|
'//b.tile.openstreetmap.org/${z}/${x}/${y}.png',
|
||||||
// OpenCycleMap
|
'//c.tile.openstreetmap.org/${z}/${x}/${y}.png']);
|
||||||
|
map.addLayer(mapnik);
|
||||||
|
if (layer_ocm==1) {
|
||||||
|
// OpenCycleMap
|
||||||
var ocm = new OpenLayers.Layer.OSM('OpenCycleMap',
|
var ocm = new OpenLayers.Layer.OSM('OpenCycleMap',
|
||||||
['http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png',
|
['//a.tile.thunderforest.com/cycle/${z}/${x}/${y}.png',
|
||||||
'http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png',
|
'//b.tile.thunderforest.com/cycle/${z}/${x}/${y}.png',
|
||||||
'http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png']);
|
'//c.tile.thunderforest.com/cycle/${z}/${x}/${y}.png']);
|
||||||
map.addLayer(ocm);
|
map.addLayer(ocm);
|
||||||
}
|
}
|
||||||
if (layer_mq==1) {
|
if (layer_mq==1) {
|
||||||
// MapQuest-OSM
|
// MapQuest-OSM
|
||||||
var mq = new OpenLayers.Layer.OSM('MapQuest-OSM',
|
var mq = new OpenLayers.Layer.OSM('MapQuest-OSM',
|
||||||
['http://otile1.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg',
|
['//otile1.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg',
|
||||||
'http://otile2.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg',
|
'//otile2.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg',
|
||||||
'http://otile3.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg',
|
'//otile3.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg',
|
||||||
'http://otile4.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg']);
|
'//otile4.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg']);
|
||||||
map.addLayer(mq);
|
map.addLayer(mq);
|
||||||
}
|
}
|
||||||
if (layer_osmapa==1) {
|
if (layer_osmapa==1) {
|
||||||
// osmapa.pl
|
// osmapa.pl
|
||||||
var osmapa = new OpenLayers.Layer.OSM('osmapa.pl',
|
var osmapa = new OpenLayers.Layer.OSM('osmapa.pl',
|
||||||
['http://a.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png',
|
['//a.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png',
|
||||||
'http://b.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png',
|
'//b.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png',
|
||||||
'http://c.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png']);
|
'//c.osm.trail.pl/osmapa.pl/${z}/${x}/${y}.png']);
|
||||||
map.addLayer(osmapa);
|
map.addLayer(osmapa);
|
||||||
}
|
}
|
||||||
if (layer_ump==1) {
|
if (layer_ump==1) {
|
||||||
// UMP
|
// UMP
|
||||||
var ump = new OpenLayers.Layer.OSM('UMP',
|
var ump = new OpenLayers.Layer.OSM('UMP',
|
||||||
['http://1.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png',
|
['//1.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png',
|
||||||
'http://2.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png',
|
'//2.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png',
|
||||||
'http://3.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png']);
|
'//3.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png']);
|
||||||
map.addLayer(ump);
|
map.addLayer(ump);
|
||||||
}
|
}
|
||||||
var position = new OpenLayers.LonLat(init_longitude,init_latitude).transform(wgs84, mercator);
|
var position = new OpenLayers.LonLat(init_longitude,init_latitude).transform(wgs84, mercator);
|
||||||
var zoom = 8;
|
var zoom = 8;
|
||||||
map.setCenter(position, zoom);
|
map.setCenter(position, zoom);
|
||||||
// init layers
|
// init layers
|
||||||
layerTrack = new OpenLayers.Layer.Vector('Track');
|
layerTrack = new OpenLayers.Layer.Vector('Track');
|
||||||
layerMarkers = new OpenLayers.Layer.Markers('Markers');
|
layerMarkers = new OpenLayers.Layer.Markers('Markers');
|
||||||
}
|
}
|
||||||
function displayTrack(xml,update) {
|
function displayTrack(xml,update) {
|
||||||
altitudes.length = 0;
|
altitudes.length = 0;
|
||||||
@ -104,21 +107,21 @@ function displayTrack(xml,update) {
|
|||||||
// save altitudes for chart
|
// save altitudes for chart
|
||||||
altitudes[i] = p.altitude;
|
altitudes[i] = p.altitude;
|
||||||
}
|
}
|
||||||
var lineString = new OpenLayers.Geometry.LineString(points);
|
var lineString = new OpenLayers.Geometry.LineString(points);
|
||||||
var lineFeature = new OpenLayers.Feature.Vector(lineString, null, lineStyle);
|
var lineFeature = new OpenLayers.Feature.Vector(lineString, null, lineStyle);
|
||||||
layerTrack.addFeatures([lineFeature]);
|
layerTrack.addFeatures([lineFeature]);
|
||||||
map.addLayer(layerTrack);
|
map.addLayer(layerTrack);
|
||||||
map.addLayer(layerMarkers);
|
map.addLayer(layerMarkers);
|
||||||
if (update) {
|
if (update) {
|
||||||
map.zoomToExtent(latlngbounds);
|
map.zoomToExtent(latlngbounds);
|
||||||
if (i==1) {
|
if (i==1) {
|
||||||
// only one point, zoom out
|
// only one point, zoom out
|
||||||
map.zoomOut();
|
map.zoomOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
latestTime = p.dateoccured;
|
latestTime = p.dateoccured;
|
||||||
//polies.push(poly);
|
//polies.push(poly);
|
||||||
|
|
||||||
updateSummary(p.dateoccured,totalMeters,totalSeconds);
|
updateSummary(p.dateoccured,totalMeters,totalSeconds);
|
||||||
if (p.tid!=trackid) {
|
if (p.tid!=trackid) {
|
||||||
trackid=p.tid;
|
trackid=p.tid;
|
||||||
@ -144,18 +147,18 @@ function setMarker(p,i,posLen) {
|
|||||||
// marker
|
// marker
|
||||||
var lonLat = new OpenLayers.LonLat(p.longitude,p.latitude).transform(wgs84,mercator);
|
var lonLat = new OpenLayers.LonLat(p.longitude,p.latitude).transform(wgs84,mercator);
|
||||||
var size = new OpenLayers.Size(21, 25);
|
var size = new OpenLayers.Size(21, 25);
|
||||||
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
|
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
|
||||||
if (latest==1) { var icon = new OpenLayers.Icon('http://www.openstreetmap.org/openlayers/img/marker.png',size,offset); }
|
if (latest==1) { var icon = new OpenLayers.Icon('//www.openstreetmap.org/openlayers/img/marker.png',size,offset); }
|
||||||
else if (i==0) { var icon = new OpenLayers.Icon('http://www.openstreetmap.org/openlayers/img/marker-green.png',size,offset); }
|
else if (i==0) { var icon = new OpenLayers.Icon('//www.openstreetmap.org/openlayers/img/marker-green.png',size,offset); }
|
||||||
else if (i==posLen-1) { var icon = new OpenLayers.Icon('http://www.openstreetmap.org/openlayers/img/marker.png',size,offset); }
|
else if (i==posLen-1) { var icon = new OpenLayers.Icon('//www.openstreetmap.org/openlayers/img/marker.png',size,offset); }
|
||||||
else {
|
else {
|
||||||
size = new OpenLayers.Size(12, 20);
|
size = new OpenLayers.Size(12, 20);
|
||||||
offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
|
offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
|
||||||
var icon = new OpenLayers.Icon('http://labs.google.com/ridefinder/images/mm_20_gray.png',size,offset);
|
var icon = new OpenLayers.Icon('//maps.gstatic.com/mapfiles/ridefinder-images/mm_20_gray.png',size,offset);
|
||||||
}
|
}
|
||||||
var marker = new OpenLayers.Marker(lonLat,icon);
|
var marker = new OpenLayers.Marker(lonLat,icon);
|
||||||
layerMarkers.addMarker(marker);
|
layerMarkers.addMarker(marker);
|
||||||
|
|
||||||
|
|
||||||
// popup
|
// popup
|
||||||
var content = '<div id="popup">'+
|
var content = '<div id="popup">'+
|
||||||
@ -171,49 +174,49 @@ function setMarker(p,i,posLen) {
|
|||||||
'<b>'+lang_aspeed+':</b> '+((p.totalSeconds>0)?((p.totalMeters/p.totalSeconds).toKmH()*factor_kmh).toFixed():0)+' '+unit_kmh+'<br />'+
|
'<b>'+lang_aspeed+':</b> '+((p.totalSeconds>0)?((p.totalMeters/p.totalSeconds).toKmH()*factor_kmh).toFixed():0)+' '+unit_kmh+'<br />'+
|
||||||
'<b>'+lang_tdistance+':</b> '+(p.totalMeters.toKm()*factor_km).toFixed(2)+' '+unit_km+'<br />'+'</div>'):'')+
|
'<b>'+lang_tdistance+':</b> '+(p.totalMeters.toKm()*factor_km).toFixed(2)+' '+unit_km+'<br />'+'</div>'):'')+
|
||||||
'<div id="pfooter">'+lang_point+' '+(i+1)+' '+lang_of+' '+(posLen)+'</div>'+
|
'<div id="pfooter">'+lang_point+' '+(i+1)+' '+lang_of+' '+(posLen)+'</div>'+
|
||||||
'</div></div>';
|
'</div></div>';
|
||||||
marker.events.register("mousedown", marker, (function() {
|
marker.events.register("mousedown", marker, (function() {
|
||||||
return function() {
|
return function() {
|
||||||
// remove popups
|
// remove popups
|
||||||
if (map.popups.length>0) {
|
if (map.popups.length>0) {
|
||||||
for (var j = map.popups.length-1; j>=0; j-- ) {
|
for (var j = map.popups.length-1; j>=0; j-- ) {
|
||||||
map.removePopup(map.popups[j])
|
map.removePopup(map.popups[j])
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// show popup
|
// show popup
|
||||||
var popup = new OpenLayers.Popup.FramedCloud("id "+(i+1),lonLat,null,content,icon,true);
|
var popup = new OpenLayers.Popup.FramedCloud("id "+(i+1),lonLat,null,content,icon,true);
|
||||||
map.addPopup(popup);
|
map.addPopup(popup);
|
||||||
if (document.getElementById('bottom').style.display=='block') {
|
if (document.getElementById('bottom').style.display=='block') {
|
||||||
chart.setSelection([{row:i,column:null}]);
|
chart.setSelection([{row:i,column:null}]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
}
|
}
|
||||||
|
|
||||||
function addChartEvent(chart) {
|
function addChartEvent(chart) {
|
||||||
google.visualization.events.addListener(chart, 'select', function() {
|
google.visualization.events.addListener(chart, 'select', function() {
|
||||||
var selection = chart.getSelection()[0];
|
var selection = chart.getSelection()[0];
|
||||||
if (selection) {
|
if (selection) {
|
||||||
var id = selection.row;
|
var id = selection.row;
|
||||||
var marker = layerMarkers.markers[id];
|
var marker = layerMarkers.markers[id];
|
||||||
var url = marker.icon.url;
|
var url = marker.icon.url;
|
||||||
marker.setUrl('http://www.openstreetmap.org/openlayers/img/marker-gold.png');
|
marker.setUrl('//www.openstreetmap.org/openlayers/img/marker-gold.png');
|
||||||
altTimeout = setTimeout(function() { marker.setUrl(url); },2000);
|
altTimeout = setTimeout(function() { marker.setUrl(url); },2000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//20.597985430276808,52.15547181298076,21.363595171488573,52.33750879522563
|
//20.597985430276808,52.15547181298076,21.363595171488573,52.33750879522563
|
||||||
function getBounds() {
|
function getBounds() {
|
||||||
var b = map.getExtent().transform(mercator,wgs84).toString();
|
var b = map.getExtent().transform(mercator,wgs84).toString();
|
||||||
var bounds = b.split(',',4);
|
var bounds = b.split(',',4);
|
||||||
var lon_sw = bounds[0];
|
var lon_sw = bounds[0];
|
||||||
var lat_sw = bounds[1];
|
var lat_sw = bounds[1];
|
||||||
var lon_ne = bounds[2];
|
var lon_ne = bounds[2];
|
||||||
var lat_ne = bounds[3];
|
var lat_ne = bounds[3];
|
||||||
return [lon_sw,lat_sw,lon_ne,lat_ne];
|
return [lon_sw,lat_sw,lon_ne,lat_ne];
|
||||||
}
|
}
|
||||||
|
|
||||||
function zoomToBounds(b) {
|
function zoomToBounds(b) {
|
||||||
var bounds = new OpenLayers.Bounds(b).transform(wgs84,mercator);
|
var bounds = new OpenLayers.Bounds(b).transform(wgs84,mercator);
|
||||||
map.zoomToExtent(bounds);
|
map.zoomToExtent(bounds);
|
||||||
}
|
}
|
||||||
|
24
auth.php
24
auth.php
@ -26,8 +26,8 @@ if (isset($_COOKIE["phpTrackme_interval"])) { $interval = $_COOKIE["phpTrackme_i
|
|||||||
require_once("lang.php");
|
require_once("lang.php");
|
||||||
$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
|
$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
|
||||||
if ($mysqli->connect_errno) {
|
if ($mysqli->connect_errno) {
|
||||||
printf("Connect failed: %s\n", $mysqli->connect_error);
|
printf("Connect failed: %s\n", $mysqli->connect_error);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
$mysqli->set_charset("utf8");
|
$mysqli->set_charset("utf8");
|
||||||
$auth = NULL;
|
$auth = NULL;
|
||||||
@ -37,18 +37,18 @@ if ($require_authentication) {
|
|||||||
session_name('trackme');
|
session_name('trackme');
|
||||||
session_start();
|
session_start();
|
||||||
$sid = session_id();
|
$sid = session_id();
|
||||||
|
|
||||||
$auth = (isset($_SESSION['auth']) ? $_SESSION['auth'] : "");
|
$auth = (isset($_SESSION['auth']) ? $_SESSION['auth'] : "");
|
||||||
$admin = (isset($_SESSION['admin']) ? $_SESSION['admin'] : "");
|
$admin = (isset($_SESSION['admin']) ? $_SESSION['admin'] : "");
|
||||||
$user = (isset($_REQUEST['user']) ? $_REQUEST['user'] : "");
|
$user = (isset($_REQUEST['user']) ? $_REQUEST['user'] : "");
|
||||||
$pass = (isset($_REQUEST['pass']) ? md5($salt.$_REQUEST['pass']) : "");
|
$pass = (isset($_REQUEST['pass']) ? md5($salt.$_REQUEST['pass']) : "");
|
||||||
$ssl = ((!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "" || $_SERVER['HTTPS'] == "off") ? "http" : "https");
|
$ssl = ((!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "" || $_SERVER['HTTPS'] == "off") ? "http" : "https");
|
||||||
$auth_error = (isset($_REQUEST['auth_error']) ? $_REQUEST['auth_error'] : 0);
|
$auth_error = (isset($_REQUEST['auth_error']) ? $_REQUEST['auth_error'] : 0);
|
||||||
|
|
||||||
// not authenticated and username not submited
|
// not authenticated and username not submited
|
||||||
// load form
|
// load form
|
||||||
if ((!$auth) && (!$user)){
|
if ((!$auth) && (!$user)){
|
||||||
print
|
print
|
||||||
'<!DOCTYPE html>
|
'<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -92,13 +92,13 @@ if ($require_authentication) {
|
|||||||
$query->free_result();
|
$query->free_result();
|
||||||
//correct pass
|
//correct pass
|
||||||
|
|
||||||
if (($user==$rec_user) && ($pass==$rec_pass)) {
|
if (($user==$rec_user) && ($pass==$rec_pass)) {
|
||||||
// login successful
|
// login successful
|
||||||
//delete old session
|
//delete old session
|
||||||
$_SESSION = NULL;
|
$_SESSION = NULL;
|
||||||
session_destroy();
|
session_destroy();
|
||||||
// start new session
|
// start new session
|
||||||
session_name('trackme');
|
session_name('trackme');
|
||||||
session_start();
|
session_start();
|
||||||
if (($user==$admin_user) && ($admin_user != "")) {
|
if (($user==$admin_user) && ($admin_user != "")) {
|
||||||
$_SESSION['admin'] = $admin_user;
|
$_SESSION['admin'] = $admin_user;
|
||||||
@ -106,7 +106,7 @@ if ($require_authentication) {
|
|||||||
$_SESSION['auth'] = $rec_ID;
|
$_SESSION['auth'] = $rec_ID;
|
||||||
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
|
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
|
||||||
header("Location: $ssl://$url");
|
header("Location: $ssl://$url");
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
// unsuccessful
|
// unsuccessful
|
||||||
$error = "?auth_error=1";
|
$error = "?auth_error=1";
|
||||||
@ -115,8 +115,8 @@ if ($require_authentication) {
|
|||||||
if (isset($_COOKIE[session_name('trackme')])) {
|
if (isset($_COOKIE[session_name('trackme')])) {
|
||||||
setcookie(session_name('trackme'),'',time()-42000,'/');
|
setcookie(session_name('trackme'),'',time()-42000,'/');
|
||||||
}
|
}
|
||||||
session_destroy();
|
session_destroy();
|
||||||
$mysqli->close();
|
$mysqli->close();
|
||||||
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
|
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
|
||||||
header("Location: $ssl://$url$error");
|
header("Location: $ssl://$url$error");
|
||||||
exit;
|
exit;
|
||||||
|
10
config.php
10
config.php
@ -17,9 +17,9 @@
|
|||||||
* License along with this program; if not, write to the Free Software
|
* License along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
$version = "2.3";
|
$version = "2.3";
|
||||||
|
|
||||||
// default map drawing framework
|
// default map drawing framework
|
||||||
// (gmaps = google maps, openlayers = openlayers/osm)
|
// (gmaps = google maps, openlayers = openlayers/osm)
|
||||||
//$mapapi = "gmaps";
|
//$mapapi = "gmaps";
|
||||||
$mapapi = "openlayers";
|
$mapapi = "openlayers";
|
||||||
@ -50,7 +50,7 @@ $dbname = ""; // database name
|
|||||||
$salt = ""; // fill in random string here, it will increase security of password hashes
|
$salt = ""; // fill in random string here, it will increase security of password hashes
|
||||||
|
|
||||||
// other
|
// other
|
||||||
// require login/password authentication
|
// require login/password authentication
|
||||||
// (0 = no, 1 = yes)
|
// (0 = no, 1 = yes)
|
||||||
$require_authentication = 1;
|
$require_authentication = 1;
|
||||||
|
|
||||||
@ -58,12 +58,12 @@ $require_authentication = 1;
|
|||||||
// none if empty
|
// none if empty
|
||||||
$admin_user = "";
|
$admin_user = "";
|
||||||
|
|
||||||
// allow automatic registration of new users
|
// allow automatic registration of new users
|
||||||
// (0 = no, 1 = yes)
|
// (0 = no, 1 = yes)
|
||||||
$allow_registration = 0;
|
$allow_registration = 0;
|
||||||
|
|
||||||
// Default interval in seconds for live auto reload
|
// Default interval in seconds for live auto reload
|
||||||
$interval = 10;
|
$interval = 10;
|
||||||
|
|
||||||
// Default language
|
// Default language
|
||||||
// (en, pl, de)
|
// (en, pl, de)
|
||||||
|
52
download.php
52
download.php
@ -29,7 +29,7 @@ if ($units=="imperial") {
|
|||||||
$unit_m = "ft";
|
$unit_m = "ft";
|
||||||
$factor_km = 0.62; // to miles
|
$factor_km = 0.62; // to miles
|
||||||
$unit_km = "mi";
|
$unit_km = "mi";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$factor_kmh = 1;
|
$factor_kmh = 1;
|
||||||
$unit_kmh = "km/h";
|
$unit_kmh = "km/h";
|
||||||
@ -55,10 +55,10 @@ function addStyle($xml,$name,$url) {
|
|||||||
$xml->startElement("IconStyle");
|
$xml->startElement("IconStyle");
|
||||||
$xml->writeAttribute("id", $name."Icon");
|
$xml->writeAttribute("id", $name."Icon");
|
||||||
$xml->startElement("Icon");
|
$xml->startElement("Icon");
|
||||||
$xml->writeElement("href", $url);
|
$xml->writeElement("href", $url);
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
}
|
}
|
||||||
function toHMS($s) {
|
function toHMS($s) {
|
||||||
$d = floor($s/86400);
|
$d = floor($s/86400);
|
||||||
@ -100,7 +100,7 @@ if ($trackid>0 && $userid>0) {
|
|||||||
// marker styles
|
// marker styles
|
||||||
addStyle($xml,"red","http://maps.google.com/mapfiles/markerA.png");
|
addStyle($xml,"red","http://maps.google.com/mapfiles/markerA.png");
|
||||||
addStyle($xml,"green","http://maps.google.com/mapfiles/marker_greenB.png");
|
addStyle($xml,"green","http://maps.google.com/mapfiles/marker_greenB.png");
|
||||||
addStyle($xml,"gray","http://labs.google.com/ridefinder/images/mm_20_gray.png");
|
addStyle($xml,"gray","http://maps.gstatic.com/mapfiles/ridefinder-images/mm_20_gray.png");
|
||||||
$style = "#redStyle"; // for first element
|
$style = "#redStyle"; // for first element
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$totalMeters = 0;
|
$totalMeters = 0;
|
||||||
@ -113,12 +113,12 @@ if ($trackid>0 && $userid>0) {
|
|||||||
$prev_dateoccured = $dateoccured;
|
$prev_dateoccured = $dateoccured;
|
||||||
$totalMeters += $distance;
|
$totalMeters += $distance;
|
||||||
$totalSeconds += $seconds;
|
$totalSeconds += $seconds;
|
||||||
|
|
||||||
if(++$i == $query->num_rows) { $style = "#greenStyle"; } // last element
|
if(++$i == $query->num_rows) { $style = "#greenStyle"; } // last element
|
||||||
$xml->startElement("Placemark");
|
$xml->startElement("Placemark");
|
||||||
$xml->writeAttribute("id", $positionid);
|
$xml->writeAttribute("id", $positionid);
|
||||||
//$xml->writeElement("name", $i);
|
//$xml->writeElement("name", $i);
|
||||||
$description =
|
$description =
|
||||||
"<div style=\"font-weight: bolder;padding-bottom: 10px;border-bottom: 1px solid gray;\">".$lang_user.": ".strtoupper($username)."<br />".$lang_track.": ".strtoupper($trackname).
|
"<div style=\"font-weight: bolder;padding-bottom: 10px;border-bottom: 1px solid gray;\">".$lang_user.": ".strtoupper($username)."<br />".$lang_track.": ".strtoupper($trackname).
|
||||||
"</div>".
|
"</div>".
|
||||||
"<div>".
|
"<div>".
|
||||||
@ -138,7 +138,7 @@ if ($trackid>0 && $userid>0) {
|
|||||||
$coordinate[$i] = $longitude.",".$latitude.(($altitude) ? ",".$altitude : "");
|
$coordinate[$i] = $longitude.",".$latitude.(($altitude) ? ",".$altitude : "");
|
||||||
$xml->writeElement("coordinates", $coordinate[$i]);
|
$xml->writeElement("coordinates", $coordinate[$i]);
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$style = "#grayStyle"; // other elements
|
$style = "#grayStyle"; // other elements
|
||||||
}
|
}
|
||||||
$coordinates = implode("\n",$coordinate);
|
$coordinates = implode("\n",$coordinate);
|
||||||
@ -147,16 +147,16 @@ if ($trackid>0 && $userid>0) {
|
|||||||
$xml->startElement("LineString");
|
$xml->startElement("LineString");
|
||||||
$xml->writeElement("coordinates", $coordinates);
|
$xml->writeElement("coordinates", $coordinates);
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
|
|
||||||
|
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endDocument();
|
$xml->endDocument();
|
||||||
$xml->flush();
|
$xml->flush();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "gpx":
|
case "gpx":
|
||||||
header("Content-type: application/application/gpx+xm");
|
header("Content-type: application/application/gpx+xm");
|
||||||
header("Content-Disposition: attachment; filename=\"track$trackid.gpx\"");
|
header("Content-Disposition: attachment; filename=\"track$trackid.gpx\"");
|
||||||
@ -164,10 +164,10 @@ if ($trackid>0 && $userid>0) {
|
|||||||
$xml->openURI("php://output");
|
$xml->openURI("php://output");
|
||||||
$xml->startDocument("1.0");
|
$xml->startDocument("1.0");
|
||||||
$xml->startElement("gpx");
|
$xml->startElement("gpx");
|
||||||
$xml->writeAttribute("xmlns", "http://www.topografix.com/GPX/1/1");
|
$xml->writeAttribute("xmlns", "http://www.topografix.com/GPX/1/1");
|
||||||
$xml->writeAttribute("xmlns:gpxdata", "http://www.cluetrust.com/XML/GPXDATA/1/0");
|
$xml->writeAttribute("xmlns:gpxdata", "http://www.cluetrust.com/XML/GPXDATA/1/0");
|
||||||
$xml->writeAttribute("creator", "phpTrackme");
|
$xml->writeAttribute("creator", "phpTrackme");
|
||||||
$xml->writeAttribute("version", "1.1");
|
$xml->writeAttribute("version", "1.1");
|
||||||
$xml->startElement("metadata");
|
$xml->startElement("metadata");
|
||||||
$xml->writeElement("name", $trackname);
|
$xml->writeElement("name", $trackname);
|
||||||
$xml->writeElement("time", str_replace(" ","T",$dateoccured));
|
$xml->writeElement("time", str_replace(" ","T",$dateoccured));
|
||||||
@ -185,7 +185,7 @@ if ($trackid>0 && $userid>0) {
|
|||||||
$seconds = (isset($prev_dateoccured))?(strtotime($dateoccured)-strtotime($prev_dateoccured)):0;
|
$seconds = (isset($prev_dateoccured))?(strtotime($dateoccured)-strtotime($prev_dateoccured)):0;
|
||||||
$prev_dateoccured = $dateoccured;
|
$prev_dateoccured = $dateoccured;
|
||||||
$totalMeters += $distance;
|
$totalMeters += $distance;
|
||||||
$totalSeconds += $seconds;
|
$totalSeconds += $seconds;
|
||||||
$xml->startElement("trkpt");
|
$xml->startElement("trkpt");
|
||||||
$xml->writeAttribute("lat", $latitude);
|
$xml->writeAttribute("lat", $latitude);
|
||||||
$xml->writeAttribute("lon", $longitude);
|
$xml->writeAttribute("lon", $longitude);
|
||||||
@ -193,7 +193,7 @@ if ($trackid>0 && $userid>0) {
|
|||||||
$xml->writeElement("time", str_replace(" ","T",$dateoccured));
|
$xml->writeElement("time", str_replace(" ","T",$dateoccured));
|
||||||
$xml->writeElement("name", ++$i);
|
$xml->writeElement("name", ++$i);
|
||||||
$xml->startElement("desc");
|
$xml->startElement("desc");
|
||||||
$description =
|
$description =
|
||||||
$lang_user.": ".strtoupper($username)." ".$lang_track.": ".strtoupper($trackname).
|
$lang_user.": ".strtoupper($username)." ".$lang_track.": ".strtoupper($trackname).
|
||||||
" ".$lang_time.": ".$dateoccured.
|
" ".$lang_time.": ".$dateoccured.
|
||||||
(($speed)?" ".$lang_speed.": ".round($speed*3.6,2*$factor_kmh)." ".$unit_kmh:"").
|
(($speed)?" ".$lang_speed.": ".round($speed*3.6,2*$factor_kmh)." ".$unit_kmh:"").
|
||||||
@ -205,14 +205,14 @@ if ($trackid>0 && $userid>0) {
|
|||||||
$xml->writeCData($description);
|
$xml->writeCData($description);
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
}
|
}
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endDocument();
|
$xml->endDocument();
|
||||||
$xml->flush();
|
$xml->flush();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$query->free_result();
|
$query->free_result();
|
||||||
$query->close();
|
$query->close();
|
||||||
|
@ -42,7 +42,7 @@ if ($userid) {
|
|||||||
else {
|
else {
|
||||||
// get data only for latest point
|
// get data only for latest point
|
||||||
$query = $mysqli->prepare("SELECT positions.ID,positions.Latitude,positions.Longitude,positions.Altitude,positions.Speed,positions.Angle,positions.DateOccurred,positions.Comments,users.username,trips.Name,trips.ID FROM positions LEFT JOIN users ON (positions.FK_Users_ID=users.ID) LEFT JOIN trips ON (positions.FK_Trips_ID=trips.ID) WHERE positions.FK_Users_ID=? ORDER BY positions.DateOccurred DESC LIMIT 1");
|
$query = $mysqli->prepare("SELECT positions.ID,positions.Latitude,positions.Longitude,positions.Altitude,positions.Speed,positions.Angle,positions.DateOccurred,positions.Comments,users.username,trips.Name,trips.ID FROM positions LEFT JOIN users ON (positions.FK_Users_ID=users.ID) LEFT JOIN trips ON (positions.FK_Trips_ID=trips.ID) WHERE positions.FK_Users_ID=? ORDER BY positions.DateOccurred DESC LIMIT 1");
|
||||||
$query->bind_param('i', $userid);
|
$query->bind_param('i', $userid);
|
||||||
}
|
}
|
||||||
$query->execute();
|
$query->execute();
|
||||||
$query->bind_result($positionid,$latitude,$longitude,$altitude,$speed,$angle,$dateoccured,$comments,$username,$trackname,$trackid);
|
$query->bind_result($positionid,$latitude,$longitude,$altitude,$speed,$angle,$dateoccured,$comments,$username,$trackname,$trackid);
|
||||||
@ -53,32 +53,32 @@ if ($userid) {
|
|||||||
$xml->startDocument("1.0");
|
$xml->startDocument("1.0");
|
||||||
$xml->setIndent(true);
|
$xml->setIndent(true);
|
||||||
$xml->startElement('root');
|
$xml->startElement('root');
|
||||||
|
|
||||||
while ($query->fetch()) {
|
while ($query->fetch()) {
|
||||||
$xml->startElement("position");
|
$xml->startElement("position");
|
||||||
$xml->writeAttribute("id", $positionid);
|
$xml->writeAttribute("id", $positionid);
|
||||||
$xml->writeElement("latitude", $latitude);
|
$xml->writeElement("latitude", $latitude);
|
||||||
$xml->writeElement("longitude", $longitude);
|
$xml->writeElement("longitude", $longitude);
|
||||||
$xml->writeElement("altitude", ($altitude)?round($altitude):$altitude);
|
$xml->writeElement("altitude", ($altitude)?round($altitude):$altitude);
|
||||||
$xml->writeElement("speed", $speed);
|
$xml->writeElement("speed", $speed);
|
||||||
$xml->writeElement("angle", $angle);
|
$xml->writeElement("angle", $angle);
|
||||||
$xml->writeElement("dateoccured", $dateoccured);
|
$xml->writeElement("dateoccured", $dateoccured);
|
||||||
$xml->writeElement("comments", $comments);
|
$xml->writeElement("comments", $comments);
|
||||||
$xml->writeElement("username", $username);
|
$xml->writeElement("username", $username);
|
||||||
$xml->writeElement("trackid", $trackid);
|
$xml->writeElement("trackid", $trackid);
|
||||||
$xml->writeElement("trackname", $trackname);
|
$xml->writeElement("trackname", $trackname);
|
||||||
$distance = (isset($prev_latitude))?haversine_distance($prev_latitude,$prev_longitude,$latitude,$longitude):0;
|
$distance = (isset($prev_latitude))?haversine_distance($prev_latitude,$prev_longitude,$latitude,$longitude):0;
|
||||||
$prev_latitude = $latitude;
|
$prev_latitude = $latitude;
|
||||||
$prev_longitude = $longitude;
|
$prev_longitude = $longitude;
|
||||||
$xml->writeElement("distance", round($distance));
|
$xml->writeElement("distance", round($distance));
|
||||||
$seconds = (isset($prev_dateoccured))?(strtotime($dateoccured)-strtotime($prev_dateoccured)):0;
|
$seconds = (isset($prev_dateoccured))?(strtotime($dateoccured)-strtotime($prev_dateoccured)):0;
|
||||||
$prev_dateoccured = $dateoccured;
|
$prev_dateoccured = $dateoccured;
|
||||||
$xml->writeElement("seconds", $seconds);
|
$xml->writeElement("seconds", $seconds);
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endDocument();
|
$xml->endDocument();
|
||||||
$xml->flush();
|
$xml->flush();
|
||||||
|
|
||||||
$query->free_result();
|
$query->free_result();
|
||||||
|
12
gettrips.php
12
gettrips.php
@ -33,16 +33,16 @@ if ($userid) {
|
|||||||
$xml->startDocument("1.0");
|
$xml->startDocument("1.0");
|
||||||
$xml->setIndent(true);
|
$xml->setIndent(true);
|
||||||
$xml->startElement('root');
|
$xml->startElement('root');
|
||||||
|
|
||||||
while ($query->fetch()) {
|
while ($query->fetch()) {
|
||||||
$xml->startElement("trip");
|
$xml->startElement("trip");
|
||||||
$xml->writeElement("trackid", $trackid);
|
$xml->writeElement("trackid", $trackid);
|
||||||
$xml->writeElement("trackname", $trackname);
|
$xml->writeElement("trackname", $trackname);
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml->endElement();
|
$xml->endElement();
|
||||||
$xml->endDocument();
|
$xml->endDocument();
|
||||||
$xml->flush();
|
$xml->flush();
|
||||||
|
|
||||||
$query->free_result();
|
$query->free_result();
|
||||||
|
39
index.php
39
index.php
@ -22,14 +22,14 @@ require_once("auth.php");
|
|||||||
|
|
||||||
if ($auth && !$admin) {
|
if ($auth && !$admin) {
|
||||||
// get username
|
// get username
|
||||||
$query = "SELECT username FROM users WHERE ID='$auth' LIMIT 1";
|
$query = "SELECT username FROM users WHERE ID='$auth' LIMIT 1";
|
||||||
$result = $mysqli->query($query);
|
$result = $mysqli->query($query);
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
$user = $row["username"];
|
$user = $row["username"];
|
||||||
|
|
||||||
// users
|
// users
|
||||||
$user_form = '<u>'.$lang_user.'</u><br />'.$user.' (<a href="logout.php">'.$lang_logout.'</a>)';
|
$user_form = '<u>'.$lang_user.'</u><br />'.$user.' (<a href="logout.php">'.$lang_logout.'</a>)';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// free access or admin user
|
// free access or admin user
|
||||||
// prepare user select form
|
// prepare user select form
|
||||||
@ -40,12 +40,12 @@ else {
|
|||||||
<u>'.$lang_user.'</u> ';
|
<u>'.$lang_user.'</u> ';
|
||||||
if ($auth) {
|
if ($auth) {
|
||||||
$user_form .= ' '.$user.' (<a href="logout.php">'.$lang_logout.'</a>)';
|
$user_form .= ' '.$user.' (<a href="logout.php">'.$lang_logout.'</a>)';
|
||||||
}
|
}
|
||||||
$user_form .= '
|
$user_form .= '
|
||||||
<br />
|
<br />
|
||||||
<form>
|
<form>
|
||||||
<select name="user" onchange="selectUser(this)">
|
<select name="user" onchange="selectUser(this)">
|
||||||
<option value="0">'.$lang_suser.'</option>';
|
<option value="0">'.$lang_suser.'</option>';
|
||||||
// get last position user
|
// get last position user
|
||||||
$query = "SELECT FK_Users_ID FROM positions ORDER BY DateOccurred LIMIT 1";
|
$query = "SELECT FK_Users_ID FROM positions ORDER BY DateOccurred LIMIT 1";
|
||||||
$result = $mysqli->query($query);
|
$result = $mysqli->query($query);
|
||||||
@ -55,10 +55,10 @@ else {
|
|||||||
} else {
|
} else {
|
||||||
$last_id = "";
|
$last_id = "";
|
||||||
}
|
}
|
||||||
$query = "SELECT ID,username FROM users ORDER BY username";
|
$query = "SELECT ID,username FROM users ORDER BY username";
|
||||||
$result = $mysqli->query($query);
|
$result = $mysqli->query($query);
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$user_form .= sprintf("<option %svalue=\"%s\">%s</option>\n", ($row["ID"] == $last_id)?"selected ":"",$row["ID"], $row["username"]);
|
$user_form .= sprintf("<option %svalue=\"%s\">%s</option>\n", ($row["ID"] == $last_id)?"selected ":"",$row["ID"], $row["username"]);
|
||||||
}
|
}
|
||||||
$user_form .= '
|
$user_form .= '
|
||||||
</select>
|
</select>
|
||||||
@ -79,7 +79,7 @@ if ($auth && !$admin) {
|
|||||||
// or user who did last move
|
// or user who did last move
|
||||||
$userid = $last_id;
|
$userid = $last_id;
|
||||||
}
|
}
|
||||||
$query = "SELECT * FROM trips WHERE FK_Users_ID='$userid' ORDER BY ID DESC";
|
$query = "SELECT * FROM trips WHERE FK_Users_ID='$userid' ORDER BY ID DESC";
|
||||||
$result = $mysqli->query($query);
|
$result = $mysqli->query($query);
|
||||||
|
|
||||||
$trackid = "";
|
$trackid = "";
|
||||||
@ -111,7 +111,6 @@ $lang_form = '
|
|||||||
<option value="en"'.(($lang=="en")?' selected':'').'>English</option>
|
<option value="en"'.(($lang=="en")?' selected':'').'>English</option>
|
||||||
<option value="pl"'.(($lang=="pl")?' selected':'').'>Polski</option>
|
<option value="pl"'.(($lang=="pl")?' selected':'').'>Polski</option>
|
||||||
<option value="de"'.(($lang=="de")?' selected':'').'>Deutsch</option>
|
<option value="de"'.(($lang=="de")?' selected':'').'>Deutsch</option>
|
||||||
<option value="hu"'.(($lang=="hu")?' selected':'').'>Magyar</option>
|
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
';
|
';
|
||||||
@ -126,7 +125,7 @@ $units_form = '
|
|||||||
</form>
|
</form>
|
||||||
';
|
';
|
||||||
|
|
||||||
print
|
print
|
||||||
'<!DOCTYPE html>
|
'<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -164,14 +163,14 @@ print
|
|||||||
<script type="text/javascript" src="main.js"></script>
|
<script type="text/javascript" src="main.js"></script>
|
||||||
';
|
';
|
||||||
if ($mapapi == "gmaps") {
|
if ($mapapi == "gmaps") {
|
||||||
print
|
print
|
||||||
' <script type="text/javascript" src="//maps.googleapis.com/maps/api/js?'.(isset($gkey)?'key='.$gkey.'&':'').'sensor=false"></script>
|
' <script type="text/javascript" src="//maps.googleapis.com/maps/api/js'.(isset($gkey)?'?key='.$gkey:'').'"></script>
|
||||||
<script type="text/javascript" src="api_gmaps.js"></script>
|
<script type="text/javascript" src="api_gmaps.js"></script>
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print
|
print
|
||||||
' <script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
|
' <script type="text/javascript" src="//openlayers.org/api/OpenLayers.js"></script>
|
||||||
<script type="text/javascript" src="api_openlayers.js"></script>
|
<script type="text/javascript" src="api_openlayers.js"></script>
|
||||||
';
|
';
|
||||||
}
|
}
|
||||||
@ -180,7 +179,7 @@ print '
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
google.load("visualization", "1", {packages:["corechart"]});
|
google.load("visualization", "1", {packages:["corechart"]});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body onload="init();loadTrack(userid,trackid,1);">
|
<body onload="init();loadTrack(userid,trackid,1);">
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
@ -190,20 +189,20 @@ print '
|
|||||||
</div>
|
</div>
|
||||||
<div id="trip">
|
<div id="trip">
|
||||||
'.$track_form.'
|
'.$track_form.'
|
||||||
<input type="checkbox" onchange="autoReload();"> '.$lang_autoreload.' (<a href="javascript:void(0);" onclick="setTime()"><span id="auto">'.$interval.'</span></a> s)<br />
|
<input type="checkbox" onchange="autoReload();"> '.$lang_autoreload.' (<a href="javascript:void(0);" onclick="setTime()"><span id="auto">'.$interval.'</span></a> s)<br />
|
||||||
<a href="javascript:void(0);" onclick="loadTrack(userid,trackid,0)">'.$lang_reload.'</a><br />
|
<a href="javascript:void(0);" onclick="loadTrack(userid,trackid,0)">'.$lang_reload.'</a><br />
|
||||||
</div>
|
</div>
|
||||||
<div id="summary"></div>
|
<div id="summary"></div>
|
||||||
<div id="other">
|
<div id="other">
|
||||||
<a href="javascript:void(0);" onclick="toggleChart();">'.$lang_chart.'</a>
|
<a href="javascript:void(0);" onclick="toggleChart();">'.$lang_chart.'</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="api">
|
<div id="api">
|
||||||
'.$api_form.'
|
'.$api_form.'
|
||||||
</div>
|
</div>
|
||||||
<div id="lang">
|
<div id="lang">
|
||||||
'.$lang_form.'
|
'.$lang_form.'
|
||||||
</div>
|
</div>
|
||||||
<div id="units">
|
<div id="units">
|
||||||
'.$units_form.'
|
'.$units_form.'
|
||||||
</div>
|
</div>
|
||||||
<div id="export">
|
<div id="export">
|
||||||
@ -220,7 +219,7 @@ print '
|
|||||||
<div id="bottom">
|
<div id="bottom">
|
||||||
<div id="chart"></div>
|
<div id="chart"></div>
|
||||||
<div id="close"><a href="javascript:void(0);" onclick="toggleChart(0);">'.$lang_close.'</a></div>
|
<div id="close"><a href="javascript:void(0);" onclick="toggleChart(0);">'.$lang_close.'</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>';
|
</html>';
|
||||||
|
14
lang.php
14
lang.php
@ -53,7 +53,7 @@ switch($lang) {
|
|||||||
$lang_metric = "Metric";
|
$lang_metric = "Metric";
|
||||||
$lang_imperial = "Imperial/US";
|
$lang_imperial = "Imperial/US";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "pl":
|
case "pl":
|
||||||
$lang_title = "• phpTrackme •";
|
$lang_title = "• phpTrackme •";
|
||||||
$lang_private = "Aby się zalogować musisz podać login i hasło";
|
$lang_private = "Aby się zalogować musisz podać login i hasło";
|
||||||
@ -75,20 +75,20 @@ switch($lang) {
|
|||||||
$lang_suser = "wybierz login";
|
$lang_suser = "wybierz login";
|
||||||
$lang_point = "Punkt";
|
$lang_point = "Punkt";
|
||||||
$lang_of = "z";
|
$lang_of = "z";
|
||||||
$lang_summary = "Podsumowanie";
|
$lang_summary = "Podsumowanie";
|
||||||
$lang_logout = "wyloguj";
|
$lang_logout = "wyloguj";
|
||||||
$lang_login = "zaloguj";
|
$lang_login = "zaloguj";
|
||||||
$lang_username = "Login";
|
$lang_username = "Login";
|
||||||
$lang_password = "Hasło";
|
$lang_password = "Hasło";
|
||||||
$lang_language = "Język";
|
$lang_language = "Język";
|
||||||
$lang_newinterval = "Podaj częstotliwość odświeżania (w sekundach)";
|
$lang_newinterval = "Podaj częstotliwość odświeżania (w sekundach)";
|
||||||
$lang_api = "Map API";
|
$lang_api = "Map API";
|
||||||
$lang_language = "Język";
|
$lang_language = "Język";
|
||||||
$lang_units = "Jednostki";
|
$lang_units = "Jednostki";
|
||||||
$lang_metric = "Metryczne";
|
$lang_metric = "Metryczne";
|
||||||
$lang_imperial = "Anglosaskie";
|
$lang_imperial = "Anglosaskie";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "de":
|
case "de":
|
||||||
$lang_title = "• phpTrackme •";
|
$lang_title = "• phpTrackme •";
|
||||||
$lang_private = "Sie müssen Benutzernamen und Kennwort eingeben, um auf diese Seite zuzugreifen.";
|
$lang_private = "Sie müssen Benutzernamen und Kennwort eingeben, um auf diese Seite zuzugreifen.";
|
||||||
@ -122,7 +122,7 @@ switch($lang) {
|
|||||||
$lang_units = "Maßsystem";
|
$lang_units = "Maßsystem";
|
||||||
$lang_metric = "Metrisches";
|
$lang_metric = "Metrisches";
|
||||||
$lang_imperial = "Angloamerikanisches";
|
$lang_imperial = "Angloamerikanisches";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "hu":
|
case "hu":
|
||||||
$lang_title = "• phpTrackme •";
|
$lang_title = "• phpTrackme •";
|
||||||
@ -145,14 +145,14 @@ switch($lang) {
|
|||||||
$lang_suser = "Felhasználónév";
|
$lang_suser = "Felhasználónév";
|
||||||
$lang_point = "Rögzített pontok száma";
|
$lang_point = "Rögzített pontok száma";
|
||||||
$lang_of = "/";
|
$lang_of = "/";
|
||||||
$lang_summary = "Utazás adatai";
|
$lang_summary = "Utazás adatai";
|
||||||
$lang_logout = "Kilépés";
|
$lang_logout = "Kilépés";
|
||||||
$lang_login = "Belépés";
|
$lang_login = "Belépés";
|
||||||
$lang_username = "Felhasználó";
|
$lang_username = "Felhasználó";
|
||||||
$lang_password = "Jelszó";
|
$lang_password = "Jelszó";
|
||||||
$lang_language = "Nyelv";
|
$lang_language = "Nyelv";
|
||||||
$lang_newinterval = "Automatikus frissítés ideje (másodpercben)";
|
$lang_newinterval = "Automatikus frissítés ideje (másodpercben)";
|
||||||
$lang_api = "Map API";
|
$lang_api = "Map API";
|
||||||
$lang_language = "Nyelv";
|
$lang_language = "Nyelv";
|
||||||
$lang_units = "Mértékegység";
|
$lang_units = "Mértékegység";
|
||||||
$lang_metric = "Metrikus";
|
$lang_metric = "Metrikus";
|
||||||
|
@ -23,7 +23,7 @@ $_SESSION = NULL;
|
|||||||
if (isset($_COOKIE[session_name('trackme')])) {
|
if (isset($_COOKIE[session_name('trackme')])) {
|
||||||
setcookie(session_name('trackme'),'',time()-42000,'/');
|
setcookie(session_name('trackme'),'',time()-42000,'/');
|
||||||
}
|
}
|
||||||
session_destroy();
|
session_destroy();
|
||||||
$ssl = ((!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "" || $_SERVER['HTTPS'] == "off") ? "http" : "https");
|
$ssl = ((!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "" || $_SERVER['HTTPS'] == "off") ? "http" : "https");
|
||||||
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
|
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
|
||||||
header("Location: $ssl://$url");
|
header("Location: $ssl://$url");
|
||||||
|
10
main.css
10
main.css
@ -78,7 +78,7 @@ select {
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
width: 165px;
|
width: 165px;
|
||||||
bottom:0;
|
bottom:0;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background-color:rgba(102, 102, 102, 0.9);
|
background-color:rgba(102, 102, 102, 0.9);
|
||||||
color: lightgray;
|
color: lightgray;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ select {
|
|||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
#login {
|
#login {
|
||||||
font-family: Verdana, sans-serif;
|
font-family: Verdana, sans-serif;
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 10%;
|
top: 10%;
|
||||||
background-color: #444;
|
background-color: #444;
|
||||||
@ -141,7 +141,7 @@ select {
|
|||||||
border-bottom: 1px solid gray;
|
border-bottom: 1px solid gray;
|
||||||
}
|
}
|
||||||
#pcomments {
|
#pcomments {
|
||||||
clear: both;
|
clear: both;
|
||||||
color: #903;
|
color: #903;
|
||||||
}
|
}
|
||||||
#pleft,#pright {
|
#pleft,#pright {
|
||||||
@ -161,8 +161,8 @@ select {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 10000;
|
z-index: 10000;
|
||||||
}
|
}
|
||||||
#chart {
|
#chart {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0; left:0; right: 0;
|
bottom: 0; left:0; right: 0;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
margin-right: 165px;
|
margin-right: 165px;
|
||||||
|
148
main.js
148
main.js
@ -16,7 +16,7 @@
|
|||||||
* License along with this program; if not, write to the Free Software
|
* License along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// general stuff
|
// general stuff
|
||||||
if (units=='imperial') {
|
if (units=='imperial') {
|
||||||
factor_kmh = 0.62; //to mph
|
factor_kmh = 0.62; //to mph
|
||||||
@ -25,7 +25,7 @@ if (units=='imperial') {
|
|||||||
unit_m = 'ft';
|
unit_m = 'ft';
|
||||||
factor_km = 0.62; // to miles
|
factor_km = 0.62; // to miles
|
||||||
unit_km = 'mi';
|
unit_km = 'mi';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
factor_kmh = 1;
|
factor_kmh = 1;
|
||||||
unit_kmh = 'km/h';
|
unit_kmh = 'km/h';
|
||||||
@ -58,18 +58,18 @@ function displayChart() {
|
|||||||
|
|
||||||
chart = new google.visualization.LineChart(document.getElementById('chart'));
|
chart = new google.visualization.LineChart(document.getElementById('chart'));
|
||||||
chart.draw(data, options);
|
chart.draw(data, options);
|
||||||
|
|
||||||
addChartEvent(chart);
|
addChartEvent(chart);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleChart(i) {
|
function toggleChart(i) {
|
||||||
var altLen = altitudes.length;
|
var altLen = altitudes.length;
|
||||||
if (altLen<=1) { return; }
|
if (altLen<=1) { return; }
|
||||||
var e = document.getElementById('bottom');
|
var e = document.getElementById('bottom');
|
||||||
if (arguments.length < 1) {
|
if (arguments.length < 1) {
|
||||||
if (e.style.display == 'block') { i = 0 }
|
if (e.style.display == 'block') { i = 0 }
|
||||||
else { i = 1; }
|
else { i = 1; }
|
||||||
}
|
}
|
||||||
if (i==0) {
|
if (i==0) {
|
||||||
chart.clearChart();
|
chart.clearChart();
|
||||||
e.style.display = 'none';
|
e.style.display = 'none';
|
||||||
@ -80,14 +80,14 @@ function toggleChart(i) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleMenu(i) {
|
function toggleMenu(i) {
|
||||||
var emenu = document.getElementById('menu');
|
var emenu = document.getElementById('menu');
|
||||||
var emain = document.getElementById('main');
|
var emain = document.getElementById('main');
|
||||||
var ebutton = document.getElementById('menu-close');
|
var ebutton = document.getElementById('menu-close');
|
||||||
if (arguments.length < 1) {
|
if (arguments.length < 1) {
|
||||||
if (ebutton.innerHTML == '»') { i = 0 }
|
if (ebutton.innerHTML == '»') { i = 0 }
|
||||||
else { i = 1; }
|
else { i = 1; }
|
||||||
}
|
}
|
||||||
if (i==0) {
|
if (i==0) {
|
||||||
emenu.style.width = '0';
|
emenu.style.width = '0';
|
||||||
emain.style.marginRight = '0';
|
emain.style.marginRight = '0';
|
||||||
@ -99,7 +99,7 @@ function toggleMenu(i) {
|
|||||||
emain.style.marginRight = '165px';
|
emain.style.marginRight = '165px';
|
||||||
ebutton.style.right = '165px';
|
ebutton.style.right = '165px';
|
||||||
ebutton.innerHTML = '»';
|
ebutton.innerHTML = '»';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getXHR() {
|
function getXHR() {
|
||||||
@ -120,8 +120,8 @@ function loadTrack(userid,trackid,update) {
|
|||||||
if (xhr.readyState==4 && xhr.status==200) {
|
if (xhr.readyState==4 && xhr.status==200) {
|
||||||
var xml = xhr.responseXML;
|
var xml = xhr.responseXML;
|
||||||
var positions = xml.getElementsByTagName('position');
|
var positions = xml.getElementsByTagName('position');
|
||||||
if (positions.length>0) {
|
if (positions.length>0) {
|
||||||
clearMap();
|
clearMap();
|
||||||
displayTrack(xml,update);
|
displayTrack(xml,update);
|
||||||
}
|
}
|
||||||
xhr = null;
|
xhr = null;
|
||||||
@ -161,7 +161,7 @@ function parsePosition(p) {
|
|||||||
'dateoccured': dateoccured,
|
'dateoccured': dateoccured,
|
||||||
'distance': distance,
|
'distance': distance,
|
||||||
'seconds': seconds
|
'seconds': seconds
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function load(type,userid,trackid) {
|
function load(type,userid,trackid) {
|
||||||
@ -246,7 +246,7 @@ function getTrips(userid) {
|
|||||||
var trackSelect = document.getElementsByName('track')[0];
|
var trackSelect = document.getElementsByName('track')[0];
|
||||||
clearOptions(trackSelect);
|
clearOptions(trackSelect);
|
||||||
var trips = xml.getElementsByTagName('trip');
|
var trips = xml.getElementsByTagName('trip');
|
||||||
if (trips.length>0) {
|
if (trips.length>0) {
|
||||||
fillOptions(xml);
|
fillOptions(xml);
|
||||||
} else {
|
} else {
|
||||||
clearMap();
|
clearMap();
|
||||||
@ -255,7 +255,7 @@ function getTrips(userid) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhr.open('GET','gettrips.php?userid='+userid,true);
|
xhr.open('GET','gettrips.php?userid='+userid,true);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillOptions(xml) {
|
function fillOptions(xml) {
|
||||||
@ -269,7 +269,7 @@ function fillOptions(xml) {
|
|||||||
option.value = trackid;
|
option.value = trackid;
|
||||||
option.innerHTML = trackname;
|
option.innerHTML = trackname;
|
||||||
trackSelect.appendChild(option);
|
trackSelect.appendChild(option);
|
||||||
}
|
}
|
||||||
var defaultTrack = getNode(trips[0],'trackid');
|
var defaultTrack = getNode(trips[0],'trackid');
|
||||||
loadTrack(userid,defaultTrack,1);
|
loadTrack(userid,defaultTrack,1);
|
||||||
}
|
}
|
||||||
@ -300,94 +300,94 @@ function setTime() {
|
|||||||
interval = i;
|
interval = i;
|
||||||
document.getElementById('auto').innerHTML = interval;
|
document.getElementById('auto').innerHTML = interval;
|
||||||
// if live tracking on, reload with new interval
|
// if live tracking on, reload with new interval
|
||||||
if (live==1) {
|
if (live==1) {
|
||||||
live = 0;
|
live = 0;
|
||||||
clearInterval(auto);
|
clearInterval(auto);
|
||||||
autoReload();
|
autoReload();
|
||||||
}
|
}
|
||||||
// save current state as default
|
// save current state as default
|
||||||
setCookie('interval',interval,30);
|
setCookie('interval',interval,30);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dynamic change of map api
|
// dynamic change of map api
|
||||||
var savedBounds;
|
var savedBounds;
|
||||||
function loadMapAPI(api) {
|
function loadMapAPI(api) {
|
||||||
savedBounds = getBounds();
|
savedBounds = getBounds();
|
||||||
document.getElementById("map-canvas").innerHTML = '';
|
document.getElementById("map-canvas").innerHTML = '';
|
||||||
var url = new Array();
|
var url = new Array();
|
||||||
if (api=='gmaps') {
|
if (api=='gmaps') {
|
||||||
url.push('api_gmaps.js');
|
url.push('api_gmaps.js');
|
||||||
url.push('//maps.googleapis.com/maps/api/js?'+((gkey!==null)?('key='+gkey+'&'):'')+'sensor=false&callback=init');
|
url.push('//maps.googleapis.com/maps/api/js?'+((gkey!==null)?('key='+gkey+'&'):'')+'callback=init');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
url.push('api_openlayers.js');
|
url.push('api_openlayers.js');
|
||||||
url.push('http://openlayers.org/api/OpenLayers.js');
|
url.push('//openlayers.org/api/OpenLayers.js');
|
||||||
}
|
}
|
||||||
addScript(url[0]);
|
addScript(url[0]);
|
||||||
waitAndLoad(api,url);
|
waitAndLoad(api,url);
|
||||||
}
|
}
|
||||||
var loadTime = 0;
|
var loadTime = 0;
|
||||||
function waitAndLoad(api,url) {
|
function waitAndLoad(api,url) {
|
||||||
// wait till first script loaded
|
// wait till first script loaded
|
||||||
if (loadTime>5000) { loadTime = 0; alert('Sorry, can\'t load '+api+' API'); return; }
|
if (loadTime>5000) { loadTime = 0; alert('Sorry, can\'t load '+api+' API'); return; }
|
||||||
if (loadedAPI!==api) {
|
if (loadedAPI!==api) {
|
||||||
setTimeout(function() { loadTime += 50; waitAndLoad(api,url); }, 50);
|
setTimeout(function() { loadTime += 50; waitAndLoad(api,url); }, 50);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!isScriptLoaded(url[1])){
|
if(!isScriptLoaded(url[1])){
|
||||||
addScript(url[1]);
|
addScript(url[1]);
|
||||||
}
|
}
|
||||||
loadTime = 0;
|
loadTime = 0;
|
||||||
waitAndInit(api);
|
waitAndInit(api);
|
||||||
}
|
}
|
||||||
|
|
||||||
function waitAndInit(api) {
|
function waitAndInit(api) {
|
||||||
// wait till main api loads
|
// wait till main api loads
|
||||||
if (loadTime>10000) { loadTime = 0; alert('Sorry, can\'t load '+api+' API'); return; }
|
if (loadTime>10000) { loadTime = 0; alert('Sorry, can\'t load '+api+' API'); return; }
|
||||||
try {
|
try {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
setTimeout(function() { loadTime += 50; waitAndInit(api); }, 50);
|
setTimeout(function() { loadTime += 50; waitAndInit(api); }, 50);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadTime = 0;
|
loadTime = 0;
|
||||||
zoomToBounds(savedBounds);
|
zoomToBounds(savedBounds);
|
||||||
loadTrack(userid,trackid,0);
|
loadTrack(userid,trackid,0);
|
||||||
// save current api as default
|
// save current api as default
|
||||||
setCookie('api',api,30);
|
setCookie('api',api,30);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addScript(url) {
|
function addScript(url) {
|
||||||
var tag = document.createElement('script');
|
var tag = document.createElement('script');
|
||||||
tag.setAttribute('type','text/javascript');
|
tag.setAttribute('type','text/javascript');
|
||||||
tag.setAttribute('src', url);
|
tag.setAttribute('src', url);
|
||||||
if (typeof tag!='undefined') {
|
if (typeof tag!='undefined') {
|
||||||
document.getElementsByTagName('head')[0].appendChild(tag);
|
document.getElementsByTagName('head')[0].appendChild(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isScriptLoaded(url) {
|
function isScriptLoaded(url) {
|
||||||
scripts = document.getElementsByTagName('script');
|
scripts = document.getElementsByTagName('script');
|
||||||
for (var i = scripts.length; i--;) {
|
for (var i = scripts.length; i--;) {
|
||||||
// check if url matches src
|
// check if url matches src
|
||||||
var scriptUrl = scripts[i].src.replace(/https?:/,'');
|
var scriptUrl = scripts[i].src.replace(/https?:/,'');
|
||||||
if (scriptUrl != '' && url.indexOf(scriptUrl) !== -1) return true;
|
if (scriptUrl != '' && url.indexOf(scriptUrl) !== -1) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCookie(name,value,days) {
|
function setCookie(name,value,days) {
|
||||||
if (days) {
|
if (days) {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
date.setTime(date.getTime()+(days*24*60*60*1000));
|
date.setTime(date.getTime()+(days*24*60*60*1000));
|
||||||
var expires = '; expires='+date.toGMTString();
|
var expires = '; expires='+date.toGMTString();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var expires = '';
|
var expires = '';
|
||||||
}
|
}
|
||||||
document.cookie = 'phpTrackme_'+name+'='+value+expires+'; path=/';
|
document.cookie = 'phpTrackme_'+name+'='+value+expires+'; path=/';
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLang(lang) {
|
function setLang(lang) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
--
|
--
|
||||||
-- Database layout inherited from TrackMe
|
-- Database layout inherited from TrackMe
|
||||||
-- Some tables/columns are not used by the viewer at the moment.
|
-- Some tables/columns are not used by the viewer at the moment.
|
||||||
-- Kept for compatibility with old data.
|
-- Kept for compatibility with old data.
|
||||||
--
|
--
|
||||||
|
|
||||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||||
SET time_zone = "+00:00";
|
SET time_zone = "+00:00";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user