summaryrefslogtreecommitdiff
path: root/classes/Notice.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Notice.php')
-rw-r--r--classes/Notice.php31
1 files changed, 29 insertions, 2 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 7d4e61823..fdf5cd4c8 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -66,9 +66,15 @@ class Notice extends Memcached_DataObject
public $is_local; // tinyint(1)
public $source; // varchar(32)
public $conversation; // int(4)
+ public $lat; // decimal(10,7)
+ public $lon; // decimal(10,7)
+ public $location_id; // int(4)
+ public $location_ns; // int(4)
/* Static get */
- function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Notice',$k,$v); }
+ function staticGet($k,$v=NULL) {
+ return Memcached_DataObject::staticGet('Notice',$k,$v);
+ }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
@@ -162,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);
@@ -228,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