function pfile($fileid, $oldstr, $onlyimgurl = false) { global $db; $str = $oldstr; $fileid = intval($fileid); if (empty($fileid)) { return $str; } $row = $db->row_select_one("attachments", "id={$fileid}"); if (empty($row)) { return $str; } $fs = pathinfo_($row['filename']); $fs['extension'] = strtolower($fs['extension']); if ($onlyimgurl) { return "uploadfile/attachment/{$row['filepath']}"; } if ($fs['extension'] == 'swf') { $str = $this->parseflash("uploadfile/attachment/{$row['filepath']}"); } elseif ($row['type'] == 1 && $fs['extension'] != 'swf') { //图片 $str = "<a href=\"uploadfile/attachment/{$row['filepath']}\" target=\"_blank\" title=\"\"><img src=\"uploadfile/attachment/{$row['filepath']}\" border=\"0\" " . ($row['imgwidth'] > 640 ? "width=\"640px\"" : "") . " /></a>"; } else { //普通附件 $extarr = array('pdf' => 'pdf', 'ppt' => 'ppt', 'doc' => 'doc', 'mp3' => 'media', 'wmv' => 'media', 'mpeg' => 'media', 'mp4' => 'media', 'rm' => 'media', 'rmvb' => 'media', 'wav' => 'media', 'html' => 'htm', 'htm' => 'htm', 'swf' => 'swf', 'fla' => 'swf', 'flv' => 'swf', 'xls' => 'xls', 'txt' => 'txt', 'gif' => 'img', 'jpg' => 'img', 'jpeg' => 'img', 'png' => 'img', 'bmp' => 'img', 'zip' => 'package', 'rar' => 'package', '7z' => 'package', 'gz' => 'package', 'tar' => 'package'); $extimg = $extarr[$fs['extension']]; $extimg = empty($extimg) ? "txt" : $extimg; $str = "<span class=\"ext_small ext_small_{$extimg}\"><a href=\"attachment.php?id={$row['id']}\" target=\"_blank\" title=\"\">{$fs['basename']}</a></span>"; } return $str; }
} require_once '../init.php'; require_once '../images_class.php'; require_once './../../' . ADMIN_DIR . '/language/language.php'; if (!isAdmin()) { exit($_AL['all.notlogin']); } $folderid = intval($_GET["folderid"]); $folderid = $folderid == 0 ? 1 : $folderid; $updir = INC_P . "/../uploadfile/attachment/"; $thumbdir = INC_P . "/../uploadfile/thumb/"; $renamed = "1"; $overwrite = "1"; if (isset($_FILES["Filedata"]) && is_uploaded_file($_FILES["Filedata"]["tmp_name"]) && $_FILES["Filedata"]["error"] == 0) { $upload_file = $_FILES["Filedata"]; $file_info = pathinfo_($upload_file["name"]); $file_size = intval($_FILES["Filedata"]["size"]); $file_size_max = intval(20480 * 1024); if ($file_size > $file_size_max) { exit(_LANG($_AL['attachment.filesize.toobig'], array($file_size, $file_size_max))); } $file_type = $_FILES["Filedata"]["type"]; $file_ext = strtolower($file_info["extension"]); $file_ext = addslashes(str_replace(array("'", "/", "\\/", "\"", "."), array('', '', '', '', ''), $file_ext)); $file_ext_allow = '*'; if ($file_ext_allow != "*" && !stristr(",{$file_ext_allow},", ",{$file_ext},")) { exit(_LANG($_AL['attachment.extnoallow'], array($file_ext, $file_ext_allow))); } //upload path switch ($cache_settings['attachmentsave']) { case "all":