<?php 
error_reporting(0);
if(cd_ykuploadmusic=="no"){if(!$userlogined==true){exit("<script type=\"text/javascript\">location.href='".cd_webpath."user/login.php?login_referer=".cd_webpath."user/".rewrite_url('space.php?do=upvideo')."';</script>");}}
?>
  <div class="user"> 
   <div class="user_center"> 
<?php
include_once('source/space_menu.php');
?>
<?php if($view==""){ ?>
<script type="text/javascript">
function changeimg()
{
var myimg = document.getElementById("code"); 
now = new Date(); 
myimg.src="source/ajax.php?ac=seccode&rand="+now.getTime();
}
</script>
    <div class="user_main"> 
     <div class="uMain_content"> 
      <div class="main_nav"> 
       <ul> 
        <li class="concert"> <a href="<?php echo rewrite_url('space.php?do=upvideo&view=list');?>">已审视频</a> </li> 
        <li class="find"> <a href="<?php echo rewrite_url('space.php?do=upvideo&view=passed');?>">待审视频</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=upvideo');?>">发布视频</a> 
       </div> 
      </div> 
      <div class="main"> 
       <div id="tooltip" class="refresh"> 
       </div> 
      </div> 
<?php if(cd_uploadentrance=="yes"){?>
      <div class="minHeight500"> 
       <div class="profile"> 
        <div class="title"> <div class="name">发布视频</div> </div> 
        <form name="form"> 
         <ul id="videoAddMain"> 
          <li> 
           <div class="name">视频名称：</div> 
           <div class="input"> <input type="text" style="width: 190px;" class="input_normal" name="rvideoName" id="rvideoName" maxlength="100" /> </div> 
           <div class="input_msg" id="mvideoName">作为视频名称请您认真填写，合理的名称审核才会通过。</div> </li> 
          <li> 
           <div class="name">所属歌手：</div> 
           <div class="input"> <input type="text" style="width: 90px;" class="input_normal" name="rSingerID" id="rSingerID" maxlength="100" /> </div> 
           <div class="input_msg" id="mSingerID">请输入视频所属歌手。</div> </li> 
          <li> 
           <div class="name">所属分类：</div> 
           <div class="input"> <select class="select_normal" name="rclassId" id="rclassId" disabled> <option value="0">选择所属分类</option> 
<?php
$videoclasssql="select CD_ID,CD_Name from " . tname('videoclass') . " where CD_FatherID=0 and CD_IsHide=0 order by CD_TheOrder asc";
$result=$db->query($videoclasssql);
//$classnum=$db->num_rows($result);
if($result) {
	while($videoclass=$db->fetch_array($result)) {
			echo "<option value='" . $videoclass['CD_ID'] . "' >&nbsp;|—" . $videoclass['CD_Name'] . "</option>";
echo Get_Fclass_select($videoclass['CD_ID'],'videoclass');				
}
}
?></select> </div> 
           <div class="input_msg"> <span class="button2-main"><span><button type="button" onclick="pop.up('请选择一个分类', 'selectclass/index.php?ac=video', '960px', '550px', '110px');">选择分类</button></span></span> </div> 
		   <div class="input_msg" id="mclassId">视频的所属分类，请正确选择。</div> </li> 
          <li> 
           <div class="name">所属专辑： </div> 
           <div class="input"> <select style="width: 110px;" class="select_normal" name="rSpecialID" id="rSpecialID"> <option value="">选择所属专辑</option> <option value="0">不属任何专辑</option> 
<?php
$valbumsql="select * from " . tname('valbum') . " where CD_User='" . $CcTvAi_com_username . "'";
$results=$db->query($valbumsql);
if($results) {
		while($valbum=$db->fetch_array($results)) {
				echo "<option value='" . $valbum['CD_ID'] . "'>" . getlen("len", "10", $valbum['CD_Name']) . "</option>";
		}
}
?></select> </div> 
           <div class="input_msg" id="mSpecialID">只显示您创建的专辑，请选择加入一个。 </div> </li> 
          <li> 
           <div class="name">视频地址：</div> 
           <div class="input"> <input type="text" style="width: 320px;" class="input_normal" name="rUrl" id="rUrl" /> </div> 
           <div class="input_msg"> 
<?php
include "../plug/up/conf.inc.php";
?>	
           <span class="button2-main"><span><button type="button" onclick="pop.up('请选择上传服务器，并选择您电脑上的视频文件上传。', '<?php echo cd_webpath?>plug/up/index.php?type=video', '<?php echo upwidth?>', '<?php echo upheight?>', '<?php echo uptop?>');">上传文件</button> </span></span> </div> 
<?php
include "../plug/yijianvideo/conf.inc.php";
if(yijianvideoopen=="yes") {
echo '<div class="input_msg">
<span class="button2-main"><span><button type="button" onclick="pop.up(\'一键添加视频\', \'' . cd_webpath . 'plug/yijianvideo/index.php\', \'' . width . '\', \'' . height . '\', \'' . top . '\');">一键添加</button></span></span>
</div>';
}
?>
           <div class="input_msg" id="mPlay"></div>  </li> 
          <li> 
           <div class="name">设置封面：</div> 
           <div class="input"> <input type="text" style="width: 320px;" class="input_normal" name="rPic" id="rPic" /> </div> 
           <div class="input_msg"><span class="button2-main"><span><button type="button" onclick="pop.up('上传封面', '<?php echo cd_webpath;?>include/upload/?ac=videopic&f=form.rPic', '406px', '180px', '140px');">上传封面</button></span></span></div>
           <div class="input_msg" id="mPic"></div> </li> 
          <li> 
           <div class="name">视频介绍： </div> 
           <div class="input"> <textarea name="rnote" id="rnote"></textarea> </div> </li> 
          <li class="note" style="display:none"> 
           <div class="name">文本歌词： </div> 
           <div class="input"> <textarea name="rLrc" id="rLrc"></textarea> </div> </li> 
          <li class="note"> 
           <div class="name">视频标签： </div> 
           <div class="input"> <input type="text" style="width: 150px;" class="input_normal" name="rtag" id="rtag" readonly="" /> </div> 
           <div class="input_msg"> <span class="button2-main"><span><button type="button" onclick="pop.up('添加视频TAG标签', '<?php echo cd_webpath;?>user/tag.php', '320px', '320px', '140px');">添加标签</button></span></span> </div></li> 
          <li class="note"> 
           <div class="name">下载售价： </div> 
           <div class="input"> <input type="text" style="width: 30px;" class="input_normal" name="price" id="price" value="0" /> </div> 
           <div class="input_msg">金币&nbsp;&nbsp;<font color="red">最高[<?php echo cd_attachmentpoints;?>]金币</font> </div></li> 
          <li class="note"> 
           <div class="name">下载权限： </div> 
           <div class="input"> <select class="select_normal" name="grade" id="grade"> <option value="0" selected="">游客下载</option> <option value="1">普通用户</option> <option value="2">VIP 用户</option> </select> </div> </li> 
          <li class="note"> 
           <div class="name">验证码： </div> 
           <div class="input"> <input type="text" style="width: 50px;" class="input_normal" name="seccode" id="seccode" /> </div> 
           <div class="input_msg"><img id="code" alt="" src="source/ajax.php?ac=seccode&rand=" /> <a href="javascript:changeimg()">看不清楚？换一张</a> </div> </li> 
           <input type="hidden" name="rServer" id="rServer" value="" /> 
           <input type="hidden" name="rfrom" id="rfrom" value="" /> 
           <input type="hidden" name="rsiz" id="rsiz" value="" /> 
           <input type="hidden" name="rmd5" id="rmd5" value="" /> 
           <input type="hidden" name="ruid" id="ruid" value="" /> 
           <input type="hidden" name="Playtime" id="Playtime" value="" /> 
           <input type="hidden" name="Bitkbps" id="Bitkbps" value="" /> 
           <input type="hidden" name="yijianvideo" id="yijianvideo" value="" /> 
          <li> 
           <div class="name"></div> 
           <div class="input"> <span class="button-main"><span><button type="button" id="videoNewAdd">上传保存</button></span></span> </div> </li>   
       </div> 
      </div> 
<?php }else{?>
      <div class="minHeight500"> 
       <div class="profile"> 
        <div class="title"> <div class="name">提醒：本站已暂时关闭分享视频功能！</div> </div> 
      </div> 
     </div> 
<?php }?>
     </div> 
    </div> 
   </div> 
<?php }elseif($view=="passed"){ ?>
    <div class="user_main"> 
     <div class="uMain_content"> 
      <div class="main_nav"> 
       <ul> 
        <li class="concert"> <a href="<?php echo rewrite_url('space.php?do=upvideo&view=list');?>">已审视频</a> </li> 
        <li class="find"> <a class="on" href="<?php echo rewrite_url('space.php?do=upvideo&view=passed');?>">待审视频</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=upvideo');?>">发布视频</a> 
       </div> 
      </div> 
      <div class="big_list"> 
       <ul> 
        <li><a href="<?php echo rewrite_url('space.php?do=upvideo&view=passed');?>"<?php if($day=="") {echo ' class="current"';}?>>全部类型</a></li>
<?php
if($day){$videoclass=$db->getrow('select * from ' . tname('videoclass') . " where CD_ID='" . $day . "'");}
$videoclasssql1="select CD_ID,CD_Name from " . tname('videoclass') . " where CD_FatherID=0 and CD_IsHide=0";
$results=$db->query($videoclasssql1);
if($results) {
		while($videoclass1=$db->fetch_array($results)) {
			if($videoclass["CD_FatherID"]=="0"){$FatherID=$videoclass["CD_ID"];}else{$FatherID=$videoclass["CD_FatherID"];}
				if($videoclass1['CD_ID']==$FatherID){
						echo "<li><a href='" . rewrite_url('space.php?do=upvideo&view=passed&day='.$videoclass1['CD_ID'].'')."' class=\"current\">" . $videoclass1['CD_Name'] . "</a></li>";
				} else {
						echo "<li><a href='" . rewrite_url('space.php?do=upvideo&view=passed&day='.$videoclass1['CD_ID'].'')."'>" . $videoclass1['CD_Name'] . "</a></li>";
				}
		}
}
?>
</div> 
<?php
if($day){
if($videoclass["CD_TieID"]!=999999){
echo'<div class="small_list">';
$videoclasssql2="select CD_ID,CD_Name from " . tname('videoclass') . " where CD_ID in (".$videoclass["CD_TieID"].") and CD_IsHide=0";
$results=$db->query($videoclasssql2);
if($results) {
	while($videoclass2=$db->fetch_array($results)) {
		if($videoclass2['CD_ID']==$day){
			echo "<li><a href='" . rewrite_url('space.php?do=upvideo&view=passed&day='.$videoclass2['CD_ID'].'')."' class=\"current\">" . $videoclass2['CD_Name'] . "</a></li>";
		}else{
			echo "<li><a href='" . rewrite_url('space.php?do=upvideo&view=passed&day='.$videoclass2['CD_ID'].'')."'>" . $videoclass2['CD_Name'] . "</a></li>";
		}
	}
}
echo'</div>';
}
}
?>
      <div id="favoritesList" class="minHeight500"> 
<?php
global $db;
$a=0;
if($day) {
if(cd_zclass=="1"){
	if($videoclass["CD_FatherID"]==0){$fidsql=" and CD_ClassID in (".rtrim($videoclass["CD_ID"].','.$videoclass['CD_TieID'], ',').")";}else{$fidsql=" and CD_ClassID='".$videoclass["CD_ID"]."'";}
	}else{
		$fidsql=" and CD_ClassID='".$videoclass["CD_ID"]."'";
		}
}
$videosql="select * from " . tname('video') . " where CD_Deleted=0 and CD_Passed=1$fidsql and CD_User='" . $CcTvAi_com_username . "' order by CD_AddTime desc";
$Arr=getuserpage($videosql, 20); //sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<div class="nothing">暂无已审视频。</div>';
} else {
		if($result) {
				echo '<div class="image_praise">';
				echo '<ul>';
				while($video=$db->fetch_array($result)) {
						echo '<li>';
						echo '<div class="pic">';
						echo '<a href="' . LinkUrl("video", $video['CD_ClassID'], 1, $video['CD_ID']) . '" target="_blank"><img class="avatar" src="' . LinkPicUrl($video['CD_Pic'],'video') . '" title="' . $video['CD_Name'] . '" height="80" width="80" onerror="this.src=\'' . cd_webpath . 'user/static/images/nopic.jpg\'"/></a>';
						echo '</div>';
						echo '<div class="option">';
						echo '<label style="cursor:pointer;">' . getlen("len", "8", $video['CD_Name']) . '</label>';
						echo '<label style="color:#FF0000;" class="delete" did="' . $video['CD_ID'] . '">删除</label>';
						echo '</div>';
						echo '</li>';
				}
				echo '</ul>';
				echo '</div>';
		}
}
?>
<?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; ?>user/space.php?do=upvideo&view=passed&day=<?php echo $day; ?>&pages='+val+'';return false;}else{return true;}};if(!c(event,this.value))return false;" title="输入页码，按回车快速跳转"/>
        </div> 
       </div> 
