function _janrain_capture_get_screen in Janrain Registration 7.3
Same name and namespace in other branches
- 7.4 janrain_capture.module \_janrain_capture_get_screen()
- 7.2 janrain_capture.module \_janrain_capture_get_screen()
4 calls to _janrain_capture_get_screen()
- janrain_capture_form_user_profile_form_alter in includes/
janrain_capture.fancybox.inc - Implements hook_form_FORM_ID_alter().
- janrain_capture_oauth in includes/
janrain_capture.endpoints.inc - Callback for the janrain_capture/oauth menu item. This serves as the redirect_uri Capture redirects the user to and performs the authentication.
- janrain_capture_user_view in includes/
janrain_capture.fancybox.inc - Implementation of hook_user_view to customize profile view
- janrain_capture_widget_signin_screens in includes/
janrain_capture.widget.inc - Returns widget signin screens.
File
- ./
janrain_capture.module, line 991 - This module implements authentication endpoints for Janrain Capture.
Code
function _janrain_capture_get_screen($fname) {
if (module_exists('janrain_capture_screens')) {
if (!in_array($fname, _janrain_capture_get_screens())) {
return '';
}
if ($screen_file = _janrain_capture_get_screen_file($fname)) {
return file_get_contents($screen_file);
}
return '';
}
else {
$url = variable_get('janrain_capture_screens_folder', 'file:///sites/all/themes/janrain-capture-screens/');
if (!isset($url)) {
watchdog('janrain_capture', 'No Capture screens folder specified in the Janrain Capture settings.', array(), WATCHDOG_WARNING);
return '';
}
if (strpos($url, 'file:///', 0) === 0) {
global $base_path;
$path = DRUPAL_ROOT . str_replace('file://', '', $url) . $fname;
$result = @file_get_contents($path);
if (!$result) {
drupal_set_message(t('Janrain Capture: Could not load screen file "@filename." Please make sure your screens folder is in the correct location.', array(
'@filename' => $fname,
)), 'error');
return false;
}
}
else {
$url_type = isset($_REQUEST['url_type']) ? $_REQUEST['url_type'] : false;
// allow only alpha-numeric (and dashes) to prevent hijacking
if ($url_type && !ctype_alnum(str_replace('-', '', $url_type))) {
header('HTTP/1.1 400 Bad Request');
exit;
}
$url .= $fname;
$resp = drupal_http_request($url);
if (isset($resp->error)) {
watchdog('janrain_capture', 'Failed to retrieve a Capture screen with the following URL: %url', array(
'%url' => $url,
), WATCHDOG_WARNING);
$result = '';
}
else {
$result = $resp->data;
}
}
if (!$result) {
$result = '';
}
return $result;
}
}