You are here

function media_view_page in D7 Media 7

Menu callback; view a single file entity.

1 string reference to 'media_view_page'
media_menu in ./media.module
Implement of hook_menu().

File

includes/media.pages.inc, line 11
Common pages for the Media module.

Code

function media_view_page($file) {

  // @todo Implement granular editorial access: http://drupal.org/node/696970.
  //   In the meantime, protect information about private files from being
  //   discovered by unprivileged users. File IDs are autoincrement, so one can
  //   attempt discovery by trying to access different media/ID paths. See also
  //   media_browser_list(). This logic potentially belongs within
  //   media_access(), but that would require extending that function's
  //   signature to accept a $file paramter, and this is temporary code anyway.
  if (!user_access('administer media') && file_uri_scheme($file->uri) === 'private') {
    return MENU_ACCESS_DENIED;
  }
  drupal_set_title($file->filename);
  return file_view($file, 'media_original');
}