phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] tts/inc/class.attachedFiles.inc.php, 1.2


From: nomail
Subject: [Phpgroupware-cvs] tts/inc/class.attachedFiles.inc.php, 1.2
Date: Mon, 11 Oct 2004 11:43:14 +0200

Update of /tts/inc
Added Files:
        Branch: 
          class.attachedFiles.inc.php

date: 2004/10/11 09:43:14;  author: fipsfuchs;  state: Exp;  lines: +70 -0

Log Message:
replaced with 0.9.16 branche
=====================================================================
<?php
  /**************************************************************************\
  * phpGroupWare - attachedFiles                                             *
  * http://www.phpgroupware.org                                              *
  * This file is written by Lars Piepho <address@hidden>             *
  * Copyright (C) 2003 probusiness AG (Lars Piepho)                          *
  *                                                                          *
  * --------------------------------------------                             *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/

        /* $Id: class.attachedFiles.inc.php,v 1.2 2004/10/11 09:43:14 fipsfuchs 
Exp $ */

        
        class attachedFiles
        {

                var $public_functions = array(
                        'show_file' => True
                );
                var $file;
                var $vfs;

                function attachedFiles()
                {               
                 $this->file = $_REQUEST['file'];
                                  
                 $GLOBALS['phpgw_info']['flags'] = array
                (
                        'currentapp'    => 'tts',
                        'noheader'      => True,
                        'nofooter'      => True,
                        'enable_vfs_class'      => True,
                        'enable_browser_class'  => True
                );
                
                $this->vfs = CreateObject('phpgwapi.vfs');
                
                }

                function show_file()
                {                       
                        $ls_array = $this->vfs->ls(array (
                        'string'        => $this->file,
                        'relatives'     => array (RELATIVE_ALL),
                        'checksubdirs'  => False,
                        'nofiles'       => True));

                        if ($ls_array[0]['mime_type'])
                        {
                                $mime_type = $ls_array[0]['mime_type'];
                        }
                        elseif ($GLOBALS['settings']['viewtextplain'])
                        {
                                $mime_type = 'text/plain';
                        }
                        $filename = basename($this->file);
                        header('Content-type: ' . $mime_type);
                        header('Content-Disposition: attachment; filename=' . 
$filename);
                        echo $this->vfs->read (array (
                                        'string'        => $this->file,
                                        'relatives'     => array 
(RELATIVE_NONE)));
                        $GLOBALS['phpgw']->common->phpgw_exit ();
                }
                
        }
?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]