<?php error_reporting(0);?>
  <div class="spaceMain"> 
   <div class="mainTop"></div> 
   <div class="mainCenter"> 
    <div class="publicLeft"> 
     <div class="stageBox"> 
      <div class="stageBoxTop"> 
       <span></span> 
      </div> 
      <div class="stageBoxCenter min_space_height"> 
       <div class="spaceMTitle2"> 
        <p>随便说说</p> 
        <ul> 
         <li><a href="<?php echo cd_webpath.cd_webmlsinger?>/<?php echo rewrite_url('index.php?ac=feed&id='.$cctvai_web_userid.'');?>">全部动态</a><b></b></li>
         <li class="current"><a href="<?php echo cd_webpath.cd_webmlsinger?>/<?php echo rewrite_url('index.php?ac=miniblog&id='.$cctvai_web_userid.'');?>">随便说说</a><b></b></li>
        </ul> 
       </div> 
       <div class="title_per">  </div>
<?php if($day){ ?>
       <div class="miniblogShow"> 
<?php
global $db;
$sql="select * from " . tname('blog') . " where cd_uid='" . $cctvai_web_userid . "' and cd_id='" . $day . "'";
$result=$db->query($sql);
if($row=$db->fetch_array($result)) {
		//$cookies="web_blog_".$day;
		//if(!$_COOKIE[$cookies]=="yes"){
		//	setcookie($cookies,"yes",time()+86400);
		$db->query("update " . tname('blog') . " set cd_hits=cd_hits+1 where cd_id='" . $day . "'");
		//}
		$user=$db->getrow("select * from " . tname('user') . " where cd_id='" . $row['cd_uid'] . "'");
		$cd_content=preg_replace("/\[em:(\d+)]/is", "<img src=\"" . cd_webpath . "user/static/images/emot/e\\1.gif\" class=\"emotImg\">", $row['cd_content']);
		echo '<ul>';
		echo '<li>';
		echo '<input id="showType" type="hidden" value="1">';
		echo '<div class="avatar">';
		echo '<a href="' . linkweburl($row['cd_uid'], $row['cd_uname']) . '" target="_blank">';
		echo '<img class="avatar-42" src="' . linkuserphoto($row['cd_uid'], 48) . '"/>';
		echo '</a>';
		echo '</div>';
		echo '<div class="content">';
		echo '<div class="text" uid="' . $row['cd_uid'] . '">';
		echo '<a href="' . linkweburl($row['cd_uid'], $row['cd_uname']) . '" style="float:left;margin-right:3px;">' . $user['cd_nicheng'] . '</a>' . CheckCertify($user['cd_checkmusic'], $user['cd_checkmm'], $user['cd_grade'], $user['cd_viprank']) . ' ：' . $cd_content . '';
		echo '</div>';
		echo '<div class="info">';
		echo '<span class="time">发表于:' . datetime(date('Y-m-d H:i:s', $row['cd_addtime'])) . '</span>';
		if($cctvai_web_userid==$CcTvAi_com_userid) {
				echo '<span id="' . $row['cd_id'] . '" class="del" title="删除" bid="' . $row['cd_id'] . '" uid="' . $row['cd_uid'] . '"></span>';
		}
		echo '<span id="replyNum" class="action">评论[' . $row['cd_commentnum'] . ']</span>';
		echo '</div>';
		echo '</div>';
		echo '</li>';
		echo '</ul>';
		echo '<div class="miniblogComment">';
		echo '<div class="arrow"></div>';
		echo '<div class="topBox"></div>';
		echo '<div class="centerBox">';
		echo '<div class="replayUser" id="replayUser"></div>';
		echo '<div id="replayUserDel" class="dells" title="取消对此人的回复"></div>';
		echo '<div class="inputBox">';
		echo '<input type="hidden" name="bid" id="bid" value="' . $row['cd_id'] . '" />';
		echo '<input type="hidden" name="uid" id="uid" value="' . $row['cd_uid'] . '" />';
		echo '<div class="avatar"><img class="avatar-34" src="' . linkuserphoto($CcTvAi_com_userid, 48) . '" /></div>';
		echo '<div class="note"><textarea id="note" name="note" style="overflow-y:hidden;"></textarea></div>';
		echo '<button id="send" uid="' . $row['cd_uid'] . '" class="send">发表</button>';
		echo '</div>';
		echo '<div id="miniblogCommentList" class="miniblogCommentList">';
		if($row['cd_commentnum']) {
				echo '<ul>';
				$query=$db->query("select * from " . tname('comment') . " where cd_channel=9 and cd_dataid='" . $day . "' order by cd_addtime desc LIMIT 0,100");
				while($rows=$db->fetch_array($query)) {
						$user=$db->getrow("select cd_nicheng from " . tname('user') . " where cd_id='" . $row['cd_uid'] . "'");
						$cd_contents=preg_replace("/\[em:(\d+)]/is", "<img src=\"" . cd_webpath . "user/static/images/emot/e\\1.gif\" class=\"emotImg\">", $rows['cd_content']);
						echo '<li>';
						echo '<div class="avatar"><a href="' . linkweburl($rows['cd_uid'], $rows['cd_uname']) . '" target="_blank"><img class="avatar-34" src="' . linkuserphoto($rows['cd_uid'], 48) . '"/></a></div>';
						echo '<div class="content">';
						echo '<div class="note"><a href="' . linkweburl($rows['cd_uid'], $rows['cd_uname']) . '" target="_blank">' . GetAlias("cctvai_user", "cd_nicheng", "cd_id", $rows['cd_uid']) . '</a>：' . $cd_contents . '</div>';
						echo '<div class="time">发表于:' . datetime($rows['cd_addtime']) . '</div>';
						echo '<div class="replay">';
						if($rows['cd_uid']!=$CcTvAi_com_userid) {
								echo '<a id="comment" class="comment" authorId="' . $rows['cd_uid'] . '" nickname="' . GetAlias("cctvai_user", "cd_name", "cd_id", $rows['cd_uid']) . '" cid="' . $rows['cd_id'] . '">回复</a>';
						} else {
								echo '<span></span>';
						}
						if($cctvai_web_userid==$CcTvAi_com_userid) {
								echo '<span cid="' . $rows['cd_id'] . '" class="dell" title="删除"></span>';
						} else {
								echo '<span></span>';
						}
						echo '</div>';
						echo '</div>';
						echo '</li>';
				}
				echo '</ul>';
		}
		echo '</div>';
		echo '<div id="nums" type="hidden" num="' . $row['cd_commentnum'] . '"></div>';
		echo '</div>';
		echo '<div class="bottomBox"></div>';
		echo '</div>';
} else {
		echo '<div class="nothing">您查看的说说不存在，或已被删除！</div>';
}
?>
       </div> 
<?php }else{ ?>
      <div id="miniblogList" class="miniblogList">
       <ul>
        <input id="showType" type="hidden" value="1">
<?php
global $db;
$i=0;
$sql="select * from " . tname('blog') . " where cd_uid='".$cctvai_web_userid."' order by cd_addtime desc";
$Arr=getwebpage($sql, 15, "index.php?ac=miniblog&id=".$cctvai_web_userid."");//sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<div class="nothing_miniblog">还没有发表说说哦!</div>';
} else {
		if($result) {
				while($row=$db->fetch_array($result)) {
						$i=$i+1;
						$user=$db->getrow("select * from " . tname('user') . " where cd_id='" . $row['cd_uid'] . "'");
						$cd_content=preg_replace("/\[em:(\d+)]/is", "<img src=\"" . cd_webpath . "user/static/images/emot/e\\1.gif\" class=\"emotImg\">", $row['cd_content']);
						//$cd_content = preg_replace("/\<br.*?\>/is", ' ', $cd_content);
						echo '<li>';
						echo '<div class="time"><em>' . date('Y', $row['cd_addtime']) . '</em>' . date('m', $row['cd_addtime']) . '/' . date('d', $row['cd_addtime']) . '</div>';
						echo '<div class="content">';
						echo '<div class="text">';
						echo '<a href="' . linkweburl($row['cd_uid'], $row['cd_uname']) . '" target="_blank" style="float:left;margin-right:3px;">' . $user['cd_nicheng'] . '</a> ' . CheckCertify($user['cd_checkmusic'], $user['cd_checkmm'], $user['cd_grade'], $user['cd_viprank']) . ' <span>：' . $cd_content . '</span>';
						echo '</div>';
						echo '<div class="info">';
						echo '<span class="action">';
						echo '<a href="' . cd_webpath .cd_webmlsinger. '/index.php?ac=miniblog&id=' . $row['cd_uid'] . '&day=' . $row['cd_id'] . '" target="_blank">评论[' . $row['cd_commentnum'] . ']</a>';
						echo '</span>';
						echo '<span class="update_time">发表于：' . datetime(date('Y-m-d H:i:s', $row['cd_addtime'])) . '</span>';
						if($cctvai_web_userid==$CcTvAi_com_userid) {
								echo '<span id="' . $row['cd_id'] . '" class="del" bid="' . $row['cd_id'] . '" title="删除" uid="' . $row['cd_uid'] . '"></span>';
						} else {
								echo '<span></span>';
						}
						echo '</div>';
						echo '</div>';
				}
		}
}
?>
       </ul>
