You are here

function _janrain_capture_get_local_screen in Janrain Registration 7.4

Same name and namespace in other branches
  1. 7.2 janrain_capture.module \_janrain_capture_get_local_screen()
1 call to _janrain_capture_get_local_screen()
_janrain_capture_get_screen in ./janrain_capture.module

File

./janrain_capture.module, line 1176
This module implements authentication endpoints for Janrain Capture.

Code

function _janrain_capture_get_local_screen($fname, $fromCache = FALSE) {
  if (!$fromCache) {
    $url = variable_get('janrain_capture_screens_folder');
    $url = $url($_SESSION['country_id']);
    $path = DRUPAL_ROOT . str_replace('file://', '', $url) . $fname;
  }
  else {
    $path = sprintf('public://janrain_capture_screens/cache/%d/%s', $_SESSION['country_id'], $fname);
  }
  if (file_exists($path) && is_readable($path)) {
    return file_get_contents($path);
  }

  // problem encountered with the file
  $message = 'Janrain Capture: Could not load screen file "@filename." Please make sure your screens folder is in' . ' the correct location.';
  drupal_set_message(t($message, array(
    '@filename' => $fname,
  )), 'error');
  return '';
}