Skip to content

Commit a5b12c2

Browse files
authored
Update PlEpp.php
1 parent f1783fb commit a5b12c2

File tree

1 file changed

+264
-0
lines changed

1 file changed

+264
-0
lines changed

src/Registries/PlEpp.php

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,21 @@ public function domainCheck($params = array())
11381138

11391139
return $return;
11401140
}
1141+
1142+
/**
1143+
* domainCheckClaims
1144+
*/
1145+
public function domainCheckClaims($params = array())
1146+
{
1147+
if (!$this->isLoggedIn) {
1148+
return array(
1149+
'code' => 2002,
1150+
'msg' => 'Command use error'
1151+
);
1152+
}
1153+
1154+
throw new EppException("Launch extension not supported!");
1155+
}
11411156

11421157
/**
11431158
* domainInfo
@@ -1575,6 +1590,122 @@ public function domainUpdateAuthinfo($params = array())
15751590

15761591
return $return;
15771592
}
1593+
1594+
/**
1595+
* domainUpdateDNSSEC
1596+
*/
1597+
public function domainUpdateDNSSEC($params = array())
1598+
{
1599+
if (!$this->isLoggedIn) {
1600+
return array(
1601+
'code' => 2002,
1602+
'msg' => 'Command use error'
1603+
);
1604+
}
1605+
1606+
$return = array();
1607+
try {
1608+
$from = $to = array();
1609+
$from[] = '/{{ name }}/';
1610+
$to[] = htmlspecialchars($params['domainname']);
1611+
if ($params['command'] == 'add') {
1612+
$from[] = '/{{ add }}/';
1613+
$to[] = "<secDNS:add>
1614+
<secDNS:dsData>
1615+
<secDNS:keyTag>".htmlspecialchars($params['keyTag_1'])."</secDNS:keyTag>
1616+
<secDNS:alg>".htmlspecialchars($params['alg_1'])."</secDNS:alg>
1617+
<secDNS:digestType>".htmlspecialchars($params['digestType_1'])."</secDNS:digestType>
1618+
<secDNS:digest>".htmlspecialchars($params['digest_1'])."</secDNS:digest>
1619+
</secDNS:dsData>
1620+
</secDNS:add>";
1621+
$from[] = '/{{ rem }}/';
1622+
$to[] = "";
1623+
$from[] = '/{{ addrem }}/';
1624+
$to[] = "";
1625+
} else if ($params['command'] == 'rem') {
1626+
$from[] = '/{{ add }}/';
1627+
$to[] = "";
1628+
$from[] = '/{{ rem }}/';
1629+
$to[] = "<secDNS:rem>
1630+
<secDNS:dsData>
1631+
<secDNS:keyTag>".htmlspecialchars($params['keyTag_1'])."</secDNS:keyTag>
1632+
<secDNS:alg>".htmlspecialchars($params['alg_1'])."</secDNS:alg>
1633+
<secDNS:digestType>".htmlspecialchars($params['digestType_1'])."</secDNS:digestType>
1634+
<secDNS:digest>".htmlspecialchars($params['digest_1'])."</secDNS:digest>
1635+
</secDNS:dsData>
1636+
</secDNS:rem>";
1637+
$from[] = '/{{ addrem }}/';
1638+
$to[] = "";
1639+
} else if ($params['command'] == 'addrem') {
1640+
$from[] = '/{{ add }}/';
1641+
$to[] = "";
1642+
$from[] = '/{{ rem }}/';
1643+
$to[] = "";
1644+
$from[] = '/{{ addrem }}/';
1645+
$to[] = "<secDNS:rem>
1646+
<secDNS:dsData>
1647+
<secDNS:keyTag>".htmlspecialchars($params['keyTag_1'])."</secDNS:keyTag>
1648+
<secDNS:alg>".htmlspecialchars($params['alg_1'])."</secDNS:alg>
1649+
<secDNS:digestType>".htmlspecialchars($params['digestType_1'])."</secDNS:digestType>
1650+
<secDNS:digest>".htmlspecialchars($params['digest_1'])."</secDNS:digest>
1651+
</secDNS:dsData>
1652+
</secDNS:rem>
1653+
<secDNS:add>
1654+
<secDNS:dsData>
1655+
<secDNS:keyTag>".htmlspecialchars($params['keyTag_2'])."</secDNS:keyTag>
1656+
<secDNS:alg>".htmlspecialchars($params['alg_2'])."</secDNS:alg>
1657+
<secDNS:digestType>".htmlspecialchars($params['digestType_2'])."</secDNS:digestType>
1658+
<secDNS:digest>".htmlspecialchars($params['digest_2'])."</secDNS:digest>
1659+
</secDNS:dsData>
1660+
</secDNS:add>";
1661+
}
1662+
$from[] = '/{{ clTRID }}/';
1663+
$clTRID = str_replace('.', '', round(microtime(1), 3));
1664+
$to[] = htmlspecialchars($this->prefix . '-domain-updateDNSSEC-' . $clTRID);
1665+
$from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims";
1666+
$to[] = '';
1667+
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1668+
<epp xmlns="http://www.dns.pl/nask-epp-schema/epp-2.1"
1669+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1670+
xsi:schemaLocation="http://www.dns.pl/nask-epp-schema/epp-2.1
1671+
epp-2.1.xsd">
1672+
<command>
1673+
<update>
1674+
<domain:update
1675+
xmlns:domain="http://www.dns.pl/nask-epp-schema/domain-2.1"
1676+
xsi:schemaLocation="http://www.dns.pl/nask-epp-schema/domain-2.1
1677+
domain-2.1.xsd">
1678+
<domain:name>{{ name }}</domain:name>
1679+
</domain:update>
1680+
</update>
1681+
<extension>
1682+
<secDNS:update
1683+
xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1"
1684+
xsi:schemaLocation="urn:ietf:params:xml:ns:secDNS-1.1 secDNS-1.1.xsd">
1685+
{{ add }}
1686+
{{ rem }}
1687+
{{ addrem }}
1688+
</secDNS:update>
1689+
</extension>
1690+
<clTRID>{{ clTRID }}</clTRID>
1691+
</command>
1692+
</epp>');
1693+
$r = $this->writeRequest($xml);
1694+
$code = (int)$r->response->result->attributes()->code;
1695+
$msg = (string)$r->response->result->msg;
1696+
1697+
$return = array(
1698+
'code' => $code,
1699+
'msg' => $msg
1700+
);
1701+
} catch (\Exception $e) {
1702+
$return = array(
1703+
'error' => $e->getMessage()
1704+
);
1705+
}
1706+
1707+
return $return;
1708+
}
15781709

