<?php error_reporting(0);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head> 
  <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" /> 
  <meta name="apple-mobile-web-app-capable" content="yes" /> 
  <meta name="apple-mobile-web-app-status-bar-style" content="black" /> 
  <meta name="format-detection" content="telephone=no" /> 
  <title><?php echo $cctvai_web_nicheng?><?php echo $title?> -<?php echo cd_webname?></title>
  <script type="text/javascript" src="js/function.js"></script>
  <link rel="stylesheet" href="css/style.css" type="text/css" />  
  <link rel="stylesheet" href="css/list.css" type="text/css" />  
 </head> 
 <body>
<?php include 'cctvai_header.php'; if($iid==""){?>

<div class="pic-up">
<div class="head"><strong>全部照片</strong></div>
 </div>
<script src="js/jquery.js" type="text/javascript"></script>
<style>body{ background-color: #f2f2f2;}</style>
  <div class="wrapper"> 
   <ul class="wall"> 
<?php
$query="select cd_url,cd_id,cd_hits,cd_addtime from " . tname('pic') . " where cd_uid='".$cctvai_web_userid."' order by cd_theorder desc";
$Arr=getuserpage($query, 20); 
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<center>No.album</center>';
} else {
	if($result) {
		while($pic=$db->fetch_array($result)) {
		echo '<li class="article"><a href="index.php?ac=album&id='.$cctvai_web_userid.'&iid='.$pic['cd_id'].'"><img src="' . getalbumthumb($pic['cd_url'], 2) . '" /><p>'.date('Y-m-d',$pic['cd_addtime']).'</p><small>'.$pic['cd_hits'].'</small></a></li>';
}
} 
}
?>
   </ul> 
  </div> 
  	<div class="pic-page"><?php echo $Arr[0];?></div>
  <script src="js/jaliswall.js" type="text/javascript"></script> 
  <script type="text/javascript">$(function(){$('.wall').jaliswall({ item: '.article' });});</script> 
<?php }else{?>
<div class="pic-up">
<div class="head"><strong>查看照片</strong></div>
 </div>
<?php
$pic=$db->getrow('select * from ' . tname('pic') . " where cd_uid='" . $cctvai_web_userid . "' and cd_id='" . $iid . "'");
if($pic["cd_id"]){
$db->query("update " . tname('pic') . " set cd_hits=cd_hits+1 where cd_id='" . $iid . "'");
$rowu=$db->getrow("Select cd_id from " . tname('pic') . " where cd_uid='" . $cctvai_web_userid . "' and cd_id<'" . $iid . "' order by cd_id asc");
if($rowu) {$cd_upurl='index.php?ac=album&id=' . $cctvai_web_userid . '&iid=' . $rowu['cd_id'] . '';} 
$rowd=$db->getrow("Select cd_id from " . tname('pic') . " where cd_uid='" . $cctvai_web_userid . "' and cd_id>'" . $iid . "' order by cd_id asc");
if($rowd) {$cd_dpurl='index.php?ac=album&id=' . $cctvai_web_userid . '&iid=' . $rowd['cd_id'] . '';} 
$picurl=getalbumthumb($pic["cd_url"],0);
}else{
	exit('<center>照片不存在</center>');
}
?>
<div class="pic-content">
<div class="pic"><img src="<?php echo $picurl;?>"/></div> 
<p><?php echo $pic["cd_title"];?></p>
<p>浏览次数：<?php echo $pic["cd_hits"];?></p>
<p>上传时间：<?php echo date('Y-m-d H:i:s',$pic["cd_addtime"]);?></p>
<p>&nbsp;</p>
<div>
<span class="x5-btn x5-btn-warning" onclick="window.open('<?php echo $picurl;?>','_self')">下载照片</span>
<?php if($pic["cd_uid"]==$CcTvAi_com_userid){echo'<a style="margin-left: 15px;" href="../user/do.php?ac=delpic&id='.$iid.'&uid='.$cctvai_web_userid.'" onClick="return confirm(\'确定要删除这张照片吗?\');"><span class="x5-btn x5-btn-warning" >删除照片</span></a>';}?>
</div>
<div class="pic-page"><a href="<?php echo $cd_upurl;?>">上一张</a>　　　<a href="<?php echo $cd_dpurl;?>">下一张</a></div>
</div>
<?php }?>
<?php include 'cctvai_bottom.php';?>
 </body>
</html>