[ Index ] |
|
Code source de Phorum 5.1.25 |
1 <?php 2 3 //////////////////////////////////////////////////////////////////////////////// 4 // // 5 // Copyright (C) 2006 Phorum Development Team // 6 // http://www.phorum.org // 7 // // 8 // This program is free software. You can redistribute it and/or modify // 9 // it under the terms of either the current Phorum License (viewable at // 10 // phorum.org) or the Phorum License that was distributed with this file // 11 // // 12 // This program is distributed in the hope that it will be useful, // 13 // but WITHOUT ANY WARRANTY, without even the implied warranty of // 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // 15 // // 16 // You should have received a copy of the Phorum License // 17 // along with this program. // 18 //////////////////////////////////////////////////////////////////////////////// 19 20 if(!defined("PHORUM_CONTROL_CENTER")) return; 21 22 if ($PHORUM["file_uploads"] || $PHORUM["user"]["admin"]) { 23 24 if(!empty($_FILES) && is_uploaded_file($_FILES["newfile"]["tmp_name"])){ 25 26 if($PHORUM["max_file_size"]>0 && $_FILES["newfile"]["size"]>$PHORUM["max_file_size"]*1024){ 27 $error_msg = true; 28 $PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["FileTooLarge"]; 29 } 30 31 if(!empty($PHORUM["file_types"])){ 32 $ext=strtolower(substr($_FILES["newfile"]["name"], strrpos($_FILES["newfile"]["name"], ".")+1)); 33 $allowed_exts=explode(";", $PHORUM["file_types"]); 34 if(!in_array($ext, $allowed_exts)){ 35 $error_msg = true; 36 $PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["FileWrongType"]; 37 } 38 } 39 40 if($PHORUM["file_space_quota"]>0 && phorum_db_get_user_filesize_total($PHORUM["user"]["user_id"])+$_FILES["newfile"]["size"]>=$PHORUM["file_space_quota"]*1024){ 41 $error_msg = true; 42 $PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["FileOverQuota"]; 43 } 44 45 if(empty($error_msg)){ 46 47 // read in the file 48 $fp=fopen($_FILES["newfile"]["tmp_name"], "r"); 49 $buffer=base64_encode(fread($fp, $_FILES["newfile"]["size"])); 50 fclose($fp); 51 52 $file_id=phorum_db_file_save($PHORUM["user"]["user_id"], $_FILES["newfile"]["name"], $_FILES["newfile"]["size"], $buffer); 53 54 } 55 56 } elseif(!empty($_POST["delete"])) { 57 58 foreach($_POST["delete"] as $file_id){ 59 60 phorum_db_file_delete($file_id); 61 62 } 63 64 } 65 66 $files = phorum_db_get_user_file_list($PHORUM["user"]["user_id"]); 67 68 $total_size=0; 69 70 foreach($files as $key => $file) { 71 $files[$key]["filesize"] = phorum_filesize($file["filesize"]); 72 $files[$key]["dateadded"]=phorum_date($PHORUM["short_date"], $file["add_datetime"]); 73 74 $files[$key]["url"]=phorum_get_url(PHORUM_FILE_URL, "file=$key"); 75 76 $total_size+=$file["filesize"]; 77 } 78 79 $template = "cc_files"; 80 81 if($PHORUM["max_file_size"]){ 82 $PHORUM["DATA"]["FILE_SIZE_LIMIT"]=$PHORUM["DATA"]["LANG"]["FileSizeLimits"] . ' ' . phorum_filesize($PHORUM["max_file_size"]*1024); 83 } 84 85 if($PHORUM["file_types"]){ 86 $PHORUM["DATA"]["FILE_TYPE_LIMIT"]=$PHORUM["DATA"]["LANG"]["FileTypeLimits"]; 87 } 88 89 if($PHORUM["file_space_quota"]){ 90 $PHORUM["DATA"]["FILE_QUOTA_LIMIT"]=$PHORUM["DATA"]["LANG"]["FileQuotaLimits"] . ' ' . phorum_filesize($PHORUM["file_space_quota"]*1024);; 91 } 92 93 $PHORUM["DATA"]["FILES"] = $files; 94 95 $PHORUM["DATA"]["TOTAL_FILES"] = count($files); 96 $PHORUM["DATA"]["TOTAL_FILE_SIZE"] = phorum_filesize($total_size); 97 98 } else { 99 $template = "message"; 100 101 $PHORUM["DATA"]["MESSAGE"] = $PHORUM["DATA"]["LANG"]["UploadNotAllowed"]; 102 } 103 104 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:22:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |