You are here

function _epub_file_transfer in Epub 6

Transfer ePub file to the user

Parameters

$data: The ebook binary file, which basically is a zipped xml file.

$headers: An array containing http headers for the response.

Return value

NULL.

1 call to _epub_file_transfer()
epub_create_file in ./epub.module
Generate an ePub file from a book.

File

./epub.module, line 679
Provide ePub content type and enable the creation of ePub files from book contents.

Code

function _epub_file_transfer($data, $headers) {
  if (ob_get_level()) {
    ob_end_clean();
  }
  foreach ($headers as $header) {

    // To prevent HTTP header injection, we delete new lines that are
    // not followed by a space or a tab.
    // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
    $header = preg_replace('/\\r?\\n(?!\\t| )/', '', $header);
    drupal_set_header($header);
  }
  echo $data;
  exit;
}