import_domain() - Alan Adlarını İçeri Aktar
Modül ayarları bölümünde yer alan "İçe Aktarma" işlevi için kullanılır. Yazman üzerindeki herhangi bir alan adını herhangi bir müşteriye aktarılmasını sağlar.
Modülün içinde bulunan “controllers/import.php” dosyasının içerisinde çağırılmaktadır.
Fonksiyonu örnekte olacak şekilde kullanabilirsiniz.
public function import_domain($data=[]){
$config = $this->config;
$imports = [];
Helper::Load(["Orders","Products","Money"]);
foreach($data AS $domain=>$datum){
$domain_parse = Utility::domain_parser("http://".$domain);
$sld = $domain_parse["host"];
$tld = $domain_parse["tld"];
$user_id = (int) $datum["user_id"];
if(!$user_id) continue;
$info = $this->get_info([
'domain' => $domain,
'name' => $sld,
'tld' => $tld,
]);
if(!$info) continue;
$user_data = User::getData($user_id,"id,lang","array");
$ulang = $user_data["lang"];
$locallang = Config::get("general/local");
$productID = Models::$init->db->select("id")->from("tldlist")->where("name","=",$tld);
$productID = $productID->build() ? $productID->getObject()->id : false;
if(!$productID) continue;
$productPrice = Products::get_price("register","tld",$productID);
$productPrice_amt = $productPrice["amount"];
$productPrice_cid = $productPrice["cid"];
$start_date = $info["creation_time"];
$end_date = $info["end_time"];
$year = 1;
$options = [
"established" => true,
"group_name" => Bootstrap::$lang->get_cm("website/account_products/product-type-names/domain",false,$ulang),
"local_group_name" => Bootstrap::$lang->get_cm("website/account_products/product-type-names/domain",false,$locallang),
"category_id" => 0,
"domain" => $domain,
"name" => $sld,
"tld" => $tld,
"dns_manage" => true,
"whois_manage" => true,
"transferlock" => $info["transferlock"],
"cns_list" => isset($info["cns"]) ? $info["cns"] : [],
"whois" => isset($info["whois"]) ? $info["whois"] : [],
];
if(isset($info["whois_privacy"]) && $info["whois_privacy"]){
$options["whois_privacy"] = $info["whois_privacy"]["status"] == "enable";
$wprivacy_endtime = DateManager::ata();
if(isset($info["whois_privacy"]["end_time"]) && $info["whois_privacy"]["end_time"]){
$wprivacy_endtime = $info["whois_privacy"]["end_time"];
$options["whois_privacy_endtime"] = $wprivacy_endtime;
}
}
if(isset($info["ns1"]) && $info["ns1"]) $options["ns1"] = $info["ns1"];
if(isset($info["ns2"]) && $info["ns2"]) $options["ns2"] = $info["ns2"];
if(isset($info["ns3"]) && $info["ns3"]) $options["ns3"] = $info["ns3"];
if(isset($info["ns4"]) && $info["ns4"]) $options["ns4"] = $info["ns4"];
$order_data = [
"owner_id" => (int) $user_id,
"type" => "domain",
"product_id" => (int) $productID,
"name" => $domain,
"period" => "year",
"period_time" => (int) $year,
"amount" => (float) $productPrice_amt,
"total_amount" => (float) $productPrice_amt,
"amount_cid" => (int) $productPrice_cid,
"status" => "active",
"cdate" => $start_date,
"duedate" => $end_date,
"renewaldate" => DateManager::Now(),
"module" => $config["meta"]["name"],
"options" => Utility::jencode($options),
"unread" => 1,
];
$insert = Orders::insert($order_data);
if(!$insert) continue;
if(isset($options["whois_privacy"])){
$amount = Money::exChange($this->whidden["amount"],$this->whidden["currency"],$productPrice_cid);
$start = DateManager::Now();
$end = isset($wprivacy_endtime) ? $wprivacy_endtime : DateManager::ata();
Orders::insert_addon([
'invoice_id' => 0,
'owner_id' => $insert,
"addon_key" => "whois-privacy",
'addon_id' => 0,
'addon_name' => Bootstrap::$lang->get_cm("website/account_products/whois-privacy",false,$ulang),
'option_id' => 0,
"option_name" => Bootstrap::$lang->get("needs/iwwant",$ulang),
'period' => 1,
'period_time' => "year",
'status' => "active",
'cdate' => $start,
'renewaldate' => $start,
'duedate' => $end,
'amount' => $amount,
'cid' => $productPrice_cid,
'unread' => 1,
]);
}
$imports[] = $order_data["name"]." (#".$insert.")";
}
if($imports){
$adata = UserManager::LoginData("admin");
User::addAction($adata["id"],"alteration","domain-imported",[
'module' => $config["meta"]["name"],
'imported' => implode(", ",$imports),
]);
}
return $imports;
}