<?php
require ('../e/class/connect.php');
require ('../e/class/db_sql.php');
require('../e/class/t_functions.php'); //引入栏目缓存文件
require ('../e/class/functions.php');
require('../e/data/dbcache/class.php'); //引入栏目缓存文件
require('../e/class/movie_config.php'); 
$link=db_connect();
$empire=new mysqlquery;
$add=$_GET;
$line=$movie_config[repagenum];
if($line==0){
$line=5;
}
$thispage=$add[pid];
if(!$thispage){
$thispage=0;
}
$offseta=$line*$thispage;
$endnum=$movie_config[repageendnum];
if($endnum==0){
$endnum=999999;
}


$action=$add[action];
$ishtml=$add[ishtml];
$add[id]=(int)$add[id];
if($ishtml=='1'){
$queryadd=' and havehtml=0 ';
}
else{
$queryadd='';	
}
$isjs=$add[isjs];

if($thispage==0&&$movie_config[repagestartnum]){

$thispage=floor($movie_config[repagestartnum]/$line);
$offseta=$thispage*$line;
}


if($add[reid]){
	$reid=(int)$add[reid];
	$query1="select * from {$dbtbpre}ecms_movie where id='$reid' limit 1";
	$r=$empire->fetch1($query1);
	if($r){
			
				$add_r=$empire->fetch1("select * from {$dbtbpre}ecms_movie_data_".$r[stb]." where id='$r[id]' limit 1");
				$r=array_merge($r,$add_r);	
				$returnhtml=makehtml($r,0);
				if($movie_config[isfenhtml]==1){
				$returnhtml=makehtml($r,1);
				}
				$returnhtml=makehtml($r,2);
				if($returnhtml){
				printerror2('生成信息 (ID='.$r[id].')成功');
				}
				else{
				printerror2('生成信息 (ID='.$r[id].')失败');
				}
	
	}
	
}
else{


$query1="select * from {$dbtbpre}ecms_movie where classid>0 ".$queryadd." and id>$offseta and id<$endnum order by id asc limit $line";


if($ishtml==1){
$query1="select * from {$dbtbpre}ecms_movie where classid>0 ".$queryadd."  order by id asc limit $line";
}

$query=$empire->query($query1);
		while($r=$empire->fetch($query)){
				$add_r=$empire->fetch1("select * from {$dbtbpre}ecms_movie_data_".$r[stb]." where id='$r[id]' limit 1");
				$r=array_merge($r,$add_r);
				echo '<hr>';
				if($isjs==0){
				$returnhtml=makehtml($r,0);
				if($movie_config[isfenhtml]==1){
				$returnhtml=makehtml($r,1);
				}
				$returnhtml=makehtml($r,2);
				}

				if($returnhtml){
						echo '<font color="green">生成播放内容(ID='.$r[id].') 成功！</font><br />';
				}
				else{
						echo '<font color="red">生成播放内容(ID='.$r[id].') 失败！</font><br />';
				}
				$endtype=1;
	
				}
}

//$add=array_merge($add,$addr);


if(!$add[reid]){
$pagea=$thispage+1;
if(empty($endtype)){
echo"<br />刷新所有页面成功 <a href='renewmovie.php'>点击返回</a>";
}
else{
echo"<meta http-equiv=\"refresh\" content=\"0;url=gethtml.php?isjs=".$isjs."&ishtml=".$ishtml."&pid=".$pagea."\">";
}
}
db_close();
$empire=NULL;
//".$public_r['realltime']."
?>