diff --git a/modules/registrars/cozaepp/cozaeppsync.php b/modules/registrars/cozaepp/cozaeppsync.php index e02daa159a2f59a5f0dc1956b8868be8aa2cfe60..c27643577eb17cc73886a42741960e605976e119 100644 --- a/modules/registrars/cozaepp/cozaeppsync.php +++ b/modules/registrars/cozaepp/cozaeppsync.php @@ -102,11 +102,43 @@ try { continue; } + # Checking for transfer status if transfer in progress + $output = $client->request($xml = ' +<epp:epp xmlns:epp="urn:ietf:params:xml:ns:epp-1.0" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> + <epp:command> + <epp:transfer op="query"> + <domain:transfer> + <domain:name>'.$domain.'</domain:name> + </domain:transfer> + </epp:transfer> + </epp:command> +</epp:epp>'); + + $transferstatus = ''; + + # parsing for transfer status + $doc= new DOMDocument(); + $doc->loadXML($output); + $coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code'); + if($coderes == '1000') { + if( $doc->getElementsByTagName('trnData')) { + if($doc->getElementsByTagName('trnData')->item(0)->getElementsByTagName('trStatus')->item(0)) { + $transferstatus = $doc->getElementsByTagName('trnData')->item(0)->getElementsByTagName('trStatus')->item(0)->nodeValue; + } else { + $transferstatus = "Domain $domain not being transfered!"; + continue; + } + } + } else { + echo "Domain check on $domain not successful: "._cozaepp_message($coderes)." (File a bug report here: http://devlabs.linuxassist.net/projects/whmcs-coza-epp/issues/new)"; + continue; + } + # This is the template we going to use below for our updates $querytemplate = "UPDATE tbldomains SET status = '%s', registrationdate = '%s', expirydate = '%s', nextduedate = '%s' WHERE domain = '%s'"; # Check status and update - if ($statusres == "ok") { + if ($statusres == "ok" || $transferstatus == "clientApproved") { mysql_query(sprintf($querytemplate,"Active", mysql_real_escape_string($createdate), mysql_real_escape_string($nextduedate), @@ -115,14 +147,14 @@ try { )); echo "Updated $domain expiry to $nextduedate\n"; - } elseif ($statusres == "serverHold") { - mysql_query(sprintf($querytemplate,"Active", + } elseif ($statusres == "serverHold" || $transferstatus == "pending") { + mysql_query(sprintf($querytemplate,"Pending", mysql_real_escape_string($createdate), mysql_real_escape_string($nextduedate), mysql_real_escape_string($nextduedate), mysql_real_escape_string($domain) )); - echo "Updated $domain expiry to $nextduedate\n"; + echo "Domain $domain is PENDING (Registration: $createdate, Expiry: $nextduedate)\n"; } elseif ($statusres == "expired" || $statusres == "pendingDelete" || $statusres == "inactive") { mysql_query(sprintf($querytemplate,"Expired",