<?php } ?>
     </div> 
    </div> 
   </div> 
  </div> 
<?php }elseif($view=="list"){ ?>
    <div class="user_main"> 
     <div class="uMain_content"> 
      <div class="main_nav"> 
       <ul> 
        <li class="concert"> <a class="on" href="<?php echo rewrite_url('space.php?do=upvideo&view=list');?>">已审视频</a> </li> 
        <li class="find"> <a href="<?php echo rewrite_url('space.php?do=upvideo&view=passed');?>">待审视频</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=upvideo');?>">发布视频</a> 
       </div> 
      </div> 
      <div class="big_list"> 
        <li><a href="<?php echo rewrite_url('space.php?do=upvideo&view=list');?>"<?php if($day=="") {echo ' class="current"';}?>>全部类型</a></li>
<?php
if($day){$videoclass=$db->getrow('select * from ' . tname('videoclass') . " where CD_ID='" . $day . "'");}
$videoclasssql1="select CD_ID,CD_Name from " . tname('videoclass') . " where CD_FatherID=0 and CD_IsHide=0";
$results=$db->query($videoclasssql1);
if($results) {
		while($videoclass1=$db->fetch_array($results)) {
			if($videoclass["CD_FatherID"]=="0"){$FatherID=$videoclass["CD_ID"];}else{$FatherID=$videoclass["CD_FatherID"];}
				if($videoclass1['CD_ID']==$FatherID){
						echo "<li><a href='" . rewrite_url('space.php?do=upvideo&view=list&day='.$videoclass1['CD_ID'].'')."' class=\"current\">" . $videoclass1['CD_Name'] . "</a></li>";
				} else {
						echo "<li><a href='" . rewrite_url('space.php?do=upvideo&view=list&day='.$videoclass1['CD_ID'].'')."'>" . $videoclass1['CD_Name'] . "</a></li>";
				}
		}
}
?>
</div> 
<?php
if($day){
if($videoclass["CD_TieID"]!=999999){
echo'<div class="small_list">';
$videoclasssql2="select CD_ID,CD_Name from " . tname('videoclass') . " where CD_ID in (".$videoclass["CD_TieID"].") and CD_IsHide=0";
$results=$db->query($videoclasssql2);
if($results) {
	while($videoclass2=$db->fetch_array($results)) {
		if($videoclass2['CD_ID']==$day){
			echo "<li><a href='" . rewrite_url('space.php?do=upvideo&view=list&day='.$videoclass2['CD_ID'].'')."' class=\"current\">" . $videoclass2['CD_Name'] . "</a></li>";
		}else{
			echo "<li><a href='" . rewrite_url('space.php?do=upvideo&view=list&day='.$videoclass2['CD_ID'].'')."'>" . $videoclass2['CD_Name'] . "</a></li>";
		}
	}
}
echo'</div>';
}
}
?> 
      <div id="favoritesList" class="minHeight500"> 
<?php
global $db;
$a=0;
if($day) {
if(cd_zclass=="1"){
	if($videoclass["CD_FatherID"]==0){$fidsql=" and CD_ClassID in (".rtrim($videoclass["CD_ID"].','.$videoclass['CD_TieID'], ',').")";}else{$fidsql=" and CD_ClassID='".$videoclass["CD_ID"]."'";}
	}else{
		$fidsql=" and CD_ClassID='".$videoclass["CD_ID"]."'";
		}
}
$videosql="select * from " . tname('video') . " where CD_Deleted=0 and CD_Passed=0$fidsql and CD_User='" . $CcTvAi_com_username . "' order by CD_AddTime desc";
$Arr=getuserpage($videosql, 20); //sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<div class="nothing">暂无已审视频。</div>';
} else {
		if($result) {
				echo '<div class="image_praise">';
				echo '<ul>';
				while($video=$db->fetch_array($result)) {
						echo '<li>';
						echo '<div class="pic" style="height: 110px;">';
						echo '<a href="' . LinkUrl("video", $video['CD_ClassID'], 1, $video['CD_ID']) . '" target="_blank"><img class="avatar" style="height: 100px;" src="' . LinkPicUrl($video['CD_Pic'],'video') . '" title="' . $video['CD_Name'] . '" height="100" width="160" onerror="this.src=\'' . cd_webpath . 'user/static/images/nopic.jpg\'"/></a>';
						echo '</div>';
						echo '<div class="option">';
						echo '<label style="cursor:pointer;">' . getlen("len", "8", $video['CD_Name']) . '</label>';
						//echo '<label style="color:#FF0000;" class="delete" did="' . $row['CD_ID'] . '">删除</label>';
						echo '</div>';
						echo '</li>';
				}
				echo '</ul>';
				echo '</div>';
		}
}
?>
<?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; ?>user/space.php?do=upvideo&view=list&day=<?php echo $day; ?>&pages='+val+'';return false;}else{return true;}};if(!c(event,this.value))return false;" title="输入页码，按回车快速跳转"/>
        </div> 
       </div> 
<?php } ?>
      </div> 
     </div> 
    </div> 
   </div> 
<?php } ?> 
  </div> 
  <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" src="<?php echo cd_webpath?>user/static/space/js/video.js"></script> 
  <script type="text/javascript" src="<?php echo cd_webpath?>user/static/space/layer/lib.js"></script> 
<?php if($view==""){ ?>
  <script type="text/javascript">
listenMsg.start();
nav.init();
nav.userMenu();
videoLib.shareAddInit();
var pop = {
up: function(text, url, width, height, top) {
$.layer({
type: 2,
maxmin: true,
title: text,
iframe: {
src: url
},
area: [width, height],
offset: [top, '50%'],
shade: [0]
});
}
}
  </script> 
<?php }elseif($view=="list"){ ?>
  <script type="text/javascript">listenMsg.start();nav.init();nav.userMenu();videoLib.passDelInit();</script> 
<?php }elseif($view=="passed"){ ?>
  <script type="text/javascript">listenMsg.start();nav.init();nav.userMenu();videoLib.passDelInit();</script> 
<?php }?>
<?php include_once('source/space_footer.php');?> 
</body>
</html>