<?php

if (!defined("WHMCS"))
	die("This file cannot be accessed directly");

function idcsmart_reseller_config() {
    $configarray = array(
        "name" => "v10业务管理系统代理管理",
        "description" => "下游是<a href='https://www.idcsmart.com/'>v10业务管理系统</a>。",
        "version" => "1.0.0",
        "author" => "智简魔方",
		"language" => "chinese",
    );
    return $configarray;
}

function idcsmart_reseller_activate() {
    $query[] = "
CREATE TABLE `idcsmart_reseller_clients` (
  `userid` int(11) NOT NULL,
  `apikey` varchar(32) DEFAULT NULL,
  `disabled` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1禁用,0启用',
  PRIMARY KEY (`userid`),
  KEY `apikey` (`apikey`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8";
    $query[] = "
CREATE TABLE `idcsmart_reseller_hosts` (
  `hosting_id` int(11) NOT NULL,
  `downstream_info` varchar(255) NOT NULL DEFAULT '' COMMENT '下游token等信息',
  `downstream_host_id` int(11) NOT NULL DEFAULT '0' COMMENT '下游产品ID',
  PRIMARY KEY (`hosting_id`),
  KEY `downstream_host_id` (`downstream_host_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8";
    foreach($query as $q){
        $result = full_query($q);
    } 
}

function idcsmart_reseller_deactivate() {
    $sql[] = "DROP TABLE `idcsmart_reseller_clients`";
    $sql[] = "DROP TABLE `idcsmart_reseller_hosts`";
    foreach($sql as $v){
        full_query($v);
    } 
}

function idcsmart_reseller_sidebar($vars){
    $sidebar=file_get_contents("../modules/addons/idcsmart_reseller/tpl/sidebar.php");
    return $sidebar;
}
function idcsmart_reseller_output($vars){  
    include_once "core.php";
}
