1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jappix_ynh.git synced 2024-09-03 19:26:19 +02:00
jappix_ynh/source/server/geolocation.php

45 lines
1 KiB
PHP
Raw Normal View History

2014-03-12 14:52:47 +01:00
<?php
/*
Jappix - An open social platform
This is the Jappix geolocation script
-------------------------------------------------
License: AGPL
Author: Valérian Saliou
*/
// PHP base
define('JAPPIX_BASE', '..');
// Get the needed files
require_once('./functions.php');
require_once('./read-main.php');
require_once('./read-hosts.php');
// Prepare application
enableErrorSink();
hideErrors();
compressThis();
// Not allowed for a special node
if(isStatic() || isUpload()) {
exit;
}
// If valid data was sent
if((isset($_GET['latitude']) && !empty($_GET['latitude'])) && (isset($_GET['longitude']) && !empty($_GET['longitude'])) && (isset($_GET['language']) && !empty($_GET['language']))) {
// Set a XML header
header('Content-Type: text/xml; charset=utf-8');
2014-11-25 23:42:38 +01:00
2014-03-12 14:52:47 +01:00
// Get the XML content
2014-11-25 20:12:58 +01:00
$xml = readUrl('http://maps.googleapis.com/maps/api/geocode/xml?latlng='.urlencode($_GET['latitude']).','.urlencode($_GET['longitude']).'&language='.urlencode($_GET['language']).'&sensor=true');
2014-11-25 23:42:38 +01:00
2014-03-12 14:52:47 +01:00
exit($xml);
}
?>