add lat and long parameters to api/statuses/update

This commit is contained in:
Evan Prodromou 2009-11-10 15:36:55 -05:00
parent 923fa068a6
commit 27e6a3f36f

View File

@ -61,6 +61,9 @@ class ApiStatusesUpdateAction extends ApiAuthAction
var $source = null; var $source = null;
var $status = null; var $status = null;
var $in_reply_to_status_id = null; var $in_reply_to_status_id = null;
var $lat = null;
var $lon = null;
static $reserved_sources = array('web', 'omb', 'mail', 'xmpp', 'api'); static $reserved_sources = array('web', 'omb', 'mail', 'xmpp', 'api');
/** /**
@ -79,6 +82,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$this->user = $this->auth_user; $this->user = $this->auth_user;
$this->status = $this->trimmed('status'); $this->status = $this->trimmed('status');
$this->source = $this->trimmed('source'); $this->source = $this->trimmed('source');
$this->lat = $this->trimmed('lat');
$this->lon = $this->trimmed('long');
if (empty($this->source) || in_array($source, self::$reserved_sources)) { if (empty($this->source) || in_array($source, self::$reserved_sources)) {
$this->source = 'api'; $this->source = 'api';
@ -198,6 +203,12 @@ class ApiStatusesUpdateAction extends ApiAuthAction
} }
} }
$location = null;
if (!empty($this->lat) && !empty($this->lon)) {
$location = Location::fromLatLon($this->lat, $this->lon);
}
$upload = null; $upload = null;
try { try {
@ -225,7 +236,13 @@ class ApiStatusesUpdateAction extends ApiAuthAction
html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8'), html_entity_decode($status_shortened, ENT_NOQUOTES, 'UTF-8'),
$this->source, $this->source,
1, 1,
$reply_to $reply_to,
null,
null,
empty($location) ? null : $location->lat,
empty($location) ? null : $location->lon,
empty($location) ? null : $location->location_id,
empty($location) ? null : $location->location_ns
); );
if (isset($upload)) { if (isset($upload)) {