From b221edeb4a0d12336cec1a1cb424b83914bb406f Mon Sep 17 00:00:00 2001 From: Martin Haidn Date: Mon, 1 Apr 2019 16:17:42 +0200 Subject: [PATCH 01/16] Added atEppDomainDeleteExtension --- .../at-ext-epp-1.0/eppData/atEppConstants.php | 20 +++++- .../eppExceptions/atEppException.php | 5 ++ .../atEppDomainDeleteExtension.php | 66 +++++++++++++++++++ .../eppRequests/atEppDeleteRequest.php | 26 +++++++- 4 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExceptions/atEppException.php create mode 100644 Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppDomainDeleteExtension.php 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..b6ff2ca3 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 @@ +suExtArguments= $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->suExtArguments['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->suExtArguments['schedule_date'])); + } + + $extension->appendchild($atDomainFacets); + + if (!is_null($this->additionalEppExtension)) + { + $this->additionalEppExtension->setEppRequestExtension($request, $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..d8c00838 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 @@ -8,10 +8,34 @@ class atEppDeleteRequest extends eppDeleteRequest protected $atEppExtensionChain = null; - function __construct($deleteinfo,atEppExtensionChain $atEppExtensionChain=null) { + function __construct($deleteinfo, atEppExtensionChain $atEppExtensionChain=null) { $this->atEppExtensionChain = $atEppExtensionChain; parent::__construct($deleteinfo); + $this->validateExtensionChain($atEppExtensionChain); $this->setAtExtensions(); $this->addSessionId(); } + + /** + * Validates the extension parameter against the allowed values; + * + * @param $atEppExtensionChain + * @throws \atEppException, If the the request contained an invalid parameter. + */ + protected function validateExtensionChain($atEppExtensionChain) + { + if ( + $atEppExtensionChain != null && + ( + strcmp($atEppExtensionChain['schedule_date'], atEppConstants::domainDeleteScheduleNow) || + strcmp($atEppExtensionChain['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 From 4d4ef910a35ed22f3189992bf45c497871ab0d71 Mon Sep 17 00:00:00 2001 From: Martin Haidn Date: Tue, 2 Apr 2019 19:32:45 +0200 Subject: [PATCH 02/16] Fixed naming and typo bug in ExtensionChain Switched validation location of domain delete extension to extension class itself --- .../at-ext-epp-1.0/eppData/atEppConstants.php | 4 +- .../apEppCreateContactExtension.php | 6 +-- .../apEppUpdateContactExtension.php | 12 ++--- .../atEppDomainDeleteExtension.php | 37 ++++++++++++--- ...pExtension.php => atEppExtensionChain.php} | 46 +++++++++---------- .../eppRequests/atEppDeleteRequest.php | 29 +----------- 6 files changed, 66 insertions(+), 68 deletions(-) rename Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/{atEppExtension.php => atEppExtensionChain.php} (56%) mode change 100755 => 100644 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 b6ff2ca3..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 @@ -36,7 +36,7 @@ class atEppConstants const autoHandle = "AUTO"; /* atEppDelete */ - const domainDeleteScheduleNow = "now"; - const domainDeleteScheduleExpiration = "expiration"; + const domainDeleteScheduleNow = 'now'; + const domainDeleteScheduleExpiration = 'expiration'; } \ No newline at end of file diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppCreateContactExtension.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppCreateContactExtension.php index 4e4d8824..b81d322a 100755 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppCreateContactExtension.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppCreateContactExtension.php @@ -6,9 +6,9 @@ class apEppCreateContactExtension 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; } 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 index ba84af38..72ac4714 100644 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppDomainDeleteExtension.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppDomainDeleteExtension.php @@ -20,7 +20,7 @@ class atEppDomainDeleteExtension extends atEppExtensionChain | This can be either 'now' or 'expiration' | */ - protected $suExtArguments=[]; + protected $deleteExtArguments=[]; /** * Domain extension part of the atEppExtensionChain @@ -28,13 +28,14 @@ class atEppDomainDeleteExtension extends atEppExtensionChain * @param array $domainExtArguments * @param atEppExtensionChain|null $additionalEppExtension */ - public function __construct(array $domainExtArguments=[], atEppExtensionChain $additionalEppExtension=null) + public function __construct(array $domainExtArguments=[], atEppExtensionChain $additionalEppExtension = null) { + $this->validateExtensionChain($domainExtArguments); if (!is_null($additionalEppExtension)) { parent::__construct($additionalEppExtension); } - $this->suExtArguments= $domainExtArguments; + $this->deleteExtArguments= $domainExtArguments; } /** @@ -49,18 +50,42 @@ public function setEppRequestExtension(eppRequest $request, \DOMElement $extensi $atDomainFacets->setAttribute('xmlns:at-ext-domain', atEppConstants::namespaceAtExtDomain); $atDomainFacets->setAttribute('xsi:schemaLocation', atEppConstants::schemaLocationAtExtDomain); - if (isset($this->suExtArguments['schedule_date'])) + 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->suExtArguments['schedule_date'])); + $scheduleDate->appendChild(new \DOMText($this->deleteExtArguments['schedule_date'])); + $atDomainFacets->appendChild($scheduleDate); } - $extension->appendchild($atDomainFacets); + $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..2c8abd6b --- 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) - { - - - } +additionaEppExtension = $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 d8c00838..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,36 +6,11 @@ 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->validateExtensionChain($atEppExtensionChain); $this->setAtExtensions(); $this->addSessionId(); } - - /** - * Validates the extension parameter against the allowed values; - * - * @param $atEppExtensionChain - * @throws \atEppException, If the the request contained an invalid parameter. - */ - protected function validateExtensionChain($atEppExtensionChain) - { - if ( - $atEppExtensionChain != null && - ( - strcmp($atEppExtensionChain['schedule_date'], atEppConstants::domainDeleteScheduleNow) || - strcmp($atEppExtensionChain['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 From b71086ac274e3a8a52cf8cf3534e5c34c7b0e507 Mon Sep 17 00:00:00 2001 From: Thomas Meike Date: Wed, 3 Apr 2019 15:43:00 +0200 Subject: [PATCH 03/16] typo inside atEppExtensionChain constructor additionaEppExtension --- .../at-ext-epp-1.0/eppExtensions/atEppExtensionChain.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtensionChain.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtensionChain.php index 2c8abd6b..c3addc27 100644 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtensionChain.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/atEppExtensionChain.php @@ -13,7 +13,7 @@ abstract class atEppExtensionChain function __construct(atEppExtensionChain $additionalEppExtension=null) { - $this->additionaEppExtension = $additionalEppExtension; + $this->additionalEppExtension = $additionalEppExtension; } public function setEppRequestExtension(eppRequest $request,\DOMElement $extension) From e94f1604f2e2a163f4067b7edf1a5eeecb7693f7 Mon Sep 17 00:00:00 2001 From: Thomas Meike Date: Thu, 4 Apr 2019 15:39:34 +0200 Subject: [PATCH 04/16] typo additionalEppExtension fixed --- .../eppExtensions/apEppCreateContactExtension.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppCreateContactExtension.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppCreateContactExtension.php index b81d322a..3e293d55 100755 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppCreateContactExtension.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppExtensions/apEppCreateContactExtension.php @@ -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); } From ba72428a055a44731f199c59e422b42df702104b Mon Sep 17 00:00:00 2001 From: Martin Haidn Date: Wed, 10 Apr 2019 09:51:02 +0200 Subject: [PATCH 05/16] Added domain withdraw request and response --- .../eppRequests/atEppWithdrawRequest.php | 53 +++++++++++++++++++ .../eppResponses/atEppWithdrawResponse.php | 19 +++++++ .../atEppConnection/atEppConnection.php | 1 + 3 files changed, 73 insertions(+) create mode 100644 Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php create mode 100644 Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppWithdrawResponse.php 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..fc243587 --- /dev/null +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php @@ -0,0 +1,53 @@ +setDomain($withdrawDomain, $zoneDeletion); + $this->addSessionId(); + } + + function __destruct() { + parent::__destruct(); + } + + public function setDomain(eppDomain $domain, bool $zoneDeleteion) { + if (!strlen($domain->getDomainname())) { + throw new atEppException('atEppWithdrawRequest domain object does not contain a valid domain name'); + } + + /* Creating the withdraw object */ + $this->domainobject = $this->createElement('withdraw'); + + $domainWithdraw = $this->createElement('domain:withdraw'); + $domainWithdraw->setAttribute('xmlns:xsi', atEppConstants::namespaceAtExtDomain); + $domainWithdraw->setAttribute('xsi:schemaLocation', atEppConstants::schemaLocationAtExt); + + $domainWithdraw->appendChild($this->createElement('domain:name', $domain->getDomainname())); + $domainWithdraw->appendChild($this->createElement('domain:zd')->setAttribute('value', $zoneDeleteion)); + + $this->domainobject->appendChild($domainWithdraw); + $this->getCommand()->appendChild($this->domainobject); + } + +} \ No newline at end of file diff --git a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppWithdrawResponse.php b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppWithdrawResponse.php new file mode 100644 index 00000000..5a4a8c77 --- /dev/null +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppWithdrawResponse.php @@ -0,0 +1,19 @@ + Date: Wed, 10 Apr 2019 10:48:37 +0200 Subject: [PATCH 06/16] Added missing atEppExtensionChain in withdraw request --- .../at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 index fc243587..8fbe39a6 100644 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php @@ -20,10 +20,13 @@ class atEppWithdrawRequest extends eppRequest { use atEppCommandTrait; - function __construct(eppDomain $withdrawDomain, bool $zoneDeletion) { + function __construct(eppDomain $withdrawDomain, bool $zoneDeletion, atEppExtensionChain $atEppExtensionChain = null) + { + $this->atEppExtensionChain = $atEppExtensionChain; parent::__construct(); $this->setDomain($withdrawDomain, $zoneDeletion); + $this->setAtExtensions(); $this->addSessionId(); } From 91383fa064ee2ff1f8d0ee43b33fc0288ee6dc43 Mon Sep 17 00:00:00 2001 From: Martin Haidn Date: Thu, 11 Apr 2019 17:45:14 +0200 Subject: [PATCH 07/16] Reduced atEppWithdrawRequest as eppRequest adapter Added argument validation to adapter --- .../eppRequests/atEppWithdrawRequest.php | 48 +++++++------------ 1 file changed, 16 insertions(+), 32 deletions(-) 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 index 8fbe39a6..13a6b736 100644 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php @@ -8,49 +8,33 @@ namespace Metaregistrar\EPP; -use atEppException; - /** - * Class atEppWithdrawRequest represents the at-registry specific withdraw request where the responsibility of - * a domain is delegated back to nic.at + * Class atEppWithdrawRequest works only as adapter in order to map a atEppResponse. * * @package Metaregistrar\EPP */ class atEppWithdrawRequest extends eppRequest { - use atEppCommandTrait; - function __construct(eppDomain $withdrawDomain, bool $zoneDeletion, atEppExtensionChain $atEppExtensionChain = null) + + /** + * atEppWithdrawRequest constructor. + * @param $arguments + * + * @throws \atEppException + */ + public function __construct($arguments) { - $this->atEppExtensionChain = $atEppExtensionChain; + $this->validateArguments($arguments); parent::__construct(); - - $this->setDomain($withdrawDomain, $zoneDeletion); - $this->setAtExtensions(); - $this->addSessionId(); } - function __destruct() { - parent::__destruct(); - } - - public function setDomain(eppDomain $domain, bool $zoneDeleteion) { - if (!strlen($domain->getDomainname())) { - throw new atEppException('atEppWithdrawRequest domain object does not contain a valid domain name'); + 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.'); } - - /* Creating the withdraw object */ - $this->domainobject = $this->createElement('withdraw'); - - $domainWithdraw = $this->createElement('domain:withdraw'); - $domainWithdraw->setAttribute('xmlns:xsi', atEppConstants::namespaceAtExtDomain); - $domainWithdraw->setAttribute('xsi:schemaLocation', atEppConstants::schemaLocationAtExt); - - $domainWithdraw->appendChild($this->createElement('domain:name', $domain->getDomainname())); - $domainWithdraw->appendChild($this->createElement('domain:zd')->setAttribute('value', $zoneDeleteion)); - - $this->domainobject->appendChild($domainWithdraw); - $this->getCommand()->appendChild($this->domainobject); } - } \ No newline at end of file From aff03f40c923da7c3d015644fd86d215851fc4a9 Mon Sep 17 00:00:00 2001 From: Martin Haidn Date: Fri, 12 Apr 2019 10:53:22 +0200 Subject: [PATCH 08/16] atEppWithdrawRequest cleanup --- .../eppRequests/atEppWithdrawRequest.php | 39 +------------------ 1 file changed, 1 insertion(+), 38 deletions(-) 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 index 8fbe39a6..d1dab685 100644 --- a/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php +++ b/Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppWithdrawRequest.php @@ -8,49 +8,12 @@ namespace Metaregistrar\EPP; -use atEppException; - /** - * Class atEppWithdrawRequest represents the at-registry specific withdraw request where the responsibility of - * a domain is delegated back to nic.at + * Class atEppWithdrawRequest works only as adapter in order to map a atEppResponse. * * @package Metaregistrar\EPP */ class atEppWithdrawRequest extends eppRequest { - use atEppCommandTrait; - - function __construct(eppDomain $withdrawDomain, bool $zoneDeletion, atEppExtensionChain $atEppExtensionChain = null) - { - $this->atEppExtensionChain = $atEppExtensionChain; - parent::__construct(); - - $this->setDomain($withdrawDomain, $zoneDeletion); - $this->setAtExtensions(); - $this->addSessionId(); - } - - function __destruct() { - parent::__destruct(); - } - - public function setDomain(eppDomain $domain, bool $zoneDeleteion) { - if (!strlen($domain->getDomainname())) { - throw new atEppException('atEppWithdrawRequest domain object does not contain a valid domain name'); - } - - /* Creating the withdraw object */ - $this->domainobject = $this->createElement('withdraw'); - - $domainWithdraw = $this->createElement('domain:withdraw'); - $domainWithdraw->setAttribute('xmlns:xsi', atEppConstants::namespaceAtExtDomain); - $domainWithdraw->setAttribute('xsi:schemaLocation', atEppConstants::schemaLocationAtExt); - - $domainWithdraw->appendChild($this->createElement('domain:name', $domain->getDomainname())); - $domainWithdraw->appendChild($this->createElement('domain:zd')->setAttribute('value', $zoneDeleteion)); - - $this->domainobject->appendChild($domainWithdraw); - $this->getCommand()->appendChild($this->domainobject); - } } \ No newline at end of file From 991b48648486979190647ab1591696bdc4db4089 Mon Sep 17 00:00:00 2001 From: Thomas Meike Date: Wed, 24 Apr 2019 14:17:29 +0200 Subject: [PATCH 09/16] atEppUndeleteRequest extension --- .../eppRequests/atEppUndeleteRequest.php | 44 +++++++++++++++++++ .../eppResponses/atEppUndeleteResponse.php | 8 ++++ .../atEppConnection/atEppConnection.php | 1 + 3 files changed, 53 insertions(+) create mode 100644 Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppRequests/atEppUndeleteRequest.php create mode 100644 Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppUndeleteResponse.php 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/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 @@ + Date: Tue, 4 Feb 2020 14:09:55 +0100 Subject: [PATCH 10/16] htmlentities fuer authcode entfernt da stdmaessig ein cdata geschrieben wird --- Protocols/EPP/eppData/eppDomain.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Protocols/EPP/eppData/eppDomain.php b/Protocols/EPP/eppData/eppDomain.php index eb2a778c..7fba233e 100644 --- a/Protocols/EPP/eppData/eppDomain.php +++ b/Protocols/EPP/eppData/eppDomain.php @@ -331,12 +331,7 @@ public function getSecdns($row = null) { * @return void */ public function setAuthorisationCode($authorisationCode) { - if ($authorisationCode) { - $this->authorisationCode = htmlspecialchars($authorisationCode, ENT_COMPAT, "UTF-8"); - } else { - $this->authorisationCode = $authorisationCode; - } - + $this->authorisationCode = $authorisationCode; } /** @@ -353,7 +348,7 @@ public function getAuthorisationCode() { * @return void */ public function setPassword($password) { - $this->authorisationCode = htmlspecialchars($password, ENT_COMPAT, "UTF-8"); + $this->setAuthorisationCode($password); } /** From 3bce9e2631e69c67952e5364006372081f99a349 Mon Sep 17 00:00:00 2001 From: Thomas Meike Date: Tue, 4 Feb 2020 15:02:52 +0100 Subject: [PATCH 11/16] bypass cdata on transfer request for authinfo --- Protocols/EPP/eppData/eppDomain.php | 9 ++++++-- .../eppRequests/atEppTransferRequest.php | 23 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Protocols/EPP/eppData/eppDomain.php b/Protocols/EPP/eppData/eppDomain.php index 7fba233e..eb2a778c 100644 --- a/Protocols/EPP/eppData/eppDomain.php +++ b/Protocols/EPP/eppData/eppDomain.php @@ -331,7 +331,12 @@ public function getSecdns($row = null) { * @return void */ public function setAuthorisationCode($authorisationCode) { - $this->authorisationCode = $authorisationCode; + if ($authorisationCode) { + $this->authorisationCode = htmlspecialchars($authorisationCode, ENT_COMPAT, "UTF-8"); + } else { + $this->authorisationCode = $authorisationCode; + } + } /** @@ -348,7 +353,7 @@ public function getAuthorisationCode() { * @return void */ public function setPassword($password) { - $this->setAuthorisationCode($password); + $this->authorisationCode = htmlspecialchars($password, ENT_COMPAT, "UTF-8"); } /** 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 From f87b9d5d30678f2237dd57d505f9af5bcca468dc Mon Sep 17 00:00:00 2001 From: Thomas Meike Date: Wed, 9 Jun 2021 10:43:19 +0200 Subject: [PATCH 12/16] php 8 upgrade fixes TG-837 --- Protocols/EPP/eppData/eppContact.php | 2 +- .../at-ext-epp-1.0/eppResponses/atEppResponseTrait.php | 4 ++-- .../sidn-ext-epp-1.0/eppResponses/sidnEppResponse.php | 4 ++-- Protocols/EPP/eppResponses/eppResponse.php | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) mode change 100755 => 100644 Protocols/EPP/eppExtensions/at-ext-epp-1.0/eppResponses/atEppResponseTrait.php 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/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/sidn-ext-epp-1.0/eppResponses/sidnEppResponse.php b/Protocols/EPP/eppExtensions/sidn-ext-epp-1.0/eppResponses/sidnEppResponse.php index 64c2bba3..55d04dbb 100644 --- a/Protocols/EPP/eppExtensions/sidn-ext-epp-1.0/eppResponses/sidnEppResponse.php +++ b/Protocols/EPP/eppExtensions/sidn-ext-epp-1.0/eppResponses/sidnEppResponse.php @@ -10,9 +10,9 @@ public function Success() { $xpath = $this->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..021e2c54 100644 --- a/Protocols/EPP/eppResponses/eppResponse.php +++ b/Protocols/EPP/eppResponses/eppResponse.php @@ -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; From a6017e91e89853ce95a4543bfa68b7f1798135ea Mon Sep 17 00:00:00 2001 From: Thomas Meike Date: Thu, 10 Jun 2021 08:50:53 +0200 Subject: [PATCH 13/16] metaregistrar composer update --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From b52cbb014f56e77e9e67fb6f268f0df2072a62d4 Mon Sep 17 00:00:00 2001 From: Thomas Meike Date: Wed, 23 Jun 2021 10:19:37 +0200 Subject: [PATCH 14/16] fixed PHP 8.0: Deprecate required parameters after optional parameters in function/method signatures --- Protocols/EPP/eppConnection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 Protocols/EPP/eppConnection.php diff --git a/Protocols/EPP/eppConnection.php b/Protocols/EPP/eppConnection.php old mode 100755 new mode 100644 index 53c81ca5..23ac2176 --- 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($directory, $settingsfile) { if ($directory) { $path = $directory . '/' . $settingsfile; } else { From dc884f37ec6bcd0a321e55624cf3f1cca821a8da Mon Sep 17 00:00:00 2001 From: Thomas Meike Date: Mon, 28 Jun 2021 10:09:31 +0200 Subject: [PATCH 15/16] php 8 deprecation fix optional param before required param --- Protocols/EPP/eppConnection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Protocols/EPP/eppConnection.php b/Protocols/EPP/eppConnection.php index 23ac2176..5eff797a 100644 --- 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, $settingsfile) { + static function loadSettings(?string $directory, $settingsfile) { if ($directory) { $path = $directory . '/' . $settingsfile; } else { From f785ac3e7891c7ff9df1779f02f3b748ae3d2531 Mon Sep 17 00:00:00 2001 From: Gene Surov Date: Fri, 1 Mar 2024 10:45:54 +0100 Subject: [PATCH 16/16] Update eppResponse.php Needed for compatibility with PHP 8.1 --- Protocols/EPP/eppResponses/eppResponse.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Protocols/EPP/eppResponses/eppResponse.php b/Protocols/EPP/eppResponses/eppResponse.php index 021e2c54..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; /**