<?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=upmusic')."';</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=upmusic&view=list');?>">已审音乐</a> </li> 
        <li class="find"> <a href="<?php echo rewrite_url('space.php?do=upmusic&view=passed');?>">待审音乐</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=upmusic');?>">分享音乐</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="danceAddMain"> 
          <li>  
           <div class="name">音乐名称： </div> 
           <div class="input"> <input type="text" style="width: 190px;" class="input_normal" name="rdanceName" id="rdanceName" maxlength="100" /> </div> 
           <div class="input_msg" id="mdanceName">作为音乐名称请您认真填写，合理的名称审核才会通过。 </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
$classsql="select CD_ID,CD_Name from " . tname('class') . " where CD_FatherID=0 and CD_IsHide=0 order by CD_TheOrder asc";
$result=$db->query($classsql);
//$classnum=$db->num_rows($result);
if($result) {
	while($class=$db->fetch_array($result)) {
			echo "<option value='" . $class['CD_ID'] . "' >&nbsp;|—" . $class['CD_Name'] . "</option>";
echo Get_Fclass_select($class['CD_ID'],'class');				
}
}
?></select> </div> 
           <div class="input_msg"> <span class="button2-main"><span><button type="button" onclick="pop.up('请选择一个分类', 'selectclass/index.php?ac=dance', '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
