summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/apistatusesupdate.php20
-rw-r--r--actions/newnotice.php22
2 files changed, 15 insertions, 27 deletions
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index dabbea92f..f594bbf39 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -203,12 +203,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
}
}
- $location = null;
-
- if (!empty($this->lat) && !empty($this->lon)) {
- $location = Location::fromLatLon($this->lat, $this->lon);
- }
-
$upload = null;
try {
@@ -235,11 +229,15 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$options = array('reply_to' => $reply_to);
- if (!empty($location)) {
- $options['lat'] = $location->lat;
- $options['lon'] = $location->lon;
- $options['location_id'] = $location->location_id;
- $options['location_ns'] = $location->location_ns;
+ if ($this->user->shareLocation()) {
+
+ $locOptions = Notice::locationOptions($this->lat,
+ $this->lon,
+ null,
+ null,
+ $this->user->getProfile());
+
+ $options = array_merge($options, $locOptions);
}
$this->notice =
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 8591522dc..2d9f0ff79 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -186,23 +186,13 @@ class NewnoticeAction extends Action
if ($user->shareLocation()) {
- $lat = $this->trimmed('lat');
- $lon = $this->trimmed('lon');
- $location_id = $this->trimmed('location_id');
- $location_ns = $this->trimmed('location_ns');
-
- if (!empty($lat) && !empty($lon) && empty($location_id)) {
- $location = Location::fromLatLon($lat, $lon);
- if (!empty($location)) {
- $location_id = $location->location_id;
- $location_ns = $location->location_ns;
- }
- }
+ $locOptions = Notice::locationOptions($this->trimmed('lat'),
+ $this->trimmed('lon'),
+ $this->trimmed('location_id'),
+ $this->trimmed('location_ns'),
+ $user->getProfile());
- $options['lat'] = $lat;
- $options['lon'] = $lon;
- $options['location_id'] = $location_id;
- $options['location_ns'] = $location_ns;
+ $options = array_merge($options, $locOptions);
}
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);