Beispiel #1
0
	/**
	 * @method getlocation
	 *
	 * Get the reported location of one or more maxxers.
	 *
	 * This data is user-reported, so it's likely that everyone is lying.
	 *
	 * The format of the data returned from this call is unstable and subject to change. Do not use this in a shipping application.
	 *
	 * @param userid integer optional Get the current location for this user only.
	 * @param minlat float optional Get locations with latitudes larger than this.
	 * @param maxlat float optional Get locations with latitudes smaller than this.
	 * @param minlong float optional Get locations with longitudes larger than this.
	 * @param maxlat float optional Get locations with longitudes larger than this.
	 * @param limit limit optional Default and maximum is 200.
	 * @return An array of location data from the database matching the parameters.
	 * @example limit=5
	 * @example userid=2054
	 * @see setlocation
	 */
	function api_getlocation() {
		send(core_getlocation($_REQUEST));
	}
require_once( 'offensive/assets/header.inc' );
require_once( "offensive/assets/activationFunctions.inc" );
require_once( 'admin/mysqlConnectionInfo.inc' );
if(!isset($link) || !$link) $link = openDbConnection();
require_once("offensive/assets/functions.inc");
require_once("offensive/assets/classes.inc");
require_once("offensive/assets/core.inc");
        
// authentication
mustLogIn(array("prompt" => "http",
                "token" => null));

$user = me()->id();
if($user == "") trigger_error("no user argument", E_USER_ERROR);

$locations = core_getlocation(array("userid" => $user));


header("Content-type: application/json");
$data = array(
	'markers'  => array()
);
foreach ($locations as $location){
	$data['markers'][] = array(
		'userid' => $location['userid'],
		'lat'    => $location['latitude'],
		'lon'    => $location['longitude']
	);
}
echo json_encode($data);