remove namespace setting from location; it's unused

This commit is contained in:
Evan Prodromou 2009-12-28 14:21:07 -08:00
parent bbf516b965
commit bb93d6b1c7
4 changed files with 46 additions and 20 deletions

View File

@ -164,19 +164,6 @@ class NewnoticeAction extends Action
$replyto = 'false'; $replyto = 'false';
} }
$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;
}
}
$upload = null; $upload = null;
$upload = MediaFile::fromUpload('attach'); $upload = MediaFile::fromUpload('attach');
@ -195,12 +182,30 @@ class NewnoticeAction extends Action
} }
} }
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
array('reply_to' => ($replyto == 'false') ? null : $replyto,
'lat' => $lat, if ($user->shareLocation()) {
'lon' => $lon,
'location_id' => $location_id, $lat = $this->trimmed('lat');
'location_ns' => $location_ns)); $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;
}
}
$options['lat'] = $lat;
$options['lon'] = $lon;
$options['location_id'] = $location_id;
$options['location_ns'] = $location_ns;
}
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
if (isset($upload)) { if (isset($upload)) {
$upload->attachToNotice($notice); $upload->attachToNotice($notice);

View File

@ -133,6 +133,11 @@ class ProfilesettingsAction extends AccountSettingsAction
($this->arg('location')) ? $this->arg('location') : $profile->location, ($this->arg('location')) ? $this->arg('location') : $profile->location,
_('Where you are, like "City, State (or Region), Country"')); _('Where you are, like "City, State (or Region), Country"'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('sharelocation', _('Share my current location when posting notices'),
($this->arg('sharelocation')) ?
$this->arg('sharelocation') : $user->shareLocation());
$this->elementEnd('li');
Event::handle('EndProfileFormData', array($this)); Event::handle('EndProfileFormData', array($this));
$this->elementStart('li'); $this->elementStart('li');
$this->input('tags', _('Tags'), $this->input('tags', _('Tags'),

View File

@ -996,4 +996,20 @@ class User extends Memcached_DataObject
return $ids; return $ids;
} }
function shareLocation()
{
$share = true;
$prefs = User_location_prefs::staticGet('user_id', $this->id);
if (empty($prefs)) {
$share = common_config('location', 'share');
} else {
$share = $prefs->share_location;
$prefs->free();
}
return $share;
}
} }

View File

@ -226,7 +226,7 @@ $default =
'message' => 'message' =>
array('contentlimit' => null), array('contentlimit' => null),
'location' => 'location' =>
array('namespace' => 1), // 1 = geonames, 2 = Yahoo Where on Earth array(),
'omb' => 'omb' =>
array('timeout' => 5), // HTTP request timeout in seconds when contacting remote hosts for OMB updates array('timeout' => 5), // HTTP request timeout in seconds when contacting remote hosts for OMB updates
'logincommand' => 'logincommand' =>