You are here

function cmis_content_get in CMIS API 6

Handle content download @todo: input validation

1 string reference to 'cmis_content_get'
cmis_content_menu in cmis_content/cmis_content.module
Implementation of hook_menu() for CMIS module.

File

cmis_content/cmis_content.module, line 177

Code

function cmis_content_get() {
  module_load_include('api.inc', 'cmis');
  $objectId = urldecode($_GET['id']);
  $repository = cmisapi_getRepositoryInfo();
  $object = cmisapi_getProperties($repository->repositoryId, $objectId);
  $content = cmisapi_getContentStream($repository->repositoryId, $objectId);
  if (ob_get_level()) {
    ob_end_clean();
  }
  drupal_set_header('Cache-Control: no-cache, must-revalidate');
  drupal_set_header('Content-type: ' . $object->contentMimeType);
  drupal_set_header('Content-Disposition: attachment; filename="' . $object->title . '"');
  print $content;
  exit;
}