You are here

function oa_files_download_uri in Open Atrium Files 7.2

Return a file download link with token Copied from file_entity but we don't want to load a full file node

Parameters

$fid:

$uri:

2 calls to oa_files_download_uri()
oa_files_add_file_links in plugins/content_types/oa_files_treeview.inc
Add info about each file in files
oa_files_prepare_files_from_files in ./oa_files.module
Helper function to create files array needed by angular app from an array of Drupal files

File

./oa_files.module, line 651

Code

function oa_files_download_uri($fid, $file_uri) {
  $uri = array(
    'path' => "file/{$fid}/download",
    'options' => array(),
  );
  if (!variable_get('file_entity_allow_insecure_download', FALSE)) {

    //    $uri['options']['query']['token'] = file_entity_get_download_token($file);
    $uri['options']['query']['token'] = substr(drupal_hmac_base64("file/{$fid}/download:" . $file_uri, drupal_get_private_key() . drupal_get_hash_salt()), 0, 8);
  }
  return url($uri['path'], $uri['options']);
}