上传多媒体文件直接播放(增加了FLASH部分)
你可以根据需要添加,此代码由于牵扯到在线播放代码,可能带来安全问题
第一步,打开viewthread.php
找到
- $attach['attachimg'] = $attachimgpost && in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp')) && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
复制代码 在下面添加
- $attach['attachmusic'] = $attachimgpost && in_array($extension, array('wav', 'wma', 'mp3', 'mid')) && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
- $attach['attachvideo'] = $attachimgpost && in_array($extension, array('avi', 'wmv', 'mpg')) && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
- $attach['attachrm'] = $attachimgpost && in_array($extension, array('rm', 'rmvb')) && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
复制代码
如果需要增加上传flash直接显示,还要加上下面的代码(很可能有安全文件,建议不要加)
- $attach['attachswf'] = $attachimgpost && in_array($extension, array('swf')) && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0;
复制代码
第二步,打开模板目录下viewthread.htm
找到
- <!--{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}-->
复制代码
在下面添加
- <!--{elseif $attach['attachmusic']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</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><object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" width="320" height="65"><param name="ShowStatusBar" value="-1"><param name="Filename" value="$attachurl/$attach[attachment]"><embed src="$attachurl/$attach[attachment]" width="320" height="65"></embed></object><br>
- <!--{elseif $attach['attachvideo']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</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><object align="middle" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class="OBJECT" id="MediaPlayer"><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="480" height="360"></embed></object><br>
- <!--{elseif $attach['attachrm']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</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><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" id="RealMoviePlayer" border="0"><param name="_ExtentX" value="13229"><param name="_ExtentY" value="10583"><param name="AUTOSTART" value="0"><param name="SHUFFLE" value="0"><param name="PREFETCH" value="0"><param name="NOLABELS" value="0"><param name="CONTROLS" value="ImageWindow"><param name="CONSOLE" value="_master"><param name="LOOP" value="0"><param name="NUMLOOP" value="0"><param name="CENTER" value="0"><param name="MAINTAINASPECT" value="0"><param name="BACKGROUNDCOLOR" value="#000000"><param name="SRC" value="$attachurl/$attach[attachment]"></object><br><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="500" height="40" id="RealMoviePlayer" border="0"><param name="_ExtentX" value="13229"><param name="_ExtentY" value="1058"><param name="AUTOSTART" value="0"><param name="SHUFFLE" value="0"><param name="PREFETCH" value="0"><param name="NOLABELS" value="0"><param name="CONTROLS" value="controlpanel"><param name="CONSOLE" value="_master"><param name="LOOP" value="0"><param name="NUMLOOP" value="0"><param name="CENTER" value="0"><param name="MAINTAINASPECT" value="0"><param name="BACKGROUNDCOLOR" value="#000000"><param name="SRC" value="$attachurl/$attach[attachment]"></object><br>
复制代码
如果需要增加上传flash直接显示,还要加上下面的代码(很可能有安全文件,建议不要加)
- <!--{elseif $attach['attachswf']}-->
- <a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</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><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" name="top10movie" width="640" height="480" id="top10movie"><param name="movie" value="$attachurl/$attach[attachment]"><param name="quality" value="high"><param name="menu" value="false"><embed src="$attachurl/$attach[attachment]" width="640" height="480" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" id="top10movie" name="top10movie" menu="false"></embed></object><br>
复制代码
完成 |