Manyou诚邀开发者加盟 | 常见问题
《站长》“开发者特刊”限量赠送
立即免费下载 Discuz!6.1.0正式版
Discuz! 6.1.0使用说明 | 使用手册
Discuz!NT2.5正式版发布
开放源码下载 | 使用手册
Discuz!收费服务内容及价格
《站长》俱乐部各地聚会活动进行中
Discuz!/ECShop 专用官方虚拟主机
论坛游戏插件再开新区 助你在聚新人气
基于Discuz!的免费论坛空间5D6D
《站长》第八期:实战互联网开放平台
返回列表 回复 发帖

上传的音乐附件(MP3/WMV/RM/FLASH)在线播放 For 4.0 by oytktk

功能:   
1. 上传到论坛上的音乐附件, 直接用播放器播放出来

2. 区分 RM 和 WMV 两在类型, 并直接上传的FLASH文件使用 WMV 模式播放!

3. FLASH 与 MP3 之间自动适应播放器高度. 请看附件图片的演示

4. 与下载附件所需阅读限制挂钩, 用户积分达不到附件阅读权限的给出友情提示
安装方法:


VIEWTHREAD.PHP

查找:
  1. $attach['attachimg'] = $attachimgpost && in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp')) ? 1 : 0;
复制代码
下面加:
  1.                                 $attach['attachmp3'] = $attachimgpost && in_array($extension, array('wav', 'wma', 'mp3', 'mid')) ? 1 : 0;
  2.                                 $attach['attachwmv'] = $attachimgpost && in_array($extension, array('avi', 'wmv', 'mpg', 'swf')) ? 1 : 0;
  3.                                 $attach['attachrm'] = $attachimgpost && in_array($extension, array('rm', 'rmvb')) ? 1 : 0;
复制代码
模板: VIEWTHREAD.HTM

查找:

查找:
  1. <!--{loop $post['attachments'] $attach}-->
  2.                                 <br><br>$attach[attachicon]
  3.                                 <!--{if $attach['attachimg']}-->
  4.                                         <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attach_img}</a>:
  5.                                         <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}-->
  6.                                         <!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><br>
  7.                                         <!--{if $attachrefcheck}-->
  8.                                                 <img src="attachment.php?aid=$attach[aid]&noupdate=yes" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('attachment.php?aid=$attach[aid]');}" onmousewheel="return imgzoom(this);">
  9.                                         <!--{else}-->
  10.                                                 <img src="$attachurl/$attach[attachment]" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('$attachurl/$attach[attachment]');}" onmousewheel="return imgzoom(this);">
  11.                                         <!--{/if}-->
  12.                                 <!--{else}-->
  13.                                         <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</a>:
  14.                                         <!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br>
  15.                                         <span class="smalltxt">{lang attach_download_count} $attach[downloads]
  16.                                         <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}--></span><br>
  17.                                 <!--{/if}-->
  18.                         <!--{/loop}-->
