<?php
require_once "config.php";
require_once 'Taoapi.php';
require_once 'incfunction.php';
date_default_timezone_set('Asia/Shanghai');

$read_data_num = 0;

$arr_app = getoneapp();

$Taoapi_Config = Taoapi_Config::Init();
$Taoapi_Config->setTestMode(false)
              ->setVersion(2)
              ->setAppKey($arr_app[0])
              ->setAppSecret($arr_app[1]);

$Taoapi = new Taoapi;
$Taoapi->Cache->setCacheTime($setCacheTime);

if((time() % 500)==0){
	deldir("Apicache",$setCacheTime*60*60);
}

$url_this = "http://".$_SERVER ['HTTP_HOST'].$_SERVER['REQUEST_URI'];

if($rehost == "on"){
	$the_host = $_SERVER['HTTP_HOST'];
	$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
	$siteurlre = str_replace("http://","",$siteurl);
	$request_uri = str_replace("index.php","",$request_uri);
	if($the_host !== $siteurlre)
	{
  	header('HTTP/1.1 301 Moved Permanently');
  	header('Location: '.$siteurl.$request_uri);
	}
}

?>