查看完整版本: 線上播放RM、MP3、WMV、AVI、MIDI等各種音樂和視頻檔+iframe(2.5sp1完美版)

rengo 2005-11-14 17:47

線上播放RM、MP3、WMV、AVI、MIDI等各種音樂和視頻檔+iframe(2.5sp1完美版)

線上播放RM、MP3、WMV、AVI、MIDI等各種音樂和視頻檔+iframe(2.5sp1完美版)
===============================================
HACK名稱:線上播放RM、WMA、MP3、WMV、AVI、MIDI等各種音樂和視頻檔+iframe For Discuz 2.5sp1(完美版)===============================================
適用版本:Discuz! 2.5 sp1
HACK作者:逸風
製作日期:21 八月 2005
修改檔:   1、include/discuzcode.php
               2、include/bbcode.js
               3、post.php
修改模版:1、templates/default/post_bbinsert.htm
               2、templates/default/templates.lang.php
               3、templates/default/messages.lang.php
安裝難易:易至中
技術支援: [url=http://www.iron-heart.com/forum][color=#000000]http://www.iron-heart.com/forum[/color][/url]
效果展示: 附圖演示
插件特色:[color=blue]
1. 線上播放RM、WMA、MP3、WMV、AVI、MIDI等各種音樂和視頻檔。
2. 插入iframe功能及限制為版主級別以上專用,避免被一般會員濫用及妨害論壇安全。\r
3. 並在bbcode代碼插入欄增加插入按鈕,比後台手動加入代碼方式更便利論壇會員。
4. 音樂與視頻只各需一個按鈕,就能涵括各種常見形式檔案的播放。
5. 播放視窗完整顯示檔案資訊及串流載入進度。
6. 音樂與視頻播放視窗下增設溫馨下載提示。[/color]

1、include/discuzcode.php
查找:

[code]"/\[img=(\d{1,3})[x|\,](\d{1,3})\]\s*([^\[]+?)\s*\[\/img\]/ies"[/code]
找到這句後先在最尾加上一個逗點

[code],[/code]
然後在下面加入

[code]"/\[iframe\]\s*(.+?)\s*\[\/iframe\]/ies",
                                "/\[mu\]\s*([^\[]+?)\s*\[\/mu\]/ies",
                                "/\[mv\]\s*([^\[]+?)\s*\[\/mv\]/ies"[/code]
再下一點找到

[code]"bbcodeurl('\\3', '<img width=\"\\1\" height=\"\\2\" src=\"%s\" border=\"0\">')"[/code]
找到這句後也是先在最尾加上一個逗點

[code],[/code]
然後在下面加入

[code]"bbcodeurl('\\1', '<a href=\"%s\" target=\"_blank\">按此開新視窗</a><br><br><iframe src=\"%s\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"yes\" width=\"97%%\" height=\"480\"></iframe>')",
                                "bbcodeurl('\\1', '<embed width=\"280\" height=\"68\" src=\"%s\" autostart=\"false\" ShowControls=\"1\" ShowDisplay=\"0\" ShowStatusBar=\"1\"><param name=\"AutoStart\" value=\"false\"><br><br><a href=\"%s\" target=\"_blank\">按此下載這個音樂檔*建議用右鍵[另存目標]</a>')",
                                "bbcodeurl('\\1', '<param name=\"AutoStart\" value=\"false\"><embed width=\"400\" height=\"280\" src=\"%s\" autostart=\"false\" ShowControls=\"1\" ShowDisplay=\"0\" ShowStatusBar=\"1\"><br><br><a href=\"%s\" target=\"_blank\">按此下載這個視頻檔*建議用右鍵[另存目標]</a>')"[/code]
2、include/bbcode.js
在最底部加入:

[code]function bb_iframe() {
               
                if (helpmode) {
                alert(iframe_help);
        } else if (document.selection && document.selection.type == "Text") {
                var range = document.selection.createRange();
                range.text = "[iframe]" + range.text + "[/iframe]";
        } else if (advmode) {
                AddTxt="\r[iframe]\r[/iframe]";
                AddText(AddTxt);
        } else {   
                txt=prompt(iframe_normal,"http://");     
                if (txt!=null) {         
                        AddTxt="\r[iframe]"+txt;
                        AddText(AddTxt);
                        AddText("[/iframe]");
                }              
        }
}

function bb_music() {
        if (helpmode) {
                alert(music_help);
        } else if (document.selection && document.selection.type == "Text") {
                var range = document.selection.createRange();
                range.text = "[mu]" + range.text + "[/mu]";
        } else if (advmode) {
                AddTxt="\r[mu]\r[/mu]";
                AddText(AddTxt);
        } else {   
                txt=prompt(music_normal,"http://");     
                if (txt!=null) {         
                        AddTxt="\r[mu]"+txt;
                        AddText(AddTxt);
                        AddText("[/mu]");
                }              
        }
}

function bb_video() {
        if (helpmode) {
                alert(video_help);
        } else if (document.selection && document.selection.type == "Text") {
                var range = document.selection.createRange();
                range.text = "[mv]" + range.text + "[/mv]";
        } else if (advmode) {
                AddTxt="\r[mv]\r[/mv]";
                AddText(AddTxt);
        } else {   
                txt=prompt(video_normal,"http://");     
                if (txt!=null) {         
                        AddTxt="\r[mv]"+txt;
                        AddText(AddTxt);
                        AddText("[/mv]");
                }              
        }
}[/code]
3、templates/default/post_bbinsert.htm (如其他風格裡有此檔也要修改)
查找:

[code]var underline_normal = "{lang post_discuzcode_underline_normal}";[/code]
下面加入

[code]var iframe_help = "{lang post_discuzcode_iframe_help}";
        var iframe_normal = "{lang post_discuzcode_iframe_normal}";
        var music_help = "{lang post_discuzcode_music_help}";
        var music_normal = "{lang post_discuzcode_music_normal}";
        var video_help = "{lang post_discuzcode_video_help}";
        var video_normal = "{lang post_discuzcode_video_normal}";[/code]
查找:

[code]<a href="javascript:list()"><img src="{IMGDIR}/bb_list.gif" border="0" alt="{lang post_discuzcode_list}"></a>[/code]
下面加入

[code]<a href="javascript:bb_iframe()"><img src="{IMGDIR}/bb_iframe.gif" border="0" alt="插入網頁"></a>
        <a href="javascript:bb_music()"><img src="{IMGDIR}/bb_music.gif" border="0" alt="插入音樂檔"></a>
        <a href="javascript:bb_video()"><img src="{IMGDIR}/bb_video.gif" border="0" alt="插入視頻檔"></a>[/code]
4、templates/default/templates.lang.php (如其他風格裡有此檔也要修改)
查找:

[code]'post_discuzcode_list_normal_input' => '請輸入列表項目內容﹐如果留空表示項目結束。',[/code]
在下面加入

[code]'post_discuzcode_iframe_help' =>  '插入一個網站網址(*請注意iframe功能只有板主以上才能使用!)。\n例如﹕\n[url]http://www.windheart.com[/url]\n[url=http://www.windheart.com]這就是逸風[/url]',
        'post_discuzcode_iframe_normal' => '請輸入要插入網頁的網址.*請注意iframe功能只有板主以上才能使用!',
        'post_discuzcode_music_help' =>  '插入音樂檔案的網址(可以是rm,wma,mp3,midi等格式)。\n例如﹕\n[mu]http://www.windheart.com/song1.rm[/mu]',
        'post_discuzcode_music_normal' => '請輸入要插入音樂檔案的網址(可以是rm,wma,mp3,midi等格式)',
        'post_discuzcode_video_help' =>  '插入視頻檔案的網址(可以是rm,wmv,avi,mpg等格式)。\n例如﹕\n[mv]http://www.windheart.com/video1.wmv[/mv]',
        'post_discuzcode_video_normal' => '請輸入要插入視頻檔案的網址(可以是rm,wmv,avi,mpg等格式)',[/code]

(以下兩步用途是限制iframe只有版主以上才可以使用, 如開放給所有會員就可以跳過這步驟, 強烈建議不要跳過)
5、post.php
查找:

[code]if(!$bbcodeoff && !$allowhidecode && preg_match("/\[hide=?\d*\].+?\[\/hide\]/is", $message)) {
        showmessage('post_hide_nopermission');
}[/code]
在下面加入

[code]if(!$bbcodeoff && !$ismoderator && preg_match("/\[iframe=?\d*\].+?\[\/iframe\]/is", $message)) {
        showmessage('post_iframe_nopermission');
}[/code]
6、templates/default/messages.lang.php (如其他風格裡有此檔也要修改)
查找:

[code]'post_hide_nopermission' => '對不起﹐只有版主才能使用 [hide] 代碼﹐請返回修改。',[/code]
下面加入

[code]'post_iframe_nopermission' => '對不起﹐只有版主才能使用 [iframe] 代碼﹐請返回修改。',[/code]
7、把以上修改過的檔存檔上載,再把附檔的圖示上載到images/風格目錄下

8、後台更新緩存,完成~
頁: [1]
查看完整版本: 線上播放RM、MP3、WMV、AVI、MIDI等各種音樂和視頻檔+iframe(2.5sp1完美版)