$malbumsql="select * from " . tname('malbum') . " where CD_User='" . $CcTvAi_com_username . "'";
$results=$db->query($malbumsql);
if($results) {
		while($malbum=$db->fetch_array($results)) {
				echo "<option value='" . $malbum['CD_ID'] . "'>" . getlen("len", "10", $malbum['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> 
<?php include "../plug/up/conf.inc.php";?> 
           <div class="input_msg"> <span class="button2-main"><span><button type="button" onclick="pop.up('请选择上传服务器，并选择您电脑上的音频文件上传。', '<?php echo cd_webpath?>plug/up/index.php?type=music', '<?php echo upwidth?>', '<?php echo upheight?>', '<?php echo uptop?>');">上传文件</button></span></span> </div> 
<?php
include "../plug/yijianmusic/conf.inc.php";
if(yijianmusicopen=="yes") {
		echo '<div class="input_msg">
<span class="button2-main"><span><button type="button" onclick="pop.up(\'一键添加音乐\', \'' . cd_webpath . 'plug/yijianmusic/index.php\', \'' . width . '\', \'' . height . '\', \'' . top . '\');">一键添加</button></span></span>
</div>';
}
?>
           <div class="input_msg" id="mUrl"></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=dancepic&f=form.rPic', '406px', '180px', '140px');">上传封面</button></span></span> </div> </li> 
          <li> 
           <div class="name">音乐介绍： </div> 
           <div class="input"> <textarea name="rnote" id="rnote"></textarea> </div> </li> 
          <li class="note"> 
           <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="" /> 
          <li> 
           <div class="name"></div> 
           <div class="input"> <span class="button-main"><span><button type="button" id="danceNewAdd">上传保存</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=upmusic&view=list');?>">已审音乐</a> </li> 
        <li class="find"> <a class="on" href="<?php echo rewrite_url('space.php?do=upmusic&view=passed');?>">待审音乐</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=upmusic');?>">分享音乐</a> 
       </div> 
      </div> 
      <div class="big_list"> 
        <li><a href="<?php echo rewrite_url('space.php?do=upmusic&view=passed');?>"<?php if($day=="") {echo ' class="current"';}?>>全部类型</a></li>
<?php
if($day){$class=$db->getrow('select * from ' . tname('class') . " where CD_ID='" . $day . "'");}
$classsql1="select CD_ID,CD_Name from " . tname('class') . " where CD_FatherID=0 and CD_IsHide=0";
$results=$db->query($classsql1);
if($results) {
		while($class1=$db->fetch_array($results)) {
			if($class["CD_FatherID"]=="0"){$FatherID=$class["CD_ID"];}else{$FatherID=$class["CD_FatherID"];}
				if($class1['CD_ID']==$FatherID){
						echo "<li><a href='" . rewrite_url('space.php?do=upmusic&view=passed&day='.$class1['CD_ID'].'')."' class=\"current\">" . $class1['CD_Name'] . "</a></li>";
				} else {
						echo "<li><a href='" . rewrite_url('space.php?do=upmusic&view=passed&day='.$class1['CD_ID'].'')."'>" . $class1['CD_Name'] . "</a></li>";
				}
		}
}
?>
</div> 
<?php
if($day){
if($class["CD_TieID"]!=999999){
echo'<div class="small_list">';
$classsql2="select CD_ID,CD_Name from " . tname('class') . " where CD_ID in (".$class["CD_TieID"].") and CD_IsHide=0";
$results=$db->query($classsql2);
if($results) {
	while($class2=$db->fetch_array($results)) {
		if($class2['CD_ID']==$day){
			echo "<li class=\"current\"><a href='" . rewrite_url('space.php?do=upmusic&view=passed&day='.$class2['CD_ID'].'')."' class=\"current\">" . $class2['CD_Name'] . "</a></li>";
		}else{
			echo "<li><a href='" . rewrite_url('space.php?do=upmusic&view=passed&day='.$class2['CD_ID'].'')."'>" . $class2['CD_Name'] . "</a></li>";
		}
	}
}
echo'</div>';
}
}
?>  
      <div id="favoritesList" class="minHeight500"> 
       <div class="private_dance_list"> 
<?php
global $db;
$a=0;
if($day) {
if(cd_zclass=="1"){
	if($class["CD_FatherID"]==0){$fidsql=" and CD_ClassID in (".rtrim($class["CD_ID"].','.$class['CD_TieID'], ',').")";}else{$fidsql=" and CD_ClassID='".$class["CD_ID"]."'";}
	}else{
		$fidsql=" and CD_ClassID='".$class["CD_ID"]."'";
		}
}
$djsql="select * from " . tname('dj') . " where CD_Deleted=0 and CD_Passed=1$fidsql and CD_User='" . $CcTvAi_com_username . "' order by CD_AddTime desc";
$Arr=getuserpage($djsql, 20); //sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<div class="nothing">暂无待审音乐。</div>';
} else {
		if($result) {
				echo '<ul id="list">';
				echo '<li class="title">';
				echo '<div class="song">音乐/分享人</div>';
				echo '<div class="time">分享时间</div>';
				echo '<div class="file">类别</div>';
				echo '<div class="add">试听</div>';
				echo '<div class="down">下载</div>';
				echo '<div class="deleting">删除</div>';
				echo '</li>';
				while($dj=$db->fetch_array($result)) {
						$a=$a+1;
						echo '<li';
						if($a%2==0) {
								echo ' class="c2"';
						}
						echo '>';
						echo '<div class="song">';
						echo '<span class="cbox"><input id="' . $dj['CD_ID'] . '" type="checkbox" name="did" value="' . $dj['CD_ID'] . '"></span>';
						echo '<div class="aleft">';
						echo '<a href="' . LinkUrl("dj", $dj['CD_ClassID'], 1, $dj['CD_ID']) . '" target="p" class="mname">' . $a . '.&nbsp;&nbsp;' . $dj["CD_Name"] . '</a>';
						echo ' - ';
						echo '<a href="' . linkweburl($CcTvAi_com_userid, $CcTvAi_com_username) . '" class="nickname" title="' . $CcTvAi_com_nicheng . '" target="_blank" uid="' . $CcTvAi_com_userid . '">' . $CcTvAi_com_nicheng . '</a>';
						echo '</div>';
						echo '</div>';
						echo '<div class="time">' . datetime($dj['CD_AddTime']) . '</div>';
						echo '<div class="file"><a href="' . LinkClassUrl("dj", $dj['CD_ClassID'], 1, 1) . '" target="_blank">' . GetAlias("cctvai_class", "CD_Name", "CD_ID", $dj['CD_ClassID']) . '</a></div>';
						echo '<div class="add"><a class="addition" href="' . LinkUrl("dj", $dj['CD_ClassID'], 1, $dj['CD_ID']) . '" target="p" title="试听歌曲"></a></div>';
						echo '<div class="down"><a class="download" href="'.DownLinkUrl(cd_webmlplay,$dj['CD_ID']).'" target="p" title="下载歌曲"></a></div>';
						echo '<div class="action">';
						echo '<a class="del" did="' . $dj['CD_ID'] . '" title="删除歌曲" href="javascript:;"></a>';
						echo '</div>';
						echo '</li>';
				}
				echo '</ul>';
		}
}
?>
       </div> 
<?php if($num>0){?>
       <div class="page"> 
        <div class="play_button"> 
         <a class="select_all" href="javascript:;" id="selectAll" onclick="dancePlayer.selectAllDance('list', '');">全选</a> 
         <a class="select_play" href="javascript:;" onclick="dancePlayer.playDance('list');">播放</a> 
        </div> 
        <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=upmusic&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=upmusic&view=list');?>">已审音乐</a> </li> 
        <li class="find"> <a href="<?php echo rewrite_url('space.php?do=upmusic&view=passed');?>">待审音乐</a> </li> 
       </ul> 
       <div class="action"> 
        <a href="<?php echo rewrite_url('space.php?do=upmusic');?>">分享音乐</a> 
       </div> 
      </div> 
      <div class="big_list"> 
        <li><a href="<?php echo rewrite_url('space.php?do=upmusic&view=list');?>"<?php if($day=="") {echo ' class="current"';}?>>全部类型</a></li>
<?php
if($day){$class=$db->getrow('select * from ' . tname('class') . " where CD_ID='" . $day . "'");}
$classsql1="select CD_ID,CD_Name from " . tname('class') . " where CD_FatherID=0 and CD_IsHide=0";
$results=$db->query($classsql1);
if($results) {
		while($class1=$db->fetch_array($results)) {
			if($class["CD_FatherID"]=="0"){$FatherID=$class["CD_ID"];}else{$FatherID=$class["CD_FatherID"];}
				if($class1['CD_ID']==$FatherID){
						echo "<li><a href='" . rewrite_url('space.php?do=upmusic&view=list&day='.$class1['CD_ID'].'')."' class=\"current\">" . $class1['CD_Name'] . "</a></li>";
				} else {
						echo "<li><a href='" . rewrite_url('space.php?do=upmusic&view=list&day='.$class1['CD_ID'].'')."'>" . $class1['CD_Name'] . "</a></li>";
				}
		}
}
?>
</div> 
<?php
if($day){
if($class["CD_TieID"]!=999999){
echo'<div class="small_list">';
$classsql2="select CD_ID,CD_Name from " . tname('class') . " where CD_ID in (".$class["CD_TieID"].") and CD_IsHide=0";
$results=$db->query($classsql2);
if($results) {
	while($class2=$db->fetch_array($results)) {
		if($class2['CD_ID']==$day){
			echo "<li><a href='" . rewrite_url('space.php?do=upmusic&view=list&day='.$class2['CD_ID'].'')."' class=\"current\">" . $class2['CD_Name'] . "</a></li>";
		}else{
			echo "<li><a href='" . rewrite_url('space.php?do=upmusic&view=list&day='.$class2['CD_ID'].'')."'>" . $class2['CD_Name'] . "</a></li>";
		}
	}
}
echo'</div>';
}
}
?>
      <div id="favoritesList" class="minHeight500"> 
       <div class="private_dance_list"> 
<?php
global $db;
$a=0;
if($day) {
if(cd_zclass=="1"){
	if($class["CD_FatherID"]==0){$fidsql=" and CD_ClassID in (".rtrim($class["CD_ID"].','.$class['CD_TieID'], ',').")";}else{$fidsql=" and CD_ClassID='".$class["CD_ID"]."'";}
	}else{
		$fidsql=" and CD_ClassID='".$class["CD_ID"]."'";
		}
}
$djsql="select * from " . tname('dj') . " where CD_Deleted=0 and CD_Passed=0$fidsql and CD_User='" . $CcTvAi_com_username . "' order by CD_AddTime desc";
$Arr=getuserpage($djsql, 20); //sql,每页显示条数
$result=$db->query($Arr[2]);
$num=$db->num_rows($result);
if($num==0) {
		echo '<div class="nothing">暂无已审音乐。</div>';
} else {
		if($result) {
				echo '<ul id="list">';
				echo '<li class="title">';
				echo '<div class="song">音乐/分享人</div>';
				echo '<div class="time">分享时间</div>';
				echo '<div class="file">类别</div>';
				echo '<div class="add">试听</div>';
				echo '<div class="down">下载</div>';
				//echo '<div class="deleting">删除</div>';
				echo '</li>';
				while($dj=$db->fetch_array($result)) {
						$a=$a+1;
						echo '<li';
						if($a%2==0) {
								echo ' class="c2"';
						}
						echo '>';
						echo '<div class="song">';
						echo '<span class="cbox"><input id="' . $dj['CD_ID'] . '" type="checkbox" name="did" value="' . $dj['CD_ID'] . '"></span>';
						echo '<div class="aleft">';
						echo '<a href="' . LinkUrl("dj", $dj['CD_ClassID'], 1, $dj['CD_ID']) . '" target="p" class="mname">' . $a . '.&nbsp;&nbsp;' . $dj["CD_Name"] . '</a>';
						echo ' - ';
						echo '<a href="' . linkweburl($CcTvAi_com_userid, $CcTvAi_com_username) . '" class="nickname" title="' . $CcTvAi_com_nicheng . '" target="_blank" uid="' . $CcTvAi_com_userid . '">' . $CcTvAi_com_nicheng . '</a>';
						echo '</div>';
						echo '</div>';
						echo '<div class="time">' . datetime($dj['CD_AddTime']) . '</div>';
						echo '<div class="file"><a href="' . LinkClassUrl("dj", $dj['CD_ClassID'], 1, 1) . '" target="_blank">' . GetAlias("cctvai_class", "CD_Name", "CD_ID", $dj['CD_ClassID']) . '</a></div>';
						echo '<div class="add"><a class="addition" href="' . LinkUrl("dj", $dj['CD_ClassID'], 1, $dj['CD_ID']) . '" target="p" title="试听歌曲"></a></div>';
						echo '<div class="down"><a class="download" href="'.DownLinkUrl(cd_webmlplay,$dj['CD_ID']).'" target="p" title="下载歌曲"></a></div>';
						echo '<div class="action">';
						//echo '<a class="del" did="' . $row['CD_ID'] . '" title="删除歌曲" href="javascript:;"></a>';
						echo '</div>';
						echo '</li>';
				}
				echo '</ul>';
		}
}
?>
</div> 
<?php if($num>0){?>
       <div class="page"> 
        <div class="play_button"> 
         <a class="select_all" href="javascript:;" id="selectAll" onclick="dancePlayer.selectAllDance('list', '');">全选</a> 
         <a class="select_play" href="javascript:;" onclick="dancePlayer.playDance('list');">播放</a> 
        </div> 
        <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=upmusic&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/dance.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();
danceLib.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();danceLib.passDelInit();</script> 
<?php }elseif($view=="passed"){ ?>
  <script type="text/javascript">listenMsg.start();nav.init();nav.userMenu();danceLib.passDelInit();</script> 
<?php }?>
<?php include_once('source/space_footer.php');?>  
  </body>
</html>