diff --git a/Protocols/EPP/eppConnection.php b/Protocols/EPP/eppConnection.php old mode 100755 new mode 100644 index 53c81ca5..5eff797a --- a/Protocols/EPP/eppConnection.php +++ b/Protocols/EPP/eppConnection.php @@ -1056,7 +1056,7 @@ public function setConnectionDetails($result) { * @return array * @throws eppException */ - static function loadSettings($directory = null, $settingsfile) { + static function loadSettings(?string $directory, $settingsfile) { if ($directory) { $path = $directory . '/' . $settingsfile; } else { diff --git a/Protocols/EPP/eppData/eppContact.php b/Protocols/EPP/eppData/eppContact.php index b44c5bfb..9337fb7a 100644 --- a/Protocols/EPP/eppData/eppContact.php +++ b/Protocols/EPP/eppData/eppContact.php @@ -239,7 +239,7 @@ protected function validatePhoneNumber($number) { if (!strlen($number)) { return null; } - if ($number{0} != '+') { + if ($number[0] != '+') { throw new eppException('Phone number ' . $number . ' is not valid for EPP. Valid format is +cc.nnnnnnnnnnn'); } if (strpos($number, '.') === false) { diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppData/atEppConstants.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppData/atEppConstants.php index 481f3831..08ab61f4 100755 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppData/atEppConstants.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppData/atEppConstants.php @@ -3,7 +3,12 @@ class atEppConstants { - const atExtResultNamespaceUri= "http://www.nic.at/xsd/at-ext-result-1.0"; + /* + |-------------------------------------------------------------------------- + | Namespace and Schema definitions + |-------------------------------------------------------------------------- + */ + const atExtResultNamespaceUri= "http://www.nic.at/xsd/at-ext-result-1.0"; const namespaceAtExt='http://www.nic.at/xsd/at-ext-epp-1.0'; const schemaLocationAtExt='http://www.nic.at/xsd/at-ext-epp-1.0%20at-ext-epp-1.0.xsd'; @@ -18,7 +23,20 @@ class atEppConstants const namespaceDomain='urn:ietf:params:xml:ns:domain-1.0'; const schemaLocationDomain='urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd'; + const namespaceAtExtDomain = "http://www.nic.at/xsd/at-ext-domain-1.0"; + const schemaLocationAtExtDomain = "http://www.nic.at/xsd/at-ext-domain-1.0%20at-ext-domain-1.0.xsd"; + const w3SchemaLocation = "http://www.w3.org/2001/XMLSchema-instance"; + /* + |-------------------------------------------------------------------------- + | Epp and extension constants + |-------------------------------------------------------------------------- + */ const autoHandle = "AUTO"; + + /* atEppDelete */ + const domainDeleteScheduleNow = 'now'; + const domainDeleteScheduleExpiration = 'expiration'; + } \ No newline at end of file diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExceptions/atEppException.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExceptions/atEppException.php new file mode 100644 index 00000000..7e55a5cb --- /dev/null +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExceptions/atEppException.php @@ -0,0 +1,5 @@ +atEppContact = $atEppContact; } @@ -25,9 +25,9 @@ public function setEppRequestExtension(eppRequest $request,\DOMElement $extensio $facet_->appendChild(new \DOMText($this->atEppContact->getPersonType())); $contactExt_->appendChild($facet_); $extension->appendchild($contactExt_); - if(!is_null($this->additionaEppExtension)) + if(!is_null($this->additionalEppExtension)) { - $this->additionaEppExtension->setEppRequestExtension($request,$extension); + $this->additionalEppExtension->setEppRequestExtension($request,$extension); } diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppUpdateContactExtension.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppUpdateContactExtension.php index a41c137c..c57f4ab9 100755 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppUpdateContactExtension.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppUpdateContactExtension.php @@ -6,9 +6,9 @@ class apEppUpdateContactExtension extends atEppExtensionChain { protected $atEppContact=null; - function __construct(atEppContact $atEppContact, atEppExtensionChain $additionaEppExtension=null) { - if(!is_null($additionaEppExtension)) { - parent::__construct($additionaEppExtension); + function __construct(atEppContact $atEppContact, atEppExtensionChain $additionalEppExtension=null) { + if(!is_null($additionalEppExtension)) { + parent::__construct($additionalEppExtension); } $this->atEppContact = $atEppContact; } @@ -28,11 +28,9 @@ public function setEppRequestExtension(eppRequest $request,\DOMElement $extensio $extChange_->appendChild($facet_); $contactExt_->appendChild($extChange_); $extension->appendchild($contactExt_); - if(!is_null($this->additionaEppExtension)) + if(!is_null($this->additionalEppExtension)) { - $this->additionaEppExtension->setEppRequestExtension($request,$extension); + $this->additionalEppExtension->setEppRequestExtension($request,$extension); } - - } } \ No newline at end of file diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppDomainDeleteExtension.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppDomainDeleteExtension.php new file mode 100644 index 00000000..72ac4714 --- /dev/null +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppDomainDeleteExtension.php @@ -0,0 +1,91 @@ +validateExtensionChain($domainExtArguments); + if (!is_null($additionalEppExtension)) + { + parent::__construct($additionalEppExtension); + } + $this->deleteExtArguments= $domainExtArguments; + } + + /** + * Extends the atEppExtensionChain by a delete schedule-date element. + * + * @param eppRequest $request + * @param \DOMElement $extension + */ + public function setEppRequestExtension(eppRequest $request, \DOMElement $extension) + { + $atDomainFacets = $request->createElement('at-ext-domain:delete'); + $atDomainFacets->setAttribute('xmlns:at-ext-domain', atEppConstants::namespaceAtExtDomain); + $atDomainFacets->setAttribute('xsi:schemaLocation', atEppConstants::schemaLocationAtExtDomain); + + if (isset($this->deleteExtArguments['schedule_date'])) + { + /* No attributre name for schedule-date, see: http://www.nic.at/xsd/at-ext-domain-1.0 */ + $scheduleDate = $request->createElement('at-ext-domain:scheduledate'); + $scheduleDate->appendChild(new \DOMText($this->deleteExtArguments['schedule_date'])); + $atDomainFacets->appendChild($scheduleDate); + } + + $extension->appendChild($atDomainFacets); + + if (!is_null($this->additionalEppExtension)) + { + $this->additionalEppExtension->setEppRequestExtension($request, $extension); + } + } + + /** + * Validates the extension parameter against the allowed values; + * + * @param $atEppExtensionChain + * @throws \atEppException, If the the request contained an invalid parameter. + */ + protected function validateExtensionChain($arguments) + { + if ( + $arguments != null && + ( + 0 == strcmp($arguments['schedule_date'], atEppConstants::domainDeleteScheduleNow) || + 0 == strcmp($arguments['schedule_date'], atEppConstants::domainDeleteScheduleExpiration) + ) + + ) return; + + throw new \atEppException( + "Invalid parameter for schedule date in domain delete request extension. Must be either \n" . + "Value must be either" . atEppConstants::domainDeleteScheduleNow . " or " . atEppConstants::domainDeleteScheduleExpiration + ); + } +} \ No newline at end of file diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtension.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtensionChain.php old mode 100755 new mode 100644 similarity index 56% rename from Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtension.php rename to Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtensionChain.php index 72bb8eb3..c3addc27 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtension.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtensionChain.php @@ -1,24 +1,24 @@ -additionaEppExtension = $additionaEppExtension; - } - - public function setEppRequestExtension(eppRequest $request,\DOMElement $extension) - { - - - } +additionalEppExtension = $additionalEppExtension; + } + + public function setEppRequestExtension(eppRequest $request,\DOMElement $extension) + { + + + } } \ No newline at end of file diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppDeleteRequest.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppDeleteRequest.php index 0fafcfb3..f680fa30 100755 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppDeleteRequest.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppDeleteRequest.php @@ -6,10 +6,9 @@ class atEppDeleteRequest extends eppDeleteRequest { use atEppCommandTrait; - protected $atEppExtensionChain = null; - - function __construct($deleteinfo,atEppExtensionChain $atEppExtensionChain=null) { + function __construct($deleteinfo, atEppExtensionChain $atEppExtensionChain = null) { $this->atEppExtensionChain = $atEppExtensionChain; + parent::__construct($deleteinfo); $this->setAtExtensions(); $this->addSessionId(); diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppTransferRequest.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppTransferRequest.php index 54abcd7f..7b0063c5 100755 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppTransferRequest.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppTransferRequest.php @@ -16,4 +16,27 @@ function __construct($operation, $object,atEppExtensionChain $atEppExtensionChai $this->addSessionId(); } + + 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); + } + } \ No newline at end of file diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppUndeleteRequest.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppUndeleteRequest.php new file mode 100644 index 00000000..fc62f12f --- /dev/null +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppUndeleteRequest.php @@ -0,0 +1,44 @@ +atEppExtensionChain = $atEppExtensionChain; + + parent::__construct(eppRequest::TYPE_UPDATE); + $domainname = $domain->getDomainname(); + $this->domainobject->appendChild($this->createElement('domain:name', $domainname)); + $this->setUndeleteExt(); + $this->epp->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); + $this->addSessionId(); + + } + + + /** + * set's the RGP-Extension + */ + protected function setUndeleteExt() { + + $updExt = $this->createElement('rgp:update'); + $updExt->setAttribute('xmlns:rgp',"urn:ietf:params:xml:ns:rgp-1.0" ); + $updExt->setAttribute('xsi:schemaLocation', "urn:ietf:params:xml:ns:rgp-1.0 rgp-1.0.xsd"); + + $restoreCmd = $this->createElement('rgp:restore'); + $restoreCmd->setAttribute('op', "request"); + $updExt->appendChild($restoreCmd); + $this->getExtension()->appendChild($updExt); + $this->setAtExtensions(); + } + + +} \ No newline at end of file diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php new file mode 100644 index 00000000..2114da19 --- /dev/null +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php @@ -0,0 +1,39 @@ +validateArguments($arguments); + parent::__construct(); + } + + protected function validateArguments($arguments) + { + if (! key_exists('domain_name', $arguments) || ! key_exists('zone_deletion', $arguments)) + { + throw new \atEppException( + 'atEppWithdrawRequest requires two arguments domain_name:string and zone_deletion:boolean.'); + } + } +} \ No newline at end of file diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppResponseTrait.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppResponseTrait.php old mode 100755 new mode 100644 index e96175cc..a1f90c25 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppResponseTrait.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppResponseTrait.php @@ -186,9 +186,9 @@ public function getDomainCreateDate() { public function Success() { $resultcode = $this->getResultCode(); - $success = ($resultcode{0} == '1'); + $success = ($resultcode[0] == '1'); if (!$success) { - switch ($resultcode{1}) { + switch ($resultcode[1]) { case '0': $this->setProblemtype('syntax'); break; diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppUndeleteResponse.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppUndeleteResponse.php new file mode 100644 index 00000000..7bed2679 --- /dev/null +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppUndeleteResponse.php @@ -0,0 +1,8 @@ +xPath(); $result = $xpath->query('/epp:epp/epp:response/epp:result/@code'); $resultcode = $result->item(0)->nodeValue; - $success = ($resultcode{0} == '1'); + $success = ($resultcode[0] == '1'); if (!$success) { - switch ($resultcode{1}) { + switch ($resultcode[1]) { case '0': $this->setProblemtype('syntax'); break; diff --git a/Protocols/EPP/eppResponses/eppResponse.php b/Protocols/EPP/eppResponses/eppResponse.php index 3acec2ff..8921a0ad 100644 --- a/Protocols/EPP/eppResponses/eppResponse.php +++ b/Protocols/EPP/eppResponses/eppResponse.php @@ -79,7 +79,7 @@ class eppResponse extends \DOMDocument { /* * @var array of supported versions */ - public $version; + public ?string $version; public $originalrequest; /** @@ -123,9 +123,9 @@ public function dumpContents() { */ public function Success() { $resultcode = $this->getResultCode(); - $success = ($resultcode{0} == '1'); + $success = ($resultcode[0] == '1'); if (!$success) { - switch ($resultcode{1}) { + switch ($resultcode[1]) { case '0': $this->setProblemtype('syntax'); break; diff --git a/Registries/nicatEppConnection/atEppConnection/atEppConnection.php b/Registries/nicatEppConnection/atEppConnection/atEppConnection.php index 276dda17..f6eaa465 100755 --- a/Registries/nicatEppConnection/atEppConnection/atEppConnection.php +++ b/Registries/nicatEppConnection/atEppConnection/atEppConnection.php @@ -32,6 +32,8 @@ public function __construct($logging = false, $settingsfile = null) { parent::addCommandResponse('Metaregistrar\EPP\atEppTransferRequest', 'Metaregistrar\EPP\atEppTransferResponse'); parent::addCommandResponse('Metaregistrar\EPP\eppInfoDomainRequest', 'Metaregistrar\EPP\atEppInfoDomainResponse'); parent::addCommandResponse('Metaregistrar\EPP\eppInfoContactRequest', 'Metaregistrar\EPP\atEppInfoContactResponse'); + parent::addCommandResponse('Metaregistrar\EPP\atEppWithdrawRequest', 'Metaregistrar\EPP\atEppWithdrawResponse'); + parent::addCommandResponse('Metaregistrar\EPP\atEppUndeleteRequest', 'Metaregistrar\EPP\atEppUndeleteResponse'); } diff --git a/composer.json b/composer.json index 6bf13970..ba1fd375 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^7" + "php": "^7.3|^8.0" }, "require-dev": { "phpunit/phpunit": "^7"