Skip to content

Commit

Permalink
Domain check and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
getpinga committed Jan 2, 2024
1 parent c9bee11 commit 1a4b28f
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 114 deletions.
3 changes: 2 additions & 1 deletion src/Epp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,8 @@ public function domainCheck($params = array())
foreach ($r->cd as $cd) {
$i++;
$domains[$i]['name'] = (string)$cd->name;
$domains[$i]['avail'] = (int)$cd->name->attributes()->avail;
$availStr = (string)$cd->name->attributes()->avail;
$domains[$i]['avail'] = ($availStr === 'true' || $availStr === '1') ? true : false;
$domains[$i]['reason'] = (string)$cd->reason;
}

Expand Down
1 change: 1 addition & 0 deletions src/EppRegistryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function domainInfo(array $params);
public function domainCreate(array $params);
public function domainCreateDNSSEC(array $params);
public function domainCreateClaims(array $params);
public function domainCreateSunrise(array $params);
public function domainUpdateNS(array $params);
public function domainUpdateContact(array $params);
public function domainUpdateStatus(array $params);
Expand Down
20 changes: 18 additions & 2 deletions src/Registries/FrEpp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,8 @@ public function domainCheck($params = array())
foreach ($r->cd as $cd) {
$i++;
$domains[$i]['name'] = (string)$cd->name;
$domains[$i]['avail'] = (int)$cd->name->attributes()->avail;
$availStr = (string)$cd->name->attributes()->avail;
$domains[$i]['avail'] = ($availStr === 'true' || $availStr === '1') ? true : false;
$domains[$i]['reason'] = (string)$cd->reason;
}

Expand Down Expand Up @@ -2112,7 +2113,22 @@ public function domainCreateClaims($params = array())
);
}

throw new EppException("Launch extension not supported!");
throw new EppException("Launch extension not supported!");
}

/**
* domainCreateSunrise
*/
public function domainCreateSunrise($params = array())
{
if (!$this->isLoggedIn) {
return array(
'code' => 2002,
'msg' => 'Command use error'
);
}

throw new EppException("Launch extension not supported!");
}

/**
Expand Down
24 changes: 20 additions & 4 deletions src/Registries/FredEpp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,8 @@ public function domainCheck($params = array())
foreach ($r->cd as $cd) {
$i++;
$domains[$i]['name'] = (string)$cd->name;
$domains[$i]['avail'] = (int)$cd->name->attributes()->avail;
$availStr = (string)$cd->name->attributes()->avail;
$domains[$i]['avail'] = ($availStr === 'true' || $availStr === '1') ? true : false;
$domains[$i]['reason'] = (string)$cd->reason;
}

Expand Down Expand Up @@ -1448,7 +1449,7 @@ public function domainUpdateContact($params = array())
return $return;
}

/**
/**
* domainUpdateStatus
*/
public function domainUpdateStatus($params = array())
Expand All @@ -1460,7 +1461,7 @@ public function domainUpdateStatus($params = array())
);
}

throw new EppException("Status update not supported!");
throw new EppException("Status update not supported!");

}

Expand Down Expand Up @@ -1770,7 +1771,22 @@ public function domainCheckClaims($params = array())
);
}

throw new EppException("Launch extension not supported!");
throw new EppException("Launch extension not supported!");
}

/**
* domainCreateSunrise
*/
public function domainCreateSunrise($params = array())
{
if (!$this->isLoggedIn) {
return array(
'code' => 2002,
'msg' => 'Command use error'
);
}

throw new EppException("Launch extension not supported!");
}

/**
Expand Down
20 changes: 18 additions & 2 deletions src/Registries/GrEpp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,8 @@ public function domainCheck($params = array())
foreach ($r->cd as $cd) {
$i++;
$domains[$i]['name'] = (string)$cd->name;
$domains[$i]['avail'] = (int)$cd->name->attributes()->avail;
$availStr = (string)$cd->name->attributes()->avail;
$domains[$i]['avail'] = ($availStr === 'true' || $availStr === '1') ? true : false;
$domains[$i]['reason'] = (string)$cd->reason;
}

Expand Down Expand Up @@ -1921,7 +1922,22 @@ public function domainCreateClaims($params = array())
);
}

throw new EppException("Launch extension not supported!");
throw new EppException("Launch extension not supported!");
}

/**
* domainCreateSunrise
*/
public function domainCreateSunrise($params = array())
{
if (!$this->isLoggedIn) {
return array(
'code' => 2002,
'msg' => 'Command use error'
);
}

throw new EppException("Launch extension not supported!");
}

