Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b6f2fa
commit 1fe56d1
Showing
8 changed files
with
138 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,113 +1,9 @@ | ||
<?php | ||
|
||
use WHMCS\ClientArea; | ||
use OpenProvider\WhmcsRegistrar\src\Configuration; | ||
use OpenProvider\WhmcsRegistrar\src\OpenProvider; | ||
use OpenProvider\WhmcsRegistrar\helpers\Language; | ||
|
||
define('CLIENTAREA', true); | ||
|
||
const PAGE_TITLE = 'DNSSEC Records'; | ||
const PAGE_NAME = 'DNSSEC Records'; | ||
const MODULE_NAME = 'dnssec'; | ||
|
||
require __DIR__ . '/init.php'; | ||
require_once __DIR__ . '/modules/registrars/openprovider/init.php'; | ||
require_once __DIR__ . '/modules/registrars/openprovider/openprovider.php'; | ||
|
||
$ca = new ClientArea(); | ||
|
||
$ca->setPageTitle(PAGE_NAME); | ||
|
||
$domainId = $_GET['domainid']; | ||
$domain = \WHMCS\Database\Capsule::table('tbldomains') | ||
->where('id', $domainId) | ||
->first(); | ||
|
||
if (!$domain->dnsmanagement && isset($_SERVER["HTTP_REFERER"])) { | ||
header("Location: " . $_SERVER["HTTP_REFERER"]); | ||
} | ||
elseif (!$domain->dnsmanagement) { | ||
header("Location: " . '/whmcs/'); | ||
} | ||
|
||
$domainName = $domain->domain; | ||
|
||
$OpenProvider = new OpenProvider(); | ||
$api = $OpenProvider->api; | ||
|
||
$domainArray = explode('.', $domainName); | ||
$args = [ | ||
'domain' => [ | ||
'extension' => $domainArray[count($domainArray) - 1], | ||
'name' => implode('.', array_slice($domainArray, 0, count($domainArray) - 1)), | ||
], | ||
]; | ||
|
||
$dnssecKeys = []; | ||
$isDnssecEnabled = false; | ||
try { | ||
$domain = $api->sendRequest('retrieveDomainRequest', $args); | ||
$dnssecKeys = $domain['dnssecKeys']; | ||
$isDnssecEnabled = $domain['isDnssecEnabled']; | ||
} catch (\Exception $e) { | ||
header("Location: " . $_SERVER["HTTP_REFERER"]); | ||
} | ||
|
||
$ca->assign('dnssecKeys', $dnssecKeys); | ||
$ca->assign('isDnssecEnabled', $isDnssecEnabled); | ||
$ca->assign('apiUrlUpdateDnssecRecords', Configuration::getApiUrl('dnssec-record-update')); | ||
$ca->assign('apiUrlTurnOnOffDnssec', Configuration::getApiUrl('dnssec-enabled-update')); | ||
$ca->assign('domainId', $domainId); | ||
$ca->assign('jsModuleUrl', Configuration::getJsModuleUrl(MODULE_NAME)); | ||
$ca->assign('cssModuleUrl', Configuration::getCssModuleUrl(MODULE_NAME)); | ||
|
||
$ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname')); | ||
$ca->addToBreadCrumb('clientarea.php', Lang::trans('clientareatitle')); | ||
$ca->addToBreadCrumb('clientarea.php?action=domains', Lang::trans('clientareanavdomains')); | ||
$ca->addToBreadCrumb('clientarea.php?action=domaindetails&id=' . $domainId, $domainName); | ||
$ca->addToBreadCrumb('dnssec.php', PAGE_NAME); | ||
|
||
$ca->initPage(); | ||
|
||
$ca->requireLogin(); | ||
|
||
$primarySidebar = Menu::primarySidebar('domainView'); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Overview') | ||
->setLabel('Overview') | ||
->setUri("clientarea.php?action=domaindetails&id={$domainId}") | ||
->setOrder(0); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Auto Renew') | ||
->setLabel('Auto Renew') | ||
->setUri("clientarea.php?action=domaindetails&id={$domainId}#tabAutorenew") | ||
->setOrder(10); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Nameservers') | ||
->setLabel('Nameservers') | ||
->setUri("clientarea.php?action=domaindetails&id={$domainId}#tabNameservers") | ||
->setOrder(20); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Addons') | ||
->setLabel('Addons') | ||
->setUri("clientarea.php?action=domaindetails&id={$domainId}#tabAddons") | ||
->setOrder(30); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Contact Information') | ||
->setLabel('Contact Information') | ||
->setUri("clientarea.php?action=domaincontacts&domainid={$domainId}") | ||
->setOrder(40); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('DNS Management') | ||
->setLabel('DNS Management') | ||
->setUri("clientarea.php?action=domaindns&domainid={$domainId}") | ||
->setOrder(50); | ||
|
||
$ca->setTemplate('/modules/registrars/openprovider/includes/templates/dnssec.tpl'); | ||
|
||
$ca->output(); | ||
openprovider_registrar_launch_decorator('showDnssecPage', []); |
125 changes: 125 additions & 0 deletions
125
modules/registrars/openprovider/Controllers/System/DnssecPageController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<?php | ||
|
||
namespace OpenProvider\WhmcsRegistrar\Controllers\System; | ||
|
||
use OpenProvider\WhmcsRegistrar\helpers\DomainFullNameToDomainObject; | ||
use WHMCS\ClientArea; | ||
use OpenProvider\API\ApiHelper; | ||
use WeDevelopCoffee\wPower\Core\Core; | ||
use WeDevelopCoffee\wPower\Controllers\BaseController; | ||
use OpenProvider\WhmcsRegistrar\src\Configuration; | ||
|
||
/** | ||
* Class DnssecPageController | ||
* @package OpenProvider\WhmcsRegistrar\Controllers\System | ||
*/ | ||
class DnssecPageController extends BaseController | ||
{ | ||
const PAGE_TITLE = 'DNSSEC Records'; | ||
const PAGE_NAME = 'DNSSEC Records'; | ||
const MODULE_NAME = 'dnssec'; | ||
|
||
/** | ||
* @var ApiHelper | ||
*/ | ||
private $apiHelper; | ||
|
||
/** | ||
* ConfigController constructor. | ||
*/ | ||
public function __construct(Core $core, ApiHelper $apiHelper) | ||
{ | ||
parent::__construct($core); | ||
|
||
$this->apiHelper = $apiHelper; | ||
} | ||
|
||
public function show($params) | ||
{ | ||
$ca = new ClientArea(); | ||
|
||
$ca->setPageTitle(self::PAGE_NAME); | ||
|
||
$domainId = $_GET['domainid']; | ||
$domain = \WHMCS\Database\Capsule::table('tbldomains') | ||
->where('id', $domainId) | ||
->first(); | ||
|
||
if (!$domain->dnsmanagement && isset($_SERVER['HTTP_REFERER'])) { | ||
header('Location: ' . $_SERVER['HTTP_REFERER']); | ||
} | ||
elseif (!$domain->dnsmanagement) { | ||
header('Location: ' . '/'); | ||
} | ||
|
||
$domainObj = DomainFullNameToDomainObject::convert($domain->domain); | ||
|
||
try { | ||
$domainOp = $this->apiHelper->getDomain($domainObj); | ||
$dnssecKeys = $domainOp['dnssecKeys']; | ||
$isDnssecEnabled = $domainOp['isDnssecEnabled']; | ||
} catch (\Exception $e) { | ||
header('Location: ' . $_SERVER["HTTP_REFERER"]); | ||
} | ||
|
||
$ca->assign('dnssecKeys', $dnssecKeys); | ||
$ca->assign('isDnssecEnabled', $isDnssecEnabled); | ||
$ca->assign('apiUrlUpdateDnssecRecords', Configuration::getApiUrl('dnssec-record-update')); | ||
$ca->assign('apiUrlTurnOnOffDnssec', Configuration::getApiUrl('dnssec-enabled-update')); | ||
$ca->assign('domainId', $domainId); | ||
$ca->assign('jsModuleUrl', Configuration::getJsModuleUrl(self::MODULE_NAME)); | ||
$ca->assign('cssModuleUrl', Configuration::getCssModuleUrl(self::MODULE_NAME)); | ||
|
||
$ca->addToBreadCrumb('index.php', \Lang::trans('globalsystemname')); | ||
$ca->addToBreadCrumb('clientarea.php', \Lang::trans('clientareatitle')); | ||
$ca->addToBreadCrumb('clientarea.php?action=domains', \Lang::trans('clientareanavdomains')); | ||
$ca->addToBreadCrumb('clientarea.php?action=domaindetails&id=' . $domainId, $domain->domain); | ||
$ca->addToBreadCrumb('dnssec.php', self::PAGE_NAME); | ||
|
||
$ca->initPage(); | ||
|
||
$ca->requireLogin(); | ||
|
||
$primarySidebar = \Menu::primarySidebar('domainView'); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Overview') | ||
->setLabel('Overview') | ||
->setUri("clientarea.php?action=domaindetails&id={$domainId}") | ||
->setOrder(0); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Auto Renew') | ||
->setLabel('Auto Renew') | ||
->setUri("clientarea.php?action=domaindetails&id={$domainId}#tabAutorenew") | ||
->setOrder(10); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Nameservers') | ||
->setLabel('Nameservers') | ||
->setUri("clientarea.php?action=domaindetails&id={$domainId}#tabNameservers") | ||
->setOrder(20); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Addons') | ||
->setLabel('Addons') | ||
->setUri("clientarea.php?action=domaindetails&id={$domainId}#tabAddons") | ||
->setOrder(30); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('Contact Information') | ||
->setLabel('Contact Information') | ||
->setUri("clientarea.php?action=domaincontacts&domainid={$domainId}") | ||
->setOrder(40); | ||
|
||
$primarySidebar->getChild('Domain Details Management') | ||
->addChild('DNS Management') | ||
->setLabel('DNS Management') | ||
->setUri("clientarea.php?action=domaindns&domainid={$domainId}") | ||
->setOrder(50); | ||
|
||
$ca->setTemplate('/modules/registrars/openprovider/includes/templates/dnssec.tpl'); | ||
|
||
$ca->output(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
require_once(__DIR__ . '/../../../../init.php'); | ||
require_once(__DIR__.'/../openprovider.php'); | ||
require_once(__DIR__ . '/../init.php'); | ||
require_once(__DIR__ . '/../openprovider.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters