功能: :)
1. 上传到论坛上的音乐附件, 直接用播放器播放出来
2. 区分 RM 和 WMV 两在类型, 并直接上传的FLASH文件使用 WMV 模式播放!
3. FLASH 与 MP3 之间自动适应播放器高度. 请看附件图片的演示
4. 与下载附件所需阅读限制挂钩, 用户积分达不到附件阅读权限的给出友情提示
安装方法:
VIEWTHREAD.PHP
查找:
- $attach['attachimg'] = $attachimgpost && in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp')) ? 1 : 0;
复制代码
下面加:
- $attach['attachmp3'] = $attachimgpost && in_array($extension, array('wav', 'wma', 'mp3', 'mid')) ? 1 : 0;
- $attach['attachwmv'] = $attachimgpost && in_array($extension, array('avi', 'wmv', 'mpg', 'swf')) ? 1 : 0;
- $attach['attachrm'] = $attachimgpost && in_array($extension, array('rm', 'rmvb')) ? 1 : 0;
复制代码
模板: VIEWTHREAD.HTM
查找:
查找:
- <!--{loop $post['attachments'] $attach}-->
- <br><br>$attach[attachicon]
- <!--{if $attach['attachimg']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attach_img}</a>:
- <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}-->
- <!--{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>
- <!--{if $attachrefcheck}-->
- <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);">
- <!--{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 false;} else {window.open('$attachurl/$attach[attachment]');}" onmousewheel="return imgzoom(this);">
- <!--{/if}-->
- <!--{else}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</a>:
- <!--{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>
- <span class="smalltxt">{lang attach_download_count} $attach[downloads]
- <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}--></span><br>
- <!--{/if}-->
- <!--{/loop}-->
复制代码
替换为:
- <!--{loop $post['attachments'] $attach}-->
- <br><br>
- <!--{if $attach['attachimg']}-->
- <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>
- <!--{elseif $attach['attachmp3']}-->
- <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]">
- <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>
- <!--{elseif $attach['attachwmv']}-->
- <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]">
- <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>
- <!--{elseif $attach['attachrm']}-->
- <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>
- <!--{else}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</a>:
- <!--{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>
- <span class="smalltxt">{lang attach_download_count} $attach[downloads]
- <!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}--></span><br>
- <!--{/if}-->
- <!--{/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 编辑 ] |