/**
Expand Down
107 changes: 15 additions & 92 deletions src/Registries/HkEpp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,8 @@ public function domainCheck($params = array())
foreach ($r->cd as $cd) {
$i++;
$domains[$i]['name'] = (string)$cd->name;
$domains[$i]['avail'] = (int)$cd->name->attributes()->avail;
$availStr = (string)$cd->name->attributes()->avail;
$domains[$i]['avail'] = ($availStr === 'true' || $availStr === '1') ? true : false;
$domains[$i]['reason'] = (string)$cd->reason;
}

Expand Down Expand Up @@ -2142,100 +2143,22 @@ public function domainCreateClaims($params = array())
);
}

$return = array();
try {
$from = $to = array();
$from[] = '/{{ name }}/';
$to[] = htmlspecialchars($params['domainname']);
$from[] = '/{{ period }}/';
$to[] = (int)($params['period']);
if (isset($params['nss'])) {
$text = '';
foreach ($params['nss'] as $hostObj) {
$text .= '<domain:hostObj>' . $hostObj . '</domain:hostObj>' . "\n";
}
$from[] = '/{{ hostObjs }}/';
$to[] = $text;
} else {
$from[] = '/{{ hostObjs }}/';
$to[] = '';
}
$from[] = '/{{ registrant }}/';
$to[] = htmlspecialchars($params['registrant']);
$text = '';
foreach ($params['contacts'] as $contactType => $contactID) {
$text .= '<domain:contact type="' . $contactType . '">' . $contactID . '</domain:contact>' . "\n";
}
$from[] = '/{{ contacts }}/';
$to[] = $text;
$from[] = '/{{ authInfoPw }}/';
$to[] = htmlspecialchars($params['authInfoPw']);
$from[] = '/{{ noticeID }}/';
$to[] = htmlspecialchars($params['noticeID']);
$from[] = '/{{ notAfter }}/';
$to[] = htmlspecialchars($params['notAfter']);
$from[] = '/{{ acceptedDate }}/';
$to[] = htmlspecialchars($params['acceptedDate']);
$from[] = '/{{ clTRID }}/';
$clTRID = str_replace('.', '', round(microtime(1), 3));
$to[] = htmlspecialchars($this->prefix . '-domain-createClaims-' . $clTRID);
$from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims";
$to[] = '';
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
<command>
<create>
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>{{ name }}</domain:name>
<domain:period unit="y">{{ period }}</domain:period>
<domain:ns>
{{ hostObjs }}
</domain:ns>
<domain:registrant>{{ registrant }}</domain:registrant>
{{ contacts }}
<domain:authInfo>
<domain:pw>{{ authInfoPw }}</domain:pw>
</domain:authInfo>
</domain:create>
<extension>
<launch:create xmlns:launch="urn:ietf:params:xml:ns:launch-1.0">
<launch:phase>claims</launch:phase>
<launch:notice>
<launch:noticeID>{{ noticeID }}</launch:noticeID>
<launch:notAfter>{{ notAfter }}</launch:notAfter>
<launch:acceptedDate>{{ acceptedDate }}</launch:acceptedDate>
</launch:notice>
</launch:create>
</extension>
</create>
<clTRID>{{ clTRID }}</clTRID>
</command>
</epp>');
$r = $this->writeRequest($xml);
$code = (int)$r->response->result->attributes()->code;
$msg = (string)$r->response->result->msg;
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->creData;
$name = (string)$r->name;
$crDate = (string)$r->crDate;
$exDate = (string)$r->exDate;

$return = array(
'code' => $code,
'msg' => $msg,
'name' => $name,
'crDate' => $crDate,
'exDate' => $exDate
);
} catch (\Exception $e) {
$return = array(
'error' => $e->getMessage()
throw new EppException("Launch extension not supported!");
}

/**
* domainCreateSunrise
*/
public function domainCreateSunrise($params = array())
{
if (!$this->isLoggedIn) {
return array(
'code' => 2002,
'msg' => 'Command use error'
);
}

return $return;
throw new EppException("Launch extension not supported!");
}

