summaryrefslogtreecommitdiff
path: root/plugins/FBConnect/FBConnectAuth.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/FBConnect/FBConnectAuth.php')
-rw-r--r--plugins/FBConnect/FBConnectAuth.php69
1 files changed, 49 insertions, 20 deletions
diff --git a/plugins/FBConnect/FBConnectAuth.php b/plugins/FBConnect/FBConnectAuth.php
index e8724cdf9..233eb83ab 100644
--- a/plugins/FBConnect/FBConnectAuth.php
+++ b/plugins/FBConnect/FBConnectAuth.php
@@ -50,7 +50,8 @@ class FBConnectauthAction extends Action
}
} catch (Exception $e) {
- common_debug("Problem getting fbuid.");
+ common_log(LOG_WARNING, 'Problem getting Facebook uid: ' .
+ $e->getMessage());
}
return true;
@@ -124,34 +125,60 @@ class FBConnectauthAction extends Action
}
$this->elementStart('form', array('method' => 'post',
- 'id' => 'account_connect',
+ 'id' => 'form_settings_facebook_connect',
+ 'class' => 'form_settings',
'action' => common_local_url('FBConnectAuth')));
- $this->hidden('token', common_session_token());
- $this->element('h2', null,
- _('Create new account'));
- $this->element('p', null,
- _('Create a new user with this nickname.'));
- $this->input('newname', _('New nickname'),
- ($this->username) ? $this->username : '',
- _('1-64 lowercase letters or numbers, no punctuation or spaces'));
- $this->elementStart('p');
+ $this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options'));
+ $this->element('legend', null, _('Connection options'));
+ $this->elementStart('ul', 'form_data');
+ $this->elementStart('li');
$this->element('input', array('type' => 'checkbox',
'id' => 'license',
+ 'class' => 'checkbox',
'name' => 'license',
'value' => 'true'));
+ $this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
$this->text(_('My text and files are available under '));
$this->element('a', array('href' => common_config('license', 'url')),
common_config('license', 'title'));
$this->text(_(' except this private data: password, email address, IM address, phone number.'));
- $this->elementEnd('p');
+ $this->elementEnd('label');
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
+
+ $this->elementStart('fieldset');
+ $this->hidden('token', common_session_token());
+ $this->element('legend', null,
+ _('Create new account'));
+ $this->element('p', null,
+ _('Create a new user with this nickname.'));
+ $this->elementStart('ul', 'form_data');
+ $this->elementStart('li');
+ $this->input('newname', _('New nickname'),
+ ($this->username) ? $this->username : '',
+ _('1-64 lowercase letters or numbers, no punctuation or spaces'));
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
$this->submit('create', _('Create'));
- $this->element('h2', null,
+ $this->elementEnd('fieldset');
+
+ $this->elementStart('fieldset');
+ $this->element('legend', null,
_('Connect existing account'));
$this->element('p', null,
_('If you already have an account, login with your username and password to connect it to your Facebook.'));
+ $this->elementStart('ul', 'form_data');
+ $this->elementStart('li');
$this->input('nickname', _('Existing nickname'));
+ $this->elementEnd('li');
+ $this->elementStart('li');
$this->password('password', _('Password'));
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
$this->submit('connect', _('Connect'));
+ $this->elementEnd('fieldset');
+
+ $this->elementEnd('fieldset');
$this->elementEnd('form');
}
@@ -283,7 +310,7 @@ class FBConnectauthAction extends Action
} else {
- common_debug("no flink found for fbuid: $this->fbuid");
+ common_debug("No flink found for fbuid: $this->fbuid");
$this->showForm(null, $this->bestNewNickname());
}
@@ -306,8 +333,6 @@ class FBConnectauthAction extends Action
function flinkUser($user_id, $fbuid)
{
- common_debug("flinkUser()");
-
$flink = new Foreign_link();
$flink->user_id = $user_id;
$flink->foreign_id = $fbuid;
@@ -370,7 +395,10 @@ class FBConnectauthAction extends Action
// XXX: Consider moving this to lib/facebookutil.php
function getFacebookFields($fb_uid, $fields) {
try {
- $infos = getFacebook()->api_client->users_getInfo($fb_uid, $fields);
+
+ $facebook = getFacebook();
+
+ $infos = $facebook->api_client->users_getInfo($fb_uid, $fields);
if (empty($infos)) {
return null;
@@ -378,9 +406,10 @@ class FBConnectauthAction extends Action
return reset($infos);
} catch (Exception $e) {
- error_log("Failure in the api when requesting " . join(",", $fields)
- ." on uid " . $fb_uid . " : ". $e->getMessage());
- return null;
+ common_log(LOG_WARNING, "Facebook client failure when requesting " .
+ join(",", $fields) . " on uid " . $fb_uid .
+ " : ". $e->getMessage());
+ return null;
}
}