[ Index ] |
PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 /* 24 if(ini_get('zlib.output_compression') && function_exists('ini_set')) { 25 ini_set('zlib.output_compression', 'Off'); 26 } 27 */ 28 29 $phpwcms = array(); 30 31 require_once ('config/phpwcms/conf.inc.php'); 32 33 if( !empty($phpwcms['SESSION_FEinit']) ) { 34 session_start(); 35 } 36 37 require_once ('include/inc_lib/default.inc.php'); 38 require_once (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php'); 39 require_once (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php'); 40 require_once (PHPWCMS_ROOT.'/include/inc_lib/functions.file.inc.php'); 41 require_once (PHPWCMS_ROOT.'/include/inc_front/front.func.inc.php'); 42 43 _checkFrontendUserAutoLogin(); 44 45 // try to get hash for file download 46 $success = false; 47 $hash = false; 48 $countonly = empty($_GET['countonly']) ? false : true; 49 $hash = empty($_GET['f']) ? '' : clean_slweg($_GET['f']); 50 51 if(isset($_GET['target'])) { 52 $phpwcms["inline_download"] = empty($_GET['target']) ? 0 : 1; 53 } elseif(!isset($phpwcms["inline_download"])) { 54 $phpwcms["inline_download"] = 0; 55 } 56 57 if(!empty($hash) && strlen($hash) == 32) { 58 59 // get file info - limit 1 entry 60 $download = _getFileInfo($hash, 1); 61 62 if(is_array($download) && count($download)) { 63 // all we need is the first array value 64 65 $download = current($download); 66 67 // ok fine - we have download information 68 // then count up download try for this file 69 $sql = "UPDATE ".DB_PREPEND."phpwcms_file "; 70 $sql .= "SET f_dlstart=f_dlstart+1 WHERE "; 71 $sql .= "f_hash='".aporeplace($download["f_hash"])."' LIMIT 1"; 72 @mysql_query($sql, $db); 73 74 75 $fileinfo = array(); 76 77 $fileinfo['filename'] = $download["f_hash"]; 78 if($download["f_ext"]) { 79 $fileinfo['filename'] .= '.'.$download["f_ext"]; 80 } 81 82 // just count up a download 83 if($countonly) { 84 85 $success = true; 86 87 // just use built-in download 88 } else { 89 90 91 $fileinfo['path'] = PHPWCMS_ROOT.$phpwcms["file_path"]; 92 $fileinfo['filesize'] = $download['f_size']; 93 $fileinfo['method'] = empty($phpwcms["inline_download"]) ? 'attachment' : 'inline'; 94 $fileinfo['mimetype'] = $download["f_type"]; 95 $fileinfo['file'] = $fileinfo['path'].$fileinfo['filename']; 96 $fileinfo['extension'] = $download["f_ext"]; 97 $fileinfo['realfname'] = $download["f_name"]; 98 99 // start download 100 $success = dl_file_resume($fileinfo['file'], $fileinfo, true); 101 102 } 103 104 105 } 106 107 } 108 109 if($success) { 110 111 $sql = "UPDATE ".DB_PREPEND."phpwcms_file "; 112 $sql .= "SET f_dlfinal=f_dlfinal+1 WHERE f_hash='".aporeplace($download["f_hash"])."' LIMIT 1"; 113 @mysql_query($sql, $db); 114 115 if($countonly) { 116 117 headerRedirect(PHPWCMS_URL . PHPWCMS_FILES . $fileinfo['filename']); 118 119 } 120 121 } else { 122 123 header("HTTP/1.0 404 Not Found"); 124 echo '<strong>404 File Not Found</strong>'; 125 126 } 127 128 exit(); 129 130 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 30 05:55:15 2009 | Cross-referenced by PHPXref 0.7 |