<?php
define('EmpireCMSAdmin','1');
require("../../e/class/connect.php");
require("../../e/class/functions.php");
require "../../e/data/".LoadLang("pub/fun.php");
require("../../e/data/dbcache/class.php");
$link=db_connect();
$empire=new mysqlquery();
$enews=$_POST['enews'];
if(empty($enews))
{
	$enews=$_GET['enews'];
}
//驗證用戶
$lur=is_login();
$logininid=(int)$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=(int)$lur['groupid'];
$loginadminstyleid=(int)$lur['adminstyleid'];
//spurl
if($enews=='EditCjNews')
{
	hSetSpFromUrl();
}
hCheckEcmsRHash();

@set_time_limit(0);

include('../../e/class/cjfun.php');
include('../../e/class/modfield.php');
if($enews=="CjUrl")//開始採集
{
	$classid=$_GET['classid'];
	$start=$_GET['start'];
	$checkrnd=$_GET['checkrnd'];
	CJUrl($classid,$start,$checkrnd,$logininid,$loginin);
}
elseif($enews=="ViewCjList")//採集列表
{
	$classid=$_GET['classid'];
	ViewCjList($classid,$logininid,$loginin);
}
elseif($enews=="ViewCjUrl")//輸出預覽內容地址
{
	$classid=$_GET['classid'];
	$listpage=$_GET['listpage'];
	ViewCjUrl($classid,$listpage,$logininid,$loginin);
}
elseif($enews=="GetNewsInfo")//開始採集頁面
{
	$classid=$_GET['classid'];
	$checkrnd=$_GET['checkrnd'];
	$start=$_GET['start'];
	GetNewsInfo($classid,$checkrnd,$start,$logininid,$loginin);
}
elseif($enews=="ViewGetNewsInfo")//輸入預覽內容文件
{
	$classid=$_GET['classid'];
	$newspage=$_GET['newspage'];
	ViewGetNewsInfo($classid,$newspage,$logininid,$loginin);
}
elseif($enews=="CjNewsIn_all")//採集全部入庫
{
	$classid=$_GET['classid'];
	$checked=$_GET['checked'];
	$start=$_GET['start'];
	$uptime=$_GET['uptime'];
	CjNewsIn_all($classid,$checked,$uptime,$start,$logininid,$loginin);
}
elseif($enews=="CjNewsIn")//採集入庫
{
	$classid=$_POST['classid'];
	$id=$_POST['id'];
	$checked=$_POST['checked'];
	$uptime=$_POST['uptime'];
	CjNewsIn($classid,$id,$checked,$uptime,$logininid,$loginin);
}
elseif($enews=="EditCjNews")//修改採集信息
{
	$newstext=$_POST['newstext'];
	EditCjNews($_POST,$newstext,$logininid,$loginin);
}
elseif($enews=="DelCjNews")//刪除採集信息
{
	$classid=$_GET['classid'];
	$id=$_GET['id'];
	DelCjNews($classid,$id,$logininid,$loginin);
}
elseif($enews=="DelCjNews_all")//批量刪除採集信息
{
	$classid=$_POST['classid'];
	$id=$_POST['id'];
	DelCjNews_all($classid,$id,$logininid,$loginin);
}
elseif($enews=="LoadOutCj")//導出採集規則
{
	LoadOutCj($_GET['classid'],$logininid,$loginin);
}
elseif($enews=="LoadInCj")//導入採集規則
{
	$file=$_FILES['file']['tmp_name'];
    $file_name=$_FILES['file']['name'];
    $file_type=$_FILES['file']['type'];
    $file_size=$_FILES['file']['size'];
	LoadInCj($_POST,$file,$file_name,$file_type,$file_size,$logininid,$loginin);
}
else
{
	printerror("ErrorUrl","history.go(-1)");
}
db_close();
$empire=null;
?>