You are here

function _cmis_browser_content_get_document in CMIS API 7.2

Same name and namespace in other branches
  1. 6.4 cmis_browser/cmis_browser.content_get.inc \_cmis_browser_content_get_document()
  2. 6.2 cmis_browser/cmis_browser.content_get.inc \_cmis_browser_content_get_document()
  3. 6.3 cmis_browser/cmis_browser.content_get.inc \_cmis_browser_content_get_document()
  4. 7 cmis_browser/cmis_browser.content_get.inc \_cmis_browser_content_get_document()

CMIS document download handler.

1 call to _cmis_browser_content_get_document()
cmis_browser_content_get in cmis_browser/cmis_browser.content_get.inc
Build cmis_browser browse page.

File

cmis_browser/cmis_browser.content_get.inc, line 40

Code

function _cmis_browser_content_get_document($repository, $object) {
  module_load_include('api.inc', 'cmis');
  try {
    $content = cmisapi_getContentStream($repository->repositoryId, $object->id);
  } catch (CMISException $e) {
    cmis_error_handler('cmis_browser_content_get', $e);
    drupal_add_http_header('', 'HTTP/1.1 503 Service unavailable');
    exit;
  }
  if (ob_get_level()) {
    ob_end_clean();
  }
  drupal_add_http_header('Cache-Control', 'no-cache, must-revalidate');
  drupal_add_http_header('Content-type', $object->properties['cmis:contentStreamMimeType']);
  if ($object->properties['cmis:contentStreamMimeType'] != 'text/html') {
    drupal_add_http_header('Content-Disposition', 'attachment; filename="' . $object->properties['cmis:name'] . '"');
  }
  print $content;
  exit;
}