插件作者的标准出来了!Manyou诚邀开发者加盟!
“互联网平台开发者”特刊 有奖征集开发者
立即免费下载 Discuz!6.1.0正式版
Discuz! 6.1.0 使用说明
Discuz!NT2.5正式版发布
开放源码下载
UCenter Home 1.2 正式版发布
官方站 | 帮助文档
基于ECShop的网店托管-卖否
PHP就业培训直通车 | LAMP培训大连
Discuz!收费服务内容及价格
《站长》杂志读者调查表
Discuz!/ECShop 专用官方虚拟主机
Insenz最新活动精美礼品大派送!
Comsenz 招聘信息
网店系统ECShop v2.6.0正式版火热发布
基于Discuz!的免费论坛空间5D6D
《站长》第七期:2008SNS进行时
发新话题
打印

[经验] 6.1上传MP3音乐附件自动播放

6.1上传MP3音乐附件自动播放

此方法为在原作者的基础上稍微修改而得,尊重原创。
由于缩进量问题,可能无法通过查找、替换来查找到,只好麻烦大家自己对了。。

懒人可以直接下载覆盖文件(附件),注意:我的为6.1版本,而且是打过最新补丁的,其它版本请勿覆盖。

1、打开default/discuzcode.htm文件,查找:

global $attachrefcheck, $extcredits, $creditstrans, $ftp, $thumbstatus, $authkey, $timestamp, $attachimgpost;

有两处这个代码,在第一个的下面添加:

$media = array('', 'wma', 'mp3','wav', 'mid');
$rms = array('', 'rm', 'rmvb');
$video = array('', 'wmv', 'avi', 'mpg', 'asx', 'asf','WMV');
$divx = array('', 'divx');

2、查找:

</dd>
<!--{else}-->
  <dt>
   $attach[attachicon]
   <a href="attachment.php?aid=$attach[aid]&k=$k&t=$timestamp" target="_blank">$attach[filename]</a>
   <em>($attach[attachsize])</em>
  </dt>

上面添加:

<!--/////////BEGIN------------->
<!--{elseif array_search(fileext($attach['filename']), $media)}-->
<dt>
                        $attach[attachicon]
                        <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
                        <em>($attach[attachsize])</em>
                </dt>
                <dd>
                        <p>
                                $attach[dateline], {lang downloads}: $attach[downloads]
                                <!--{if $attach['readperm']}-->, {lang readperm}: <strong>$attach[readperm]</strong><!--{/if}-->
                                <!--{if $attach['price']}-->
                                        , {lang price}: <strong>{$extcredits[$creditstrans][title]} $attach[price] {$extcredits[$creditstrans][unit]}</strong>  [<a href="misc.php?action=viewattachpayments&aid=$attach[aid]" target="_blank">{lang pay_view}</a>]
                                        <!--{if !$attach['payed']}-->
                                                 [<a href="misc.php?action=attachpay&aid=$attach[aid]" target="_blank">{lang attachment_buy}</a>]
                                        <!--{/if}-->
                                <!--{/if}-->
                        </p>
                        <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
                </dd>
  <!--{if !$attach['price'] || $attach['payed']}-->
  <EMBED src="attachment.php?aid=$attach[aid]&noupdate=yes" width=400 height=65 type=audio/mpeg ShowStatusBar="1" AutoStart="1" loop=10></EMBED>
