/** * * @param \domElement $element * @param eppDomain $domain ficoraEppDomain element containing changes */ protected function addDomainChanges($element, eppDomain $domain) { // can't change function argument class due to strict standards warning if (!$domain instanceof ficoraEppDomain) { throw new eppException('Domains passed to ficoraEppUpdateDomainRequest must be instances of ficoraEppDomain'); } if ($domain->getRegistrant()) { $element->appendChild($this->createElement('domain:registrant', $domain->getRegistrant())); } $hosts = $domain->getHosts(); if (is_array($hosts) && count($hosts)) { $nameservers = $this->createElement('domain:ns'); foreach ($hosts as $host) { /* @var eppHost $host */ if ($this->getForcehostattr() || is_array($host->getIpAddresses())) { $nameservers->appendChild($this->addDomainHostAttr($host)); } else { $nameservers->appendChild($this->addDomainHostObj($host)); } } $element->appendChild($nameservers); } $contacts = $domain->getContacts(); if (is_array($contacts)) { foreach ($contacts as $contact) { /* @var eppContactHandle $contact */ $this->addDomainContact($element, $contact->getContactHandle(), $contact->getContactType()); } } // Changing status is not supported for *.fi domains, verified from registry $statuses = $domain->getStatuses(); if (is_array($statuses) && count($statuses)) { throw new eppException('Changing statuses is not supported for *.fi domains.'); } // authinfo might contain domain:pw (provider transfer key) and/or domain:pwregistranttransfer (registrant transfer key) // registrant transfer key must be present on registrant change, empty one is valid if registry number doesn't change if (strlen($domain->getAuthorisationCode()) || $domain->getRegistrant() || $domain->getRegistrantTransferCode()) { $authinfo = $this->createElement('domain:authInfo'); if (strlen($domain->getAuthorisationCode())) { $pw = $this->createElement('domain:pw'); $pw->appendChild($this->createCDATASection($domain->getAuthorisationCode())); $authinfo->appendChild($pw); } if ($domain->getRegistrant() || $domain->getRegistrantTransferCode()) { $registrantPassword = $this->createElement('domain:pwregistranttransfer', $domain->getRegistrantTransferCode()); $authinfo->appendChild($registrantPassword); } $element->appendChild($authinfo); } }
public function setDomain(eppDomain $domain, $hosts = null) { if (!strlen($domain->getDomainname())) { throw new eppException('Domain object does not contain a valid domain name'); } # # Domain structure # $dname = $this->createElement('domain:name', $domain->getDomainname()); if ($hosts) { if ($hosts == self::HOSTS_ALL || $hosts == self::HOSTS_DELEGATED || $hosts == self::HOSTS_NONE || $hosts == self::HOSTS_SUBORDINATE) { $dname->setAttribute('hosts', $hosts); } else { throw new eppException('Hosts parameter of inforequest can only be to be all, none, del or sub'); } } $this->domainobject->appendChild($dname); if (!is_null($domain->getAuthorisationCode())) { $authinfo = $this->createElement('domain:authInfo'); $authinfo->appendChild($this->createElement('domain:pw', $domain->getAuthorisationCode())); $this->domainobject->appendChild($authinfo); } }
/** * * @param eppDomain $domain * @return \domElement */ public function setDomain(eppDomain $domain) { if (!strlen($domain->getDomainname())) { throw new eppException('No valid domain name in create domain request'); } if (!strlen($domain->getRegistrant())) { throw new eppException('No valid registrant in create domain request'); } # # Object create structure # $create = $this->createElement('create'); $this->domainobject = $this->createElement('domain:create'); $this->domainobject->appendChild($this->createElement('domain:name', $domain->getDomainname())); if ($domain->getPeriod() > 0) { $domainperiod = $this->createElement('domain:period', $domain->getPeriod()); $domainperiod->setAttribute('unit', $domain->getPeriodUnit()); $this->domainobject->appendChild($domainperiod); } $nsobjects = $domain->getHosts(); if ($domain->getHostLength() > 0) { $nameservers = $this->createElement('domain:ns'); foreach ($nsobjects as $nsobject) { if ($this->forcehostattr || $nsobject->getIpAddressCount() > 0) { $nameservers->appendChild($this->addDomainHostAttr($nsobject)); } else { $nameservers->appendChild($this->addDomainHostObj($nsobject)); } } $this->domainobject->appendChild($nameservers); } $this->domainobject->appendChild($this->createElement('domain:registrant', $domain->getRegistrant())); $contacts = $domain->getContacts(); if ($domain->getContactLength() > 0) { foreach ($contacts as $contact) { $this->addDomainContact($this->domainobject, $contact->getContactHandle(), $contact->getContactType()); } } if (strlen($domain->getAuthorisationCode())) { $authinfo = $this->createElement('domain:authInfo'); $authinfo->appendChild($this->createElement('domain:pw', $domain->getAuthorisationCode())); $this->domainobject->appendChild($authinfo); } $create->appendChild($this->domainobject); $this->getCommand()->appendChild($create); // Check for DNSSEC keys and add them if ($domain->getSecdnsLength() > 0) { for ($i = 0; $i < $domain->getSecdnsLength(); $i++) { $sd = $domain->getSecdns($i); /* @var $sd eppSecdns */ if ($sd) { $ext = new eppSecdns(); $ext->copy($sd); $this->addSecdns($ext); } } } return; }
public function setDomainRequest(eppDomain $domain) { # # Object create structure # $transfer = $this->createElement('transfer'); $transfer->setAttribute('op', self::OPERATION_REQUEST); $this->domainobject = $this->createElement('domain:transfer'); $this->domainobject->appendChild($this->createElement('domain:name', $domain->getDomainname())); if ($domain->getPeriod()) { $domainperiod = $this->createElement('domain:period', $domain->getPeriod()); $domainperiod->setAttribute('unit', eppDomain::DOMAIN_PERIOD_UNIT_Y); $this->domainobject->appendChild($domainperiod); } if (strlen($domain->getAuthorisationCode())) { $authinfo = $this->createElement('domain:authInfo'); $authinfo->appendChild($this->createElement('domain:pw', $domain->getAuthorisationCode())); $this->domainobject->appendChild($authinfo); } $transfer->appendChild($this->domainobject); $this->getCommand()->appendChild($transfer); }
/** * * @param \domElement $element * @param eppDomain $domain */ private function addDomainChanges($element, eppDomain $domain) { if ($domain->getRegistrant()) { $element->appendChild($this->createElement('domain:registrant', $domain->getRegistrant())); } $hosts = $domain->getHosts(); if (is_array($hosts) && count($hosts)) { $nameservers = $this->createElement('domain:ns'); foreach ($hosts as $host) { /* @var eppHost $host */ if ($this->forcehostattr || is_array($host->getIpAddresses())) { $nameservers->appendChild($this->addDomainHostAttr($host)); } else { $nameservers->appendChild($this->addDomainHostObj($host)); } } $element->appendChild($nameservers); } $contacts = $domain->getContacts(); if (is_array($contacts)) { foreach ($contacts as $contact) { /* @var eppContactHandle $contact */ $this->addDomainContact($element, $contact->getContactHandle(), $contact->getContactType()); } } $statuses = $domain->getStatuses(); if (is_array($statuses)) { foreach ($statuses as $status) { $this->addDomainStatus($element, $status); } } if (strlen($domain->getAuthorisationCode())) { $authinfo = $this->createElement('domain:authInfo'); $pw = $this->createElement('domain:pw'); $pw->appendChild($this->createCDATASection($domain->getAuthorisationCode())); $authinfo->appendChild($pw); $element->appendChild($authinfo); } }