diff options
author | Evan Prodromou <evan@status.net> | 2009-12-28 14:43:34 -0800 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-12-28 15:58:58 -0800 |
commit | 97f611107a9620f0e01e6c00c91cd1edea66d981 (patch) | |
tree | 953d39f93f2e3738e792e925486d92433e1ecfbf | |
parent | 6a6d88f0f4641f294a5c513c6aacba604e37222f (diff) |
More configuration options for location sharing
-rw-r--r-- | classes/User.php | 26 | ||||
-rw-r--r-- | lib/default.php | 3 |
2 files changed, 19 insertions, 10 deletions
diff --git a/classes/User.php b/classes/User.php index 2bcb7c2a0..34151778c 100644 --- a/classes/User.php +++ b/classes/User.php @@ -999,17 +999,25 @@ class User extends Memcached_DataObject 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)) { - $share = common_config('location', 'share'); - } else { - $share = $prefs->share_location; - $prefs->free(); - } + $prefs = User_location_prefs::staticGet('user_id', $this->id); - return $share; + if (empty($prefs)) { + $share = common_config('location', 'sharedefault'); + } else { + $share = $prefs->share_location; + $prefs->free(); + } + + return $share; + } } } diff --git a/lib/default.php b/lib/default.php index b5eda7b2c..8a70ed3fa 100644 --- a/lib/default.php +++ b/lib/default.php @@ -226,7 +226,8 @@ $default = 'message' => array('contentlimit' => null), 'location' => - array(), + array('share' => 'user', // whether to share location; 'always', 'user', 'never' + 'sharedefault' => true), 'omb' => array('timeout' => 5), // HTTP request timeout in seconds when contacting remote hosts for OMB updates 'logincommand' => |