Small rgp update fixes

This commit is contained in:
Pinga 2023-08-27 01:06:05 +03:00
parent fc1d1b844f
commit 296db82d2a
2 changed files with 14 additions and 10 deletions

View file

@ -940,7 +940,10 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
$domainRem = $xml->xpath('//domain:rem')[0] ?? null; $domainRem = $xml->xpath('//domain:rem')[0] ?? null;
$domainAdd = $xml->xpath('//domain:add')[0] ?? null; $domainAdd = $xml->xpath('//domain:add')[0] ?? null;
$domainChg = $xml->xpath('//domain:chg')[0] ?? null; $domainChg = $xml->xpath('//domain:chg')[0] ?? null;
$extensionNode = $xml->xpath('//extension')[0] ?? null; $extensionNode = $xml->command->extension;
if (isset($extensionNode)) {
$rgp_update = $xml->xpath('//rgp:update')[0] ?? null;
}
if ($domainRem === null && $domainAdd === null && $domainChg === null && $extensionNode === null) { if ($domainRem === null && $domainAdd === null && $domainChg === null && $extensionNode === null) {
sendEppError($conn, 2003, 'At least one domain:rem || domain:add || domain:chg', $clTRID); sendEppError($conn, 2003, 'At least one domain:rem || domain:add || domain:chg', $clTRID);
@ -1268,8 +1271,8 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
} }
} }
if (isset($rgp_update) && $rgp_update) { if (isset($rgp_update)) {
$op_attribute = $xml->xpath('rgp:restore/@op[1]')[0]->__toString(); $op_attribute = (string) $xml->xpath('//rgp:restore/@op[1]')[0];
if ($op_attribute === 'request') { if ($op_attribute === 'request') {
$stmt = $db->prepare("SELECT COUNT(`id`) AS `ids` FROM `domain` WHERE `rgpstatus` = 'redemptionPeriod' AND `id` = :domain_id LIMIT 1"); $stmt = $db->prepare("SELECT COUNT(`id`) AS `ids` FROM `domain` WHERE `rgpstatus` = 'redemptionPeriod' AND `id` = :domain_id LIMIT 1");
@ -1376,7 +1379,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
} }
foreach ($status_list as $node) { foreach ($status_list as $node) {
$status = $node->__toString(); $status = (string) $node;
$stmt = $db->prepare("DELETE FROM `domain_status` WHERE `domain_id` = :domain_id AND `status` = :status"); $stmt = $db->prepare("DELETE FROM `domain_status` WHERE `domain_id` = :domain_id AND `status` = :status");
$stmt->bindParam(':domain_id', $domain_id, PDO::PARAM_INT); $stmt->bindParam(':domain_id', $domain_id, PDO::PARAM_INT);
@ -1556,7 +1559,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
} }
foreach ($status_list as $node) { foreach ($status_list as $node) {
$status = $node->__toString(); $status = (string) $node;
try { try {
$stmt = $db->prepare("INSERT INTO `domain_status` (`domain_id`,`status`) VALUES(:domain_id, :status)"); $stmt = $db->prepare("INSERT INTO `domain_status` (`domain_id`,`status`) VALUES(:domain_id, :status)");
@ -1636,8 +1639,8 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
} }
} }
if (isset($rgp_update) && $rgp_update) { if (isset($rgp_update)) {
$op_attribute = (string)$xml->xpath('//rgp:restore/@op[1]')[0]; $op_attribute = (string) $xml->xpath('//rgp:restore/@op[1]')[0];
if ($op_attribute == 'request') { if ($op_attribute == 'request') {
$sth = $db->prepare("SELECT COUNT(`id`) AS `ids` FROM `domain` WHERE `rgpstatus` = 'redemptionPeriod' AND `id` = ?"); $sth = $db->prepare("SELECT COUNT(`id`) AS `ids` FROM `domain` WHERE `rgpstatus` = 'redemptionPeriod' AND `id` = ?");
@ -1665,11 +1668,11 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
list($registrar_balance, $creditLimit) = $sth->fetch(); list($registrar_balance, $creditLimit) = $sth->fetch();
$sth = $db->prepare("SELECT `m12` FROM `domain_price` WHERE `tldid` = ? AND `command` = 'renew' LIMIT 1"); $sth = $db->prepare("SELECT `m12` FROM `domain_price` WHERE `tldid` = ? AND `command` = 'renew' LIMIT 1");
$sth->execute([$tldid]); $sth->execute([$row['tldid']]);
$renew_price = $sth->fetchColumn(); $renew_price = $sth->fetchColumn();
$sth = $db->prepare("SELECT `price` FROM `domain_restore_price` WHERE `tldid` = ? LIMIT 1"); $sth = $db->prepare("SELECT `price` FROM `domain_restore_price` WHERE `tldid` = ? LIMIT 1");
$sth->execute([$tldid]); $sth->execute([$row['tldid']]);
$restore_price = $sth->fetchColumn(); $restore_price = $sth->fetchColumn();
if (($registrar_balance + $creditLimit) < ($renew_price + $restore_price)) { if (($registrar_balance + $creditLimit) < ($renew_price + $restore_price)) {

View file

@ -75,6 +75,7 @@ $server->handle(function (Connection $conn) use ($table, $db, $c) {
$xml->registerXPathNamespace('domain', 'urn:ietf:params:xml:ns:domain-1.0'); $xml->registerXPathNamespace('domain', 'urn:ietf:params:xml:ns:domain-1.0');
$xml->registerXPathNamespace('contact', 'urn:ietf:params:xml:ns:contact-1.0'); $xml->registerXPathNamespace('contact', 'urn:ietf:params:xml:ns:contact-1.0');
$xml->registerXPathNamespace('host', 'urn:ietf:params:xml:ns:host-1.0'); $xml->registerXPathNamespace('host', 'urn:ietf:params:xml:ns:host-1.0');
$xml->registerXPathNamespace('rgp', 'urn:ietf:params:xml:ns:rgp-1.0');
$xml->registerXPathNamespace('secDNS', 'urn:ietf:params:xml:ns:secDNS-1.1'); $xml->registerXPathNamespace('secDNS', 'urn:ietf:params:xml:ns:secDNS-1.1');
if ($xml === false) { if ($xml === false) {