42 lines
1003 B
PHP
Raw Normal View History

2013-07-19 18:52:33 +03:00
<?php
2013-08-08 00:22:21 +03:00
/**
* ownCloud - Office App
*
* @author Victor Dubiniuk
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
*
* This file is licensed under the Affero General Public License version 3 or
* later.
*/
2013-07-19 18:52:33 +03:00
namespace OCA\Office\Download;
2013-08-07 21:14:36 +03:00
use OCA\Office\View;
2013-07-19 18:52:33 +03:00
class Simple extends \OCA\Office\Download {
2013-08-07 21:41:11 +03:00
public function __construct($view, $filepath){
$this->view = $view;
2013-07-19 18:52:33 +03:00
$this->filepath = $filepath;
}
public function sendResponse(){
header( 'Content-Type:' . $this->getMimeType() );
$encodedName = rawurlencode($this->getFilename());
if (preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"])){
header(
'Content-Disposition: attachment; filepath="' . $encodedName . '"'
);
} else {
header('Content-Disposition: attachment; filepath*=UTF-8\'\'' . $encodedName
. '; filepath="' . $encodedName . '"');
}
2013-08-07 21:14:36 +03:00
header('Content-Length: ' . $this->view->filesize($this->filepath));
2013-07-19 18:52:33 +03:00
\OC_Util::obEnd();
2013-08-07 21:14:36 +03:00
$this->view->readfile($this->filepath);
2013-07-19 18:52:33 +03:00
}
}