<?php

$h5_page=$_G['ppp']-1;

$postarr = array();

$shareicon = '';

foreach($postlist as $key => $post) {

    if($post['first']) {

        $shareicon = getshareicon($post['message']);

        $post['message'] = odz_format_message($post['message']);

        $message = str_replace('size=', '', $post['message']);

        // $post['message'] =preg_replace("/<(\/?br.*?)>/si","",$message); //过滤br标签

        /*$post['message'] =preg_replace('/(<\/?br.*?>\s\D)+/i', '<br>', $message);*/ //过滤br标签

        $postarr = $post;

        unset($postlist[$key]);

        break;

    }

}

$listdata['pid']=$postarr['pid'];

$listdata['fid']=$postarr['fid'];

$listdata['tid']=$postarr['tid'];

$listdata['praid']=$postarr['praid'];

$listdata['praisenum']=$postarr['praisenum'];

$listdata['sortlist']=$postarr['sortlist'];

$listdata['praiselist']=$postarr['praiselist'];

$listdata=json_encode($listdata);

if(array_key_exists('videolist', $postarr) && $postarr['videolist']) {

    foreach($postarr['videolist'] as $videourl) {

        if(!preg_match('/http:\/\/v\.youku\.com\/v_show\/id_(\S+)\.html/i', $videourl, $match)) {

            continue;

        }

        $postarr['message'] .= '<div class="videoCon"><iframe src="http://player.youku.com/embed/'.$match[1].'" width="240" height="136" frameborder="0"></iframe></div>';

    }

}

?>

<!DOCTYPE html>

<html lang="en">

<head>

	<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET ?>">

	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

	<title><?php echo $_G['forum_thread']['subject']; ?></title>

        <script type="text/javascript" src="assets/js/jquery-1.8.3.min.js"></script>

        <script type="text/javascript" src="assets/js/commondz.js?hass=2232323"></script>

        <link rel="stylesheet" type="text/css" href="assets/css/activity.css?ver=11232311">

        <link rel="stylesheet" type="text/css" href="assets/css/mods.css?hash=2323232">

	<link rel="stylesheet" type="text/css" href="assets/css/style.css">

	<style>

		.hd-s img {max-width:100%;height:auto;}

                .bbs-feed-count span{margin-right: 3px;}

                .bbs-top-line{border-top: 0px;margin: 0px 6px;padding-left: 10px;}

        </style>

     <script type="text/javascript">

        var smiley_search = <?php echo make_smilie_json();?>;

    </script>

</head>

