nextcloud /
server
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @copyright Copyright (c) 2016, ownCloud, Inc. |
||
| 4 | * |
||
| 5 | * @author Andreas Fischer <[email protected]> |
||
| 6 | * @author Björn Schießle <[email protected]> |
||
| 7 | * @author Lukas Reschke <[email protected]> |
||
| 8 | * @author Morris Jobke <[email protected]> |
||
| 9 | * @author Roeland Jago Douma <[email protected]> |
||
| 10 | * @author Vincent Petry <[email protected]> |
||
| 11 | * |
||
| 12 | * @license AGPL-3.0 |
||
| 13 | * |
||
| 14 | * This code is free software: you can redistribute it and/or modify |
||
| 15 | * it under the terms of the GNU Affero General Public License, version 3, |
||
| 16 | * as published by the Free Software Foundation. |
||
| 17 | * |
||
| 18 | * This program is distributed in the hope that it will be useful, |
||
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 21 | * GNU Affero General Public License for more details. |
||
| 22 | * |
||
| 23 | * You should have received a copy of the GNU Affero General Public License, version 3, |
||
| 24 | * along with this program. If not, see <http://www.gnu.org/licenses/> |
||
| 25 | * |
||
| 26 | */ |
||
| 27 | |||
| 28 | OCP\JSON::checkAppEnabled('files_versions'); |
||
| 29 | OCP\JSON::checkLoggedIn(); |
||
|
0 ignored issues
–
show
|
|||
| 30 | |||
| 31 | $file = $_GET['file']; |
||
| 32 | $revision=(int)$_GET['revision']; |
||
| 33 | |||
| 34 | list($uid, $filename) = OCA\Files_Versions\Storage::getUidAndFilename($file); |
||
| 35 | |||
| 36 | $versionName = '/'.$uid.'/files_versions/'.$filename.'.v'.$revision; |
||
| 37 | |||
| 38 | $view = new OC\Files\View('/'); |
||
| 39 | |||
| 40 | $ftype = \OC::$server->getMimeTypeDetector()->getSecureMimeType($view->getMimeType('/'.$uid.'/files/'.$filename)); |
||
| 41 | |||
| 42 | header('Content-Type:'.$ftype); |
||
| 43 | OCP\Response::setContentDispositionHeader(basename($filename), 'attachment'); |
||
| 44 | OCP\Response::disableCaching(); |
||
| 45 | OCP\Response::setContentLengthHeader($view->filesize($versionName)); |
||
| 46 | |||
| 47 | OC_Util::obEnd(); |
||
| 48 | |||
| 49 | $view->readfile($versionName); |
||
| 50 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.