[ 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 // session_name('hashID'); 25 session_start(); 26 $phpwcms = array(); 27 28 require_once ('../../config/phpwcms/conf.inc.php'); 29 require_once ('../inc_lib/default.inc.php'); 30 require_once (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php'); 31 32 require_once (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php'); 33 checkLogin(); 34 require_once (PHPWCMS_ROOT.'/include/inc_lib/backend.functions.inc.php'); 35 36 37 $dl = isset($_GET["dl"]) ? intval($_GET["dl"]) : 0; 38 $pl = isset($_GET["pl"]) ? intval($_GET["pl"]) : 0; 39 40 if($dl) { 41 $err = 0; 42 if(!$pl) { 43 $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_trash=0 AND ". 44 "f_id=".$dl." AND f_kid=1 AND f_uid=".$_SESSION["wcs_user_id"]." LIMIT 1;"; 45 //09-20-2003: WHERE f_aktiv=1 AND... not neccessary 46 } else { 47 $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_aktiv=1 AND f_trash=0 AND ". 48 "f_id=".$dl." AND f_kid=1 AND (f_public=1 OR f_uid=".$_SESSION["wcs_user_id"].") LIMIT 1;"; 49 } 50 51 if($result = mysql_query($sql, $db) or die ("error while retrieving file download infos")) {; 52 if($download = mysql_fetch_array($result)) { 53 54 //$dl_filename = $download["f_uid"]."_".$download["f_id"]; 55 //if($download["f_ext"]) $dl_filename .= ".".$download["f_ext"]; 56 57 $dl_filename = $download["f_hash"]; 58 if($download["f_ext"]) { 59 $dl_filename .= '.'.$download["f_ext"]; 60 } 61 //$dl_path = PHPWCMS_ROOT.$phpwcms["file_path"].$download["f_uid"]."/"; 62 $dl_path = PHPWCMS_ROOT.$phpwcms["file_path"]; 63 64 if(file_exists($dl_path.$dl_filename)) { //echo "Datei existiert<br />"; 65 //Send file to user 66 //Downloads must downloaded to harddisk 67 //are not opened and showed inside browser 68 //if possible file format (PDF/JPG...) 69 //$att = (stristr($_SERVER['HTTP_USER_AGENT'],"MSIE")) ? "" : "attachment; "; 70 if($download["f_type"]) { 71 header("Content-type: ".$download["f_type"]); 72 } else { 73 header("Content-type: application/force-download"); 74 } 75 header('Content-Disposition: attachment; filename="'.$download["f_name"].'"'); 76 header("Content-Length: " . filesize($dl_path.$dl_filename)); 77 if(readfile($dl_path.$dl_filename)) { 78 exit(); 79 } else { 80 $err = 4; 81 } 82 83 } else { 84 $err = 1; //Wenn Datei nicht exisitiert 85 } 86 } else { 87 $err = 2; //Wenn keine Datei aus Datenbank zurückgegeben wird 88 } 89 } 90 } else { 91 $err = 3; //Wenn keine korrekte id übergeben wird 92 } 93 94 if($err) { 95 session_destroy(); 96 97 ?><html> 98 <head> 99 <title>phpwcms File Error</title> 100 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo PHPWCMS_CHARSET ?>"> 101 <link href="../inc_css/phpwcms.css" rel="stylesheet" type="text/css"> 102 </head> 103 104 <body bgcolor="#FFFFFF" text="#000000" link="#FF9900" vlink="#FF9900" alink="#FF9900" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> 105 <table border="0" cellpadding="0" cellspacing="0" summary=""> 106 <tr> 107 <td width="9"><img src="../../img/leer.gif" alt="" width="9" height="1"></td> 108 <td width="250"><img src="../../img/leer.gif" alt="" width="1" height="15"><br /> 109 An error (ID:<?php echo $err ?>) occured while trying to download a file of your directory.<br /> 110 <img src="../../img/leer.gif" alt="" width="1" height="10"><br /> 111 Please <a href="<?php echo PHPWCMS_URL.get_login_file() ?>"><strong>login</strong></a> again<br /> 112 and try another file.<br /> 113 <img src="../../img/leer.gif" alt="" width="1" height="10"><br /> 114 If you think that this might be a technical problem send an email to the <a href="mailto:webmaster@mailverbund.de">webmaster</a>.</td> 115 </tr> 116 </table> 117 </body> 118 </html> 119 <?php 120 } 121 ?>
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 |