diff options
author | Wojciech Polak <polak@gnu.org> | 2011-12-23 19:52:16 +0100 |
---|---|---|
committer | Wojciech Polak <polak@gnu.org> | 2011-12-23 19:52:16 +0100 |
commit | a6ef6eca093056367d1b31e94eeb56253b2613c7 (patch) | |
tree | 6c81f1b3a9a1a1dcc4f1dbc5565c4ff2bc04c9dc /frontend | |
parent | b83bdfda4a539ec098862bff827e27a7cfb1ae3f (diff) | |
download | cheetah-a6ef6eca093056367d1b31e94eeb56253b2613c7.tar.gz cheetah-a6ef6eca093056367d1b31e94eeb56253b2613c7.tar.bz2 |
Update Facebook API usage.
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/linked-accounts.php | 20 | ||||
-rw-r--r-- | frontend/login.php | 15 |
2 files changed, 14 insertions, 21 deletions
diff --git a/frontend/linked-accounts.php b/frontend/linked-accounts.php index 53981f6..2f593df 100644 --- a/frontend/linked-accounts.php +++ b/frontend/linked-accounts.php @@ -2,7 +2,7 @@ /* Cheetah News linked-accounts.php - Copyright (C) 2008, 2010 Wojciech Polak. + Copyright (C) 2008, 2010, 2012 Wojciech Polak. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -84,13 +84,10 @@ else if ($link == 'facebook') $fb = new Facebook (array ('appId' => $CONF['fb.app_id'], 'secret' => $CONF['fb.secret_key'], 'cookie' => true)); - $fb_session = $fb->getSession (); - if ($fb_session) { - $fb_uid = $fb->getUser (); - if ($fb_uid) { - $db->query ("UPDATE user SET fbUID=".$fb_uid." WHERE id='". - $session->id."'"); - } + $fb_uid = $fb->getUser (); + if ($fb_uid) { + $db->query ("UPDATE user SET fbUID=".$fb_uid." WHERE id='". + $session->id."'"); } } catch (FacebookApiException $e) { @@ -244,12 +241,11 @@ function detach (id) { var id = this.id; if (id == 'auth-facebook') { FB.login (function (res) { - if (res.session && res.perms && - res.perms.indexOf ('email') != -1) { + if (res.authResponse) { GID ('link').value = 'facebook'; document.forms[0].submit (); } - }, {perms: 'email'}); + }, {scope: 'email'}); } else if (id == 'auth-google') { GID ('link').value = 'https://www.google.com/accounts/o8/id'; @@ -279,7 +275,7 @@ function detach (id) { <div id="fb-root"></div> <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script> <script type="text/javascript"> -FB.init ({appId: '<?=$CONF['fb.app_id']?>', status: true, cookie: true, xfbml: false}); +FB.init ({appId: '<?=$CONF['fb.app_id']?>', oauth: true, status: true, cookie: true, xfbml: false}); </script> <?php } ?> diff --git a/frontend/login.php b/frontend/login.php index b5078d9..03be6dd 100644 --- a/frontend/login.php +++ b/frontend/login.php @@ -2,7 +2,7 @@ /* Cheetah News login.php - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Wojciech Polak. + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Wojciech Polak. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -76,13 +76,10 @@ else if ($fbConnect && isset ($CONF['fb.app_id']) && $fb = new Facebook (array ('appId' => $CONF['fb.app_id'], 'secret' => $CONF['fb.secret_key'], 'cookie' => true)); - $fb_session = $fb->getSession (); - if ($fb_session) { - $fb_uid = $fb->getUser (); - if ($fb_uid) { - $insideFB = $signed_request ? true : false; - $message = $_SESSION['session']->fb_login ($fb, $fb_uid, $insideFB); - } + $fb_uid = $fb->getUser (); + if ($fb_uid) { + $insideFB = $signed_request ? true : false; + $message = $_SESSION['session']->fb_login ($fb, $fb_uid, $insideFB); } } else if ($SignIn) @@ -361,7 +358,7 @@ if ($message) <div id="fb-root"></div> <script type="text/javascript" src="https://connect.facebook.net/en_US/all.js"></script> <script type="text/javascript"> -FB.init ({appId: '<?=$CONF['fb.app_id']?>', status: true, cookie: true, xfbml: false}); +FB.init ({appId: '<?=$CONF['fb.app_id']?>', oauth: true, status: true, cookie: true, xfbml: false}); </script> <?php } ?> |