当前位置: 首页>>代码示例>>PHP>>正文


PHP Domain::GetNameserverList方法代码示例

本文整理汇总了PHP中Domain::GetNameserverList方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::GetNameserverList方法的具体用法?PHP Domain::GetNameserverList怎么用?PHP Domain::GetNameserverList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Domain的用法示例。


在下文中一共展示了Domain::GetNameserverList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ChangeDomainOwner

 public function ChangeDomainOwner(Domain $domain, $period = null, $extra = array())
 {
     $params = array("name" => $this->MakeNameIDNCompatible($domain->GetHostName()), "c_registrant" => $domain->GetContact(CONTACT_TYPE::REGISTRANT)->CLID, "c_onsite" => $domain->GetContact(CONTACT_TYPE::TECH)->CLID, "c_billing" => $this->Config->GetFieldByName('BillingContactCLID')->Value, "ns" => '<' . $this->ExtPrefix . ':ns>' . $this->GetNSXML($domain->GetNameserverList()) . '</' . $this->ExtPrefix . ':ns>');
     $response = $this->Request("domain-trade-request", $params);
     $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::PENDING : REGISTRY_RESPONSE_STATUS::FAILED;
     return new ChangeDomainOwnerResponse($status, $response->ErrMsg, $response->Code);
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:7,代码来源:class.RegistryModule.php

示例2: Run

 public function Run($userid)
 {
     try {
         $Factory = RegistryModuleFactory::GetInstance();
         $Registry = $Factory->GetRegistryByExtension($this->Domain->Extension);
         $host_as_attr = (bool) $Registry->GetManifest()->GetRegistryOptions()->ability->hostattr;
     } catch (Exception $e) {
         throw new UpdateDomainNameserversAction_Exception(sprintf(_("Cannot change nameservers. Reason: %s"), $e->getMessage()));
     }
     // Check that all nameserver hosts are registered
     foreach ($this->nslist as &$NS) {
         $glue_record = preg_match("/^(.*)\\.{$this->Domain->GetHostName()}\$/", $NS->HostName, $matches);
         if ($glue_record) {
             $known_ns = $this->Db->GetRow("SELECT * FROM nhosts WHERE hostname=? AND domainid=?", array($matches[1], $this->Domain->ID));
             if (!$known_ns) {
                 if ($host_as_attr) {
                     // No need to register nameserver hosts
                     $this->Db->Execute("INSERT INTO nhosts SET domainid = ?, hostname = ?, ipaddr = ?", array($this->Domain->ID, $matches[1], $NS->IPAddr));
                 } else {
                     throw new UpdateDomainNameserversAction_Exception(sprintf(_("Nameserver %s does not exist"), $NS->HostName), UpdateDomainNameserversAction_Exception::NAMESERVERHOST_NOT_REGISTERED);
                 }
             } else {
                 $NS = new NameserverHost($NS->HostName, $host_as_attr ? $NS->IPAddr : $known_ns['ipaddr']);
                 $NS->ID = $known_ns['id'];
             }
         }
     }
     // Perform nameservers update
     try {
         $Changes = new Changelist($this->Domain->GetNameserverList(), $this->nslist);
         $Registry->UpdateDomainNameservers($this->Domain, $Changes);
         $DBNSHost = DBNameserverHost::GetInstance();
         $DBNSHost->SaveList($this->Domain->GetNameserverHostList(), $this->Domain->ID);
         return $this->Domain->HasPendingOperation(Registry::OP_UPDATE) ? UpdateDomainNameserversAction_Result::PENDING : UpdateDomainNameserversAction_Result::OK;
     } catch (Exception $e) {
         throw new UpdateDomainNameserversAction_Exception(sprintf(_("Cannot change nameservers. Reason: %s"), $e->getMessage()));
     }
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:38,代码来源:class.UpdateDomainNameserversAction.php

示例3: CreateDomain

 /**
  * Create domain and return transaction status
  *	 
  * @access public
  * @param Domain $domain
  * @param int $period Domain registration period
  * @param array $extra Extra data
  * @version v1000
  * @return Domain
  */
 public function CreateDomain(Domain $domain, $period, $extra = array())
 {
     // Validate contacts
     $contact_list = $domain->GetContactList();
     foreach (CONTACT_TYPE::GetKeys() as $contact_type) {
         $config = $this->GetManifest()->GetContactConfig($contact_type);
         if ($config instanceof SimpleXMLElement) {
             if ((int) $config->attributes()->required && !$contact_list[$contact_type]) {
                 throw new Exception(sprintf(_('%s contact is required'), ucfirst($contact_type)));
             }
         }
     }
     //
     $nameserver_list = $domain->GetNameserverList();
     foreach ($nameserver_list as $ns) {
         try {
             try {
                 $can_create = $this->NameserverCanBeCreated($ns);
             } catch (NotImplementedException $e) {
                 $can_create = true;
             }
             if ($can_create) {
                 $this->CreateNameserver($ns);
             }
         } catch (ObjectExistsException $e) {
             // Ignore errors
         } catch (NotImplementedException $e) {
             // Ignore errors
         }
     }
     $this->FireEvent('BeforeCreateDomain', $domain);
     $Resp = $this->RegModule->CreateDomain($domain, $period, $extra);
     $this->ValidateModuleResponse($Resp, 'CreateDomainResponse');
     if ($Resp->IsFailed()) {
         Log::Log(sprintf('CreateDomain failed. Registry error: %s', $Resp->ErrMsg), E_USER_ERROR);
         throw new RegistryException($Resp->ErrMsg, $Resp->Code);
     }
     $domain->Period = $period;
     $domain->AuthCode = $Resp->AuthCode;
     $domain->CreateDate = $Resp->CreateDate;
     $domain->ExpireDate = $Resp->ExpireDate;
     $domain->Protocol = $Resp->Protocol;
     $domain->Status = $Resp->Status == REGISTRY_RESPONSE_STATUS::PENDING ? DOMAIN_STATUS::REGISTRATION_PENDING : DOMAIN_STATUS::DELEGATED;
     $domain->IncompleteOrderOperation = null;
     if ($domain->Status == DOMAIN_STATUS::DELEGATED) {
         $this->FireEvent('DomainOperation', $domain, self::OP_CREATE);
         $this->FireEvent('DomainCreated', $domain);
     } else {
         if ($domain->Status == DOMAIN_STATUS::REGISTRATION_PENDING) {
             $this->AddPendingOperation($domain, self::OP_CREATE, $Resp->OperationId);
         }
     }
     $this->DBDomain->Save($domain);
     // db operation
     return $domain;
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:66,代码来源:class.Registry.php

示例4: CreateDomain

		/**
		 * Create domain and return transaction status
		 *  
		 *  Domain info is an array of the following structure:
		 *  Fill domain Data with this values
		 * 
		 *  		"crDate"   => string Creation DateTime,
		 *			"exDate"   => Expiration DateTime,
		 *			"status"   => string Status code,
		 *			"pw"	   => string Password generated by registry,
		 *			"protocol" => string Protocol
		 *	 
		 * @access public
		 * @param Domain $domain Domain name without TLD
		 * @param array $owner_contact Domain Owner contact array
		 * @param array $admin_contact Domain Admin contact array
		 * @param array $tech_contact Domain Tech contact array
		 * @param array $billing_contact Domain Billing contact array
		 * @param array $extra Domain Billing contact array
		 * @param integer $period Registration period, years
		 * @param array $nameservers Array of strings containing nameservers hostnames
		 *  
		 * @return CreateDomainResponse
		 */
		public function CreateDomain(Domain $domain, $period, $extra = array())
		{
			$contacts = $domain->GetContactList();
			$nameservers = $domain->GetNameserverList();
			
			$params = array(
				"name"				=> $this->MakeNameIDNCompatible($domain->GetHostName()),
				"registrant_id"		=> $contacts['registrant']->CLID,
				"ns1"				=> $nameservers[0]->HostName,
				"ns2"				=> $nameservers[1]->HostName,
				"period"			=> $period,
				"pw"				=> $domain->AuthCode ? $domain->AuthCode : rand(100000000, 999999999)
			);
			
			unset($contacts[CONTACT_TYPE::REGISTRANT]);
			$params['contacts'] = '';
			foreach ($contacts as $contact_type => $contact)
				$params['contacts'] .= '<domain:contact type="'.$contact_type.'">'.$contact->CLID.'</domain:contact>';

			$params['ns'] = count($nameservers) ? '<domain:ns>' . $this->GetNSXML($nameservers) . '</domain:ns>' : '';
			
			$this->BeforeRequest('domain-create', $params, __METHOD__, $domain, $period, $extra);
			$response = $this->Request("domain-create", $params);
		
			if ($response->Code == RFC3730_RESULT_CODE::OK_PENDING)
			    $status = REGISTRY_RESPONSE_STATUS::PENDING;
			elseif ($response->Succeed)
			    $status = REGISTRY_RESPONSE_STATUS::SUCCESS;
			else
				$status = REGISTRY_RESPONSE_STATUS::FAILED;
			
			$resp = new CreateDomainResponse($status, $response->ErrMsg, $response->Code);
			$resp->RawResponse = $response->Data;
			
			if ($response->Succeed)
			{
				$info = $response->Data->response->resData->children($this->XmlNamespaces['domain']);
				$info = $info[0];
				
				if ($date = $this->StrToTime((string)$info->crDate[0]))
					$resp->CreateDate = $date;
					
				if ($date = $this->StrToTime((string)$info->exDate[0])) 
					$resp->ExpireDate = $date;
				else 
					$resp->ExpireDate = strtotime("+{$period} year");
					
				$resp->AuthCode = "{$info->authInfo->pw}" ? "{$info->authInfo->pw}" : (string)$params["pw"];
			}
			
			return $resp;
		}
开发者ID:rchicoria,项目名称:epp-drs,代码行数:76,代码来源:class.GenericEPPRegistryModule.php

示例5: Save

 /**
  * Save domain in database
  *
  * @param Domain $domain
  * @return Domain
  */
 public function Save(Domain $domain)
 {
     if (!$domain->ID) {
         // check for duplicate domain
         $duplicate = $this->DB->GetOne('SELECT COUNT(*) FROM domains WHERE name = ? AND TLD = ?', array($domain->Name, $domain->Extension));
         if ($duplicate) {
             throw new Exception(sprintf(_('Domain %s already exists in DB and could\'t be added twice'), $domain->GetHostName()));
         }
     }
     // Properties data
     $row = array();
     foreach ($this->FieldPropertyMap as $field => $property) {
         $row[$field] = $domain->{$property} !== null ? $domain->{$property} : "";
     }
     if ($domain->IncompleteOrderOperation === null) {
         $row['incomplete_operation'] = null;
     }
     // Nameservers data
     $nslist = $domain->GetNameserverList();
     // If nameservers list smaller then size of db slots
     for ($i = 2; $i > count($ns_list); $i--) {
         $row['ns' . $i] = '';
     }
     $ns_n = array();
     foreach (array_values($nslist) as $i => $ns) {
         if ($i < 2) {
             $row['ns' . ($i + 1)] = $ns->HostName;
         } else {
             $ns_n[] = $ns->HostName;
         }
     }
     $row['ns_n'] = join(';', $ns_n);
     // Contacts data
     $contact_list = $domain->GetContactList();
     foreach ($this->ContactFieldTypeMap as $field => $contact_type) {
         $contact = $contact_list[$contact_type];
         // Add/Remove references to contact
         $row[$field] = $contact ? $contact->CLID : '';
     }
     // Domain extra fields
     $extra_fields = array();
     foreach ($domain->GetConfig()->xpath('registration/extra_fields/field') as $field) {
         settype($field, "array");
         $field = $field["@attributes"];
         if (isset($domain->{$field['name']})) {
             $extra_fields[$field['name']] = $domain->{$field['name']};
         }
     }
     foreach ((array) $domain->ExtraFields as $k => $v) {
         $extra_fields[$k] = $v;
     }
     // Prepare data for DB
     $row["start_date"] = $row["start_date"] ? date("Y-m-d H:i:s", $row["start_date"]) : '0000-00-00 00:00:00';
     $row["end_date"] = $row["end_date"] ? date("Y-m-d H:i:s", $row["end_date"]) : '0000-00-00 00:00:00';
     $row['dtTransfer'] = $row['dtTransfer'] ? date("Y-m-d H:i:s", $row["dtTransfer"]) : '0000-00-00 00:00:00';
     $row["islocked"] = (int) (bool) $row["islocked"];
     $row['managed_dns'] = (int) (bool) $row['managed_dns'];
     $row['period'] = (int) $row['period'];
     $row['delete_status'] = (int) $row['delete_status'];
     $row['renew_disabled'] = (int) (bool) $row['renew_disabled'];
     // Save it!
     //if ($domain->ID)
     unset($row['id']);
     // Prepare SQL statement
     $set = array();
     $bind = array();
     foreach ($row as $field => $value) {
         $set[] = "`{$field}` = ?";
         $bind[] = $value;
     }
     $set = join(', ', $set);
     $this->DB->BeginTrans();
     try {
         if ($domain->ID) {
             // Perform Update
             $bind[] = $domain->ID;
             $this->DB->Execute("UPDATE domains SET {$set} WHERE id = ?", $bind);
         } else {
             // Perform Insert
             $this->DB->Execute("INSERT INTO domains SET {$set}", $bind);
             $domain->ID = $this->DB->Insert_ID();
         }
         // Save extra data
         $this->DB->Execute('DELETE FROM domains_data WHERE domainid = ?', array($domain->ID));
         foreach ($extra_fields as $name => $value) {
             $this->DB->Execute('INSERT INTO domains_data SET `domainid` = ?, `key` = ?, `value` = ?', array($domain->ID, $name, $value));
         }
         // Save flags
         $this->DB->Execute('DELETE FROM domains_flags WHERE domainid = ?', array($domain->ID));
         $flag_list = $domain->GetFlagList();
         foreach ($flag_list as $flag) {
             $this->DB->Execute('INSERT INTO domains_flags SET domainid = ?, flag = ?', array($domain->ID, $flag));
         }
         // Save contacts
//.........这里部分代码省略.........
开发者ID:rchicoria,项目名称:epp-drs,代码行数:101,代码来源:class.DBDomain.php

示例6: CreateDomain

 /**
  * Create domain and return transaction status
  *  
  *  Domain info is an array of the following structure:
  *  Fill domain Data with this values
  * 
  *  		"crDate"   => string Creation DateTime,
  *			"exDate"   => Expiration DateTime,
  *			"status"   => string Status code,
  *			"pw"	   => string Password generated by registry,
  *			"protocol" => string Protocol
  *	 
  * @access public
  * @param Domain $domain Domain name without TLD
  * @param array $owner_contact Domain Owner contact array
  * @param array $admin_contact Domain Admin contact array
  * @param array $tech_contact Domain Tech contact array
  * @param array $billing_contact Domain Billing contact array
  * @param array $extra Domain Billing contact array
  * @param integer $period Registration period, years
  * @param array $nameservers Array of strings containing nameservers hostnames 
  * @return Domain
  * 
  */
 public function CreateDomain(Domain $domain, $period, $extra = array())
 {
     $contacts = $domain->GetContactList();
     if (!$contacts['registrant']) {
         throw new Exception(_('Registrant contact is  undefined'));
     }
     if (!$contacts['admin']) {
         throw new Exception(_('Admin contact is  undefined'));
     }
     if (!$contacts['tech']) {
         throw new Exception(_('Tech contact is  undefined'));
     }
     if (!$contacts['billing']) {
         throw new Exception(_('Billing contact is  undefined'));
     }
     $nameservers = $domain->GetNameserverList();
     $params = array("ownercontact0" => $contacts['registrant']->CLID, "techcontact0" => $contacts['tech'] ? $contacts['tech']->CLID : "", "admincontact0" => $contacts['admin'] ? $contacts['admin']->CLID : "", "billingcontact0" => $contacts['billing'] ? $contacts['billing']->CLID : "", "nameserver0" => $nameservers[0]->HostName, "nameserver1" => $nameservers[1]->HostName, "period" => $period, "auth" => $this->GeneratePassword(), "domain" => $this->MakeNameIDNCompatible($domain->GetHostName()));
     $params = array_merge($params, (array) $extra);
     if ($this->PromotionCodes[$this->Extension]) {
         $params["X-PROMOTION-CODE"] = $this->PromotionCodes[$this->Extension];
     }
     $response = $this->Request("AddDomain", $params);
     $status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
     $resp = new CreateDomainResponse($status, $response->ErrMsg, $response->Code);
     if (!$resp->IsFailed()) {
         // Match domain expiration date
         preg_match("/property\\[registration expiration date\\]\\[0\\][\\s]*=[\\s]*(.*?)\n/si", $response->Data, $matches);
         $time = strtotime($matches[1]);
         $resp->ExpireDate = $time;
         // Set create date as NOW
         $resp->CreateDate = time();
         // Auth code
         $resp->AuthCode = (string) $params["auth"];
         // Match domain renewal date
         // (Date when RRPPROXY will execute renewal cron if TLD supports auto renewal)
         $autorenew = (int) $this->Manifest->GetRegistryOptions()->ability->auto_renewal;
         if ($autorenew) {
             preg_match("/property\\[renewal date\\]\\[0\\][\\s]*=[\\s]*(.*?)\n/si", $response->Data, $matches);
             $domain->SetExtraField('RenewalDate', strtotime($matches[1]));
         }
         // Set renewal mode
         $mode = $autorenew ? 'AUTORENEW' : 'AUTOEXPIRE';
         $this->Request('SetDomainRenewalMode', array('domain' => $params['domain'], 'renewalmode' => $mode));
     }
     return $resp;
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:70,代码来源:class.RegistryModule.php


注:本文中的Domain::GetNameserverList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。