forked from GNUsocial/gnu-social
Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x
* '0.8.x' of git@gitorious.org:laconica/dev: Removed extra slash Killed the FB Connect profile-pic bounce in all browsers
This commit is contained in:
commit
6bc37a3254
@ -298,7 +298,7 @@ function NoticeAttachments() {
|
|||||||
|
|
||||||
if (anchor.children('img').length == 0) {
|
if (anchor.children('img').length == 0) {
|
||||||
t = setTimeout(function() {
|
t = setTimeout(function() {
|
||||||
$.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
|
$.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
|
||||||
anchor.append(data);
|
anchor.append(data);
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -66,7 +66,7 @@ class FBConnectauthAction extends Action
|
|||||||
// User is already logged in. Does she already have a linked Facebook acct?
|
// User is already logged in. Does she already have a linked Facebook acct?
|
||||||
$flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE);
|
$flink = Foreign_link::getByForeignID($this->fbuid, FACEBOOK_CONNECT_SERVICE);
|
||||||
|
|
||||||
if ($flink) {
|
if (!empty($flink)) {
|
||||||
|
|
||||||
// User already has a linked Facebook account and shouldn't be here
|
// User already has a linked Facebook account and shouldn't be here
|
||||||
common_debug('There is already a local user (' . $flink->user_id .
|
common_debug('There is already a local user (' . $flink->user_id .
|
||||||
@ -337,7 +337,7 @@ class FBConnectauthAction extends Action
|
|||||||
if ($flink) {
|
if ($flink) {
|
||||||
$user = $flink->getUser();
|
$user = $flink->getUser();
|
||||||
|
|
||||||
if ($user) {
|
if (!empty($user)) {
|
||||||
|
|
||||||
common_debug("Logged in Facebook user $flink->foreign_id as user $user->id ($user->nickname)");
|
common_debug("Logged in Facebook user $flink->foreign_id as user $user->id ($user->nickname)");
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ position:relative;
|
|||||||
margin-left:18px;
|
margin-left:18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#nav_fb .fb_profile_pic_rendered img {
|
#nav_fb #fbc_profile-pic {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
top:-3px;
|
top:-3px;
|
||||||
left:-18px;
|
left:-18px;
|
||||||
@ -21,7 +21,7 @@ border:1px solid #3B5998;
|
|||||||
padding:1px;
|
padding:1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#nav_fb img {
|
#nav_fb #fb_favicon {
|
||||||
position:absolute;
|
position:absolute;
|
||||||
top:-13px;
|
top:-13px;
|
||||||
left:-25px;
|
left:-25px;
|
||||||
|
@ -70,7 +70,7 @@ class FBConnectPlugin extends Plugin
|
|||||||
function onStartShowHTML($action)
|
function onStartShowHTML($action)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->requiresFB($action)) {
|
if ($this->reqFbScripts($action)) {
|
||||||
|
|
||||||
// XXX: Horrible hack to make Safari, FF2, and Chrome work with
|
// XXX: Horrible hack to make Safari, FF2, and Chrome work with
|
||||||
// Facebook Connect. These browser cannot use Facebook's
|
// Facebook Connect. These browser cannot use Facebook's
|
||||||
@ -106,7 +106,7 @@ class FBConnectPlugin extends Plugin
|
|||||||
|
|
||||||
function onStartShowHeader($action)
|
function onStartShowHeader($action)
|
||||||
{
|
{
|
||||||
if ($this->requiresFB($action)) {
|
if ($this->reqFbScripts($action)) {
|
||||||
|
|
||||||
$apikey = common_config('facebook', 'apikey');
|
$apikey = common_config('facebook', 'apikey');
|
||||||
$plugin_path = common_path('plugins/FBConnect');
|
$plugin_path = common_path('plugins/FBConnect');
|
||||||
@ -145,7 +145,7 @@ class FBConnectPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndShowFooter($action)
|
function onEndShowFooter($action)
|
||||||
{
|
{
|
||||||
if ($this->requiresFB($action)) {
|
if ($this->reqFbScripts($action)) {
|
||||||
|
|
||||||
$action->element('script',
|
$action->element('script',
|
||||||
array('type' => 'text/javascript',
|
array('type' => 'text/javascript',
|
||||||
@ -157,7 +157,7 @@ class FBConnectPlugin extends Plugin
|
|||||||
function onEndShowLaconicaStyles($action)
|
function onEndShowLaconicaStyles($action)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->requiresFB($action)) {
|
if ($this->reqFbScripts($action)) {
|
||||||
|
|
||||||
$action->element('link', array('rel' => 'stylesheet',
|
$action->element('link', array('rel' => 'stylesheet',
|
||||||
'type' => 'text/css',
|
'type' => 'text/css',
|
||||||
@ -175,7 +175,7 @@ class FBConnectPlugin extends Plugin
|
|||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function requiresFB($action) {
|
function reqFbScripts($action) {
|
||||||
|
|
||||||
// If you're logged in w/FB Connect, you always need the FB stuff
|
// If you're logged in w/FB Connect, you always need the FB stuff
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ class FBConnectPlugin extends Plugin
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
$facebook = getFacebook();
|
$facebook = getFacebook();
|
||||||
$fbuid = getFacebook()->get_loggedin_user();
|
$fbuid = getFacebook()->get_loggedin_user();
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
@ -248,15 +248,24 @@ class FBConnectPlugin extends Plugin
|
|||||||
|
|
||||||
if (!empty($fbuid)) {
|
if (!empty($fbuid)) {
|
||||||
|
|
||||||
$action->elementStart('li', array('id' => 'nav_fb'));
|
/* Default FB silhouette pic for FB users who haven't
|
||||||
$action->elementStart('fb:profile-pic', array('uid' => $fbuid,
|
uploaded a profile pic yet. */
|
||||||
'linked' => 'false',
|
|
||||||
'width' => 16,
|
|
||||||
'height' => 16));
|
|
||||||
$action->elementEnd('fb:profile-pic');
|
|
||||||
|
|
||||||
$iconurl = common_path('/plugins/FBConnect/fbfavicon.ico');
|
$silhouetteUrl =
|
||||||
$action->element('img', array('src' => $iconurl));
|
'http://static.ak.fbcdn.net/pics/q_silhouette.gif';
|
||||||
|
|
||||||
|
$url = $this->getProfilePicURL($fbuid);
|
||||||
|
|
||||||
|
$action->elementStart('li', array('id' => 'nav_fb'));
|
||||||
|
|
||||||
|
$action->element('img', array('id' => 'fbc_profile-pic',
|
||||||
|
'src' => (!empty($url)) ? $url : $silhouetteUrl,
|
||||||
|
'alt' => 'Facebook Connect User',
|
||||||
|
'width' => '16'), '');
|
||||||
|
|
||||||
|
$iconurl = common_path('plugins/FBConnect/fbfavicon.ico');
|
||||||
|
$action->element('img', array('id' => 'fb_favicon',
|
||||||
|
'src' => $iconurl));
|
||||||
|
|
||||||
$action->elementEnd('li');
|
$action->elementEnd('li');
|
||||||
|
|
||||||
@ -320,7 +329,7 @@ class FBConnectPlugin extends Plugin
|
|||||||
|
|
||||||
function onStartShowLocalNavBlock($action)
|
function onStartShowLocalNavBlock($action)
|
||||||
{
|
{
|
||||||
$action_name = get_class($action);
|
$action_name = get_class($action);
|
||||||
|
|
||||||
$login_actions = array('LoginAction', 'RegisterAction',
|
$login_actions = array('LoginAction', 'RegisterAction',
|
||||||
'OpenidloginAction', 'FBConnectLoginAction');
|
'OpenidloginAction', 'FBConnectLoginAction');
|
||||||
@ -361,4 +370,28 @@ class FBConnectPlugin extends Plugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getProfilePicURL($fbuid)
|
||||||
|
{
|
||||||
|
|
||||||
|
$facebook = getFacebook();
|
||||||
|
$url = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$fqry = 'SELECT pic_square FROM user WHERE uid = %s';
|
||||||
|
|
||||||
|
$result = $facebook->api_client->fql_query(sprintf($fqry, $fbuid));
|
||||||
|
|
||||||
|
if (!empty($result)) {
|
||||||
|
$url = $result[0]['pic_square'];
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
common_log(LOG_WARNING, "Facebook client failure requesting profile pic!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user