Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/simple_fb_connect.admin.inc b/simple_fb_connect.admin.inc
- index a019d98..e44a95b 100644
- --- a/simple_fb_connect.admin.inc
- +++ b/simple_fb_connect.admin.inc
- @@ -7,7 +7,7 @@
- function simple_fb_connect_api_keys_settings($form, &$form_state) {
- // Check that Facebook PHP SDK is properly installed and that the version is 4.0.x
- $sdk = libraries_detect('facebook-php-sdk-v4');
- - if (!is_array($sdk) || !$sdk['installed'] || $sdk['version'] < '4.0' || $sdk['version'] >= '4.1') {
- + if ( !is_array($sdk) || !$sdk['installed'] || $sdk['version'] < '4.0' || $sdk['version'] >= '4.1') {
- drupal_set_message(t('Facebook PHP SDK not poperly installed. Check README.txt and Drupal status report!'), 'error');
- }
- diff --git a/simple_fb_connect.api.php b/simple_fb_connect.api.php
- index 753e066..85084c3 100644
- --- a/simple_fb_connect.api.php
- +++ b/simple_fb_connect.api.php
- @@ -4,6 +4,7 @@
- * @file
- * Hooks provided by the Simple FB Connect module.
- */
- +
- /**
- * @addtogroup hooks
- * @{
- @@ -26,6 +27,7 @@ function hook_simple_fb_connect_register_alter(&$fields, $fb_user_profile) {
- // Implement this hook in your own module to modify $fields array
- }
- +
- /**
- * This hook allows other modules to add permissions to $scope array
- *
- diff --git a/simple_fb_connect.install b/simple_fb_connect.install
- index 9861e7b..ad46359 100644
- --- a/simple_fb_connect.install
- +++ b/simple_fb_connect.install
- @@ -36,7 +36,7 @@ function simple_fb_connect_requirements($phase) {
- $requirements['facebook-php-sdk-v4']['severity'] = REQUIREMENT_ERROR;
- $requirements['facebook-php-sdk-v4']['description'] = $t('Facebook PHP SDK v4 library not found. See README.txt');
- }
- - elseif (($sdk['version'] < '4.0') || ($sdk['version'] >= '4.1')) {
- + elseif ( ($sdk['version'] < '4.0') || ($sdk['version'] >= '4.1') ) {
- $requirements['facebook-php-sdk-v4']['value'] = $t('Unsupported version detected');
- $requirements['facebook-php-sdk-v4']['severity'] = REQUIREMENT_ERROR;
- $requirements['facebook-php-sdk-v4']['description'] = $t('Version @version detected. See README.txt', array('@version' => $sdk['version']));
- diff --git a/simple_fb_connect.module b/simple_fb_connect.module
- index abe6979..5cb08e7 100644
- --- a/simple_fb_connect.module
- +++ b/simple_fb_connect.module
- @@ -68,7 +68,7 @@ function simple_fb_connect_permission() {
- function simple_fb_connect_login($returned_from_fb = NULL) {
- // Check that Facebook PHP SDK is properly installed and that the version is 4.0.x
- $sdk = libraries_detect('facebook-php-sdk-v4');
- - if (!is_array($sdk) || !$sdk['installed'] || $sdk['version'] < '4.0' || $sdk['version'] >= '4.1') {
- + if ( !is_array($sdk) || !$sdk['installed'] || $sdk['version'] < '4.0' || $sdk['version'] >= '4.1') {
- drupal_set_message(t('Facebook PHP SDK not poperly installed. Contact site administrator.'), 'error');
- drupal_goto("user");
- }
- @@ -89,7 +89,7 @@ function simple_fb_connect_login($returned_from_fb = NULL) {
- // Save the post login URL to $_SESSION if it was explicitly defined.
- $destination = drupal_get_destination();
- - if (!url_is_external($destination['destination']) && $destination['destination'] != 'user/simple-fb-connect') {
- + if ( !url_is_external($destination['destination']) && $destination['destination'] != 'user/simple-fb-connect' ) {
- $_SESSION['simple_fb_connect']['post_login_url'] = $destination['destination'];
- // We need to unset the GET parameter so that we actually redirect the user to FB
- unset($_GET['destination']);
- @@ -277,7 +277,9 @@ function simple_fb_connect_create_user($fb_user_profile, $session) {
- // log new user creation
- if ($account) {
- watchdog(
- - 'simple_fb_connect', 'New user created: @username', array('@username' => $drupal_username_generated), WATCHDOG_NOTICE
- + 'simple_fb_connect', 'New user created: @username',
- + array('@username' => $drupal_username_generated),
- + WATCHDOG_NOTICE
- );
- return $account;
- }
- @@ -285,7 +287,10 @@ function simple_fb_connect_create_user($fb_user_profile, $session) {
- // Something went wrong
- watchdog(
- - 'simple_fb_connect', 'Could not create new user.', array(), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not create new user.',
- + array(),
- + WATCHDOG_ERROR
- );
- return FALSE;
- }
- @@ -303,15 +308,19 @@ function simple_fb_connect_get_fb_profile($session) {
- $request = new FacebookRequest($session, 'GET', '/me');
- $object = $request->execute()->getGraphObject();
- return $object;
- - }
- - catch (FacebookRequestException $ex) {
- + } catch (FacebookRequestException $ex) {
- watchdog(
- - 'simple_fb_connect', 'Could not load FB user profile: FacebookRequestException. Error details: @message', array('@message' => json_encode($ex->getResponse())), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not load FB user profile: FacebookRequestException. Error details: @message',
- + array('@message' => json_encode($ex->getResponse())),
- + WATCHDOG_ERROR
- );
- - }
- - catch (\Exception $ex) {
- + } catch (\Exception $ex) {
- watchdog(
- - 'simple_fb_connect', 'Could not load FB user profile: Unhandled exception. Error details: @message', array('@message' => $ex->getMessage()), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not load FB user profile: Unhandled exception. Error details: @message',
- + array('@message' => $ex->getMessage()),
- + WATCHDOG_ERROR
- );
- }
- @@ -354,18 +363,25 @@ function simple_fb_connect_get_fb_profile_pic($session) {
- }
- else {
- watchdog(
- - 'simple_fb_connect', 'Could not save FB profile picture. Check that directory is writeable: @destination', array('@destination' => $destination), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not save FB profile picture. Check that directory is writeable: @destination',
- + array('@destination' => $destination),
- + WATCHDOG_ERROR
- );
- }
- - }
- - catch (FacebookRequestException $ex) {
- + } catch (FacebookRequestException $ex) {
- watchdog(
- - 'simple_fb_connect', 'Could not load FB profile picture: FacebookRequestException. Error details: @message', array('@message' => json_encode($ex->getResponse())), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not load FB profile picture: FacebookRequestException. Error details: @message',
- + array('@message' => json_encode($ex->getResponse())),
- + WATCHDOG_ERROR
- );
- - }
- - catch (\Exception $ex) {
- + } catch (\Exception $ex) {
- watchdog(
- - 'simple_fb_connect', 'Could not load FB profile picture: Unhandled exception. Error details: @message', array('@message' => $ex->getMessage()), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not load FB profile picture: Unhandled exception. Error details: @message',
- + array('@message' => $ex->getMessage()),
- + WATCHDOG_ERROR
- );
- }
- @@ -410,7 +426,10 @@ function simple_fb_connect_initialize() {
- }
- else {
- watchdog(
- - 'simple_fb_connect', 'Could not initialize FB App. Define APP ID and APP SECRET on module settings.', array(), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not initialize FB App. Define APP ID and APP SECRET on module settings.',
- + array(),
- + WATCHDOG_ERROR
- );
- return FALSE;
- }
- @@ -428,25 +447,32 @@ function simple_fb_connect_initialize() {
- function simple_fb_connect_save_session($helper) {
- try {
- $session = $helper->getSessionFromRedirect();
- - }
- - catch (FacebookRequestException $ex) {
- + } catch (FacebookRequestException $ex) {
- // When Facebook returns an error
- watchdog(
- - 'simple_fb_connect', 'Could not save FB session. FacebookRequestException: @message', array('@message' => json_encode($ex->getResponse())), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not save FB session. FacebookRequestException: @message',
- + array('@message' => json_encode($ex->getResponse())),
- + WATCHDOG_ERROR
- );
- return FALSE;
- - }
- - catch (\Exception $ex) {
- + } catch (\Exception $ex) {
- // When validation fails or other local issues
- watchdog(
- - 'simple_fb_connect', 'Could not save FB session. Exception: @message', array('@message' => $ex->getMessage()), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not save FB session. Exception: @message',
- + array('@message' => $ex->getMessage()),
- + WATCHDOG_ERROR
- );
- return FALSE;
- }
- if (!$session) {
- watchdog(
- - 'simple_fb_connect', 'Facebook did not return an exception but session was NULL (user might have closed the dialog)', array(), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Facebook did not return an exception but session was NULL (user might have closed the dialog)',
- + array(),
- + WATCHDOG_ERROR
- );
- return FALSE;
- }
- @@ -478,17 +504,21 @@ function simple_fb_connect_get_session() {
- try {
- $session->validate();
- return $session;
- - }
- - catch (FacebookRequestException $ex) {
- + } catch (FacebookRequestException $ex) {
- // Session not valid, Graph API returned an exception with the reason.
- watchdog(
- - 'simple_fb_connect', 'Could not load FB session. FacebookRequestException: @message', array('@message' => json_encode($ex->getResponse())), WATCHDOG_NOTICE
- + 'simple_fb_connect',
- + 'Could not load FB session. FacebookRequestException: @message',
- + array('@message' => json_encode($ex->getResponse())),
- + WATCHDOG_NOTICE
- );
- - }
- - catch (\Exception $ex) {
- + } catch (\Exception $ex) {
- // Graph API returned info, but it may mismatch the current app or have expired.
- watchdog(
- - 'simple_fb_connect', 'Could not load FB session. Exception: @message', array('@message' => $ex->getMessage()), WATCHDOG_ERROR
- + 'simple_fb_connect',
- + 'Could not load FB session. Exception: @message',
- + array('@message' => $ex->getMessage()),
- + WATCHDOG_ERROR
- );
- }
- }
- @@ -512,8 +542,8 @@ function simple_fb_connect_libraries_info() {
- 'pattern' => '@Stable-(\d*\.\d*\.\d*)@'
- ),
- 'xautoload' => function($adapter) {
- - $adapter->add('Facebook', 'src');
- -},
- + $adapter->add('Facebook', 'src');
- + },
- );
- return $libraries;
- }
- @@ -577,7 +607,7 @@ function simple_fb_connect_get_post_login_url() {
- $post_login_url = variable_get('simple_fb_connect_post_login_url', 'user');
- // If we have stored the destination to $_SESSION, use that instead
- - if (isset($_SESSION) && isset($_SESSION['simple_fb_connect']) && isset($_SESSION['simple_fb_connect']['post_login_url'])) {
- + if ( isset($_SESSION) && isset($_SESSION['simple_fb_connect']) && isset($_SESSION['simple_fb_connect']['post_login_url']) ) {
- $post_login_url = $_SESSION['simple_fb_connect']['post_login_url'];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement