<?php
//获取视频swf函数
function getmediaswf($threadct) {
$service = Wekit::load('config.PwConfig');
$config = $service->getValues('mediaurl');
$content = $threadct;
preg_match("/\[flash(=(\d+?)\,(\d+?)(\,(0|1))?)?\]([^\[\<\r\n\"']+?)\[\/flash\]/is",$content,$arr);
$content = $arr[0]; //获取第一个flash标签
$content = preg_replace('/\[(.*?)flash(.*?)\]/i','',$content);//去除flash标签

if(substr(strrchr($content, '.'), 1) == 'swf' ){
return $content;
}

if ($config[lock] == '1') {
if ($config[youku] == '1') {
//youku
$content = preg_replace("/http:\/\/v.youku.com\/v_show\/id_(.*?).html/i","http://player.youku.com/player.php/sid/\${1}/v.swf",$content);
}
if ($config[tudou] == '1') {
//tudou
$content = preg_replace("/http:\/\/www.tudou.com\/programs\/view\/([\w\-]+)\/?(.*?)/i","http://www.tudou.com/v/\${1}/&resourceId=0_04_05_99/v.swf",$content);
$content = preg_replace('/http:\/\/www.tudou.com\/albumplay\/(.*?)\/(.*?).html(.*?)/i',"http://www.tudou.com/a/\${1}/&resourceId=0_04_05_99/v.swf",$content);
$content = preg_replace('/http:\/\/www.tudou.com\/listplay\/(.*?)\/(.*?).html(.*?)/i',"http://www.tudou.com/l/\${1}/&resourceId=0_04_05_99/v.swf",$content);
}
if ($config[_56] == '1') {
//56
$content = preg_replace('/http:\/\/www.56.com\/u(.*?)\/v_(.*?).html(.*?)/i',"http://player.56.com/v_\${2}.swf",$content);
$content = preg_replace('/http:\/\/www.56.com\/w(.*?)\/play_album\-aid\-\d+_vid\-(.*?).html(.*?)/i',"http://player.56.com/v_\${2}.swf",$content);
}
if ($config[ku6] == '1') {
//ku6
$content = preg_replace('/http:\/\/v.ku6.com\/show\/(.*?).html(.*?)/i',"http://player.ku6.com/refer/\${1}/v.swf",$content);
$content = preg_replace('/http:\/\/v.ku6.com\/special\/show_(.*?)\/(.*?).html(.*?)/i',"http://player.ku6.com/refer/\${2}/v.swf",$content);
}
if ($config[yinyuetai] == '1') {
//yinyuetai
$content = preg_replace('/http:\/\/v.yinyuetai.com\/video\/(\d+)\/?(.*?)/i',"http://player.yinyuetai.com/video/player/\${1}/v_0.swf",$content);
$content = preg_replace('/http:\/\/v.yinyuetai.com\/playlist\/(\d+)\/?(.*?)/i',"http://player.yinyuetai.com/playlist/player/\${1}/v_0.swf",$content);
}
}	
if ($content === false) return '发生错误';
return $content;
}
?>


<div class="corelist_tieba b_s">
<!--#
$threadtids = array();
foreach ($threaddb as $value) {
$threadtids[] = $value['tid'];
}
#-->
<component class='SRV:forum.PwThread' method='fetchThread' args='$threadtids,2'/>
<!--# $threadContent = $__tpl_data; #-->
<component class='SRV:attach.PwThreadAttach' method='fetchAttachByTidsAndPid' args='$threadtids' />
<!--#
$threadthumb = array();
foreach ($__tpl_data as $value) {
if ($value['ifthumb']) $threadthumb[$value['tid']][] = $value['path'];
}
#-->
<ul class="threadlist" id="J_posts_list">									
<!--# foreach ($threaddb as $key => $value) { #-->


<li class="tieba_item">
<div class="t_con cc">	
<div class="threadlist_li_left j_threadlist_li_left">
<div title="{$value['replies']}个回复" class="threadlist_rep_num j_rp_num">{$value['replies']}</div>
</div>

<div class="threadlist_li_right">

<div class="threadlist_lz cc">

<div class="threadlist_text threadlist_title" >


<!--# if ($threadContent[$value['tid']]['tags'] != null){ #-->
<!--#  $reaTags = explode(',', $threadContent[$value['tid']]['tags']); $i = 1;  #-->
<!--# foreach ((array)$reaTags as $tag) { if($i > 1)break; $i ++;  #-->
<a data-url="{@url:tag/index/card?name=$tag}" title="话题标签"  target="_blank"  class="J_read_tag_item tag_item bdr3 fl" href="{@url:tag/index/view?name=$tag}">{$tag}</a>
<div class="tag_card J_tag_card" style="display:none;"><div class="pop_loading"></div></div>
<!--# } #-->
<!--# } #-->


