<?php
if(!file_exists(ROOTDIR."/modules/addons/idcsmart_reseller/logic/function.php")){
	exit("文件：".ROOTDIR."/modules/addons/idcsmart_reseller/logic/function.php"."缺失");
}
include ROOTDIR."/modules/addons/idcsmart_reseller/logic/function.php";	
define("IDCSMARTAGENTFILE",dirname(__FILE__));
if(!empty($_GET['module_addons'])){
	list($module,$action)=explode("_",$_GET['module_addons']);
}else{
	list($module,$action)=["downreseller","reseller"];
}

$lib=IDCSMARTAGENTFILE.'/lib/'.$module.'.php';
$file_lib=file_exists($lib);
if($file_lib){
	require($lib);
	$file_module=class_exists($module);
	if($file_module){
		$newmodule=new $module();
		$file_action=method_exists($newmodule,$action);
	}	
} 

if($file_action){
	$newmodule->$action();
}else{
	_exit("error");
}

function idcsmart_reseller_tpl($tplName,$data=array()){
	if(is_array($data)){
		foreach($data as $k => $v){
			$$k = $v;
		}
		$data=array();
	}	
	$tpl=IDCSMARTAGENTFILE."/tpl/".$tplName.".php";
	if(!file_exists($tpl)) exit("模版文件不存在");
	include IDCSMARTAGENTFILE."/tpl/public.php";
	include $tpl;
}
	