More configuration options for location sharing

This commit is contained in:
Evan Prodromou 2009-12-28 14:43:34 -08:00
parent 29a1669c01
commit 39bdda9c7e
2 changed files with 19 additions and 10 deletions

View File

@ -999,17 +999,25 @@ class User extends Memcached_DataObject
function shareLocation() function shareLocation()
{ {
$share = true; $cfg = common_config('location', 'share');
$prefs = User_location_prefs::staticGet('user_id', $this->id); if ($cfg == 'always') {
return true;
} else if ($cfg == 'never') {
return false;
} else { // user
$share = true;
if (empty($prefs)) { $prefs = User_location_prefs::staticGet('user_id', $this->id);
$share = common_config('location', 'share');
} else { if (empty($prefs)) {
$share = $prefs->share_location; $share = common_config('location', 'sharedefault');
$prefs->free(); } else {
$share = $prefs->share_location;
$prefs->free();
}
return $share;
} }
return $share;
} }
} }

View File

@ -226,7 +226,8 @@ $default =
'message' => 'message' =>
array('contentlimit' => null), array('contentlimit' => null),
'location' => 'location' =>
array(), array('share' => 'user', // whether to share location; 'always', 'user', 'never'
'sharedefault' => true),
'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' =>