Changeset 16642
- Timestamp:
- 06/18/08 15:08:40 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/org.routamc.positioning/lib/fireeagle.php
r15919 r16642 74 74 75 75 function __construct($consumerKey, 76 $consumerSecret,77 $oAuthToken = null,78 $oAuthTokenSecret = null) {76 $consumerSecret, 77 $oAuthToken = null, 78 $oAuthTokenSecret = null) { 79 79 $this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); 80 80 $this->consumer = new OAuthConsumer($consumerKey, $consumerSecret, NULL); … … 152 152 $r->user->best_guess = NULL; 153 153 foreach ($r->user->location_hierarchy as &$loc) { 154 $c = $loc->geometry->coordinates;155 switch ($loc->geometry->type) {156 case 'Box': // DEPRECATED157 $loc->bbox = $c;158 $loc->latitude = ($c[0][0] + $c[1][0]) / 2;159 $loc->longitude = ($c[0][1] + $c[1][1]) / 2;160 $loc->geotype = 'box';161 break;162 case 'Polygon':163 $loc->bbox = $bbox = $loc->geometry->bbox;164 $loc->latitude = ($bbox[0][0] + $bbox[1][0]) / 2;165 $loc->longitude = ($bbox[0][1] + $bbox[1][1]) / 2;166 $loc->geotype = 'box';167 break;168 case 'Point':169 list($loc->longitude, $loc->latitude) = $c;170 $loc->geotype = 'point';171 break;172 }173 if ($loc->best_guess) $r->user->best_guess = $loc; // add shortcut to get 'best guess' loc174 unset($loc);154 $c = $loc->geometry->coordinates; 155 switch ($loc->geometry->type) { 156 case 'Box': // DEPRECATED 157 $loc->bbox = $c; 158 $loc->longitude = ($c[0][0] + $c[1][0]) / 2; 159 $loc->latitude = ($c[0][1] + $c[1][1]) / 2; 160 $loc->geotype = 'box'; 161 break; 162 case 'Polygon': 163 $loc->bbox = $bbox = $loc->geometry->bbox; 164 $loc->longitude = ($bbox[0][0] + $bbox[1][0]) / 2; 165 $loc->latitude = ($bbox[0][1] + $bbox[1][1]) / 2; 166 $loc->geotype = 'box'; 167 break; 168 case 'Point': 169 list($loc->longitude, $loc->latitude) = $c; 170 $loc->geotype = 'point'; 171 break; 172 } 173 if ($loc->best_guess) $r->user->best_guess = $loc; // add shortcut to get 'best guess' loc 174 unset($loc); 175 175 } 176 176 } … … 254 254 $url_bits = parse_url($url); 255 255 if (isset($postData)) { 256 self::dump("POST ".$url_bits['path']." HTTP/1.0\nHost: ".$url_bits['host']."\nContent-Type: application/x-www-urlencoded\nContent-Length: ".strlen($postData)."\n\n$postData\n");256 self::dump("POST ".$url_bits['path']." HTTP/1.0\nHost: ".$url_bits['host']."\nContent-Type: application/x-www-urlencoded\nContent-Length: ".strlen($postData)."\n\n$postData\n"); 257 257 } else { 258 $get_url = $url_bits['path'];259 if ($url_bits['query']) $get_url .= '?' . $url_bits['query'];260 self::dump("GET $get_url HTTP/1.0\nHost: ".$url_bits['host']."\n\n");258 $get_url = $url_bits['path']; 259 if ($url_bits['query']) $get_url .= '?' . $url_bits['query']; 260 self::dump("GET $get_url HTTP/1.0\nHost: ".$url_bits['host']."\n\n"); 261 261 } 262 262 }
