function _hybridauth_window_close in HybridAuth Social Login 7.2
Same name and namespace in other branches
- 6.2 hybridauth.pages.inc \_hybridauth_window_close()
Close the popup (if used) and redirect if there was no error.
4 calls to _hybridauth_window_close()
- hybridauth_window_close in ./
hybridauth.rules.inc - Rules action.
- hybridauth_window_start in ./
hybridauth.pages.inc - _hybridauth_window_auth in ./
hybridauth.pages.inc - _hybridauth_window_process_auth in ./
hybridauth.pages.inc - Handle the Drupal authentication.
File
- ./
hybridauth.pages.inc, line 95 - HybridAuth module pages.
Code
function _hybridauth_window_close($redirect = TRUE) {
global $user;
// Prevent devel module from spewing.
$GLOBALS['devel_shutdown'] = FALSE;
$destination = drupal_get_destination();
$destination = $destination['destination'];
// Check if token replacements are allowed for the destination string.
if (_hybridauth_allow_token_replace($destination)) {
$destination = token_replace($destination, array(
'user' => $user,
), array(
'clear' => TRUE,
));
}
$destination_error = !empty($_GET['destination_error']) ? $_GET['destination_error'] : variable_get('hybridauth_destination_error', '');
$base_options = array(
'absolute' => TRUE,
// The redirect target must never be an external URL to prevent open
// redirect vulnerabilities.
'external' => FALSE,
);
$destination_options = drupal_parse_url($destination) + $base_options;
$destination_error_options = drupal_parse_url($destination_error) + $base_options;
drupal_alter('hybridauth_destination_options', $destination_options);
drupal_alter('hybridauth_destination_error_options', $destination_error_options);
$destination = url($destination_options['path'], $destination_options);
$destination_error = url($destination_error_options['path'], $destination_error_options);
drupal_add_js(array(
'hybridauth' => array(
'redirect' => $redirect ? 1 : 0,
'destination' => $destination,
'destination_error' => $destination_error,
),
), 'setting');
drupal_add_js(drupal_get_path('module', 'hybridauth') . '/js/hybridauth.close.js');
// Make sure that we send the correct content type with charset, otherwise
// Firefox might repeat the GET request.
// @see https://www.drupal.org/node/2648912
drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
$page = element_info('page');
// Don't show messages on this closing page, show them later.
$page['#show_messages'] = FALSE;
$page['#children'] = t('Closing...');
print theme('html', array(
'page' => $page,
));
drupal_exit();
}