<?php
include("$config[webroot]/module/company/includes/company_class.php");

class company_api extends user
{
	function company_api()
	{
		parent::user();
	}
	
	function update_uid($array)
	{	
		;
	}
	
	function delete_by_uid($array)
	{
		$userid=$array['uid'];
		$company_id=$array['company_id'];
		
		$this->db->query("select catid from ".COMPANY." where company_id='$company_id'");
		$re=$this->db->fetchRow();
		$catid=explode(",",$re['catid']);
		foreach($catid as $vc)
		{
			update_cat_nums($vc,'del','com');
		}
		
		$this->db->query("select logo from ".COMPANY." where company_id='$company_id'");
		$logo=$this->db->fetchField('logo');
		@unlink($logo);
		
		$this->db->query("delete from ".COMPANY." where company_id='$company_id'");
		$this->db->query("delete from ".CDETAIL." where company_id='$company_id'");
		$this->db->query("delete from ".CDOMIN." where company_id='$company_id'");
		$this->db->query("delete from ".CERTIFICATION." where company_id='$company_id'");
		$this->db->query("delete from ".SHOPSETTING." where company_id='$company_id'");
		$this->db->query("delete from ".EAR." where company_id='$company_id'");
		
		return true;
	}
}
?>