diff options
Diffstat (limited to 'plugins/FBConnect/FBConnectSettings.php')
-rw-r--r-- | plugins/FBConnect/FBConnectSettings.php | 89 |
1 files changed, 49 insertions, 40 deletions
diff --git a/plugins/FBConnect/FBConnectSettings.php b/plugins/FBConnect/FBConnectSettings.php index 7e255f43a..034ecebae 100644 --- a/plugins/FBConnect/FBConnectSettings.php +++ b/plugins/FBConnect/FBConnectSettings.php @@ -78,63 +78,73 @@ class FBConnectSettingsAction extends ConnectSettingsAction function showContent() { $user = common_current_user(); - $flink = Foreign_link::getByUserID($user->id, FACEBOOK_CONNECT_SERVICE); + $this->elementStart('form', array('method' => 'post', + 'id' => 'form_settings_facebook', + 'class' => 'form_settings', + 'action' => + common_local_url('FBConnectSettings'))); + if (!$flink) { - $this->element('p', 'form_note', + $this->element('p', 'instructions', _('There is no Facebook user connected to this account.')); $this->element('fb:login-button', array('onlogin' => 'goto_login()', 'length' => 'long')); - return; - } + } else { - $this->element('p', 'form_note', - _('Connected Facebook user:')); + $this->element('p', 'form_note', + _('Connected Facebook user')); + + $this->elementStart('p', array('class' => 'facebook-user-display')); + $this->elementStart('fb:profile-pic', + array('uid' => $flink->foreign_id, + 'size' => 'small', + 'linked' => 'true', + 'facebook-logo' => 'true')); + $this->elementEnd('fb:profile-pic'); + + $this->elementStart('fb:name', array('uid' => $flink->foreign_id, + 'useyou' => 'false')); + $this->elementEnd('fb:name'); + $this->elementEnd('p'); - $this->elementStart('p', array('class' => 'facebook-user-display')); - $this->elementStart('fb:profile-pic', - array('uid' => $flink->foreign_id, - 'size' => 'square', - 'linked' => 'true', - 'facebook-logo' => 'true')); - $this->elementEnd('fb:profile-pic'); + $this->hidden('token', common_session_token()); - $this->elementStart('fb:name', array('uid' => $flink->foreign_id)); - $this->elementEnd('fb:name'); - $this->elementEnd('p'); + $this->elementStart('fieldset'); - $this->elementStart('form', array('method' => 'post', - 'id' => 'form_settings_facebook', - 'class' => 'form_settings', - 'action' => - common_local_url('FBConnectSettings'))); + $this->element('legend', null, _('Disconnect my account from Facebook')); - $this->hidden('token', common_session_token()); + if (!$user->password) { - $this->elementStart('fieldset'); + $this->elementStart('p', array('class' => 'form_guide')); + $this->text(_('Disconnecting your Faceboook ' . + 'would make it impossible to log in! Please ')); + $this->element('a', + array('href' => common_local_url('passwordsettings')), + _('set a password')); - $this->element('legend', null, _('Disconnect my account from Facebook')); + $this->text(_(' first.')); + $this->elementEnd('p'); + } else { - if (!$user->password) { + $note = 'Keep your %s account but disconnect from Facebook. ' . + 'You\'ll use your %s password to log in.'; - $this->elementStart('p', array('class' => 'form_guide')); - $this->text(_('Disconnecting your Faceboook ' . - 'would make it impossible to log in! Please ')); - $this->element('a', - array('href' => common_local_url('passwordsettings')), - _('set a password')); + $site = common_config('site', 'name'); - $this->text(_(' first.')); - $this->elementEnd('p'); - } else { - $this->submit('disconnect', _('Disconnect')); - } + $this->element('p', 'instructions', + sprintf($note, $site, $site)); + + $this->submit('disconnect', _('Disconnect')); + } + + $this->elementEnd('fieldset'); + } - $this->elementEnd('fieldset'); $this->elementEnd('form'); } @@ -171,8 +181,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction try { - // XXX: not sure what exactly to do here - + // Clear FB Connect cookies out $facebook = getFacebook(); $facebook->clear_cookie_state(); @@ -182,7 +191,7 @@ class FBConnectSettingsAction extends ConnectSettingsAction $e->getMessage()); } - $this->showForm(_('Facebook user disconnected.'), true); + $this->showForm(_('You have disconnected from Facebook.'), true); } else { $this->showForm(_('Not sure what you\'re trying to do.')); |