<a href="{@url:bbs/read/run?tid=$value['tid']&fid=$value['fid']}" class="st" target="_blank" style="{$value['highlight_style']}" title="{$value['subject']}">{@Pw::substrs($value['subject'],$numofthreadtitle)}</a>
<!--#if ($value['digest']) {#--><i class="icon_base digest_small" title="精华"></i><!--#}#--><!--#if ($value['topped']) {#--><i class="icon_base topped_small" title="置顶"></i><!--#}#--><!--#if ($value['special'] == "poll") {#--><i class="icon_base poll_small" title="投票"></i><!--#}#-->


</div>

<div class="threadlist_author" title="主题作者">

<span class="tb_icon_author "><a class="J_user_card_show"  data-uid="{$value['created_userid']}" href="{@url:space/index/run?uid=$value['created_userid']}" target="_blank" >{$value['created_username']}</a></span>

</div>

</div>


<div class="threadlist_detail cc" >	

<div class="threadlist_text">


<div class="threadlist_abs threadlist_abs_onlyline">{@Pw::substrs(Pw::stripWindCode(preg_replace("/\[flash(=(\d+?)\,(\d+?)(\,(0|1))?)?\]([^\[\<\r\n\"']+?)\[\/flash\]/is","[视频]",preg_replace("/\[mp3(=(0|1)?)?\]([^\[\<\r\n\"']+?)\[\/mp3\]/is","[音乐]",$threadContent[$value['tid']]['content'])),true),40)}
</div>
 																				
<!--# if (is_array($threadthumb[$value['tid']]) || preg_match("/\[flash(=(\d+?)\,(\d+?)(\,(0|1))?)?\]([^\[\<\r\n\"']+?)\[\/flash\]/is",$threadContent[$value['tid']]['content']) ){ #-->
<div class="threadlist_img" >

<ul class="small_wrap">
<!--#
foreach ((array)$threadthumb[$value['tid']] as $k=>$thumb ) {
if(3 == $k) break;
#-->
<li><img   class="{$k}"  src="{@Pw::getPath($thumb,2)}"  /></li>
<!--# } #-->

<!--# if (preg_match("/\[flash(=(\d+?)\,(\d+?)(\,(0|1))?)?\]([^\[\<\r\n\"']+?)\[\/flash\]/is",$threadContent[$value['tid']]['content'])){ #-->
<li ><span class="video_thumb icon_base" >视频图标</span></li> 
<!--# } #-->

</ul>
<!--# if (preg_match("/\[flash(=(\d+?)\,(\d+?)(\,(0|1))?)?\]([^\[\<\r\n\"']+?)\[\/flash\]/is",$threadContent[$value['tid']]['content'])){ #-->
<div class="video_wrap" style="display:none" >
<div class="picturecontrol">
<a class="icon_close">收起</a>
<span>|</span>
<a class="icon_pop">弹出</a>
</div>
<div class="video_content">
<embed src="<?php echo getmediaswf($threadContent[$value['tid']]['content']) ?>" allowfullscreen="true" quality="high" width="520" height="400" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash">

</div>	
</div> 
<!--# } #-->

<div class="big_wrap" style="display:none">

<div class="picturecontrol">
<a class="icon_close">收起</a>
<span>|</span>
<a class="icon_viewlarge">查看大图</a>
<span>|</span>
<a class="icon_turnleft">左转</a>
<span>|</span>
<a class="icon_turnright">右转</a>
</div>
	
<!--#
foreach ($threadthumb[$value['tid']] as $k=>$thumb) {
if(3 == $k) break;
#-->
<div class="switchitem {$k|html}"  data-num="{$k}"  style="display:none" >
<div class="big_img" ><img src="{@Pw::getPath($thumb,0)}" ></div>
<div class="goprevious<!--# if(0 == $k) echo " hidden" #-->"></div>
<div class="gonext<!--# if(2 == $k) echo " hidden" #-->"  ></div>
</div>
<!--# } #--> 

<a href="{@url:bbs/read/run?tid=$value['tid']&fid=$value['fid']}"  class="pa btn btn_submit enter_pb" target="_blank" >进入帖子</a>	
</div>	

	
</div>
<!--# } #--> 

</div>

<div class="threadlist_author" >
<span class="tb_icon_author_rely j_replyer" title="最后回复人" ><a class="J_user_card_show" data-uid="{$value['lastpost_userid']}" href="{@url:space/index/run?uid=$value['lastpost_userid']}" target="_blank">{$value['lastpost_username']}</a> <span class="threadlist_reply_date j_reply_data" title="最后回复时间"><!--# echo Pw::time2str($value['lastpost_time'], 'auto');#--></span></span>           

</div>
</div>

</div>
</div>
</li> 

<!--# $tpc_topped = isset($value['issort']); #-->
<!--# } #-->
</ul>

<!--s分页-->
<div class="J_page_wrap cc corelist_tieba_page" data-key="true">
<page tpl="TPL:common.page" page="$page" per="$perpage" count="$count" total="$totalpage" url="bbs/index/run" args="$urlargs"/>

<a class="bdr3 btn postoo postoo_s fr J_qlogin_trigger"  href="#" ><span class="icon_base ico_postoo">发帖图标</span>发主题</a>
</div>
<!--e分页-->

</div>