复制代码
替换为:
  1.                         <!--{loop $post['attachments'] $attach}-->
  2.                                 <br><br>
  3.                                 <!--{if $attach['attachimg']}-->
  4.                                         <table border="0" width="99%" cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" class="tableborder"><tr><td class="smalltxt">$attach[attachicon] <b>{lang attach_img}</b>($attach[filename]): {lang attach_download_count} $attach[downloads]</td><td align="right"><a href="attachment.php?aid=$attach[aid]" target="_blank" class="smalltxt">[单击下载此附件]</a></td></tr><tr bgcolor="{ALTBG2}"><td colspan="2"><table border="0" width="100%" cellspacing="1" cellpadding="10" style="table-layout: fixed;"><tr><td width="100%" style="table-layout: fixed; word-break:break-all"><!--{if $attach['description']}--><b>附件描述</b>: [{$attach[description]}]<br><br><!--{/if}--><!--{if $attach['readperm'] > $readaccess && !$adminid}-->对不起, 您的阅读权限(<font color="#FF0000"><b>$readaccess</b></font>), 没有达到附件浏览所需的阅读权限(<b><font color="#FF00FF">$attach['readperm']</font></b>)的要求, 所以不能查看附件资源!<!--{else}--><img src="$attachurl/$attach[attachment]" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return true;} else {window.open('$attachurl/$attach[attachment]');}" onmousewheel="return imgzoom(this);"><!--{/if}--></td></tr></table></td></tr></table>
  5.                                 <!--{elseif $attach['attachmp3']}-->
  6.                                         <table border="0" width="99%" cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" class="tableborder"><tr><td class="smalltxt">$attach[attachicon] WMV 类型音乐附件 ($attach[filename]): {lang attach_download_count} $attach[downloads]</td><td align="right"><a href="attachment.php?aid=$attach[aid]" target="_blank" class="smalltxt">[单击下载此附件]</a></td></tr><tr bgcolor="{ALTBG2}"><td colspan="2"><table border="0" width="100%" cellspacing="1" cellpadding="10" style="table-layout: fixed;"><tr><td width="100%" style="table-layout: fixed; word-break:break-all"><!--{if $attach['description']}--><b>附件描述</b>: [{$attach[description]}]<br><br><!--{/if}--><!--{if $attach['readperm'] > $readaccess && !$adminid}-->对不起, 您的阅读权限(<font color="#FF0000"><b>$readaccess</b></font>), 没有达到附件浏览所需的阅读权限(<b><font color="#FF00FF">$attach['readperm']</font></b>)的要求, 所以不能查看附件资源!<!--{else}--><object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="380" height="69" ><PARAM NAME="AUTOSTART" VALUE="true" ><param name="ShowStatusBar" value="-1"><param name="Filename" value="$attachurl/$attach[attachment]">
  7.                                          <embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="$attachurl/$attach[attachment]" width="380" height="69"></embed></object><!--{/if}--></td></tr></table></td></tr></table>
  8.                                 <!--{elseif $attach['attachwmv']}-->
  9.                                         <table border="0" width="99%" cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" class="tableborder"><tr><td class="smalltxt">$attach[attachicon] WMV 类型音乐附件 ($attach[filename]): {lang attach_download_count} $attach[downloads]</td><td align="right"><a href="attachment.php?aid=$attach[aid]" target="_blank" class="smalltxt">[单击下载此附件]</a></td></tr><tr bgcolor="{ALTBG2}"><td colspan="2"><table border="0" width="100%" cellspacing="1" cellpadding="10" style="table-layout: fixed;"><tr><td width="100%" style="table-layout: fixed; word-break:break-all"><!--{if $attach['description']}--><b>附件描述</b>: [{$attach[description]}]<br><br><!--{/if}--><!--{if $attach['readperm'] > $readaccess && !$adminid}-->对不起, 您的阅读权限(<font color="#FF0000"><b>$readaccess</b></font>), 没有达到附件浏览所需的阅读权限(<b><font color="#FF00FF">$attach['readperm']</font></b>)的要求, 所以不能查看附件资源!<!--{else}--><object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer" width="380" height="300" ><PARAM NAME="AUTOSTART" VALUE="true" ><param name="ShowStatusBar" value="-1"><param name="Filename" value="$attachurl/$attach[attachment]">
  10.                                          <embed type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" flename="mp" src="$attachurl/$attach[attachment]" width="380" height="300"></embed></object><!--{/if}--></td></tr></table></td></tr></table>
  11.                                 <!--{elseif $attach['attachrm']}-->
  12.                                         <table border="0" width="99%" cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" class="tableborder"><tr><td class="smalltxt">$attach[attachicon] RM 类型音乐附件 ($attach[filename]): {lang attach_download_count} $attach[downloads]</td><td align="right"><a href="attachment.php?aid=$attach[aid]" target="_blank" class="smalltxt">[单击下载此附件]</a></td></tr><tr bgcolor="{ALTBG2}"><td colspan="2"><table border="0" width="100%" cellspacing="1" cellpadding="10" style="table-layout: fixed;"><tr><td width="100%" style="table-layout: fixed; word-break:break-all"><!--{if $attach['description']}--><b>附件描述</b>: [{$attach[description]}]<br><br><!--{/if}--><!--{if $attach['readperm'] > $readaccess && !$adminid}-->对不起, 您的阅读权限(<font color="#FF0000"><b>$readaccess</b></font>), 没有达到附件浏览所需的阅读权限(<b><font color="#FF00FF">$attach['readperm']</font></b>)的要求, 所以不能查看附件资源!<!--{else}--><embed name="rplayer" type="audio/x-pn-realaudio-plugin" src="$attachurl/$attach[attachment]" controls="ControlPanel,StatusBar" width=380 height=68 border=0 autostart=true loop=true></embed><!--{/if}--></td></tr></table></td></tr></table>
  13.                                 <!--{else}-->
  14.                                         <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</a>:
  15.                                         <!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br>
  16.                                         <span class="smalltxt">{lang attach_download_count} $attach[downloads]
  17.                                         <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}--></span><br>
  18.                                 <!--{/if}-->
  19.                         <!--{/loop}-->
复制代码
完工 .



演示地址:

1. WMV模式: http://www.huasa.net/bbs/viewthread.php?tid=3234

2. RM 模式: http://www.huasa.net/bbs/viewthread.php?tid=4694

3. FLASH: http://www.huasa.net/bbs/viewthread.php?tid=4695

[ 本帖最后由 oytktk 于 2007-8-24 15:33 编辑 ]
沙发成功.






好.板凳
支持
正愁没人教,天上掉下个粘豆包
好东西,占个第一页吧
以前装过一个跟自动播放的插件,现在重装这个可以嘛?
原帖由 DiscuzPkDV 于 2005-12-24 14:03 发表
以前装过一个跟自动播放的插件,现在重装这个可以嘛?
哪个?地址~?~
站个位置~~支持LZ~~
返回列表