feat: add payment method support for domain registration
Extended the EPP registrar module to include payment method fields `card_id` and `card_cvc`, allowing for direct payment processing during domain registration and renewal processes. This update enables more streamlined transactions by incorporating payment details directly within the domain provisioning workflow, addressing previous limitations that required separate payment handling. This change introduces new configuration options for storing payment method details securely and modifies the domain registration and renewal XML requests to include these details as per the updated EPP standard. Ensure proper handling and storage of these sensitive details in compliance with applicable security standards.
This commit is contained in:
parent
66c0c8e0e6
commit
0047b66f53
1 changed files with 310 additions and 296 deletions
586
ISNIC.php
586
ISNIC.php
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indera EPP registrar module for FOSSBilling (https://fossbilling.org/)
|
* Indera EPP registrar module for FOSSBilling (https://fossbilling.org/)
|
||||||
*
|
*
|
||||||
|
@ -10,119 +11,146 @@
|
||||||
*/
|
*/
|
||||||
class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
{
|
{
|
||||||
public $config = array();
|
public $config = array();
|
||||||
public $socket;
|
public $socket;
|
||||||
public $isLogined;
|
public $isLogined;
|
||||||
|
|
||||||
public function __construct($options)
|
public function __construct($options)
|
||||||
{
|
{
|
||||||
if(isset($options['username'])) {
|
if (isset($options['username'])) {
|
||||||
$this->config['username'] = $options['username'];
|
$this->config['username'] = $options['username'];
|
||||||
}
|
}
|
||||||
if(isset($options['password'])) {
|
if (isset($options['password'])) {
|
||||||
$this->config['password'] = $options['password'];
|
$this->config['password'] = $options['password'];
|
||||||
}
|
}
|
||||||
if(isset($options['host'])) {
|
if (isset($options['host'])) {
|
||||||
$this->config['host'] = $options['host'];
|
$this->config['host'] = $options['host'];
|
||||||
}
|
}
|
||||||
if(isset($options['port'])) {
|
if (isset($options['port'])) {
|
||||||
$this->config['port'] = $options['port'];
|
$this->config['port'] = $options['port'];
|
||||||
}
|
}
|
||||||
if(isset($options['registrarprefix'])) {
|
if (isset($options['registrarprefix'])) {
|
||||||
$this->config['registrarprefix'] = $options['registrarprefix'];
|
$this->config['registrarprefix'] = $options['registrarprefix'];
|
||||||
}
|
}
|
||||||
if(isset($options['ssl_cert'])) {
|
if (isset($options['ssl_cert'])) {
|
||||||
$this->config['ssl_cert'] = $options['ssl_cert'];
|
$this->config['ssl_cert'] = $options['ssl_cert'];
|
||||||
}
|
}
|
||||||
if(isset($options['ssl_key'])) {
|
if (isset($options['ssl_key'])) {
|
||||||
$this->config['ssl_key'] = $options['ssl_key'];
|
$this->config['ssl_key'] = $options['ssl_key'];
|
||||||
}
|
}
|
||||||
if(isset($options['ssl_ca'])) {
|
if (isset($options['ssl_ca'])) {
|
||||||
$this->config['ssl_ca'] = $options['ssl_ca'];
|
$this->config['ssl_ca'] = $options['ssl_ca'];
|
||||||
}
|
}
|
||||||
if(isset($options['use_tls_12'])) {
|
if (isset($options['use_tls_12'])) {
|
||||||
$this->config['use_tls_12'] = (bool)$options['use_tls_12'];
|
$this->config['use_tls_12'] = (bool)$options['use_tls_12'];
|
||||||
} else {
|
} else {
|
||||||
$this->config['use_tls_12'] = false;
|
$this->config['use_tls_12'] = false;
|
||||||
}
|
}
|
||||||
}
|
if (isset($options['card_id'])) {
|
||||||
|
$this->config['card_id'] = $options['card_id'];
|
||||||
|
}
|
||||||
|
if (isset($options['card_cvc'])) {
|
||||||
|
$this->config['card_cvc'] = $options['card_cvc'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getTlds()
|
public function getTlds()
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getConfig()
|
public static function getConfig()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'label' => 'An EPP registry module allows registrars to manage and register domain names using the Extensible Provisioning Protocol (EPP). All details below are typically provided by the domain registry and are used to authenticate your account when connecting to the EPP server.',
|
'label' => 'An EPP registry module allows registrars to manage and register domain names using the Extensible Provisioning Protocol (EPP). All details below are typically provided by the domain registry and are used to authenticate your account when connecting to the EPP server.',
|
||||||
'form' => array(
|
'form' => array(
|
||||||
'username' => array('text', array(
|
'username' => array(
|
||||||
'label' => 'EPP Server Username',
|
'text', array(
|
||||||
'required' => true,
|
'label' => 'EPP Server Username',
|
||||||
),
|
'required' => true,
|
||||||
),
|
),
|
||||||
'password' => array('password', array(
|
),
|
||||||
'label' => 'EPP Server Password',
|
'password' => array(
|
||||||
'required' => true,
|
'password', array(
|
||||||
'renderPassword' => true,
|
'label' => 'EPP Server Password',
|
||||||
),
|
'required' => true,
|
||||||
),
|
'renderPassword' => true,
|
||||||
'host' => array('text', array(
|
),
|
||||||
'label' => 'EPP Server Host',
|
),
|
||||||
'required' => true,
|
'host' => array(
|
||||||
),
|
'text', array(
|
||||||
),
|
'label' => 'EPP Server Host',
|
||||||
'port' => array('text', array(
|
'required' => true,
|
||||||
'label' => 'EPP Server Port',
|
),
|
||||||
'required' => true,
|
),
|
||||||
),
|
'port' => array(
|
||||||
),
|
'text', array(
|
||||||
'registrarprefix' => array('text', array(
|
'label' => 'EPP Server Port',
|
||||||
'label' => 'Registrar Prefix',
|
'required' => true,
|
||||||
'required' => true,
|
),
|
||||||
),
|
),
|
||||||
),
|
'registrarprefix' => array(
|
||||||
'ssl_cert' => array('text', array(
|
'text', array(
|
||||||
'label' => 'SSL Certificate Path',
|
'label' => 'Registrar Prefix',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'ssl_key' => array('text', array(
|
'ssl_cert' => array(
|
||||||
'label' => 'SSL Key Path',
|
'text', array(
|
||||||
'required' => true,
|
'label' => 'SSL Certificate Path',
|
||||||
),
|
'required' => true,
|
||||||
),
|
),
|
||||||
'ssl_ca' => array('text', array(
|
),
|
||||||
'label' => 'SSL CA Path',
|
'ssl_key' => array(
|
||||||
'required' => false,
|
'text', array(
|
||||||
),
|
'label' => 'SSL Key Path',
|
||||||
),
|
'required' => true,
|
||||||
'use_tls_12' => array('radio', array(
|
),
|
||||||
'multiOptions' => array('1'=>'Yes', '0'=>'No'),
|
),
|
||||||
'label' => 'Use TLS 1.2 instead of 1.3',
|
'ssl_ca' => array(
|
||||||
),
|
'text', array(
|
||||||
),
|
'label' => 'SSL CA Path',
|
||||||
),
|
'required' => false,
|
||||||
);
|
),
|
||||||
}
|
),
|
||||||
|
'use_tls_12' => array(
|
||||||
|
'radio', array(
|
||||||
|
'multiOptions' => array('1' => 'Yes', '0' => 'No'),
|
||||||
|
'label' => 'Use TLS 1.2 instead of 1.3',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'card_id' => array(
|
||||||
|
'text', array(
|
||||||
|
'label' => 'Card ID of the payment method',
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'card_cvc' => array(
|
||||||
|
'text', array(
|
||||||
|
'label' => 'Card CVC',
|
||||||
|
'required' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function isDomaincanBeTransferred(Registrar_Domain $domain)
|
public function isDomaincanBeTransferred(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Checking if domain can be transferred: ' . $domain->getName());
|
$this->getLog()->debug('Checking if domain can be transferred: ' . $domain->getName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isDomainAvailable(Registrar_Domain $domain)
|
public function isDomainAvailable(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Checking domain availability: ' . $domain->getName());
|
$this->getLog()->debug('Checking domain availability: ' . $domain->getName());
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
$this->login();
|
$this->login();
|
||||||
$from = $to = array();
|
$from = $to = array();
|
||||||
$from[] = '/{{ name }}/';
|
$from[] = '/{{ name }}/';
|
||||||
$to[] = htmlspecialchars($domain->getName());
|
$to[] = htmlspecialchars($domain->getName());
|
||||||
$from[] = '/{{ clTRID }}/';
|
$from[] = '/{{ clTRID }}/';
|
||||||
$clTRID = str_replace('.', '', round(microtime(1) , 3));
|
$clTRID = str_replace('.', '', round(microtime(1), 3));
|
||||||
$to[] = htmlspecialchars($this->config['registrarprefix'] . '-domain-check-' . $clTRID);
|
$to[] = htmlspecialchars($this->config['registrarprefix'] . '-domain-check-' . $clTRID);
|
||||||
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
|
||||||
|
@ -144,27 +172,25 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->chkData;
|
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->chkData;
|
||||||
$reason = (string)$r->cd[0]->reason;
|
$reason = (string)$r->cd[0]->reason;
|
||||||
|
|
||||||
if ($reason)
|
if ($reason) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!empty($s))
|
if (!empty($s)) {
|
||||||
{
|
|
||||||
$this->logout();
|
$this->logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function modifyNs(Registrar_Domain $domain)
|
public function modifyNs(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Modifying nameservers: ' . $domain->getName());
|
$this->getLog()->debug('Modifying nameservers: ' . $domain->getName());
|
||||||
$this->getLog()->debug('Ns1: ' . $domain->getNs1());
|
$this->getLog()->debug('Ns1: ' . $domain->getNs1());
|
||||||
$this->getLog()->debug('Ns2: ' . $domain->getNs2());
|
$this->getLog()->debug('Ns2: ' . $domain->getNs2());
|
||||||
$this->getLog()->debug('Ns3: ' . $domain->getNs3());
|
$this->getLog()->debug('Ns3: ' . $domain->getNs3());
|
||||||
$this->getLog()->debug('Ns4: ' . $domain->getNs4());
|
$this->getLog()->debug('Ns4: ' . $domain->getNs4());
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
|
@ -194,7 +220,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
||||||
$add = $rem = array();
|
$add = $rem = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($r->ns->hostObj as $ns) {
|
foreach ($r->ns->hostObj as $ns) {
|
||||||
$i++;
|
$i++;
|
||||||
$ns = (string)$ns;
|
$ns = (string)$ns;
|
||||||
if (!$ns) {
|
if (!$ns) {
|
||||||
|
@ -205,31 +231,31 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (range(1, 4) as $i) {
|
foreach (range(1, 4) as $i) {
|
||||||
$k = "getNs$i";
|
$k = "getNs$i";
|
||||||
$v = $domain->{$k}();
|
$v = $domain->{$k}();
|
||||||
if (!$v) {
|
if (!$v) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($k0 = array_search($v, $rem)) {
|
if ($k0 = array_search($v, $rem)) {
|
||||||
unset($rem[$k0]);
|
unset($rem[$k0]);
|
||||||
} else {
|
} else {
|
||||||
$add["ns$i"] = $v;
|
$add["ns$i"] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($add) || !empty($rem)) {
|
if (!empty($add) || !empty($rem)) {
|
||||||
$from = $to = array();
|
$from = $to = array();
|
||||||
$text = '';
|
$text = '';
|
||||||
foreach($add as $k => $v) {
|
foreach ($add as $k => $v) {
|
||||||
$text.= '<domain:hostObj>' . $v . '</domain:hostObj>' . "\n";
|
$text .= '<domain:hostObj>' . $v . '</domain:hostObj>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$from[] = '/{{ add }}/';
|
$from[] = '/{{ add }}/';
|
||||||
$to[] = (empty($text) ? '' : "<domain:add><domain:ns>\n{$text}</domain:ns></domain:add>\n");
|
$to[] = (empty($text) ? '' : "<domain:add><domain:ns>\n{$text}</domain:ns></domain:add>\n");
|
||||||
$text = '';
|
$text = '';
|
||||||
foreach($rem as $k => $v) {
|
foreach ($rem as $k => $v) {
|
||||||
$text.= '<domain:hostObj>' . $v . '</domain:hostObj>' . "\n";
|
$text .= '<domain:hostObj>' . $v . '</domain:hostObj>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$from[] = '/{{ rem }}/';
|
$from[] = '/{{ rem }}/';
|
||||||
|
@ -258,9 +284,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -271,12 +295,12 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transferDomain(Registrar_Domain $domain)
|
public function transferDomain(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Transfering domain: ' . $domain->getName());
|
$this->getLog()->debug('Transfering domain: ' . $domain->getName());
|
||||||
$this->getLog()->debug('Epp code: ' . $domain->getEpp());
|
$this->getLog()->debug('Epp code: ' . $domain->getEpp());
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
|
@ -309,9 +333,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->trnData;
|
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->trnData;
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -322,11 +344,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDomainDetails(Registrar_Domain $domain)
|
public function getDomainDetails(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Getting domain details: ' . $domain->getName());
|
$this->getLog()->debug('Getting domain details: ' . $domain->getName());
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
$this->login();
|
$this->login();
|
||||||
|
@ -360,14 +382,14 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$status = array();
|
$status = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($r->status as $e) {
|
foreach ($r->status as $e) {
|
||||||
$i++;
|
$i++;
|
||||||
$status[$i] = (string)$e->attributes()->s;
|
$status[$i] = (string)$e->attributes()->s;
|
||||||
}
|
}
|
||||||
$ns = array();
|
$ns = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($r->ns->hostObj as $hostObj) {
|
foreach ($r->ns->hostObj as $hostObj) {
|
||||||
$i++;
|
$i++;
|
||||||
$ns[$i] = (string)$hostObj;
|
$ns[$i] = (string)$hostObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
$crDate = strtotime($crDate);
|
$crDate = strtotime($crDate);
|
||||||
|
@ -381,9 +403,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$domain->setNs2(isset($ns[1]) ? $ns[1] : '');
|
$domain->setNs2(isset($ns[1]) ? $ns[1] : '');
|
||||||
$domain->setNs3(isset($ns[2]) ? $ns[2] : '');
|
$domain->setNs3(isset($ns[2]) ? $ns[2] : '');
|
||||||
$domain->setNs4(isset($ns[3]) ? $ns[3] : '');
|
$domain->setNs4(isset($ns[3]) ? $ns[3] : '');
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$domain = array(
|
$domain = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -394,11 +414,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $domain;
|
return $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteDomain(Registrar_Domain $domain)
|
public function deleteDomain(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Removing domain: ' . $domain->getName());
|
$this->getLog()->debug('Removing domain: ' . $domain->getName());
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
|
@ -424,9 +444,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
</command>
|
</command>
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -437,11 +455,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerDomain(Registrar_Domain $domain)
|
public function registerDomain(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Registering domain: ' . $domain->getName(). ' for '.$domain->getRegistrationPeriod(). ' years');
|
$this->getLog()->debug('Registering domain: ' . $domain->getName() . ' for ' . $domain->getRegistrationPeriod() . ' years');
|
||||||
$client = $domain->getContactRegistrar();
|
$client = $domain->getContactRegistrar();
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
|
@ -500,7 +518,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$from[] = '/{{ country }}/';
|
$from[] = '/{{ country }}/';
|
||||||
$to[] = htmlspecialchars($client->getCountry());
|
$to[] = htmlspecialchars($client->getCountry());
|
||||||
$from[] = '/{{ phonenumber }}/';
|
$from[] = '/{{ phonenumber }}/';
|
||||||
$to[] = htmlspecialchars('+'.$client->getTelCc().'.'.$client->getTel());
|
$to[] = htmlspecialchars('+' . $client->getTelCc() . '.' . $client->getTel());
|
||||||
$from[] = '/{{ email }}/';
|
$from[] = '/{{ email }}/';
|
||||||
$to[] = htmlspecialchars($client->getEmail());
|
$to[] = htmlspecialchars($client->getEmail());
|
||||||
$from[] = '/{{ authInfo }}/';
|
$from[] = '/{{ authInfo }}/';
|
||||||
|
@ -605,33 +623,33 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$to[] = htmlspecialchars($domain->getName());
|
$to[] = htmlspecialchars($domain->getName());
|
||||||
$from[] = '/{{ period }}/';
|
$from[] = '/{{ period }}/';
|
||||||
$to[] = htmlspecialchars($domain->getRegistrationPeriod());
|
$to[] = htmlspecialchars($domain->getRegistrationPeriod());
|
||||||
if($domain->getNs1()) {
|
if ($domain->getNs1()) {
|
||||||
$from[] = '/{{ ns1 }}/';
|
$from[] = '/{{ ns1 }}/';
|
||||||
$to[] = htmlspecialchars($domain->getNs1());
|
$to[] = htmlspecialchars($domain->getNs1());
|
||||||
} else {
|
} else {
|
||||||
$from[] = '/{{ ns1 }}/';
|
$from[] = '/{{ ns1 }}/';
|
||||||
$to[] = '';
|
$to[] = '';
|
||||||
}
|
}
|
||||||
if($domain->getNs2()) {
|
if ($domain->getNs2()) {
|
||||||
$from[] = '/{{ ns2 }}/';
|
$from[] = '/{{ ns2 }}/';
|
||||||
$to[] = htmlspecialchars($domain->getNs2());
|
$to[] = htmlspecialchars($domain->getNs2());
|
||||||
} else {
|
} else {
|
||||||
$from[] = '/{{ ns2 }}/';
|
$from[] = '/{{ ns2 }}/';
|
||||||
$to[] = '';
|
$to[] = '';
|
||||||
}
|
}
|
||||||
if($domain->getNs3()) {
|
if ($domain->getNs3()) {
|
||||||
$from[] = '/{{ ns3 }}/';
|
$from[] = '/{{ ns3 }}/';
|
||||||
$to[] = htmlspecialchars($domain->getNs3());
|
$to[] = htmlspecialchars($domain->getNs3());
|
||||||
} else {
|
} else {
|
||||||
$from[] = '/{{ ns3 }}/';
|
$from[] = '/{{ ns3 }}/';
|
||||||
$to[] = '';
|
$to[] = '';
|
||||||
}
|
}
|
||||||
if($domain->getNs4()) {
|
if ($domain->getNs4()) {
|
||||||
$from[] = '/{{ ns4 }}/';
|
$from[] = '/{{ ns4 }}/';
|
||||||
$to[] = htmlspecialchars($domain->getNs4());
|
$to[] = htmlspecialchars($domain->getNs4());
|
||||||
} else {
|
} else {
|
||||||
$from[] = '/{{ ns4 }}/';
|
$from[] = '/{{ ns4 }}/';
|
||||||
$to[] = '';
|
$to[] = '';
|
||||||
}
|
}
|
||||||
$from[] = '/{{ cID_1 }}/';
|
$from[] = '/{{ cID_1 }}/';
|
||||||
$to[] = htmlspecialchars($contacts);
|
$to[] = htmlspecialchars($contacts);
|
||||||
|
@ -673,13 +691,17 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
</domain:authInfo>
|
</domain:authInfo>
|
||||||
</domain:create>
|
</domain:create>
|
||||||
</create>
|
</create>
|
||||||
|
<extension>
|
||||||
|
<is-ext-domain:create>
|
||||||
|
<is-ext-domain:cardID>{{ card_id }}</is-ext-domain:cardID>
|
||||||
|
<is-ext-domain:cardCVC>{{ card_cvc }}</is-ext-domain:cardCVC>
|
||||||
|
</is-ext-domain:create>
|
||||||
|
</extension>
|
||||||
<clTRID>{{ clTRID }}</clTRID>
|
<clTRID>{{ clTRID }}</clTRID>
|
||||||
</command>
|
</command>
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -690,11 +712,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renewDomain(Registrar_Domain $domain)
|
public function renewDomain(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Renewing domain: ' . $domain->getName());
|
$this->getLog()->debug('Renewing domain: ' . $domain->getName());
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
|
@ -745,13 +767,17 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
<domain:period unit="y">1</domain:period>
|
<domain:period unit="y">1</domain:period>
|
||||||
</domain:renew>
|
</domain:renew>
|
||||||
</renew>
|
</renew>
|
||||||
|
<extension>
|
||||||
|
<is-ext-domain:renew>
|
||||||
|
<is-ext-domain:cardID>{{ card_id }}</is-ext-domain:cardID>
|
||||||
|
<is-ext-domain:cardCVC>{{ card_cvc }}</is-ext-domain:cardCVC>
|
||||||
|
</is-ext-domain:renew>
|
||||||
|
</extension>
|
||||||
<clTRID>{{ clTRID }}</clTRID>
|
<clTRID>{{ clTRID }}</clTRID>
|
||||||
</command>
|
</command>
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -762,11 +788,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function modifyContact(Registrar_Domain $domain)
|
public function modifyContact(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Updating contact info: ' . $domain->getName());
|
$this->getLog()->debug('Updating contact info: ' . $domain->getName());
|
||||||
$client = $domain->getContactRegistrar();
|
$client = $domain->getContactRegistrar();
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
|
@ -816,7 +842,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$from[] = '/{{ country }}/';
|
$from[] = '/{{ country }}/';
|
||||||
$to[] = htmlspecialchars($client->getCountry());
|
$to[] = htmlspecialchars($client->getCountry());
|
||||||
$from[] = '/{{ phonenumber }}/';
|
$from[] = '/{{ phonenumber }}/';
|
||||||
$to[] = htmlspecialchars('+'.$client->getTelCc().'.'.$client->getTel());
|
$to[] = htmlspecialchars('+' . $client->getTelCc() . '.' . $client->getTel());
|
||||||
$from[] = '/{{ email }}/';
|
$from[] = '/{{ email }}/';
|
||||||
$to[] = htmlspecialchars($client->getEmail());
|
$to[] = htmlspecialchars($client->getEmail());
|
||||||
$from[] = '/{{ clTRID }}/';
|
$from[] = '/{{ clTRID }}/';
|
||||||
|
@ -853,9 +879,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
</command>
|
</command>
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -866,11 +890,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enablePrivacyProtection(Registrar_Domain $domain)
|
public function enablePrivacyProtection(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Enabling Privacy protection: ' . $domain->getName());
|
$this->getLog()->debug('Enabling Privacy protection: ' . $domain->getName());
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
|
@ -900,13 +924,13 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
||||||
$dcontact = array();
|
$dcontact = array();
|
||||||
$dcontact['registrant'] = (string)$r->registrant;
|
$dcontact['registrant'] = (string)$r->registrant;
|
||||||
foreach($r->contact as $e) {
|
foreach ($r->contact as $e) {
|
||||||
$type = (string)$e->attributes()->type;
|
$type = (string)$e->attributes()->type;
|
||||||
$dcontact[$type] = (string)$e;
|
$dcontact[$type] = (string)$e;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact = array();
|
$contact = array();
|
||||||
foreach($dcontact as $id) {
|
foreach ($dcontact as $id) {
|
||||||
if (isset($contact[$id])) {
|
if (isset($contact[$id])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -916,7 +940,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$from[] = '/{{ flag }}/';
|
$from[] = '/{{ flag }}/';
|
||||||
$to[] = 1;
|
$to[] = 1;
|
||||||
$from[] = '/{{ clTRID }}/';
|
$from[] = '/{{ clTRID }}/';
|
||||||
$clTRID = str_replace('.', '', round(microtime(1) , 3));
|
$clTRID = str_replace('.', '', round(microtime(1), 3));
|
||||||
$to[] = htmlspecialchars($this->config['registrarprefix'] . '-contact-update-' . $clTRID);
|
$to[] = htmlspecialchars($this->config['registrarprefix'] . '-contact-update-' . $clTRID);
|
||||||
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
|
||||||
|
@ -943,9 +967,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -956,11 +978,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disablePrivacyProtection(Registrar_Domain $domain)
|
public function disablePrivacyProtection(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Disabling Privacy protection: ' . $domain->getName());
|
$this->getLog()->debug('Disabling Privacy protection: ' . $domain->getName());
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
|
@ -990,13 +1012,13 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
||||||
$dcontact = array();
|
$dcontact = array();
|
||||||
$dcontact['registrant'] = (string)$r->registrant;
|
$dcontact['registrant'] = (string)$r->registrant;
|
||||||
foreach($r->contact as $e) {
|
foreach ($r->contact as $e) {
|
||||||
$type = (string)$e->attributes()->type;
|
$type = (string)$e->attributes()->type;
|
||||||
$dcontact[$type] = (string)$e;
|
$dcontact[$type] = (string)$e;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact = array();
|
$contact = array();
|
||||||
foreach($dcontact as $id) {
|
foreach ($dcontact as $id) {
|
||||||
if (isset($contact[$id])) {
|
if (isset($contact[$id])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1006,7 +1028,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$from[] = '/{{ flag }}/';
|
$from[] = '/{{ flag }}/';
|
||||||
$to[] = 0;
|
$to[] = 0;
|
||||||
$from[] = '/{{ clTRID }}/';
|
$from[] = '/{{ clTRID }}/';
|
||||||
$clTRID = str_replace('.', '', round(microtime(1) , 3));
|
$clTRID = str_replace('.', '', round(microtime(1), 3));
|
||||||
$to[] = htmlspecialchars($this->config['registrarprefix'] . '-contact-update-' . $clTRID);
|
$to[] = htmlspecialchars($this->config['registrarprefix'] . '-contact-update-' . $clTRID);
|
||||||
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
$xml = preg_replace($from, $to, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
|
||||||
|
@ -1033,9 +1055,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -1046,11 +1066,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEpp(Registrar_Domain $domain)
|
public function getEpp(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Retrieving domain transfer code: ' . $domain->getName());
|
$this->getLog()->debug('Retrieving domain transfer code: ' . $domain->getName());
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
|
@ -1081,12 +1101,10 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$eppcode = (string)$r->authInfo->pw;
|
$eppcode = (string)$r->authInfo->pw;
|
||||||
|
|
||||||
if (!empty($s)) {
|
if (!empty($s)) {
|
||||||
$this->logout();
|
$this->logout();
|
||||||
}
|
}
|
||||||
return $eppcode;
|
return $eppcode;
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -1097,11 +1115,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lock(Registrar_Domain $domain)
|
public function lock(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Locking domain: ' . $domain->getName());
|
$this->getLog()->debug('Locking domain: ' . $domain->getName());
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
|
@ -1130,7 +1148,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
||||||
$status = array();
|
$status = array();
|
||||||
foreach($r->status as $e) {
|
foreach ($r->status as $e) {
|
||||||
$st = (string)$e->attributes()->s;
|
$st = (string)$e->attributes()->s;
|
||||||
if (!preg_match("/^client.+Prohibited$/i", $st)) {
|
if (!preg_match("/^client.+Prohibited$/i", $st)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1140,7 +1158,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$add = array();
|
$add = array();
|
||||||
foreach(array(
|
foreach (array(
|
||||||
'clientUpdateProhibited',
|
'clientUpdateProhibited',
|
||||||
'clientDeleteProhibited',
|
'clientDeleteProhibited',
|
||||||
'clientTransferProhibited'
|
'clientTransferProhibited'
|
||||||
|
@ -1152,8 +1170,8 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
|
|
||||||
if (!empty($add)) {
|
if (!empty($add)) {
|
||||||
$text = '';
|
$text = '';
|
||||||
foreach($add as $st) {
|
foreach ($add as $st) {
|
||||||
$text.= '<domain:status s="' . $st . '" lang="en"></domain:status>' . "\n";
|
$text .= '<domain:status s="' . $st . '" lang="en"></domain:status>' . "\n";
|
||||||
}
|
}
|
||||||
$from[] = '/{{ add }}/';
|
$from[] = '/{{ add }}/';
|
||||||
$to[] = (empty($text) ? '' : "<domain:add>\n{$text}</domain:add>\n");
|
$to[] = (empty($text) ? '' : "<domain:add>\n{$text}</domain:add>\n");
|
||||||
|
@ -1180,9 +1198,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -1193,11 +1209,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unlock(Registrar_Domain $domain)
|
public function unlock(Registrar_Domain $domain)
|
||||||
{
|
{
|
||||||
$this->getLog()->debug('Unlocking: ' . $domain->getName());
|
$this->getLog()->debug('Unlocking: ' . $domain->getName());
|
||||||
$return = array();
|
$return = array();
|
||||||
try {
|
try {
|
||||||
$s = $this->connect();
|
$s = $this->connect();
|
||||||
|
@ -1226,7 +1242,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
$r = $r->response->resData->children('urn:ietf:params:xml:ns:domain-1.0')->infData;
|
||||||
$status = array();
|
$status = array();
|
||||||
foreach($r->status as $e) {
|
foreach ($r->status as $e) {
|
||||||
$st = (string)$e->attributes()->s;
|
$st = (string)$e->attributes()->s;
|
||||||
if (!preg_match("/^client.+Prohibited$/i", $st)) {
|
if (!preg_match("/^client.+Prohibited$/i", $st)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1236,7 +1252,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$rem = array();
|
$rem = array();
|
||||||
foreach(array(
|
foreach (array(
|
||||||
'clientUpdateProhibited',
|
'clientUpdateProhibited',
|
||||||
'clientDeleteProhibited',
|
'clientDeleteProhibited',
|
||||||
'clientTransferProhibited'
|
'clientTransferProhibited'
|
||||||
|
@ -1248,8 +1264,8 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
|
|
||||||
if (!empty($rem)) {
|
if (!empty($rem)) {
|
||||||
$text = '';
|
$text = '';
|
||||||
foreach($rem as $st) {
|
foreach ($rem as $st) {
|
||||||
$text.= '<domain:status s="' . $st . '" lang="en"></domain:status>' . "\n";
|
$text .= '<domain:status s="' . $st . '" lang="en"></domain:status>' . "\n";
|
||||||
}
|
}
|
||||||
$from[] = '/{{ rem }}/';
|
$from[] = '/{{ rem }}/';
|
||||||
$to[] = (empty($text) ? '' : "<domain:rem>\n{$text}</domain:rem>\n");
|
$to[] = (empty($text) ? '' : "<domain:rem>\n{$text}</domain:rem>\n");
|
||||||
|
@ -1276,9 +1292,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
</epp>');
|
</epp>');
|
||||||
$r = $this->write($xml, __FUNCTION__);
|
$r = $this->write($xml, __FUNCTION__);
|
||||||
}
|
}
|
||||||
}
|
} catch (exception $e) {
|
||||||
|
|
||||||
catch(exception $e) {
|
|
||||||
$return = array(
|
$return = array(
|
||||||
'error' => $e->getMessage()
|
'error' => $e->getMessage()
|
||||||
);
|
);
|
||||||
|
@ -1289,7 +1303,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function connect()
|
public function connect()
|
||||||
{
|
{
|
||||||
|
@ -1309,11 +1323,11 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
);
|
);
|
||||||
$context = stream_context_create($opts);
|
$context = stream_context_create($opts);
|
||||||
if ($this->config['use_tls_12'] === true) {
|
if ($this->config['use_tls_12'] === true) {
|
||||||
$tls = 'tlsv1.2';
|
$tls = 'tlsv1.2';
|
||||||
} else {
|
} else {
|
||||||
$tls = 'tlsv1.3';
|
$tls = 'tlsv1.3';
|
||||||
}
|
}
|
||||||
$this->socket = stream_socket_client($tls."://{$host}:{$port}", $errno, $errmsg, $timeout, STREAM_CLIENT_CONNECT, $context);
|
$this->socket = stream_socket_client($tls . "://{$host}:{$port}", $errno, $errmsg, $timeout, STREAM_CLIENT_CONNECT, $context);
|
||||||
|
|
||||||
if (!$this->socket) {
|
if (!$this->socket) {
|
||||||
throw new exception("Cannot connect to server '{$host}': {$errmsg}");
|
throw new exception("Cannot connect to server '{$host}': {$errmsg}");
|
||||||
|
@ -1387,40 +1401,40 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
|
|
||||||
public function read()
|
public function read()
|
||||||
{
|
{
|
||||||
$hdr = stream_get_contents($this->socket, 4);
|
$hdr = stream_get_contents($this->socket, 4);
|
||||||
if ($hdr === false) {
|
if ($hdr === false) {
|
||||||
throw new exception('Connection appears to have closed.');
|
throw new exception('Connection appears to have closed.');
|
||||||
}
|
}
|
||||||
if (strlen($hdr) < 4) {
|
if (strlen($hdr) < 4) {
|
||||||
throw new exception('Failed to read header from the connection.');
|
throw new exception('Failed to read header from the connection.');
|
||||||
}
|
}
|
||||||
$unpacked = unpack('N', $hdr);
|
$unpacked = unpack('N', $hdr);
|
||||||
$xml = fread($this->socket, ($unpacked[1] - 4));
|
$xml = fread($this->socket, ($unpacked[1] - 4));
|
||||||
$xml = preg_replace('/></', ">\n<", $xml);
|
$xml = preg_replace('/></', ">\n<", $xml);
|
||||||
return $xml;
|
return $xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function write($xml)
|
public function write($xml)
|
||||||
{
|
{
|
||||||
if (fwrite($this->socket, pack('N', (strlen($xml) + 4)) . $xml) === false) {
|
if (fwrite($this->socket, pack('N', (strlen($xml) + 4)) . $xml) === false) {
|
||||||
throw new exception('Error writing to the connection.');
|
throw new exception('Error writing to the connection.');
|
||||||
}
|
}
|
||||||
$xml_string = $this->read();
|
$xml_string = $this->read();
|
||||||
libxml_use_internal_errors(true);
|
libxml_use_internal_errors(true);
|
||||||
|
|
||||||
$r = simplexml_load_string($xml_string, 'SimpleXMLElement', LIBXML_DTDLOAD | LIBXML_NOENT);
|
$r = simplexml_load_string($xml_string, 'SimpleXMLElement', LIBXML_DTDLOAD | LIBXML_NOENT);
|
||||||
if ($r instanceof SimpleXMLElement) {
|
if ($r instanceof SimpleXMLElement) {
|
||||||
$r->registerXPathNamespace('e', 'urn:ietf:params:xml:ns:epp-1.0');
|
$r->registerXPathNamespace('e', 'urn:ietf:params:xml:ns:epp-1.0');
|
||||||
$r->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
$r->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
||||||
$r->registerXPathNamespace('domain', 'urn:ietf:params:xml:ns:domain-1.0');
|
$r->registerXPathNamespace('domain', 'urn:ietf:params:xml:ns:domain-1.0');
|
||||||
$r->registerXPathNamespace('contact', 'urn:ietf:params:xml:ns:contact-1.0');
|
$r->registerXPathNamespace('contact', 'urn:ietf:params:xml:ns:contact-1.0');
|
||||||
$r->registerXPathNamespace('host', 'urn:ietf:params:xml:ns:host-1.0');
|
$r->registerXPathNamespace('host', 'urn:ietf:params:xml:ns:host-1.0');
|
||||||
$r->registerXPathNamespace('rgp', 'urn:ietf:params:xml:ns:rgp-1.0');
|
$r->registerXPathNamespace('rgp', 'urn:ietf:params:xml:ns:rgp-1.0');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($r->response) && $r->response->result->attributes()->code >= 2000) {
|
if (isset($r->response) && $r->response->result->attributes()->code >= 2000) {
|
||||||
throw new exception($r->response->result->msg);
|
throw new exception($r->response->result->msg);
|
||||||
}
|
}
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1429,7 +1443,7 @@ class Registrar_Adapter_ISNIC extends Registrar_AdapterAbstract
|
||||||
{
|
{
|
||||||
$result = fclose($this->socket);
|
$result = fclose($this->socket);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new exception('Error closing the connection.');
|
throw new exception('Error closing the connection.');
|
||||||
}
|
}
|
||||||
$this->socket = null;
|
$this->socket = null;
|
||||||
return $result;
|
return $result;
|
||||||
|
|
Loading…
Reference in a new issue