<?php
/**
 * 配置文件
 * */
define('IN_AM',true);
define('AM_DIR',dirname(__FILE__).DIRECTORY_SEPARATOR);
define('AM_BUG', '0');
define('AM_VAR','1.0');

AM_BUG?error_reporting(7):error_reporting(E_ERROR);

$_TG = $_TC = $_TD = $_TB = $arr = '';

include_once(AM_DIR.'./config.php');

require_once (AM_DIR.'./include/cache.class.php');
$AM_CACHE = new Cache("");
	
include_once(AM_DIR.'./include/lib_common.php');
$_TG = $_TC;

foreach(array('_COOKIE', '_POST', '_GET') as $_request) { 
	foreach($$_request as $_key => $_value) {
		$$_key = '';
	}
}

if(!(get_magic_quotes_gpc())) {
	$_GET = _addslashes($_GET);
	$_POST = _addslashes($_POST);
    $_COOKIE = _addslashes($_COOKIE);
}

$mtime = explode(' ', microtime());
$_TG['starttime'] = $mtime[1] + $mtime[0];
$_TG['time'] = $mtime[1];
$_TG['ajax'] = empty($_GET['ajax']) ? 0 : intval($_GET['ajax']);
$_TG['ip'] = getip();


//if (function_exists('ob_gzhandler')) {
//	ob_start('ob_gzhandler');
//} else {
	ob_start();
//}

header('Content-Type: text/html; charset='.$_TC['charset']);

if(@include_once(AM_DIR.'./include/cls_mysql.php')) {
	$_TD = new dbstuff();
	$_TD->showbug = intval($_TC['showbug'])==1?1:0;
	$_TD->charset = $_TC['dbcharset'];
	$_TD->connect($_TC['sqlhost'],$_TC['sqluser'],$_TC['sqlpw'],$_TC['sqlname'],$_TC['pconnect']);
}


function appmaker_listtackle($arr){
	global $picUrl;
	$retlist = array();
	$caculatecount=0;
	foreach ($arr as $key=>$val){
		
		if (strpos($val['vod_pic'], "http://") === 0)
			$val['imgsrc'] = $val['vod_pic'];
		else
			$val['imgsrc'] = $picUrl.$val['vod_pic'];
		
		if(strlen($val['vod_addtime']) != 10)
		{
			$val['vod_addtime'] = strtotime($val['vod_addtime']);
		}
		
		
		unset($val['vod_url']);
		unset($val['vod_content']);
		unset($val['vod_play']);
		$retlist[$caculatecount] = $val;
		
		$caculatecount++;
	}
	return $retlist;
}
function appmaker_gallarytackle($arr){
	global $picUrl;
			
	if (strpos($arr[0]['vod_pic'], "http://") === 0)
		$arr[0]['imgsrc'] = $arr[0]['vod_pic'];
	else
		$arr[0]['imgsrc'] = $picUrl.$arr[0]['vod_pic'];
	
	if(strlen($arr[0]['vod_addtime']) != 10)
	{
		$arr[0]['vod_addtime'] = strtotime($arr[0]['vod_addtime']);
	}
		
	unset($arr[0]['vod_url']);
	unset($arr[0]['vod_content']);
	unset($arr[0]['vod_play']);
	
	return $arr[0];
}

function appmaker_detailtackle($arr){
	global $picUrl;
	if (strpos($arr[0]['vod_pic'], "http://") === 0)
		$arr[0]['imgsrc'] = $arr[0]['vod_pic'];
	else
		$arr[0]['imgsrc'] = $picUrl.$arr[0]['vod_pic'];
		
	if(strlen($arr[0]['vod_addtime']) != 10)
	{
		$arr[0]['vod_addtime'] = strtotime($arr[0]['vod_addtime']);
	}
	//unset($arr[0]['vod_play']);
	$arr[0]['vod_url'] = str_replace("#" , "\r" , $arr[0]['vod_url']);
	
	return $arr[0];
}

function appmaker_commenttackle($arr){
	$retlist = array();
	$caculatecount=0;
	foreach ($arr as $key=>$val){	
		if(strlen($val['cm_addtime']) != 10)
		{
			$val['cm_addtime'] = strtotime($val['cm_addtime']);
		}
		$retlist[$caculatecount] = $val;
		$caculatecount++;
	}

	return $retlist;
}


?>