<?php

/*

'**************************************************************************************************

' 软件名称: 黑色幻想舞曲管理系统CMS2.0

' 版本编号: hshxsdj 2.0

' 官方网站: http://www..hshxs.com

' 官方论坛：http://bbs.hshxs.com

' 版权所有: 黑色幻想开发团队    噬己翼(QQ:532917920)

' 郑重声明:

'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；

'    2、黑色幻想网络事业部保留此软件的法律追究权利

'**************************************************************************************************

*/

include_once("../include/label.php");

$Param=$_SERVER['QUERY_STRING'];

if($Param=="") {

	if(S_Webmode==1 && file_exists(_CHSHDJ_ROOT_.S_Templateurl."vodindex.html")){

		$cache_id ="vodindex_";

		if(!($cache_opt->start($cache_id))){

			 echo GetTemp("vodindex.html",0);

			$cache_opt->end();

		}		

	}else{

		header("Location:index.html");	

		}

	die();	

	}

	

//判断是否需要自动转向静态

if((stristr($Param,S_UrlList) or stristr($Param,S_UrlContent)) && S_Webmode==0){

	$ID=SafeRequest("ID","get");

	if($ID==""){

		if(stristr($Param,S_UrlList) && S_Slists!='1'){

			$ID=ReplaceStr($Param,S_UrlList,"");

			$ID=preg_replace("/.".S_Dvsuffix."(.*?)$/",'',$ID);

			$Page=SafeRequest("pages","get","zr");

			if(!IsNum($Page)) $Page=1;

			if(!IsNum($ID)) die("参数传输错误1"); 

			$headerhtml=LinkClassUrl("s_video",$ID,1,$Page,S_SLists);

			header("Location:$headerhtml");

			}

		elseif(stristr($Param,S_UrlContent)){

			$ID=ReplaceStr($Param,S_UrlContent,"");

			$ID=preg_replace("/.".S_Dvsuffix."(.*?)$/",'',$ID);

			if(!IsNum($ID)) die("参数传输错误2");

			$sql="select S_ClassID from s_video where S_ID=$ID";

			$row=$db->getRow($sql);

			$headerhtml=LinkUrl("s_video",$row['S_ClassID'],1,$ID);

			header("Location:$headerhtml");

		 }elseif(S_Slists!='1'){

			 die("参数传输错误咯3");

			 }	

	}else{

		if(stristr($ID,S_UrlList) && S_Slists!='1'){		

		 	$ID=ReplaceStr($ID,S_UrlList,"");

			if(!IsNum($ID)) die("参数传输错误4");

			$Page=SafeRequest("pages","get","zr");

			if(!IsNum($Page)) $Page=1;			

			$headerhtml=LinkClassUrl("s_video",$ID,1,$Page,S_SLists);

			header("Location:$headerhtml");

		  }elseif(stristr($ID,S_UrlContent)){

		  	$ID=ReplaceStr($ID,S_UrlContent,"");

		 	if(!IsNum($ID)) die("参数传输错误5");

			$Page=SafeRequest("pages","get","zr");

			if(!IsNum($Page)) $Page=1;	

			$sql="select S_ClassID from s_video where S_ID=$ID";

			$row=$db->getRow($sql);

			$headerhtml=LinkUrl("s_video",$row['S_ClassID'],1,$ID);

			header("Location:$headerhtml");			

		}elseif(S_Slists!='1'){

			 die("参数传输错误咯6");

			}		

		

		}

		

}



if(S_Webmode==1 or S_Slists=='1'){

	$ID=SafeRequest("ID","get","zr");

	if($ID==""){

		if(stristr($Param,S_UrlList)){

			$ID=ReplaceStr($Param,S_UrlList,"");

			$ID=preg_replace("/.".S_Dvsuffix."(.*?)$/",'',$ID);

			$pages=SafeRequest("pages","get","zr");

			if(!IsNum($ID)) die("参数传输错误7"); 

			//缓存区

			$cache_id ='l_'.$ID."_".$pages;

			if(!($cache_opt->start($cache_id))){

				 echo SpanVideoList($ID);

				$cache_opt->end();

			}

		}elseif(stristr($Param,S_UrlContent)){

			$ID=ReplaceStr($Param,S_UrlContent,"");

			$ID=preg_replace("/.".S_Dvsuffix."(.*?)$/",'',$ID);

			if(!IsNum($ID)) die("参数传输错误8");

			$pages=SafeRequest("pages","get","zr");

		  	$cache_id ='c_'.$ID."_".$pages;

			if(!($cache_opt->start($cache_id))){

				 echo SpanVideoShow($ID);

				$cache_opt->end();

			}

		}else{

			die("参数传输错误!9");

			}

	}else{	

		if(stristr($ID,S_UrlList)){		

			  $ID=ReplaceStr($ID,S_UrlList,"");

			  $pages=SafeRequest("pages","get","zr");

			  if(!IsNum($ID)){die("参数传输错误10");}	

			  $cache_id ='l_'.$ID."_".$pages;;

			  if(!($cache_opt->start($cache_id))){

				   echo SpanVideoList($ID);	

				   $cache_opt->end();

			  }

		} elseif(stristr($ID,S_UrlContent)){

			  $ID=ReplaceStr($ID,S_UrlContent,"");

			  $pages=SafeRequest("pages","get","zr");

			  if(!IsNum($ID)){die("参数传输错误11");}

			  $cache_id ='c_'.$ID."_".$pages;

			  if(!($cache_opt->start($cache_id))){

				   echo SpanVideoShow($ID);

				  $cache_opt->end();

			  }		

		  }else{

		 	 die("参数传输错误!12");

		  }		  

	}	

}



function PlayFormSel($Url,$PlayForm,$AddPath,$ID){

	if($AddPath!=0 && $AddPath!=""){

		$server=trim(GetAddPath($AddPath));

		}

	else{

		$server="";

		}

	$playurl=$server.$Url;

	$Mark_Text=@file_get_contents("../js/player/play.html");

	$Mark_Text=ReplaceStr($Mark_Text,'$playshow$',@file_get_contents("../js/player/".$PlayForm.".html"));

	if($PlayForm!="mp3" && $PlayForm!="cmp" && $PlayForm!="dj95"){

	$Mark_Text=ReplaceStr($Mark_Text,'$width$',S_PlayspWidth);

	$Mark_Text=ReplaceStr($Mark_Text,'$height$',S_PlayspHeight);

		}

	else{

	$Mark_Text=ReplaceStr($Mark_Text,'$width$',S_PlayWidth);

	$Mark_Text=ReplaceStr($Mark_Text,'$height$',S_PlayHeight);

		}

	$Mark_Text=ReplaceStr($Mark_Text,'$s_adloadtime$',S_AdLoadTime);

	$Mark_Text=ReplaceStr($Mark_Text,'$uid$',S_UID);

	$Mark_Text=ReplaceStr($Mark_Text,'{chshdjcms:path}',S_SitePath);

	$Mark_Text=ReplaceStr($Mark_Text,'{chshdjcms:webname}',S_SiteName);

	$Mark_Text=ReplaceStr($Mark_Text,'$spurl$',"".$Url."");

	$Mark_Text=ReplaceStr($Mark_Text,'$url$',"".S_SitePath."include/playurl.php?id=".$ID."");

	return $Mark_Text;

	}	

function GetAddPath($ID){

	global $db;

	$sql="select S_ID,S_AddPath from s_pathip where S_ID=".$ID;

	$row=$db->getRow($sql);

	if($row){

              $addpath=$row['S_AddPath'];

        }else{

              $addpath="";

        }

	return $addpath;

}

?>