Skip to content
Snippets Groups Projects
Select Git revision
  • 70d6b2b4259ec68dea1ccfd7d4d06acba582b21a
  • master default protected
2 results

MainWindow.xaml

Blame
  • files.php 8.98 KiB
    <?php
    /**
     * @author Arthur Schiwon <blizzz@owncloud.com>
     * @author Bart Visscher <bartv@thisnet.nl>
     * @author Björn Schießle <schiessle@owncloud.com>
     * @author Brice Maron <brice@bmaron.net>
     * @author dratini0 <dratini0@gmail.com>
     * @author Fabian Henze <flyser42@gmx.de>
     * @author Frank Karlitschek <frank@owncloud.org>
     * @author Jakob Sack <mail@jakobsack.de>
     * @author Joas Schilling <nickvergessen@owncloud.com>
     * @author Jörn Friedrich Dreyer <jfd@butonic.de>
     * @author josh4trunks <joshruehlig@gmail.com>
     * @author Lukas Reschke <lukas@owncloud.com>
     * @author Michael Gapczynski <GapczynskiM@gmail.com>
     * @author Morris Jobke <hey@morrisjobke.de>
     * @author mvn23 <schopdiedwaas@gmail.com>
     * @author Nicolai Ehemann <en@enlightened.de>
     * @author Robin Appelman <icewind@owncloud.com>
     * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>
     * @author Thibaut GRIDEL <tgridel@free.fr>
     * @author Thomas Müller <thomas.mueller@tmit.eu>
     * @author Valerio Ponte <valerio.ponte@gmail.com>
     * @author Vincent Petry <pvince81@owncloud.com>
     *
     * @copyright Copyright (c) 2015, ownCloud, Inc.
     * @license AGPL-3.0
     *
     * This code is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License, version 3,
     * as published by the Free Software Foundation.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License, version 3,
     * along with this program.  If not, see <http://www.gnu.org/licenses/>
     *
     */
    
    // TODO: get rid of this using proper composer packages
    require_once 'mcnetic/phpzipstreamer/ZipStreamer.php';
    
    /**
     * Class for file server access
     *
     */
    class OC_Files {
    	const FILE = 1;
    	const ZIP_FILES = 2;
    	const ZIP_DIR = 3;
    
    	const UPLOAD_MIN_LIMIT_BYTES = 1048576; // 1 MiB
    
    	/**
    	 * @param string $filename
    	 * @param string $name
    	 * @param bool $zip
    	 */
    	private static function sendHeaders($filename, $name, $zip = false) {
    		OC_Response::setContentDispositionHeader($name, 'attachment');
    		header('Content-Transfer-Encoding: binary');
    		OC_Response::disableCaching();
    		if ($zip) {
    			header('Content-Type: application/zip');
    		} else {
    			$filesize = \OC\Files\Filesystem::filesize($filename);
    			header('Content-Type: '.\OC_Helper::getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)));