SMF 是 Simple Machines Forum 的縮寫 ..
此系統是個人所使用過覺得功能還算齊備的論壇系統。
只不過 … 偶爾會遇到中文支援的問題 … 以下就是紀錄中文附件檔案的處理方式。
1. 中文檔名 IE 會無法下載:
解決方式
開啟Sources資料夾裡的Display.php
找到這一段
程式碼:
header('Content-Disposition: attachment; filename="' . $real_filename . '"');
header('Content-Type: application/octet-stream');
在這一段的上頭加上下面這段
程式碼:
if(strstr($_SERVER['HTTP_USER_AGENT'], ‘MSIE’) || strstr($_SERVER['HTTP_USER_AGENT'], ‘Internet Explorer’)) $real_filename = urlencode($real_filename);
2. 第二類,也是中文檔名無法下載,不過不僅僅是 IE 連 Firefox 也不行 .. 發生原因不確定,解決方式如下:
編輯
Subs-Post.php
尋找
db_query("
INSERT INTO {$db_prefix}attachments
(ID_MSG, filename, size, width, height)
VALUES (" . (int) $attachmentOptions['post'] . “, SUBSTRING(’” .
$attachmentOptions['name'] . “‘, 1, 255), ” . (int)
$attachmentOptions['size'] . ‘, ‘ . (empty($attachmentOptions['width'])
? ‘0′ : (int) $attachmentOptions['width']) . ‘, ‘ .
(empty($attachmentOptions['height']) ? ‘0′ : (int)
$attachmentOptions['height']) . ‘)’, __FILE__, __LINE__);
$attachmentOptions['id'] = db_insert_id();
在上面這一段文字的上方,加入下面這二行就ok了。
$a="_";
$attachmentOptions['name']=$a.$attachmentOptions['name'];
資料來源:森林之原 .. http://openlyu.com/forums/index.php?PHPSESSID=e41abf9176e19d004a3813210d6886c1&topic=3074.0