Skip to content

Commit

Permalink
dna lib extended
Browse files Browse the repository at this point in the history
  • Loading branch information
bakcay committed Sep 15, 2023
1 parent 268f5c4 commit 13e73f6
Show file tree
Hide file tree
Showing 2 changed files with 1,427 additions and 2,046 deletions.
49 changes: 24 additions & 25 deletions includes/modules/Domain/domainnameapi/class.domainnameapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class domainnameapi extends DomainModule{
protected $version = '1.0.52';
protected $modname = "Domain Name Api";
protected $description = 'Domain Name API - ICANN Accredited Domain Registrar from TURKEY ';

/**
* @var null DomainNameAPI_PHPLibrary
*/
private $dna = null;


Expand Down Expand Up @@ -70,16 +74,14 @@ class domainnameapi extends DomainModule{
*/
private function dna(){

if($this->dna==null){
$this->dna = new \DomainNameAPI_PHPLibrary();
}
$testmode = false;
if ($this->configuration['testmode']['value'] == '1'){
$this->dna->useTestMode(true);
}else{
$this->dna->useTestMode(false);
$testmode=true;
}

if($this->dna==null){
$this->dna = new \DomainNameApi\DomainNameAPI_PHPLibrary($this->configuration['username']['value'],$this->configuration['password']['value'],$testmode);
}
$this->dna->setUser($this->configuration['username']['value'],$this->configuration['password']['value']);
$this->dna->useCaching(false);

return $this->dna;
}
Expand All @@ -92,9 +94,7 @@ private function dna(){
*/
public function testConnection() {

$result = $this->dna()->GetList();


$result = $this->dna()->GetCurrentBalance();

if($result["result"] == "OK"){
return true;
Expand Down Expand Up @@ -282,18 +282,17 @@ public function getNameServers() {

if ($result["result"] == "OK") {
$values = [];
if (is_array($result["data"]["NameServers"][0])) {

foreach (range(1, 5) as $k => $v) {
if (isset($result["data"]["NameServers"][0][$k])) {
$values[$v] = $result["data"]["NameServers"][0][$k];
if (is_array($result["data"]["NameServers"])) {
foreach ([0, 1, 2, 3, 4] as $k => $v) {
if (isset($result["data"]["NameServers"][$v])) {
$values[$v] = $result["data"]["NameServers"][$v];
}
}

} else {

if (isset($result["data"]["NameServers"][0])) {
$values[1] = $result["data"]["NameServers"][0];
// Only one nameserver
if (isset($result["data"]["NameServers"])) {
$values[1] = $result["data"]["NameServers"];
}
}
return $values;
Expand Down Expand Up @@ -804,12 +803,12 @@ public function synchInfo() {

$result = $this->dna()->GetDetails($this->options['sld'] . '.' . $this->options['tld']);

$resp=[
'status'=>'Active',
'expires'=>date('Y-m-d',strtotime($result['data']['Dates']['Expiration'])),
'reglock'=>$result['data']['LockStatus']=='true',
'ns'=>$result['date']['NameServers'][0],
'idprotection'=>$result['data']['PrivacyProtectionStatus']==true
$resp = [
'status' => 'Active',
'expires' => date('Y-m-d', strtotime($result['data']['Dates']['Expiration'])),
'reglock' => $result['data']['LockStatus'] == 'true',
'ns' => $result['date']['NameServers'][0],
'idprotection' => $result['data']['PrivacyProtectionStatus'] == true
];

if(in_array($result['data']['Status'],['WaitingForRegistration', 'WaitingForDocument', 'ConfirmationEmailSend', 'PreRegistration', 'PendingHold'])){
Expand Down
Loading

0 comments on commit 13e73f6

Please sign in to comment.