Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 1.0.4 - Bugfixes , api upgraded #5

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
563 changes: 160 additions & 403 deletions components/modules/domainnameapi/apis/api.php

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions components/modules/domainnameapi/composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "blesta/domainnameapi",
"description": "DomainNameApi",
"license": "proprietary",
"type": "blesta-module",
"require": {
"blesta/composer-installer": "~1.0",
"ext-dom": "*",
"ext-simplexml": "*",
"ext-curl": "*",
"ext-soap": "*"
}
"name": "blesta/domainnameapi",
"description": "DomainNameApi",
"license": "proprietary",
"type": "blesta-module",
"require": {
"blesta/composer-installer": "~1.0",
"ext-dom": "*",
"ext-simplexml": "*",
"ext-curl": "*",
"ext-soap": "*"
}
}
2 changes: 1 addition & 1 deletion components/modules/domainnameapi/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.3",
"version": "1.0.4",
"type": "registrar",
"name": "Domainnameapi",
"description": "DomainNameApi is a domain registration module that allows you to register and manage domain names. More Than 800 extension!",
Expand Down
58 changes: 38 additions & 20 deletions components/modules/domainnameapi/domainnameapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ public function getAdminAddFields($package, $vars = null)
// Set default name servers

if (!isset($vars->ns1) && isset($package->meta->ns)) {
$i = 0;
$i = 1;
foreach ($package->meta->ns as $ns) {
$vars->{'ns' . ($i++)} = $ns;
}
Expand Down Expand Up @@ -618,7 +618,10 @@ public function getClientAddFields($package, $vars = null)
if (!isset($vars->ns) && isset($package->meta->ns)) {
$i = 0;
foreach ($package->meta->ns as $ns) {
$vars->{'ns' . $i++ } = $ns;
if(strlen($ns) > 0) {
$i++;
$vars->{'ns' . ($i)} = $ns;
}
}
}

Expand Down Expand Up @@ -998,7 +1001,6 @@ private function manageNameservers($view, $package, $service, array $get = null,


if (!empty($post)) {
die(var_dump($post));
// Update domain nameservers
$this->setDomainNameservers($fields->domain, $package->module_row, ($post['ns'] ?? []));
$vars = (object)$post;
Expand Down Expand Up @@ -1026,9 +1028,9 @@ private function manageNameservers($view, $package, $service, array $get = null,
* @param string $view The view to use
* @param stdClass $package A stdClass object representing the current package
* @param stdClass $service A stdClass object representing the current service
* @param array $get Any GET parameters
* @param array $post Any POST parameters
* @param array $files Any FILES parameters
* @param array|null $get Any GET parameters
* @param array|null $post Any POST parameters
* @param array|null $files Any FILES parameters
* @return string The string representing the contents of this tab
*/
private function manageSettings($view, $package, $service, array $get = null, array $post = null, array $files = null) {
Expand All @@ -1045,6 +1047,7 @@ private function manageSettings($view, $package, $service, array $get = null, ar
// Determine if this service has access to id_protection
$id_protection = $this->featureServiceEnabled('id_protection', $service);


// Determine if this service has access to epp_code
$epp_code = $package->meta->epp_code ?? '0';

Expand All @@ -1054,20 +1057,35 @@ private function manageSettings($view, $package, $service, array $get = null, ar

if (!empty($post)) {
// Set domain status
if ($post['registrar_lock'] == 'true') {
$this->lockDomain($fields->domain, $package->module_row);
} else {
$this->unlockDomain($fields->domain, $package->module_row);
if ($post['registrar_lock'] == 'true' && $post['current_id_protection'] == 'false') {
$lockStatus = $this->lockDomain($fields->domain, $package->module_row);
if ($lockStatus === true) {
$vars->registrar_lock = 'true';
}

$this->view->set('lockStatus', $lockStatus);
}

if ($post['registrar_lock'] == 'false' && $post['current_id_protection'] == 'true') {
$unlockStatus = $this->unlockDomain($fields->domain, $package->module_row);
if ($unlockStatus === true) {
$vars->registrar_lock = 'false';
}
}

if($id_protection){
if($post['whois_privacy_state'] == 'true'){
$this->enablePrivacyProtection($fields->domain, $package->module_row);
}else{
$this->disablePrivacyProtection($fields->domain, $package->module_row);
if ($post['whois_privacy_state'] == 'true' && $post['current_privacy_state'] == 'false' && $id_protection === true) {
$privacyStatus = $this->enablePrivacyProtection($fields->domain, $package->module_row);
if ($privacyStatus === true) {
$vars->whois_privacy_state = 'true';
}
}
if ($post['whois_privacy_state'] == 'false' && $post['current_privacy_state'] == 'true' && $id_protection === true) {
$privacyStatus = $this->disablePrivacyProtection($fields->domain, $package->module_row);

if ($privacyStatus === true) {
$vars->whois_privacy_state = 'false';
}
}
}


Expand Down Expand Up @@ -1300,7 +1318,7 @@ public function lockDomain($domain, $module_row_id = null)
$response = $api->EnableTheftProtectionLock($domain);
$this->processResponse($api);

return $response['status'] == 'OK';
return $response['result'] == 'OK';
}

/**
Expand All @@ -1319,7 +1337,7 @@ public function unlockDomain($domain, $module_row_id = null)
$response = $api->DisableTheftProtectionLock($domain);
$this->processResponse($api);

return $response['status'] == 'OK';
return $response['result'] == 'OK';
}

public function enablePrivacyProtection($domain, $module_row_id = null)
Expand All @@ -1330,7 +1348,7 @@ public function enablePrivacyProtection($domain, $module_row_id = null)
$response = $api->ModifyPrivacyProtectionStatus($domain,true);
$this->processResponse($api);

return $response['status'] == 'OK';
return $response['result'] == 'OK';
}
public function disablePrivacyProtection($domain, $module_row_id = null)
{
Expand All @@ -1340,7 +1358,7 @@ public function disablePrivacyProtection($domain, $module_row_id = null)
$response = $api->ModifyPrivacyProtectionStatus($domain,false);
$this->processResponse($api);

return $response['status'] == 'OK';
return $response['result'] == 'OK';
}


Expand Down Expand Up @@ -1382,7 +1400,7 @@ public function registerDomain($domain, $module_row_id = null, array $vars = [])

$this->processResponse($api);

return $registerResult['status'] == 'OK';
return $registerResult['result'] == 'OK';
}

/**
Expand Down
78 changes: 40 additions & 38 deletions components/modules/domainnameapi/views/default/add_row.pdt
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
<?php
$this->Widget->clear();
$this->Widget->create($this->_('Domainnameapi.add_row.box_title', true));
?>
<div class="inner">
<?php
$this->Form->create();
?>
<div class="title_row first">
<h3><?php $this->_('Domainnameapi.add_row.basic_title');?></h3>
</div>
<div class="pad">
<ul>
<li>
<?php
$this->Form->label($this->_('Domainnameapi.row_meta.user', true), 'user');
$this->Form->fieldText('user', ($vars->user ?? null), ['id' => 'user']);
?>
</li>
<li>
<?php
$this->Form->label($this->_('Domainnameapi.row_meta.key', true), 'key');
$this->Form->fieldText('key', ($vars->key ?? null), ['id' => 'key' , 'type'=>'password']);
?>
</li>

</ul>
</div>

<div class="button_row">
<?php
$this->Widget->clear();
$this->Widget->create($this->_('Domainnameapi.add_row.box_title', true));
?>
<div class="inner">
<?php
$this->Form->create();
?>
<div class="title_row first">
<h3><?php
$this->_('Domainnameapi.add_row.basic_title'); ?></h3>
</div>
<div class="pad">
<ul>
<li>
<?php
$this->Form->fieldSubmit('save', $this->_('Domainnameapi.add_row.add_btn', true), ['class' => 'btn btn-primary float-right']);
$this->Form->label($this->_('Domainnameapi.row_meta.user', true), 'user');
$this->Form->fieldText('user', ($vars->user ?? null), ['id' => 'user']);
?>
</div>
<?php
$this->Form->end();
?>
</div>
</li>
<li>
<?php
$this->Form->label($this->_('Domainnameapi.row_meta.key', true), 'key');
$this->Form->fieldText('key', ($vars->key ?? null), ['id' => 'key', 'type' => 'password']);
?>
</li>

</ul>
</div>

<div class="button_row">
<?php
$this->Widget->end();
?>
$this->Form->fieldSubmit('save', $this->_('Domainnameapi.add_row.add_btn', true),
['class' => 'btn btn-primary float-right']);
?>
</div>
<?php
$this->Form->end();
?>
</div>
<?php
$this->Widget->end();
?>
76 changes: 39 additions & 37 deletions components/modules/domainnameapi/views/default/edit_row.pdt
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
<?php
$this->Widget->clear();
$this->Widget->create($this->_('Domainnameapi.edit_row.box_title', true));
?>
<div class="inner">
<?php
$this->Form->create();
?>
<div class="title_row first">
<h3><?php $this->_('Domainnameapi.edit_row.basic_title');?></h3>
</div>
<div class="pad">
<ul>
<li>
<?php
$this->Form->label($this->_('Domainnameapi.row_meta.user', true), 'user');
$this->Form->fieldText('user', ($vars->user ?? null), ['id' => 'user']);
?>
</li>
<li>
<?php
$this->Form->label($this->_('Domainnameapi.row_meta.key', true), 'key');
$this->Form->fieldText('key', ($vars->key ?? null), ['id' => 'key', 'type'=>'password']);
?>
</li>
</ul>
</div>

<div class="button_row">
<?php
$this->Widget->clear();
$this->Widget->create($this->_('Domainnameapi.edit_row.box_title', true));
?>
<div class="inner">
<?php
$this->Form->create();
?>
<div class="title_row first">
<h3><?php
$this->_('Domainnameapi.edit_row.basic_title'); ?></h3>
</div>
<div class="pad">
<ul>
<li>
<?php
$this->Form->fieldSubmit('save', $this->_('Domainnameapi.edit_row.add_btn', true), ['class' => 'btn btn-primary float-right']);
$this->Form->label($this->_('Domainnameapi.row_meta.user', true), 'user');
$this->Form->fieldText('user', ($vars->user ?? null), ['id' => 'user']);
?>
</div>
<?php
$this->Form->end();
?>
</div>
</li>
<li>
<?php
$this->Form->label($this->_('Domainnameapi.row_meta.key', true), 'key');
$this->Form->fieldText('key', ($vars->key ?? null), ['id' => 'key', 'type' => 'password']);
?>
</li>
</ul>
</div>

<div class="button_row">
<?php
$this->Widget->end();
?>
$this->Form->fieldSubmit('save', $this->_('Domainnameapi.edit_row.add_btn', true),
['class' => 'btn btn-primary float-right']);
?>
</div>
<?php
$this->Form->end();
?>
</div>
<?php
$this->Widget->end();
?>
3 changes: 2 additions & 1 deletion components/modules/domainnameapi/views/default/manage.pdt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

$link_buttons = [
'add_account' => [
'name' => $this->_('Domainnameapi.add_module_row', true),
'name' => $this->_('Domainnameapi.add_module_row', true),
'attributes' => ['href' => $this->base_uri . 'settings/company/modules/addrow/' . $module->id]
]
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

if (($fields ?? null) && !empty($fields)) {
?>
<ul class="no_border">
Expand Down
Loading