═╬簡箪√嗳

 找回密码
 立即注册
搜索
查看: 7321|回复: 0

[原创] Discuz论坛修改附件中未能识别的附件类型图标

[复制链接]
发表于 2014-6-6 23:43 | 显示全部楼层 |阅读模式
  1. function attachtype($type, $returnval = 'html') {

  2.         static $attachicons = array(
  3.                         1 => 'unknown.gif',
  4.                         2 => 'binary.gif',
  5.                         3 => 'zip.gif',
  6.                         4 => 'rar.gif',
  7.                         5 => 'msoffice.gif',
  8.                         6 => 'text.gif',
  9.                         7 => 'html.gif',
  10.                         8 => 'real.gif',
  11.                         9 => 'av.gif',
  12.                         10 => 'flash.gif',
  13.                         11 => 'image.gif',
  14.                         12 => 'pdf.gif',
  15.                         13 => 'torrent.gif'
  16.                 );

  17.         if(is_numeric($type)) {
  18.                 $typeid = $type;
  19.         } else {
  20.                 if(preg_match("/bittorrent|^torrent\t/", $type)) {
  21.                         $typeid = 13;
  22.                 } elseif(preg_match("/pdf|^pdf\t/", $type)) {
  23.                         $typeid = 12;
  24.                 } elseif(preg_match("/image|^(jpg|gif|png|bmp)\t/", $type)) {
  25.                         $typeid = 11;
  26.                 } elseif(preg_match("/flash|^(swf|fla|flv|swi)\t/", $type)) {
  27.                         $typeid = 10;
  28.                 } elseif(preg_match("/audio|video|^(wav|mid|mp3|m3u|wma|asf|asx|vqf|mpg|mpeg|avi|wmv)\t/", $type)) {
  29.                         $typeid = 9;
  30.                 } elseif(preg_match("/real|^(ra|rm|rv)\t/", $type)) {
  31.                         $typeid = 8;
  32.                 } elseif(preg_match("/htm|^(php|js|pl|cgi|asp)\t/", $type)) {
  33.                         $typeid = 7;
  34.                 } elseif(preg_match("/text|^(txt|rtf|wri|chm)\t/", $type)) {
  35.                         $typeid = 6;
  36.                 } elseif(preg_match("/word|powerpoint|^(doc|ppt)\t/", $type)) {
  37.                         $typeid = 5;
复制代码

1.png
注意看这里的图标,是个问号.原因是代码设置里面未识别最新的office2013的后缀导致.
注意倒数第二行的这一段代码:
} elseif(preg_match("/word|powerpoint|^(doc|ppt|xls|docx|pptx|xlsx)\t/", $type)) {
把office2013后缀添加进去,系统就可以自动识别啦.
文件是在source\function目录中的function_attachment.php

2.png
改完之后,我们就会发现系统已经识别此文件类型.


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|═╬簡箪√嗳's BBS

GMT+8, 2024-7-27 16:01

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表