<?php
/*
'**************************************************************************************************
' 软件名称: 盘锦DJ舞曲网CMS Content Management PjRen.Net
' 版本编号: Version 2.5
' 盘锦舞曲: http://www.pj57.com
' 官方网站: http://www.pjren.net
' 小说网站: http://www.hx39.com
' 0427DJ网: http://www.0427dj.net
' 官方论坛: http://www.tianjiazhen.com
' 版权所有: 盘锦舞曲开发团队    盘锦人(QQ:814006710)
' 郑重声明:
'    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;
}
?>