<!--{/if}-->
<!--{elseif array_search(fileext($attach['filename']), $video)}-->
<dt>
                        $attach[attachicon]
                        <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
                        <em>($attach[attachsize])</em>
                </dt>
                <dd>
                        <p>
                                $attach[dateline], {lang downloads}: $attach[downloads]
                                <!--{if $attach['readperm']}-->, {lang readperm}: <strong>$attach[readperm]</strong><!--{/if}-->
                                <!--{if $attach['price']}-->
                                        , {lang price}: <strong>{$extcredits[$creditstrans][title]} $attach[price] {$extcredits[$creditstrans][unit]}</strong>  [<a href="misc.php?action=viewattachpayments&aid=$attach[aid]" target="_blank">{lang pay_view}</a>]
                                        <!--{if !$attach['payed']}-->
                                                 [<a href="misc.php?action=attachpay&aid=$attach[aid]" target="_blank">{lang attachment_buy}</a>]
                                        <!--{/if}-->
                                <!--{/if}-->
                        </p>
                        <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
                </dd>
  <!--{if !$attach['price'] || $attach['payed']}-->
  <EMBED src="attachment.php?aid=$attach[aid]&noupdate=yes" width=450 height=420 type=audio/mpeg ShowStatusBar="1" AutoStart="1"></EMBED>
<!--{/if}-->
<!--{elseif fileext($attach['filename'])=='swf'||fileext($attach['filename'])=='fla'}-->
       <dt>
                        $attach[attachicon]
                        <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
                        <em>($attach[attachsize])</em>
                </dt>
                <dd>
                        <p>
                                $attach[dateline], {lang downloads}: $attach[downloads]
                                <!--{if $attach['readperm']}-->, {lang readperm}: <strong>$attach[readperm]</strong><!--{/if}-->
                                <!--{if $attach['price']}-->
                                        , {lang price}: <strong>{$extcredits[$creditstrans][title]} $attach[price] {$extcredits[$creditstrans][unit]}</strong>  [<a href="misc.php?action=viewattachpayments&aid=$attach[aid]" target="_blank">{lang pay_view}</a>]
                                        <!--{if !$attach['payed']}-->
                                                 [<a href="misc.php?action=attachpay&aid=$attach[aid]" target="_blank">{lang attachment_buy}</a>]
                                        <!--{/if}-->
                                <!--{/if}-->
                        </p>
                        <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
                </dd>
  <!--{if !$attach['price'] || $attach['payed']}-->
  <embed id="player$attach[aid]" width="480" height="320" pluginspage="http://www.macromedia.com/go/getflashplayer" src="attachment.php?aid=$attach[aid]¬humb=yes" type="application/x-shockwave-flash" menu="true" quality="high">
  </embed>
  <!--{/if}-->
<!--{elseif array_search(fileext($attach['filename']), $rms)}-->
       <dt>
                        $attach[attachicon]
                        <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
                        <em>($attach[attachsize])</em>
                </dt>
                <dd>
                        <p>
                                $attach[dateline], {lang downloads}: $attach[downloads]
                                <!--{if $attach['readperm']}-->, {lang readperm}: <strong>$attach[readperm]</strong><!--{/if}-->
                                <!--{if $attach['price']}-->
                                        , {lang price}: <strong>{$extcredits[$creditstrans][title]} $attach[price] {$extcredits[$creditstrans][unit]}</strong>  [<a href="misc.php?action=viewattachpayments&aid=$attach[aid]" target="_blank">{lang pay_view}</a>]
                                        <!--{if !$attach['payed']}-->
                                                 [<a href="misc.php?action=attachpay&aid=$attach[aid]" target="_blank">{lang attachment_buy}</a>]
                                        <!--{/if}-->
                                <!--{/if}-->
                        </p>
                        <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
                </dd>
  <!--{if !$attach['price'] || $attach['payed']}-->
<object width="420" height="280" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" id="Player_name" viewastext>
  <param name="Autostart" value="0">
  <param name="CONTROLS" value="ImageWindow">
  <param name="CONSOLE" value="_master">
  <param name="LOOP" value="0">
  <param name="CENTER" value="0">
  <param name="_ExtentX" value="9525">
  <param name="_ExtentY" value="7938">
  <param name="SHUFFLE" value="0">                                
  <param name="PREFETCH" value="0">
  <param name="NOLABELS" value="0">
  <param name="NUMLOOP" value="0">
  <param name="MAINTAINASPECT" value="0">
  <param name="BACKGROUNDCOLOR" value="#000000">
  </object>
  

  <object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA height=68 width="420" VIEWASTEXT>
  <param name="_ExtentX" value="9525">
  <param name="_ExtentY" value="1693">
  <param name="Autostart" value="0">
  <param name="LOOP" value="0">
  <param name="CENTER" value="0">
  <param name="SRC" value="$attach[url]/$attach[attachment]">
  <param name="SHUFFLE" value="0">
  <param name="PREFETCH" value="0">
  <param name="NOLABELS" value="0">
  <param name="NUMLOOP" value="0">
  <param name="MAINTAINASPECT" value="0">
  <param name="BACKGROUNDCOLOR" value="#000000">
  </object>
  <!--{/if}-->
