2013-07-23 15:35:46 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of ViewOnline controller
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @license GPL 2
|
|
|
|
* @version @version@
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which does the busines logic for downloading a document
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2010-2013 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
class SeedDMS_Controller_ViewOnline extends SeedDMS_Controller_Common {
|
|
|
|
|
|
|
|
public function run() {
|
|
|
|
$dms = $this->params['dms'];
|
2014-01-10 06:51:50 +00:00
|
|
|
$settings = $this->params['settings'];
|
2013-07-23 15:35:46 +00:00
|
|
|
$type = $this->params['type'];
|
|
|
|
$content = $this->params['content'];
|
|
|
|
$document = $content->getDocument();
|
|
|
|
|
|
|
|
switch($type) {
|
|
|
|
case "version":
|
2016-11-22 08:20:12 +00:00
|
|
|
if(null === $this->callHook('version')) {
|
2014-01-10 06:51:50 +00:00
|
|
|
header("Content-Type: " . $content->getMimeType());
|
|
|
|
if (!isset($settings->_viewOnlineFileTypes) || !is_array($settings->_viewOnlineFileTypes) || !in_array(strtolower($content->getFileType()), $settings->_viewOnlineFileTypes)) {
|
|
|
|
header("Content-Disposition: filename=\"" . $document->getName().$content->getFileType()) . "\"";
|
2013-07-23 15:35:46 +00:00
|
|
|
}
|
|
|
|
header("Content-Length: " . filesize($dms->contentDir . $content->getPath()));
|
|
|
|
header("Expires: 0");
|
|
|
|
header("Cache-Control: no-cache, must-revalidate");
|
|
|
|
header("Pragma: no-cache");
|
|
|
|
|
2014-01-10 06:51:50 +00:00
|
|
|
ob_clean();
|
2013-07-23 15:35:46 +00:00
|
|
|
readfile($dms->contentDir . $content->getPath());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|