Blame view

sources/apps/documents/ajax/download.php 739 Bytes
d1bafeea1   Kload   [fix] Upgrade to ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  <?php
  
  /**
   * ownCloud - Documents 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.
   */
  
  namespace OCA\Documents;
  
  \OCP\JSON::checkLoggedIn();
6d9380f96   Cédric Dupont   Update sources OC...
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  $path = Helper::getArrayValueByKey($_GET, 'path');
  if (!empty($path)){
  	if (\OC\Files\Filesystem::getMimeType($path)!==Filter_Office::NATIVE_MIMETYPE){
  		$fileInfo = \OC\Files\Filesystem::getFileInfo($path);
  		$file = new File($fileInfo->getId());
  		$genesis = new Genesis($file);
  		$fullPath = $genesis->getPath();
  	} else {
  		$fullPath = '/files' . $path;
  	}
  	$download = new Download(\OCP\User::getUser(), $fullPath);
  	$download->sendResponse();
  }
  exit();