/**
Expand Down
20 changes: 18 additions & 2 deletions src/Registries/LvEpp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,8 @@ public function domainCheck($params = array())
foreach ($r->cd as $cd) {
$i++;
$domains[$i]['name'] = (string)$cd->name;
$domains[$i]['avail'] = (int)$cd->name->attributes()->avail;
$availStr = (string)$cd->name->attributes()->avail;
$domains[$i]['avail'] = ($availStr === 'true' || $availStr === '1') ? true : false;
$domains[$i]['reason'] = (string)$cd->reason;
}

Expand Down Expand Up @@ -2101,7 +2102,22 @@ public function domainCreateClaims($params = array())
);
}

throw new EppException("Claims extension not supported!");
throw new EppException("Claims extension not supported!");
}

/**
* domainCreateSunrise
*/
public function domainCreateSunrise($params = array())
{
if (!$this->isLoggedIn) {
return array(
'code' => 2002,
'msg' => 'Command use error'
);
}

throw new EppException("Launch extension not supported!");
}

/**
Expand Down
20 changes: 18 additions & 2 deletions src/Registries/NoEpp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,8 @@ public function domainCheck($params = array())
foreach ($r->cd as $cd) {
$i++;
$domains[$i]['name'] = (string)$cd->name;
$domains[$i]['avail'] = (int)$cd->name->attributes()->avail;
$availStr = (string)$cd->name->attributes()->avail;
$domains[$i]['avail'] = ($availStr === 'true' || $availStr === '1') ? true : false;
$domains[$i]['reason'] = (string)$cd->reason;
}

Expand Down Expand Up @@ -2101,7 +2102,22 @@ public function domainCreateClaims($params = array())
);
}

throw new EppException("Launch extension not supported!");
throw new EppException("Launch extension not supported!");
}

/**
* domainCreateSunrise
*/
public function domainCreateSunrise($params = array())
{
if (!$this->isLoggedIn) {
return array(
'code' => 2002,
'msg' => 'Command use error'
);
}

throw new EppException("Launch extension not supported!");
}

/**
Expand Down
20 changes: 18 additions & 2 deletions src/Registries/PlEpp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,8 @@ public function domainCheck($params = array())
foreach ($r->cd as $cd) {
$i++;
$domains[$i]['name'] = (string)$cd->name;
$domains[$i]['avail'] = $cd->name->attributes()->avail;
$availStr = (string)$cd->name->attributes()->avail;
$domains[$i]['avail'] = ($availStr === 'true' || $availStr === '1') ? true : false;
$domains[$i]['reason'] = (string)$cd->reason;
}

Expand Down Expand Up @@ -2008,7 +2009,22 @@ public function domainCreateClaims($params = array())
);
}

throw new EppException("Launch extension not supported!");
throw new EppException("Launch extension not supported!");
}

/**
* domainCreateSunrise
*/
public function domainCreateSunrise($params = array())
{
if (!$this->isLoggedIn) {
return array(
'code' => 2002,
'msg' => 'Command use error'
);
}

throw new EppException("Launch extension not supported!");
}

/**
Expand Down
20 changes: 18 additions & 2 deletions src/Registries/PtEpp.php
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,8 @@ public function domainCheck($params = array())
foreach ($r->cd as $cd) {
$i++;
$domains[$i]['name'] = (string)$cd->name;
$domains[$i]['avail'] = (int)$cd->name->attributes()->avail;
$availStr = (string)$cd->name->attributes()->avail;
$domains[$i]['avail'] = ($availStr === 'true' || $availStr === '1') ? true : false;
$domains[$i]['reason'] = (string)$cd->reason;
}

Expand Down Expand Up @@ -2122,7 +2123,22 @@ public function domainCreateClaims($params = array())
);
}

throw new EppException("Launch extension not supported!");
throw new EppException("Launch extension not supported!");
}

/**
* domainCreateSunrise
*/
public function domainCreateSunrise($params = array())
{
if (!$this->isLoggedIn) {
return array(
'code' => 2002,
'msg' => 'Command use error'
);
}

throw new EppException("Launch extension not supported!");
}

/**
Expand Down
Loading

0 comments on commit 1a4b28f

Please sign in to comment.