summaryrefslogtreecommitdiff
path: root/classes/Notice.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-10-23 11:47:00 -0400
committerEvan Prodromou <evan@status.net>2009-10-23 11:47:00 -0400
commit967de946654e96793d11413a46067ac95b356a64 (patch)
tree8d682a3bfe9652543ee4b548adfb6f808f928312 /classes/Notice.php
parent943b2bea09b484bd4709b6d2c4a3560ce82a2467 (diff)
update location while saving new profile
Diffstat (limited to 'classes/Notice.php')
-rw-r--r--classes/Notice.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 592f64426..7478f945d 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -168,7 +168,8 @@ class Notice extends Memcached_DataObject
}
static function saveNew($profile_id, $content, $source=null,
- $is_local=Notice::LOCAL_PUBLIC, $reply_to=null, $uri=null, $created=null) {
+ $is_local=Notice::LOCAL_PUBLIC, $reply_to=null, $uri=null, $created=null,
+ $lat=null, $lon=null, $location_id=null, $location_ns=null) {
$profile = Profile::staticGet($profile_id);
@@ -234,6 +235,26 @@ class Notice extends Memcached_DataObject
$notice->conversation = $reply->conversation;
}
+ if (!empty($lat) && !empty($lon)) {
+ $notice->lat = $lat;
+ $notice->lon = $lon;
+ $notice->location_id = $location_id;
+ $notice->location_ns = $location_ns;
+ } else if (!empty($location_ns) && !empty($location_id)) {
+ $location = Location::fromId($location_id, $location_ns);
+ if (!empty($location)) {
+ $notice->lat = $location->lat;
+ $notice->lon = $location->lon;
+ $notice->location_id = $location_id;
+ $notice->location_ns = $location_ns;
+ }
+ } else {
+ $notice->lat = $profile->lat;
+ $notice->lon = $profile->lon;
+ $notice->location_id = $profile->location_id;
+ $notice->location_ns = $profile->location_ns;
+ }
+
if (Event::handle('StartNoticeSave', array(&$notice))) {
// XXX: some of these functions write to the DB