/** * Fetches Fire Eagle information for users */ public function _on_execute() { debug_add('_on_execute called'); $fireeagle = org_routamc_positioning_importer::create('fireeagle'); $fireeagle->seek_fireeagle_users(); debug_add('Done'); return; }
/** * Fetches Plazes information for users */ public function _on_execute() { debug_add('_on_execute called'); $plazes = org_routamc_positioning_importer::create('plazes'); $plazes->seek_plazes_users(); debug_add('Done'); return; }
/** * Fetches icbm information for users */ public function _on_execute() { debug_add('_on_execute called'); $html = org_routamc_positioning_importer::create('html'); $html->seek_icbm_users(); debug_add('Done'); return; }
<?php midcom::get()->finish(); _midcom_stop_request(); } elseif (isset($_GET['f']) && $_GET['f'] == 'callback') { // the user has authorized us at FE, so now we can pick up our access token + secret if (!$session->exists('auth_state') || $session->get('auth_state') != 'start') { throw new midcom_error("Out of sequence."); } $fireeagle = new FireEagle($fireeagle_consumer_key, $fireeagle_consumer_secret, $session->get('request_token'), $session->get('request_secret')); $access_token = $fireeagle->getAccessToken(); if (!isset($access_token['oauth_token']) || !is_string($access_token['oauth_token']) || !isset($access_token['oauth_token_secret']) || !is_string($access_token['oauth_token_secret'])) { throw new midcom_error("Failed to get FireEagle access token\n"); } $user->set_parameter('net.yahoo.fireeagle', 'access_key', $access_token['oauth_token']); $user->set_parameter('net.yahoo.fireeagle', 'access_secret', $access_token['oauth_token_secret']); midcom::get()->relocate($_SERVER['SCRIPT_NAME']); // This will exit } ?> <p><a href="?f=start">Start Fire Eagle authentication</a></p> <?php midcom::get()->finish(); _midcom_stop_request(); } $fireeagle = org_routamc_positioning_importer::create('fireeagle'); $coordinates = $fireeagle->get_fireeagle_location($user); if ($coordinates) { echo sprintf('According to Fire Eagle your position since %s is %s', strftime('%x %X', $coordinates['date']), org_routamc_positioning_utils::microformat_location($coordinates['latitude'], $coordinates['longitude'])); } else { echo "Failed to get position, last error is {$fireeagle->error} {$fireeagle->error_string}"; }
<?php midcom::get('auth')->require_valid_user(); $user = midcom::get('auth')->user->get_storage(); $html = org_routamc_positioning_importer::create('html'); $coordinates = $html->get_icbm_location($user); if ($coordinates) { echo sprintf('According to ICBM URL your position is %s', org_routamc_positioning_utils::microformat_location($coordinates['latitude'], $coordinates['longitude'])); } else { echo "Failed to get position, last error is {$html->error}"; }
if (!$api_key) { if (isset($_POST['instamapper_api_key'])) { $user->parameter('org.routamc.positioning:instamapper', 'api_key', $_POST['instamapper_api_key']); $api_key = $_POST['instamapper_api_key']; } else { ?> <h1>Set your InstaMapper API key</h1> <p> You can get the key from the <a href="http://www.instamapper.com/">InstaMapper</a> site. </p> <form method="post"> <label> <span>API key</span> <input type="text" name="instamapper_api_key" /> </label> <input type="submit" value="Save" /> </form> <?php } } if ($api_key) { $importer = org_routamc_positioning_importer::create('instamapper'); $coordinates = $importer->get_instamapper_location($user); if ($coordinates) { echo sprintf('According to InstaMapper your position is %s', org_routamc_positioning_utils::microformat_location($coordinates['latitude'], $coordinates['longitude'])); } else { echo "Failed to get position, last error is {$importer->error}"; } }
$message = "New location is " . org_routamc_positioning_utils::pretty_print_coordinates($latest_log->latitude, $latest_log->longitude) . "."; if ($previous_log) { $previous_coord = array('latitude' => $previous_log->latitude, 'longitude' => $previous_log->longitude); $message .= " Previous was " . org_routamc_positioning_utils::get_distance($previous_coord, $latest_coord) . "km " . org_routamc_positioning_utils::get_bearing($latest_coord, $previous_coord) . "."; } org_routamc_positioning_send_sms($person->handphone, $message, $config->get('smslib_from'), $config); } } midcom::get('auth')->drop_sudo(); midcom::get()->finish(); _midcom_stop_request(); } midcom::get('auth')->require_valid_user(); $user = midcom::get('auth')->user->get_storage(); if (array_key_exists('add_position', $_POST)) { $manual = org_routamc_positioning_importer::create('manual'); $manual_position = array(); if (array_key_exists('geocoder', $_POST)) { $manual_position['geocoder'] = $_POST['geocoder']; } if (array_key_exists('street', $_POST)) { $manual_position['street'] = $_POST['street']; } if (array_key_exists('city', $_POST)) { $manual_position['city'] = $_POST['city']; } if (array_key_exists('country', $_POST)) { $manual_position['country'] = $_POST['country']; } if (array_key_exists('latitude', $_POST) && !empty($_POST['latitude'])) { $manual_position['latitude'] = $_POST['latitude'];
<?php midcom::get('auth')->require_valid_user(); $user = midcom::get('auth')->user->get_storage(); $html = org_routamc_positioning_importer::create('georss'); $coordinates = $html->get_georss_location($user); if ($coordinates) { echo sprintf('According to your GeoRSS feed your position is %s', org_routamc_positioning_utils::microformat_location($coordinates['latitude'], $coordinates['longitude'])); } else { echo "Failed to get position, last error is {$html->error}"; }
if (!$api_key) { if (isset($_POST['qaiku_apikey'])) { $user->set_parameter('org.routamc.statusmessage:qaiku', 'apikey', $_POST['qaiku_apikey']); $api_key = $_POST['qaiku_apikey']; } else { ?> <h1>Set your Qaiku API key</h1> <p> You can get the key from <a href="http://www.qaiku.com/settings/api/">Qaiku</a>. </p> <form method="post"> <label> <span>API key</span> <input type="text" name="qaiku_apikey" /> </label> <input type="submit" value="Save" /> </form> <?php } } if ($api_key) { $importer = org_routamc_positioning_importer::create('qaiku'); $coordinates = $importer->get_qaiku_location($user); if ($coordinates) { echo sprintf('According to Qaiku your position is %s', org_routamc_positioning_utils::microformat_location($coordinates['latitude'], $coordinates['longitude'])); } else { echo "Failed to get position, last error is {$importer->error}"; } }
<?php midcom::get('auth')->require_valid_user(); $user = midcom::get('auth')->user->get_storage(); $plazes = org_routamc_positioning_importer::create('plazes'); $coordinates = $plazes->get_plazes_location($user); if ($coordinates) { echo sprintf('According to Plazes your position since %s is %s', strftime('%x %X', $coordinates['date']), org_routamc_positioning_utils::microformat_location($coordinates['latitude'], $coordinates['longitude'])); } else { echo "Failed to get position, last error is {$plazes->error} {$plazes->error_string}"; }