| [ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the File view (including resizing of images) 4 * 5 * This file is part of the evoCore framework - {@link http://evocore.net/} 6 * See also {@link http://sourceforge.net/projects/evocms/}. 7 * 8 * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/} 9 * Parts of this file are copyright (c)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}. 10 * 11 * {@internal License choice 12 * - If you have received this file as part of a package, please find the license.txt file in 13 * the same folder or the closest folder above for complete license terms. 14 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/) 15 * then you must choose one of the following licenses before using the file: 16 * - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php 17 * - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php 18 * }} 19 * 20 * {@internal Open Source relicensing agreement: 21 * PROGIDISTRI S.A.S. grants Francois PLANQUE the right to license 22 * PROGIDISTRI S.A.S.'s contributions to this file and the b2evolution project 23 * under any OSI approved OSS license (http://www.opensource.org/licenses/). 24 * }} 25 * 26 * @package htsrv 27 * 28 * {@internal Below is a list of authors who have contributed to design/coding of this file: }} 29 * @author fplanque: Francois PLANQUE. 30 * @author mbruneau: Marc BRUNEAU / PROGIDISTRI 31 */ 32 33 34 /** 35 * Load config, init and get the {@link $mode mode param}. 36 */ 37 require_once dirname(__FILE__).'/../conf/_config.php'; 38 require_once $inc_path.'/_main.inc.php'; 39 40 41 // Check permission: 42 // fp> TODO: skip this if $public_access_to_media (needs testing before enabling) 43 if( ! isset($current_User) ) 44 { 45 debug_die( 'No permission to get file (not logged in)!' ); 46 } 47 $current_User->check_perm( 'files', 'view', true ); 48 // fp> TODO: check specific READ perm for requested fileroot 49 50 // Load params: 51 param( 'root', 'string', true ); // the root directory from the dropdown box (user_X or blog_X; X is ID - 'user' for current user (default)) 52 param( 'path', 'string', true ); 53 param( 'size', 'string', NULL ); // Can be used for images. 54 55 // Load fileroot info: 56 $FileRootCache = & get_Cache( 'FileRootCache' ); 57 $FileRoot = & $FileRootCache->get_by_ID( $root ); 58 59 // Load file object (not the file content): 60 $File = & new File( $FileRoot->type, $FileRoot->in_type_ID, $path ); 61 62 if( !empty($size) && $File->is_image() ) 63 { // We want a thumbnail: 64 // This will do all the magic: 65 $File->thumbnail( $size ); 66 } 67 else 68 { // We want the regular file: 69 // Headers to display the file directly in the browser 70 header('Content-type: '.$File->Filetype->mimetype ); 71 header('Content-Length: '.filesize( $File->get_full_path() ) ); 72 73 if( $File->Filetype->viewtype == 'download' ) 74 { 75 header('Content-disposition: attachment; filename="'.$File->get_name().'"' ); 76 } 77 78 // Display the content of the file 79 readfile( $File->get_full_path() ); 80 } 81 82 /* 83 * $Log: getfile.php,v $ 84 * Revision 1.13 2007/04/26 00:11:14 fplanque 85 * (c) 2007 86 * 87 * Revision 1.12 2006/12/13 20:10:30 fplanque 88 * object responsibility delegation? 89 * 90 * Revision 1.11 2006/12/13 18:10:21 fplanque 91 * thumbnail resampling proof of concept 92 * 93 * Revision 1.10 2006/12/13 03:08:28 fplanque 94 * thumbnail implementation design demo 95 * 96 * Revision 1.9 2006/11/24 18:27:22 blueyed 97 * Fixed link to b2evo CVS browsing interface in file docblocks 98 * 99 * Revision 1.8 2006/08/19 07:56:29 fplanque 100 * Moved a lot of stuff out of the automatic instanciation in _main.inc 101 * 102 * Revision 1.7 2006/04/19 20:13:48 fplanque 103 * do not restrict to :// (does not catch subdomains, not even www.) 104 * 105 * Revision 1.6 2006/04/11 21:22:25 fplanque 106 * partial cleanup 107 * 108 */ 109 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
|