if (Event::handle('StartShowStatusNetScripts', array($this))) {
$this->script('util.js');
$this->script('xbImportNode.js');
- $this->script('geometa.js');
+ if (common_location_shared()) {
+ $this->script('geometa.js');
+ }
// This route isn't available in single-user mode.
// Not sure why, but it causes errors here.
}
return call_user_func_array('sprintf', $args);
}
+
+function common_location_shared()
+{
+ // Get default setting
+ $cfg = common_config('location', 'share');
+
+ if ($cfg == 'always') {
+ // Always enabled
+ return true;
+ } elseif ($cfg == 'never') {
+ // Never enabled
+ return false;
+ }
+
+ // Is the user logged-in?
+ if (common_logged_in()) {
+ // Get current user
+ $user = common_current_user();
+
+ // Is it there?
+ if ($user instanceof User) {
+ // Yes, get profile
+ $profile = $user->getProfile();
+
+ // Get it from the profile
+ return $profile->shareLocation();
+ }
+ }
+
+ // User is not logged in, get default
+ return common_config('location', 'sharedefault');
+}