<body>

	<div class="micro">

            <div class="portrait ">

                <a href="javascript:void(0);" onclick="lbsPerson(<?php echo $_G['forum_thread']['authorid']; ?>)" title="<?php echo $_G['forum_thread']['author']; ?>" class="user-hd">

                    <?php echo $postarr['avatar']; ?>

                </a>

            </div>

            <div class="user-txt">

                <div class="dline">

                        <a href="###"  onclick="lbsPerson(<?php echo $_G['forum_thread']['authorid']; ?>)" class="user-txt-name user-txt-name1"><?php echo $_G['forum_thread']['author']; ?></a>

                        <p><?php echo $postarr['dateline']; ?></p>

                </div>

                <div class="rightflow rightflow1">

                    <img src="assets/images/talk.png" alt=""><span class="flow"><?php echo $_G['forum_thread']['replies']; ?></span>

                </div>

                <div class="rightflow">

                    <img src="assets/images/look.png" alt="">

                    <span class="flow"><?php echo $_G['forum_thread']['views']; ?></span>

                </div>

            </div>

            <div class="main clear hd-s">

                <?php echo  $postarr['message'];?>

                <?php $operation_edit = ($_G['forum']['ismoderator'] && $_G['group']['alloweditpost'] && (!in_array($post['adminid'], array(1, 2, 3)) || $_G['adminid'] <= $post['adminid'])) || ($_G['forum']['alloweditpost'] && $_G['uid'] && ($post['authorid'] == $_G['uid'] && $_G['forum_thread']['closed'] == 0) && !(!$alloweditpost_status && $edittimelimit && TIMESTAMP - $post['dbdateline'] > $edittimelimit)) ? true : false;

                      if($operation_edit || $_G['group']['allowdelpost']){

                ?>

                <ul class="operation">

                    <?php if ($operation_edit) {?>

                    <li><a href="javascript:editpost(<?php echo $postarr[pid]; ?>);"><img src="assets/images/edit.png" alt=""><p>编辑</p></a></li>

                    <?php } ?>

                    <?php if($_G['group']['allowdelpost']) { ?>

                    <li><a href="javascript:deletepost('topic', <?php echo $postarr[pid]; ?>);" class="del_op"><img src="assets/images/delete.png" alt=""><p>删除</p></a></li>

                    <?php } ?>

                </ul>

                <?php } ?>

            </div>

	</div>

	<span style="float:right">

		  <a id="report-btn" href="javascript:void(0);" onclick="report();">&nbsp;举报&nbsp;</a>

	  </span>

        <div class="bottom clear">

            <div class="point">

                <img src="assets/images/praise1.png" alt="">

                <span class="praise"><?php echo  $postarr['praiselist'];?></span>

            </div>

            <div class="heart">

                <a userid='<?php echo  $postarr['uid'];?>' class="likea"  onclick="testPraise();">

                    <?php if($postarr['praid']!=''){ ?>

                        <img src="assets/images/like_a.png" alt="">

                    <?php }else{?>

                        <img src="assets/images/like_b.png" alt="">

                    <?php }?>

                </a>

                <a href="###" class="sharea" onclick="weiShare()"><img src="assets/images/share_a.png" alt=""></a>

            </div>

			<div class="hrtalk"></div>

            <div class="bbs-feed-count bbs-top-line">   

                  <img src="assets/images/icon-comment.png?hash=12345" width="18" height="18">

                  <span><?php echo $_G['forum_thread']['replies']; ?>条评论</span>

                  

            </div>

            <!-- <div class="point clear">

                <span class="commm">评论(<?php echo $_G['forum_thread']['replies']; ?>)</span>

                <a href="javascript:void(0);"id="report-btn" onclick="report();" class="report">举报</a>

            </div> -->

	</div>

        <div class="bbs-feed-list">

            <div class="itm"><?php include './template/share_reply.php';?></div>

            <div class="loading-con" style="text-align:center;display:none" id="replay_itm">

                <img src="assets/images/loading.gif?hash=201503301552" >

                    <span class="loadtext">正在加载中...</span>

            </div>  

        </div>

        <div class="backtop">

            <img src="assets/images/backtop.png" alt="返回顶部" />

        </div>



        <!-- 弹出信息框START -->

        <div class="vdialog">

            <p class="dTop"><span></span></p>

            <a href="javascript:v_dBottom();"><p class="dBottom">好</p></a>

        </div>

        <div class="subdialog">

            <p class="subdTop"><span></span></p>

            <a href="javascript:sub_dBottom();"><p class="subBottom">好</p></a>

        </div>

        <!-- 弹出信息框END -->   

        <script type="text/javascript" src='assets/js/jquery.lazyload.min.js?_=20150929164733'></script>

        <script type="text/javascript">

            $(function() {

                $(".img_detail").lazyload();  

            });

        </script>

        <script type="text/javascript">

            var tagindex = 1;

            var MocuzMobile = {

                Android: function() {

                    return /Android/i.test(navigator.userAgent);

                },

                BlackBerry: function() {

                    return /BlackBerry/i.test(navigator.userAgent);

                },

                iOS: function() {

                    return /iPhone|iPad|iPod/i.test(navigator.userAgent);

                },

                Windows: function() {

                    return /IEMobile/i.test(navigator.userAgent);

                },

                any: function() {

                    return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Windows());

                }

            };

            $(function(){

                var  contentid = '<?php echo $_G['tid']?>';

                var data = {

                    'tid'        : '<?php echo $_G['tid']?>'

                };

                /*DetailHandler.sendDataToClientIOS(data, "getBbsContentInfo");

                if (window.androidclient && window.androidclient.onClientInit) {

                    window.androidclient.onClientInit(DetailHandler.json2str(data));

                }*/

                Comment.auth = "<?php echo $_GET['auth']?>";

                Comment.tid = "<?php echo $_G['tid']?>";;

                Comment.totalpage = <?php echo $totalpage?>;

                Comment.currentpage = 2;

                Comment.url = "<?php echo $_G['baseurl'].$_G['mocuz_config']['mocuz_type']; ?>/index.php?mod=biu_detail";

                Comment.loadinInter = $("div.bbs-feed-list").find('div.loading-con');

                Comment.containter = $("div.bbs-feed-list").find('div.itm');

                var contentid = "<?php echo $_G['tid']?>";

                var totalpage = <?php echo $totalpage?>;

                var auth      = "<?php echo $_GET['auth']?>";

                //加载获取更多内容  

                var tabContainter = $("div.bbs-feed-list");

                var loadinInter   = tabContainter .find('div.loading-con');

                var containter    = tabContainter .find("div.itm");

                var currentP = 2 ,currentLoaded = false ,currentLoading = false ;

    

                //滚动触发加载

                var scrollTrriget = function(){

                    var bodyTop = document.documentElement.scrollTop ;//document.body.scrollTop;

                    if(!bodyTop) bodyTop = document.body.scrollTop;

                    //滚动到底部时出发函数

                    //滚动的当前位置+窗口的高度 >= 整个body的高度

                    var oBody = $('body')[0];



                    if(bodyTop+oBody.clientHeight >= $(document.body).height()){

                        Comment.load();

                    };

                }

                $(window) .bind('scroll',function(event){



                    if($(window).scrollTop() == $(document).height() - $(window).height()){

                        scrollTrriget()

                    }

                });

                var AdapterObj = {

                    scrollEvent: scrollTrriget

                };

                window.AdapterObj = AdapterObj;

                //==============================

            })

            /**

             * 夜间模式切换

             * @param isNight 是否启用夜间模式

             */

            function switchNightMode(isNight) {

                var colorVal = '';

                if (isNight == 1) {

                    colorVal = '#000000';

                } else {

                    colorVal = '';

                }

                document.body.style.backgroundColor = colorVal;

            }

            //论坛举报客户端加载

            function report(){

                var pid="<?php echo $postarr['pid']?>";  

                var fid="<?php echo $_G['fid']?>";  

                if(MocuzMobile.Android()) {

                    window.myjs.report(pid,fid);//android

                    return;

                }

                if(MocuzMobile.iOS()) {

                     window.location.href="objc://report:/"+pid+"/"+fid;

                    return;

                }

            }

            //论坛h5客户端加载

            function testPraise(){

                if(MocuzMobile.Android()) {

                    window.myjs.praise();//android

                    return;

                }

                if(MocuzMobile.iOS()) {

                    window.location.href="objc://praise";

                    return;

                }

            }

             //论坛h5客户端加载

            function testClick(cmd,pid,uid,name){

                var tid=<?php echo $_G['tid']?>;  

                if(MocuzMobile.Android()) {

                    window.myjs.runJs(""+tid, ""+pid, ""+uid, ""+name);//android

                    return;

                }

                if(MocuzMobile.iOS()) {

                    window.location.href="objc://"+cmd+":/"+tid+"/"+uid+"/"+pid+"/"+name;

                }

            }

            //论坛h5客户端分享

            function weiShare(){  

                var  contentid = '<?php echo $_G['tid']?>';

                var url ="<?php echo $_G['baseurl'].$_G['mocuz_config']['mocuz_type']; ?>/index.php?mod=biu_detail&tid="+contentid+"&biuhtml=1";

                if(MocuzMobile.Android()) {  

                    window.myjs.weiShare(url);

                    return;

                }

                if(MocuzMobile.iOS()) {

                    window.location.href="objc://weiShare"+":/"+url;

                    return;

                }

            }

            function scrollParameter(){

                $(window).bind('scroll', AdapterObj.scrollEvent);

            };

            //回复跳转



            var tagindex = 1;

            function  postParameter(uid,username,message) {

                var divFeedList = $("div.bbs-feed-list");

                var divFeedItem = divFeedList.find("div.itm");

                var author="<?php echo $_G['setting']['ucenterurl'];?>/avatar.php?uid="+uid+"&size=small";

                var html ='';

                html+="<ul class='parameter'>";

                html+= "<li class='item-view'>";

                html+=  "<div class=''>";

                html+=  "<a href='javascript:void(0);' class='user-hd'><img src="+author+"></a>";

                html+=  "<div class='hd-name'>";

                html+=   "<a href='javascript:void(0);' class='user-txt-name'>"+username+"</a>";

                html+=  "<div class='hd-time hd-s'>"+odz_smiley_parse(message)+"</div>";

                html+=  " </div>";

                html+=  "</div>";

                html+=  " </li>";

                html+="</ul>";

                $(window).unbind('scroll');

                if (tagindex == 1) {

                    divFeedItem.append(html);

                    tagindex = 1;

                }

                var oBody = $('body')[0];

                var scrollTop = oBody.scrollHeight - oBody.clientHeight;

                scrollTop = scrollTop - 45;

                $('body').animate({scrollTop:scrollTop}, 300, '', function() {

                    $(window).bind('scroll', AdapterObj.scrollEvent);

                });

            }; 

            //返回顶部

            $('.backtop').click(function(event) {

                $('.backtop img').attr('src','assets/images/backtop2.png');

                $("html,body").animate({scrollTop:"0px"},300,function(){

                    $('.backtop img').attr('src','assets/images/backtop.png');

                });

            });

            function changePraise(cmd,praisename){

                var el = $('.praise');

                var htmls= el.html();

                if(cmd==1){//点赞成功

                    if(htmls){

                        var  Praisehtml=','+praisename; 

                    }else{

                        var  Praisehtml=praisename; 

                    }

                    $('.praise').append(Praisehtml);

                }else if(cmd==2){//去除点赞成功

                    var  Praisehtmlb=','+praisename;

                    var  Praisehtmls=praisename+',';

                    var  Praisehtml=praisename;

                    el.html(el.html().replace(Praisehtmlb, ''));

                    el.html(el.html().replace(Praisehtmls, ''));

                    el.html(el.html().replace(Praisehtml, ''));

                }

            }

            //论坛h5客户端加载

            function changeColor(cmd){

                if(cmd){

                    $('.likea img').attr('src','assets/images/like_a.png');

                }else{

                    $('.likea img').attr('src','assets/images/like_b.png');

                }

            }

            //操作居中

            function op_center(){

                var liindex=$('.operation li').length;

                /*var lihidden=$(".operation li:hidden").length;*/

                var licount=liindex

                var op_w=$('.operation').width();

                $('.operation li').width(op_w/licount-2);

            }

            op_center();



            //弹出框

            $('.move_op').click(function(event) {

                window.ontouchmove=function(e){

                    e.preventDefault && e.preventDefault();

                    e.returnValue=false;

                    e.stopPropagation && e.stopPropagation();

                    return false;

                }        

                $('.frame-box').show();

                $('.shade').show();

                var div=$('.frame-box');

                $('.frame-box').css('left',parseInt(($(window).width()-div.width())/2));

                $('.frame-box').css('top',parseInt((document.body.clientHeight-div.height())/2+$(document).scrollTop()));



            });



            //切换选择

            $('.them').click(function(event) {

                $('.them').find('img').attr('data',"false");

                $('.them').find('img').attr('src','<?php echo $_G['siteurl'] ?>assets/images/nselect.png');

                $(this).find('img').attr('data',"true");

                if($(this).find('img').attr('data',"true")){

                    $(this).find('img').attr('src','<?php echo $_G['siteurl'] ?>assets/images/select.png');

                }

            });



            //下拉

            $('.frame-main select:first').change(function(event) {

                var options=$(".test option:selected");

                if(options.text()!='默认板块'){

                    $('.select-them').show();

                    $('.frame-main select').css('color','#454545');

                }else{

                    $('.select-them').hide();

                } 

            });



            $('.clance').click(function(event) {

                $('.frame-box').hide();

                $('.shade').hide();

                window.ontouchmove=function(e){

                    e.preventDefault && e.preventDefault();

                    e.returnValue=true;

                    e.stopPropagation && e.stopPropagation();

                    return true;

                }

            });



            //确定

            $('.confirm').click(function(event) {

                 window.ontouchmove=function(e){

                    e.preventDefault && e.preventDefault();

                    e.returnValue=true;

                    e.stopPropagation && e.stopPropagation();

                    return true;

                }

                var auth = "<?php echo $_GET['auth']; ?>";

                var action = 'moderate';

                var fid = <?php echo $_G['fid']; ?>;

                var moveto = $('select[name=moveto]').val();

                var threadtypeid = $('select[name=threadtypeid]').val();

                var moderate = <?php echo $_G['tid']; ?>;

                var operations = 'move';

                var type = $('.them1 img').attr('data') ? 'normal' : 'redirect';



                // 调用客户端移动帖子方法

                if (MocuzMobile.Android()) {

                    window.myjs.executeMove(""+fid, ""+moderate, ""+moveto, ""+threadtypeid, ""+type);

                    return;

                }

                if (MocuzMobile.iOS()) {

                    var cmd = "executeMove";

                    window.location.href="objc://"+cmd+":/"+action+"/"+fid+"/"+moderate+"/"+operations+"/"+moveto+"/"+threadtypeid+"/"+type;

                }

            });



            // 编辑帖子

            function editpost(pid) {

                var auth = "<?php echo $_GET['auth']; ?>",

                    fid = <?php echo $_G['fid']; ?>,

                    tid = <?php echo $_G['tid']; ?>,

                    pid = pid;

                    // alert($('.item-view').length);

                // 调用客户端编辑帖子方法

                if (MocuzMobile.Android()) {

                    window.myjs.executeEdit(""+fid, ""+tid, ""+pid);

                    return;

                }

                if (MocuzMobile.iOS()) {

                    var cmd = "executeEdit";

                    window.location.href="objc://"+cmd+":/"+fid+"/"+tid+"/"+pid;

                }

            }

            // 帖子删除  post删除帖子  topic 删除主题

            function deletepost(type, pid) {

                if(confirm("确认要删除吗？")) {

                    if (type == 'post') {

                        data = {auth:'<?php echo $_GET['auth']; ?>', action:'delpost', fid:<?php echo $_G['fid']; ?>, tid:<?php echo $_G['tid']; ?>, topiclist:pid};

                        // alert(data.tid);

                        //调用客户端删除帖子方法

                        if (MocuzMobile.Android()) {

                            window.myjs.executeDelete(""+data.action, ""+data.fid, ""+data.tid, ""+data.topiclist);//android

                            return;

                        }

                        if (MocuzMobile.iOS()) {

                            var cmd = "executeDelete";

                            window.location.href="objc://"+cmd+":/"+data.action+"/"+data.fid+"/"+data.tid+"/"+data.topiclist;

                        }

                    } else if (type == 'topic') {

                        data = {auth:'', action:'moderate', fid:<?php echo $_G['fid']; ?>, moderate:<?php echo $_G['tid']; ?>, operations:'delete'};

                        // 调用客户端删除主题方法

                        if (MocuzMobile.Android()) {

                            window.myjs.executeDelete(""+data.action, ""+data.fid, ""+data.moderate, ""+data.operations);//android

                            return;

                        }

                        if (MocuzMobile.iOS()) {

                            var cmd = "executeDelete";

                            window.location.href="objc://"+cmd+":/"+data.action+"/"+data.fid+"/"+data.moderate+"/"+data.operations;

                        }

                    } else {

                        return;

                    }

                }

            }

            // 帖子删除成功调用方法

            function afterdel(pid) {

                var item = document.getElementsByClassName('item-view');

                for(var i=0; i<item.length; i++) {

                    tagid = item[i].getAttribute('pid');

                    if (tagid == pid) {

                        item[i].style.display = 'none';;

                    }

                }

            }

            // 获取板块类型

            function getthreadtypes(fid) {

                if (!fid) {

                    return;

                }

                $.ajax({

                    type: "GET",

                    url: "<?php echo $_G['baseurl'].$_G['mocuz_config']['mocuz_type'];  ?>/index.php?mod=forum_ajax&action=getthreadtypes&fid="+fid,

                    dataType: "html",

                    success: function(data){

                        $('#threadtypeid').html('');

                        $('#threadtypeid').append(data);

                        return;

                    }

                });

            }

            function jiaohu(cmd,str) {

                    var client="<?php echo $_GET['client'];?>";

                    var favid="<?php echo $postarr['favid'];?>";

                    var listdata ='<?php echo $listdata;?>' || '{}';

                    var sharelink="<?php echo urlencode($sharelink); ?>";

                    var share_text="<?php echo odz_format_sharetext($share_text); ?>";

                    var subject="<?php echo odz_format_sharetext($sharesubject); ?>....";

                    var shareIcon="<?php echo $shareicon; ?>";

                    if(favid){

                          var status='1';

                    }else{

                          var status='0';

                    }

                    var cmd ='jiaohu';

                    var str = '{"shoucang":'+status+', "listdata":'+listdata+',"shareSNS":{"sharelink":"'+sharelink+'", "shareIcon":"'+shareIcon+'", "sharetext":"'+share_text+'", "sharesubject":"'+subject+'"}}';

                    if(MocuzMobile.Android()&&client==1){

                        window.shareInfo.jiaohu(str);//android

                        return;

                    }

                    if (MocuzMobile.iOS()&&client==1){

                        window.location.href="objc://"+cmd+":/"+str;

                    }

            };

            window.onload = jiaohu();



            function lbsPerson(user_id){

                var user_id = '{"user_id":' + user_id + '}';

                if(MocuzMobile.Android()) {

                    window.myjs.lbsPerson(user_id);//android

                    return;

                }

                if(MocuzMobile.iOS()) {

                    var cmd = "lbsPerson";

                    window.location.href="objc://"+cmd+":/"+user_id;

                    return;

                }

            }





        </script>

    </body>

</html>