/**
  *
  * @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);
     }
 }
Пример #2
0
 /**
  *
  * @param \domElement $element
  * @param eppHost $host
  */
 private function addHostChanges($element, eppHost $host)
 {
     $addresses = $host->getIpAddresses();
     if (is_array($addresses)) {
         foreach ($addresses as $address => $type) {
             $ipaddress = $this->createElement('host:addr', $address);
             $ipaddress->setAttribute('ip', $type);
             $element->appendChild($ipaddress);
         }
     }
     $statuses = $host->getHostStatuses();
     if (is_array($statuses)) {
         foreach ($statuses as $status) {
             $stat = $this->createElement('host:status');
             $stat->setAttribute('s', $status);
             $element->appendChild($stat);
         }
     }
 }
 /**
  *
  * @param \domElement $element
  * @param eppContact $contact
  */
 private function addContactChanges($element, eppContact $contact)
 {
     if ($contact->getPostalInfoLength() > 0) {
         $postal = $contact->getPostalInfo(0);
         $postalinfo = $this->createElement('contact:postalInfo');
         if ($postal->getType() == eppContact::TYPE_AUTO) {
             // If all fields are ascii, type = int (international) else type = loc (localization)
             if (self::isAscii($postal->getName()) && self::isAscii($postal->getOrganisationName()) && self::isAscii($postal->getStreet(0))) {
                 $postal->setType(eppContact::TYPE_INT);
             } else {
                 $postal->setType(eppContact::TYPE_LOC);
             }
         }
         $postalinfo->setAttribute('type', $postal->getType());
         if (!$postal->getName() == '') {
             $postalinfo->appendChild($this->createElement('contact:name', $postal->getName()));
         }
         if (!$postal->getOrganisationName() == '') {
             $postalinfo->appendChild($this->createElement('contact:org', $postal->getOrganisationName()));
         }
         if ($postal->getStreetCount() > 0 || strlen($postal->getCity()) || strlen($postal->getProvince()) || strlen($postal->getZipcode()) || strlen($postal->getCountrycode())) {
             $postaladdr = $this->createElement('contact:addr');
             if (($count = $postal->getStreetCount()) > 0) {
                 for ($i = 0; $i < $count; $i++) {
                     $postaladdr->appendChild($this->createElement('contact:street', $postal->getStreet($i)));
                 }
             }
             if (strlen($postal->getCity())) {
                 $postaladdr->appendChild($this->createElement('contact:city', $postal->getCity()));
             }
             if (strlen($postal->getProvince())) {
                 $postaladdr->appendChild($this->createElement('contact:sp', $postal->getProvince()));
             }
             if (strlen($postal->getZipcode())) {
                 $postaladdr->appendChild($this->createElement('contact:pc', $postal->getZipcode()));
             }
             if (strlen($postal->getCountrycode())) {
                 $postaladdr->appendChild($this->createElement('contact:cc', $postal->getCountrycode()));
             }
             $postalinfo->appendChild($postaladdr);
         }
         $element->appendChild($postalinfo);
     }
     if (strlen($contact->getVoice())) {
         $element->appendChild($this->createElement('contact:voice', $contact->getVoice()));
     }
     if (strlen($contact->getFax())) {
         $element->appendChild($this->createElement('contact:fax', $contact->getFax()));
     }
     if (strlen($contact->getEmail())) {
         $element->appendChild($this->createElement('contact:email', $contact->getEmail()));
     }
     if ($contact->getPassword()) {
         $authinfo = $this->createElement('contact:authInfo');
         $authinfo->appendChild($this->createElement('contact:pw', $contact->getPassword()));
         $element->appendChild($authinfo);
     }
     if (!is_null($contact->getDisclose())) {
         $disclose = $this->createElement('contact:disclose');
         $disclose->setAttribute('flag', $contact->getDisclose());
         $name = $this->createElement('contact:name');
         if ($contact->getDisclose() == 1) {
             $name->setAttribute('type', 'loc');
         }
         $disclose->appendChild($name);
         $org = $this->createElement('contact:org');
         if ($contact->getDisclose() == 1) {
             $org->setAttribute('type', 'loc');
         }
         $disclose->appendChild($org);
         $addr = $this->createElement('contact:addr');
         if ($contact->getDisclose() == 1) {
             $addr->setAttribute('type', 'loc');
         }
         $disclose->appendChild($addr);
         $disclose->appendChild($this->createElement('contact:voice'));
         $disclose->appendChild($this->createElement('contact:email'));
         $element->appendChild($disclose);
     }
 }
 protected function setAtContactDisclosure(\domElement $element, atEppContact $contact)
 {
     if (!is_null($contact->getDisclose())) {
         $disclose = $this->createElement('contact:disclose');
         $disclose->setAttribute('flag', $contact->getDisclose());
         $disclPhone = $this->createElement('contact:voice');
         if ($contact->getDisclose() == 1) {
             $disclPhone->setAttribute('type', eppContact::TYPE_LOC);
         }
         if ($contact->getDisclose() != $contact->getWhoisHidePhone()) {
             $disclose->appendChild($disclPhone);
         }
         $disclFax = $this->createElement('contact:fax');
         if ($contact->getDisclose() == 1) {
             $disclFax->setAttribute('type', eppContact::TYPE_LOC);
         }
         if ($contact->getWhoisHideFax() != $contact->getDisclose()) {
             $disclose->appendChild($disclFax);
         }
         $disclEmail = $this->createElement('contact:email');
         if ($contact->getDisclose() == 1) {
             $disclEmail->setAttribute('type', eppContact::TYPE_LOC);
         }
         if ($contact->getWhoisHideEmail() != $contact->getDisclose()) {
             $disclose->appendChild($disclEmail);
         }
         $element->appendChild($disclose);
     }
 }
 /**
  *
  * @param \domElement $domain
  * @param string $contactid
  * @param string $contacttype
  */
 private function addDomainContact($domain, $contactid, $contacttype)
 {
     $domaincontact = $this->createElement('domain:contact', $contactid);
     $domaincontact->setAttribute('type', $contacttype);
     $domain->appendChild($domaincontact);
 }