mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
new controller class for downloading document version
This commit is contained in:
parent
5ee03ef693
commit
317021a283
45
controllers/class.Download.php
Normal file
45
controllers/class.Download.php
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of Download 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_Download extends SeedDMS_Controller_Common {
|
||||||
|
|
||||||
|
public function run() {
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
$type = $this->params['type'];
|
||||||
|
$content = $this->params['content'];
|
||||||
|
|
||||||
|
switch($type) {
|
||||||
|
case "version":
|
||||||
|
|
||||||
|
if(!$this->callHook('version')) {
|
||||||
|
header("Content-Transfer-Encoding: binary");
|
||||||
|
header("Content-Length: " . filesize($dms->contentDir . $content->getPath() ));
|
||||||
|
header("Content-Disposition: attachment; filename=\"" . $content->getOriginalFileName() . "\"");
|
||||||
|
header("Content-Type: " . $content->getMimeType());
|
||||||
|
header("Cache-Control: must-revalidate");
|
||||||
|
|
||||||
|
readfile($dms->contentDir . $content->getPath());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user