15791710
/**
15801711
* domainTransfer
@@ -1837,6 +1968,139 @@ public function domainCreate($params = array())
18371968

18381969
return $return;
18391970
}
1971+
1972+
/**
1973+
* domainCreateClaims
1974+
*/
1975+
public function domainCreateClaims($params = array())
1976+
{
1977+
if (!$this->isLoggedIn) {
1978+
return array(
1979+
'code' => 2002,
1980+
'msg' => 'Command use error'
1981+
);
1982+
}
1983+
1984+
throw new EppException("Launch extension not supported!");
1985+
}
1986+
1987+
/**
1988+
* domainCreateDNSSEC
1989+
*/
1990+
public function domainCreateDNSSEC($params = array())
1991+
{
1992+
if (!$this->isLoggedIn) {
1993+
return array(
1994+
'code' => 2002,
1995+
'msg' => 'Command use error'
1996+
);
1997+
}
1998+
1999+
$return = array();
2000+
try {
2001+
$from = $to = array();
2002+
$from[] = '/{{ name }}/';
2003+
$to[] = htmlspecialchars($params['domainname']);
2004+
$from[] = '/{{ period }}/';
2005+
$to[] = (int)($params['period']);
2006+
$text = '';
2007+
foreach ($params['nss'] as $hostObj) {
2008+
$text .= '<domain:ns>' . $hostObj . '</domain:ns>' . "\n";
2009+
}
2010+
$from[] = '/{{ hostObjs }}/';
2011+
$to[] = $text;
2012+
$from[] = '/{{ registrant }}/';
2013+
$to[] = htmlspecialchars($params['registrant']);
2014+
$text = '';
2015+
foreach ($params['contacts'] as $id => $contactType) {
2016+
$text .= '<domain:contact type="' . $contactType . '">' . $id . '</domain:contact>' . "\n";
2017+
}
2018+
$from[] = '/{{ contacts }}/';
2019+
$to[] = $text;
2020+
if ($params['dnssec_records'] == 1) {
2021+
$from[] = '/{{ dnssec_data }}/';
2022+
$to[] = "<secDNS:dsData>
2023+
<secDNS:keyTag>".htmlspecialchars($params['keyTag_1'])."</secDNS:keyTag>
2024+
<secDNS:alg>".htmlspecialchars($params['alg_1'])."</secDNS:alg>
2025+
<secDNS:digestType>".htmlspecialchars($params['digestType_1'])."</secDNS:digestType>
2026+
<secDNS:digest>".htmlspecialchars($params['digest_1'])."</secDNS:digest>
2027+
</secDNS:dsData>";
2028+
} else if ($params['dnssec_records'] == 2) {
2029+
$from[] = '/{{ dnssec_data }}/';
2030+
$to[] = "<secDNS:dsData>
2031+
<secDNS:keyTag>".htmlspecialchars($params['keyTag_1'])."</secDNS:keyTag>
2032+
<secDNS:alg>".htmlspecialchars($params['alg_1'])."</secDNS:alg>
2033+
<secDNS:digestType>".htmlspecialchars($params['digestType_1'])."</secDNS:digestType>
2034+
<secDNS:digest>".htmlspecialchars($params['digest_1'])."</secDNS:digest>
2035+
</secDNS:dsData>
2036+
<secDNS:dsData>
2037+
<secDNS:keyTag>".htmlspecialchars($params['keyTag_2'])."</secDNS:keyTag>
2038+
<secDNS:alg>".htmlspecialchars($params['alg_2'])."</secDNS:alg>
2039+
<secDNS:digestType>".htmlspecialchars($params['digestType_2'])."</secDNS:digestType>
2040+
<secDNS:digest>".htmlspecialchars($params['digest_2'])."</secDNS:digest>
2041+
</secDNS:dsData>";
2042+
}
2043+
$from[] = '/{{ authInfoPw }}/';
2044+
$to[] = htmlspecialchars($params['authInfoPw']);
2045+
$from[] = '/{{ clTRID }}/';
2046+
$clTRID = str_replace('.', '', round(microtime(1), 3));
2047+
$to[] = htmlspecialchars($this->prefix . '-domain-createDNSSEC-' . $clTRID);
2048+
$from[] = "/<\w+:\w+>\s*<\/\w+:\w+>\s+/ims";
2049+
$to[] = '';
2050+
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2051+
<epp xmlns="http://www.dns.pl/nask-epp-schema/epp-2.1"
2052+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2053+
xsi:schemaLocation="http://www.dns.pl/nask-epp-schema/epp-2.1
2054+
epp-2.1.xsd">
2055+
<command>
2056+
<create>
2057+
<domain:create
2058+
xmlns:domain="http://www.dns.pl/nask-epp-schema/domain-2.1"
2059+
xsi:schemaLocation="http://www.dns.pl/nask-epp-schema/domain-2.1
2060+
domain-2.1.xsd">
2061+
<domain:name>{{ name }}</domain:name>
2062+
<domain:period unit="y">{{ period }}</domain:period>
2063+
{{ hostObjs }}
2064+
<domain:registrant>{{ registrant }}</domain:registrant>
2065+
{{ contacts }}
2066+
<domain:authInfo>
2067+
<domain:pw>{{ authInfoPw }}</domain:pw>
2068+
</domain:authInfo>
2069+
</domain:create>
2070+
</create>
2071+
<extension>
2072+
<secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
2073+
<secDNS:add>
2074+
{{ dnssec_data }}
2075+
</secDNS:add>
2076+
</secDNS:create>
2077+
</extension>
2078+
<clTRID>{{ clTRID }}</clTRID>
2079+
</command>
2080+
</epp>');
2081+
$r = $this->writeRequest($xml);
2082+
$code = (int)$r->response->result->attributes()->code;
2083+
$msg = (string)$r->response->result->msg;
2084+
$r = $r->response->resData->children('http://www.dns.pl/nask-epp-schema/domain-2.1')->creData;
2085+
$name = (string)$r->name;
2086+
$crDate = (string)$r->crDate;
2087+
$exDate = (string)$r->exDate;
2088+
2089+
$return = array(
2090+
'code' => $code,
2091+
'msg' => $msg,
2092+
'name' => $name,
2093+
'crDate' => $crDate,
2094+
'exDate' => $exDate
2095+
);
2096+
} catch (\Exception $e) {
2097+
$return = array(
2098+
'error' => $e->getMessage()
2099+
);
2100+
}
2101+
2102+
return $return;
2103+
}
18402104

18412105
/**
18422106
* domainRenew

0 commit comments

Comments
 (0)