<?php if($num>0){?>
      <div class="page">
       <div class="pages">
<?php echo $Arr[0]; ?><input type="text" maxlength="5" onkeydown="function c(event,val){e = event ? event :(window.event ? window.event : null);if(e.keyCode==13){val = parseInt(val);val=isNaN(val)||(val<=0)?1:val;window.location.href='<?php echo cd_webpath.cd_webmlsinger.'/index.php?ac=miniblog&id='.$cctvai_web_userid.'&pages='; ?>'+val;return false;}else{return true;}};if(!c(event,this.value))return false;" title="输入页码，按回车快速跳转"/>
      </div>
      <div id="currPage"><?php echo SafeRequest("pages","get"); ?></div>
      </div>
<?php } ?>
      </div>
<?php } ?>
      </div> 
      <div class="stageBoxBottom"> 
       <span></span> 
      </div> 
     </div> 
    </div> 
    <div class="publicRight"> 
<?php include "source/cctvai_right.php"; ?> 
    </div> 
   </div> 
   <div class="mainBottom"></div> 
  </div> 
<?php include "source/cctvai_footer.php"; ?>  
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/jquery/jquery.min.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/core.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/card.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/dialog.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/js/jquery/jquery.plugins.js"></script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/space/js/common.js"></script>
  <script type="text/javascript">listenMsg.start();nav.init();nav.userMenu();</script>
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/space/js/miniblog.js"></script>
  <script type="text/javascript">
<?php if($day){ ?>
miniblogLib.miniblogDelInit(".info");
miniblogLib.commentDelInit();
miniblogLib.commentAddInit();
miniblogLib.replayUserInit();
miniblogLib.replayUserDelInit();
<?php }else{ ?>
miniblogLib.miniblogDelInit("#miniblogList");
<?php } ?>
</script>
  </body>
</html>