<!--{elseif array_search(fileext($attach['filename']), $divx)}-->
       <dt>
                        $attach[attachicon]
                        <a href="attachment.php?aid=$attach[aid]" target="_blank">$attach[filename]</a>
                        <em>($attach[attachsize])</em>
                </dt>
                <dd>
                        <p>
                                $attach[dateline], {lang downloads}: $attach[downloads]
                                <!--{if $attach['readperm']}-->, {lang readperm}: <strong>$attach[readperm]</strong><!--{/if}-->
                                <!--{if $attach['price']}-->
                                        , {lang price}: <strong>{$extcredits[$creditstrans][title]} $attach[price] {$extcredits[$creditstrans][unit]}</strong>  [<a href="misc.php?action=viewattachpayments&aid=$attach[aid]" target="_blank">{lang pay_view}</a>]
                                        <!--{if !$attach['payed']}-->
                                                 [<a href="misc.php?action=attachpay&aid=$attach[aid]" target="_blank">{lang attachment_buy}</a>]
                                        <!--{/if}-->
                                <!--{/if}-->
                        </p>
                        <!--{if $attach['description']}--><p>{$attach[description]}</p><!--{/if}-->
                </dd>
  <!--{if !$attach['price'] || $attach['payed']}-->
<object
codebase="http://download.divx.com/player/DivXBrowserPlugin.cab" height="400" width="690" classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616">
<param name="autoplay" value="false">
<param name="src" value="$attach[url]/$attach[attachment]" />
<param name="custommode" value="Stage6" />
<param name="showpostplaybackad" value="false" />
<embed type="video/divx" src="$attach[url]/$attach[attachment]" pluginspage="http://go.divx.com/plugin/download/" showpostplaybackad="false" custommode="Stage6" autoplay="false" height="400" width="720" />
</object>
  <!--{/if}-->
<!--/////////END------------->


最终效果见附件。

3、打开:include\post.func.php,查找:

static $safeext  = array('jpg', 'jpeg', 'gif', 'png', 'swf', 'bmp', 'txt', 'zip', 'rar', 'doc', 'mp3');

修改为:

      static $safeext  = array('jpg', 'jpeg', 'gif', 'png', 'swf', 'bmp', 'txt', 'zip', 'rar', 'doc', 'mp3', 'rm', 'rmvb');

[ 本帖最后由 独孤求婚 于 2008-5-2 20:19 编辑 ]

附件

未命名.jpg (10.67 KB)

2008-5-2 20:03

未命名.jpg

MP3附件自动播放.rar (8.26 KB)

2008-5-2 20:19, 下载次数: 1335

本帖最近评分记录
  • xmcl 金币 +1 www.tingcd.com感谢 2008-6-7 07:34
  • bettergates 金币 +1 www.1010idc.com 专业虚拟主机提供商 2008-5-2 21:50
很好!支持一下!
如果能设计一个上传swf附件,然后可以使用[flash]播放的就好了!嗬嗬!
好像已经有这样的了!!!!
感谢楼主分享!!不知道可不可以支持远程附件呢?
谢谢楼主分享
谢谢 :) :) :)
非黄色网站
www.76kcb.cn
前拍支持 !!!!!!!!!!!!!!!!!!!11

[ 本帖最后由 白垩纪 于 2008-5-2 23:31 编辑 ]
顶个,呵呵~~~这个东东是要收藏滴~
出租签名位
发新话题
版块跳转