pw論壇只有三種格式圖標,在后面找了很久沒找到,今天自已修改部分代碼,修改方法如下:
為下文方便說明,現在規定下面2個單詞定義
type指:附件類別名稱,比如大家可以將后綴為bmp、png、jpg等的一類附件定義為img這樣一個類別
ifupload指:一個type對應的一個唯一編號,比如下面例子中的img--->1,txt--->2
下面以添加music,pdf,torrent這三個類別文件圖標為例
1、 修改根目錄thread.php
找 到:
$attachtype = array('1'=>'img','2'=>'txt','3'=>'zip');
添 加相應格式圖標進去:
添加格式:,'ifupload'=>'type'
如:
$attachtype = array('1'=>'img','2'=>'txt','3'=>'zip','5'=>'music','6'=>'pdf','4'=>'torrent');
2、 修改lib文件夾下的getinfo.class.php
找 到:
$attachtype = array('img','txt','zip');
添 加相應格式圖標進去:
添 加格式:,'type'
如:
$attachtype = array('img','txt','zip','pdf','music','torrent');
3、 修改lib文件夾下的upload.class.php
找 到:
elseif ($upload['ext'] == 'txt') {
if (preg_match('/(onload|submit|post|form)/i', readover($source))) {
P_unlink($source);
uploadmsg('upload_content_error');
}
$upload['type'] = 'txt';
}
添 加相應的圖標進去:
添 加格式:elseif ($upload['ext'] == '附件后綴')(多個后綴有的不同,詳細看下面例子) {
$upload['type'] = 'type';
}
如:
elseif ($upload['ext'] == 'txt') {
if (preg_match('/(onload|submit|post|form)/i', readover($source))) {
P_unlink($source);
uploadmsg('upload_content_error');
}
$upload['type'] = 'txt';
}elseif ($upload['ext'] == 'pdf') {
$upload['type'] = 'pdf';
}elseif (in_array($upload['ext'], array('mp3','mp4','avi','rmvb'))) {
$upload['type'] = 'music';
}elseif (in_array($upload['ext'], array('torrent','bittorrent'))) {
$upload['type'] = 'torrent';
}
新聞熱點
疑難解答