mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-20 17:46:03 +02:00
DomainUpdate CP almost ready
This commit is contained in:
parent
4b7500c397
commit
a7aa791fb5
13 changed files with 1130 additions and 115 deletions
|
@ -9,12 +9,12 @@ use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
class DomainsController extends Controller
|
class DomainsController extends Controller
|
||||||
{
|
{
|
||||||
public function view(Request $request, Response $response)
|
public function listDomains(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
return view($response,'admin/domains/view.twig');
|
return view($response,'admin/domains/listDomains.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function check(Request $request, Response $response)
|
public function checkDomain(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
if ($request->getMethod() === 'POST') {
|
if ($request->getMethod() === 'POST') {
|
||||||
// Retrieve POST data
|
// Retrieve POST data
|
||||||
|
@ -59,7 +59,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return view($response, 'admin/domains/check.twig', [
|
return view($response, 'admin/domains/checkDomain.twig', [
|
||||||
'isAvailable' => $isAvailable,
|
'isAvailable' => $isAvailable,
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
|
@ -68,10 +68,10 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default view for GET requests or if POST data is not set
|
// Default view for GET requests or if POST data is not set
|
||||||
return view($response,'admin/domains/check.twig');
|
return view($response,'admin/domains/checkDomain.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(Request $request, Response $response)
|
public function createDomain(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
if ($request->getMethod() === 'POST') {
|
if ($request->getMethod() === 'POST') {
|
||||||
// Retrieve POST data
|
// Retrieve POST data
|
||||||
|
@ -111,7 +111,7 @@ class DomainsController extends Controller
|
||||||
$invalid_domain = validate_label($domainName, $db);
|
$invalid_domain = validate_label($domainName, $db);
|
||||||
|
|
||||||
if ($invalid_domain) {
|
if ($invalid_domain) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Invalid domain name',
|
'error' => 'Invalid domain name',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -131,7 +131,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$valid_tld) {
|
if (!$valid_tld) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Invalid domain extension',
|
'error' => 'Invalid domain extension',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -145,7 +145,7 @@ class DomainsController extends Controller
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($domain_already_exist) {
|
if ($domain_already_exist) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Domain name already exists',
|
'error' => 'Domain name already exists',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -159,7 +159,7 @@ class DomainsController extends Controller
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($domain_already_reserved) {
|
if ($domain_already_reserved) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Domain name is reserved or restricted',
|
'error' => 'Domain name is reserved or restricted',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -168,7 +168,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($registrationYears && (($registrationYears < 1) || ($registrationYears > 10))) {
|
if ($registrationYears && (($registrationYears < 1) || ($registrationYears > 10))) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Domain period must be from 1 to 10',
|
'error' => 'Domain period must be from 1 to 10',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -201,7 +201,7 @@ class DomainsController extends Controller
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$price) {
|
if (!$price) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'The price, period and currency for such TLD are not declared',
|
'error' => 'The price, period and currency for such TLD are not declared',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -210,7 +210,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($registrar_balance + $creditLimit) < $price) {
|
if (($registrar_balance + $creditLimit) < $price) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Low credit: minimum threshold reached',
|
'error' => 'Low credit: minimum threshold reached',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -219,7 +219,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($nameservers) !== count(array_unique($nameservers))) {
|
if (count($nameservers) !== count(array_unique($nameservers))) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Duplicate nameservers detected. Please provide unique nameservers.',
|
'error' => 'Duplicate nameservers detected. Please provide unique nameservers.',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -229,7 +229,7 @@ class DomainsController extends Controller
|
||||||
|
|
||||||
foreach ($nameservers as $index => $nameserver) {
|
foreach ($nameservers as $index => $nameserver) {
|
||||||
if (preg_match("/^-|^\.-|-\.$|^\.$/", $nameserver)) {
|
if (preg_match("/^-|^\.-|-\.$|^\.$/", $nameserver)) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Invalid hostName',
|
'error' => 'Invalid hostName',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -238,7 +238,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^([A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9]){0,1}\.){1,125}[A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9])$/i', $nameserver) && strlen($nameserver) < 254) {
|
if (!preg_match('/^([A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9]){0,1}\.){1,125}[A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9])$/i', $nameserver) && strlen($nameserver) < 254) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Invalid hostName',
|
'error' => 'Invalid hostName',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -252,7 +252,7 @@ class DomainsController extends Controller
|
||||||
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactRegistrant]);
|
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactRegistrant]);
|
||||||
|
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Registrant does not exist',
|
'error' => 'Registrant does not exist',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -261,7 +261,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($clid != $row['clid']) {
|
if ($clid != $row['clid']) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'The contact requested in the command does NOT belong to the current registrar',
|
'error' => 'The contact requested in the command does NOT belong to the current registrar',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -275,7 +275,7 @@ class DomainsController extends Controller
|
||||||
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactAdmin]);
|
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactAdmin]);
|
||||||
|
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Admin contact does not exist',
|
'error' => 'Admin contact does not exist',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -284,7 +284,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($clid != $row['clid']) {
|
if ($clid != $row['clid']) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'The contact requested in the command does NOT belong to the current registrar',
|
'error' => 'The contact requested in the command does NOT belong to the current registrar',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -298,7 +298,7 @@ class DomainsController extends Controller
|
||||||
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactTech]);
|
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactTech]);
|
||||||
|
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Tech contact does not exist',
|
'error' => 'Tech contact does not exist',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -307,7 +307,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($clid != $row['clid']) {
|
if ($clid != $row['clid']) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'The contact requested in the command does NOT belong to the current registrar',
|
'error' => 'The contact requested in the command does NOT belong to the current registrar',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -321,7 +321,7 @@ class DomainsController extends Controller
|
||||||
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactBilling]);
|
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactBilling]);
|
||||||
|
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Billing contact does not exist',
|
'error' => 'Billing contact does not exist',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -330,7 +330,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($clid != $row['clid']) {
|
if ($clid != $row['clid']) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'The contact requested in the command does NOT belong to the current registrar',
|
'error' => 'The contact requested in the command does NOT belong to the current registrar',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -340,7 +340,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$authInfo) {
|
if (!$authInfo) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Missing domain authinfo',
|
'error' => 'Missing domain authinfo',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -349,7 +349,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($authInfo) < 6 || strlen($authInfo) > 16) {
|
if (strlen($authInfo) < 6 || strlen($authInfo) > 16) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Password needs to be at least 6 and up to 16 characters long',
|
'error' => 'Password needs to be at least 6 and up to 16 characters long',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -358,7 +358,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/[A-Z]/', $authInfo)) {
|
if (!preg_match('/[A-Z]/', $authInfo)) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Password should have both upper and lower case characters',
|
'error' => 'Password should have both upper and lower case characters',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -415,7 +415,7 @@ class DomainsController extends Controller
|
||||||
// Validate keyTag
|
// Validate keyTag
|
||||||
if (!empty($dsKeyTag)) {
|
if (!empty($dsKeyTag)) {
|
||||||
if (!is_int($dsKeyTag)) {
|
if (!is_int($dsKeyTag)) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Incomplete key tag provided',
|
'error' => 'Incomplete key tag provided',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -424,7 +424,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($dsKeyTag < 0 || $dsKeyTag > 65535) {
|
if ($dsKeyTag < 0 || $dsKeyTag > 65535) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Incomplete key tag provided',
|
'error' => 'Incomplete key tag provided',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -436,7 +436,7 @@ class DomainsController extends Controller
|
||||||
// Validate alg
|
// Validate alg
|
||||||
$validAlgorithms = [2, 3, 5, 6, 7, 8, 10, 13, 14, 15, 16];
|
$validAlgorithms = [2, 3, 5, 6, 7, 8, 10, 13, 14, 15, 16];
|
||||||
if (!empty($dsAlg) && !in_array($dsAlg, $validAlgorithms)) {
|
if (!empty($dsAlg) && !in_array($dsAlg, $validAlgorithms)) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Incomplete algorithm provided',
|
'error' => 'Incomplete algorithm provided',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -446,7 +446,7 @@ class DomainsController extends Controller
|
||||||
|
|
||||||
// Validate digestType and digest
|
// Validate digestType and digest
|
||||||
if (!empty($dsDigestType) && !is_int($dsDigestType)) {
|
if (!empty($dsDigestType) && !is_int($dsDigestType)) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Incomplete digest type provided',
|
'error' => 'Incomplete digest type provided',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -459,7 +459,7 @@ class DomainsController extends Controller
|
||||||
4 => 96 // SHA-384
|
4 => 96 // SHA-384
|
||||||
];
|
];
|
||||||
if (!empty($validDigests[$dsDigestType])) {
|
if (!empty($validDigests[$dsDigestType])) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Unsupported digest type',
|
'error' => 'Unsupported digest type',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -468,7 +468,7 @@ class DomainsController extends Controller
|
||||||
}
|
}
|
||||||
if (!empty($dsDigest)) {
|
if (!empty($dsDigest)) {
|
||||||
if (strlen($dsDigest) != $validDigests[$dsDigestType] || !ctype_xdigit($dsDigest)) {
|
if (strlen($dsDigest) != $validDigests[$dsDigestType] || !ctype_xdigit($dsDigest)) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Invalid digest length or format',
|
'error' => 'Invalid digest length or format',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -481,7 +481,7 @@ class DomainsController extends Controller
|
||||||
// Validate flags
|
// Validate flags
|
||||||
$validFlags = [256, 257];
|
$validFlags = [256, 257];
|
||||||
if (!empty($dnskeyFlags) && !in_array($dnskeyFlags, $validFlags)) {
|
if (!empty($dnskeyFlags) && !in_array($dnskeyFlags, $validFlags)) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Invalid flags provided',
|
'error' => 'Invalid flags provided',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -491,7 +491,7 @@ class DomainsController extends Controller
|
||||||
|
|
||||||
// Validate protocol
|
// Validate protocol
|
||||||
if (!empty($dnskeyProtocol) && $dnskeyProtocol != 3) {
|
if (!empty($dnskeyProtocol) && $dnskeyProtocol != 3) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Invalid protocol provided',
|
'error' => 'Invalid protocol provided',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -501,7 +501,7 @@ class DomainsController extends Controller
|
||||||
|
|
||||||
// Validate algKeyData
|
// Validate algKeyData
|
||||||
if (!empty($dnskeyAlg)) {
|
if (!empty($dnskeyAlg)) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Invalid algorithm encoding',
|
'error' => 'Invalid algorithm encoding',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -511,7 +511,7 @@ class DomainsController extends Controller
|
||||||
|
|
||||||
// Validate pubKey
|
// Validate pubKey
|
||||||
if (!empty($dnskeyPubKey) && base64_encode(base64_decode($dnskeyPubKey, true)) !== $dnskeyPubKey) {
|
if (!empty($dnskeyPubKey) && base64_encode(base64_decode($dnskeyPubKey, true)) !== $dnskeyPubKey) {
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Invalid public key encoding',
|
'error' => 'Invalid public key encoding',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -702,7 +702,7 @@ class DomainsController extends Controller
|
||||||
$db->commit();
|
$db->commit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$db->rollBack();
|
$db->rollBack();
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'error' => 'Database failure: ' . $e->getMessage(),
|
'error' => 'Database failure: ' . $e->getMessage(),
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -715,7 +715,7 @@ class DomainsController extends Controller
|
||||||
[$domain_id]
|
[$domain_id]
|
||||||
);
|
);
|
||||||
|
|
||||||
return view($response, 'admin/domains/create.twig', [
|
return view($response, 'admin/domains/createDomain.twig', [
|
||||||
'domainName' => $domainName,
|
'domainName' => $domainName,
|
||||||
'crdate' => $crdate,
|
'crdate' => $crdate,
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
@ -744,7 +744,7 @@ class DomainsController extends Controller
|
||||||
$position = (strpos($pattern, '¤') < strpos($pattern, '#')) ? 'before' : 'after';
|
$position = (strpos($pattern, '¤') < strpos($pattern, '#')) ? 'before' : 'after';
|
||||||
|
|
||||||
// Default view for GET requests or if POST data is not set
|
// Default view for GET requests or if POST data is not set
|
||||||
return view($response,'admin/domains/create.twig', [
|
return view($response,'admin/domains/createDomain.twig', [
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
'currencySymbol' => $symbol,
|
'currencySymbol' => $symbol,
|
||||||
'currencyPosition' => $position,
|
'currencyPosition' => $position,
|
||||||
|
@ -752,11 +752,6 @@ class DomainsController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transfers(Request $request, Response $response)
|
|
||||||
{
|
|
||||||
return view($response,'admin/domains/transfers.twig');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function viewDomain(Request $request, Response $response, $args)
|
public function viewDomain(Request $request, Response $response, $args)
|
||||||
{
|
{
|
||||||
$db = $this->container->get('db');
|
$db = $this->container->get('db');
|
||||||
|
@ -818,7 +813,7 @@ class DomainsController extends Controller
|
||||||
'currentUri' => $uri
|
'currentUri' => $uri
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// Contact does not exist, redirect to the domains view
|
// Domain does not exist, redirect to the domains view
|
||||||
return $response->withHeader('Location', '/domains')->withStatus(302);
|
return $response->withHeader('Location', '/domains')->withStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -829,4 +824,482 @@ class DomainsController extends Controller
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateDomain(Request $request, Response $response, $args)
|
||||||
|
{
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
$registrars = $db->select("SELECT id, clid, name FROM registrar");
|
||||||
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
|
$registrar = true;
|
||||||
|
} else {
|
||||||
|
$registrar = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uri = $request->getUri()->getPath();
|
||||||
|
|
||||||
|
if ($args) {
|
||||||
|
$domain = $db->selectRow('SELECT id, name, registrant, crdate, exdate, `update`, clid, idnlang, rgpstatus FROM domain WHERE name = ?',
|
||||||
|
[ $args ]);
|
||||||
|
|
||||||
|
if ($domain) {
|
||||||
|
$registrars = $db->selectRow('SELECT id, clid, name FROM registrar WHERE id = ?', [$domain['clid']]);
|
||||||
|
|
||||||
|
// Check if the user is not an admin (assuming role 0 is admin)
|
||||||
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
|
$userRegistrars = $db->select('SELECT registrar_id FROM registrar_users WHERE user_id = ?', [$_SESSION['auth_user_id']]);
|
||||||
|
|
||||||
|
// Assuming $userRegistrars returns an array of arrays, each containing 'registrar_id'
|
||||||
|
$userRegistrarIds = array_column($userRegistrars, 'registrar_id');
|
||||||
|
|
||||||
|
// Check if the registrar's ID is in the user's list of registrar IDs
|
||||||
|
if (!in_array($registrars['id'], $userRegistrarIds)) {
|
||||||
|
// Redirect to the domains view if the user is not authorized for this contact
|
||||||
|
return $response->withHeader('Location', '/domains')->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$domainRegistrant = $db->selectRow('SELECT identifier FROM contact WHERE id = ?',
|
||||||
|
[ $domain['registrant'] ]);
|
||||||
|
$domainStatus = $db->select('SELECT status FROM domain_status WHERE domain_id = ?',
|
||||||
|
[ $domain['id'] ]);
|
||||||
|
$domainAuth = $db->selectRow('SELECT authinfo FROM domain_authInfo WHERE domain_id = ?',
|
||||||
|
[ $domain['id'] ]);
|
||||||
|
$domainSecdns = $db->select('SELECT * FROM secdns WHERE domain_id = ?',
|
||||||
|
[ $domain['id'] ]);
|
||||||
|
$domainHostsQuery = '
|
||||||
|
SELECT dhm.id, dhm.domain_id, dhm.host_id, h.name
|
||||||
|
FROM domain_host_map dhm
|
||||||
|
JOIN host h ON dhm.host_id = h.id
|
||||||
|
WHERE dhm.domain_id = ?';
|
||||||
|
|
||||||
|
$domainHosts = $db->select($domainHostsQuery, [$domain['id']]);
|
||||||
|
$domainContactsQuery = '
|
||||||
|
SELECT dcm.id, dcm.domain_id, dcm.contact_id, dcm.type, c.identifier
|
||||||
|
FROM domain_contact_map dcm
|
||||||
|
JOIN contact c ON dcm.contact_id = c.id
|
||||||
|
WHERE dcm.domain_id = ?';
|
||||||
|
$domainContacts = $db->select($domainContactsQuery, [$domain['id']]);
|
||||||
|
|
||||||
|
return view($response,'admin/domains/updateDomain.twig', [
|
||||||
|
'domain' => $domain,
|
||||||
|
'domainStatus' => $domainStatus,
|
||||||
|
'domainAuth' => $domainAuth,
|
||||||
|
'domainRegistrant' => $domainRegistrant,
|
||||||
|
'domainSecdns' => $domainSecdns,
|
||||||
|
'domainHosts' => $domainHosts,
|
||||||
|
'domainContacts' => $domainContacts,
|
||||||
|
'registrar' => $registrars,
|
||||||
|
'currentUri' => $uri
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
// Domain does not exist, redirect to the domains view
|
||||||
|
return $response->withHeader('Location', '/domains')->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Redirect to the domains view
|
||||||
|
return $response->withHeader('Location', '/domains')->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateDomainProcess(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
if ($request->getMethod() === 'POST') {
|
||||||
|
// Retrieve POST data
|
||||||
|
$data = $request->getParsedBody();
|
||||||
|
$db = $this->container->get('db');
|
||||||
|
$domainName = $data['domainName'] ?? null;
|
||||||
|
|
||||||
|
$result = $db->selectRow('SELECT registrar_id FROM registrar_users WHERE user_id = ?', [$_SESSION['auth_user_id']]);
|
||||||
|
|
||||||
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
|
$clid = $result['registrar_id'];
|
||||||
|
} else {
|
||||||
|
$clid = $db->selectValue('SELECT clid FROM domain WHERE name = ?', [$domainName]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$contactRegistrant = $data['contactRegistrant'] ?? null;
|
||||||
|
$contactAdmin = $data['contactAdmin'] ?? null;
|
||||||
|
$contactTech = $data['contactTech'] ?? null;
|
||||||
|
$contactBilling = $data['contactBilling'] ?? null;
|
||||||
|
|
||||||
|
$nameservers = $data['nameserver'] ?? [];
|
||||||
|
|
||||||
|
$dsKeyTag = $data['dsKeyTag'] ?? null;
|
||||||
|
$dsAlg = $data['dsAlg'] ?? null;
|
||||||
|
$dsDigestType = $data['dsDigestType'] ?? null;
|
||||||
|
$dsDigest = $data['dsDigest'] ?? null;
|
||||||
|
|
||||||
|
$dnskeyFlags = $data['dnskeyFlags'] ?? null;
|
||||||
|
$dnskeyProtocol = $data['dnskeyProtocol'] ?? null;
|
||||||
|
$dnskeyAlg = $data['dnskeyAlg'] ?? null;
|
||||||
|
$dnskeyPubKey = $data['dnskeyPubKey'] ?? null;
|
||||||
|
|
||||||
|
$authInfo = $data['authInfo'] ?? null;
|
||||||
|
|
||||||
|
foreach ($nameservers as $index => $nameserver) {
|
||||||
|
if (preg_match("/^-|^\.-|-\.$|^\.$/", $nameserver)) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Invalid hostName');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/^([A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9]){0,1}\.){1,125}[A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9])$/i', $nameserver) && strlen($nameserver) < 254) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Invalid hostName');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($contactRegistrant) {
|
||||||
|
$validRegistrant = validate_identifier($contactRegistrant);
|
||||||
|
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactRegistrant]);
|
||||||
|
|
||||||
|
if (!$row) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Registrant does not exist');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($clid != $row['clid']) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'The contact requested in the command does NOT belong to the current registrar');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($contactAdmin) {
|
||||||
|
$validAdmin = validate_identifier($contactAdmin);
|
||||||
|
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactAdmin]);
|
||||||
|
|
||||||
|
if (!$row) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Admin contact does not exist');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($clid != $row['clid']) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'The contact requested in the command does NOT belong to the current registrar');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($contactTech) {
|
||||||
|
$validTech = validate_identifier($contactTech);
|
||||||
|
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactTech]);
|
||||||
|
|
||||||
|
if (!$row) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Tech contact does not exist');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($clid != $row['clid']) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'The contact requested in the command does NOT belong to the current registrar');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($contactBilling) {
|
||||||
|
$validBilling = validate_identifier($contactBilling);
|
||||||
|
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactBilling]);
|
||||||
|
|
||||||
|
if (!$row) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Billing contact does not exist');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($clid != $row['clid']) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'The contact requested in the command does NOT belong to the current registrar');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$authInfo) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Domain ' . $domainName . ' can not be updated: Missing domain authinfo');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($authInfo) < 6 || strlen($authInfo) > 16) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Password needs to be at least 6 and up to 16 characters long');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/[A-Z]/', $authInfo)) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Password should have both upper and lower case characters');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
$registrant_id = $db->selectValue(
|
||||||
|
'SELECT id FROM contact WHERE identifier = ? LIMIT 1',
|
||||||
|
[$contactRegistrant]
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$db->beginTransaction();
|
||||||
|
|
||||||
|
$currentDateTime = new \DateTime();
|
||||||
|
$update = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||||
|
|
||||||
|
$db->update('domain', [
|
||||||
|
'registrant' => $registrant_id,
|
||||||
|
'update' => $update,
|
||||||
|
'upid' => $clid
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => $domainName
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$domain_id = $db->selectValue(
|
||||||
|
'SELECT id FROM domain WHERE name = ?',
|
||||||
|
[$domainName]
|
||||||
|
);
|
||||||
|
|
||||||
|
$db->update(
|
||||||
|
'domain_authInfo',
|
||||||
|
[
|
||||||
|
'authinfo' => $authInfo
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => $domain_id,
|
||||||
|
'authtype' => 'pw'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Data sanity checks
|
||||||
|
// Validate keyTag
|
||||||
|
if (!empty($dsKeyTag)) {
|
||||||
|
if (!is_int($dsKeyTag)) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Incomplete key tag provided');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($dsKeyTag < 0 || $dsKeyTag > 65535) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Incomplete key tag provided');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate alg
|
||||||
|
$validAlgorithms = [2, 3, 5, 6, 7, 8, 10, 13, 14, 15, 16];
|
||||||
|
if (!empty($dsAlg) && !in_array($dsAlg, $validAlgorithms)) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Incomplete algorithm provided');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate digestType and digest
|
||||||
|
if (!empty($dsDigestType) && !is_int($dsDigestType)) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Incomplete digest type provided');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
$validDigests = [
|
||||||
|
1 => 40, // SHA-1
|
||||||
|
2 => 64, // SHA-256
|
||||||
|
4 => 96 // SHA-384
|
||||||
|
];
|
||||||
|
if (!empty($validDigests[$dsDigestType])) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Unsupported digest type');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
if (!empty($dsDigest)) {
|
||||||
|
if (strlen($dsDigest) != $validDigests[$dsDigestType] || !ctype_xdigit($dsDigest)) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Invalid digest length or format');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Data sanity checks for keyData
|
||||||
|
// Validate flags
|
||||||
|
$validFlags = [256, 257];
|
||||||
|
if (!empty($dnskeyFlags) && !in_array($dnskeyFlags, $validFlags)) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Invalid flags provided');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate protocol
|
||||||
|
if (!empty($dnskeyProtocol) && $dnskeyProtocol != 3) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Invalid protocol provided');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate algKeyData
|
||||||
|
if (!empty($dnskeyAlg)) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Invalid algorithm encoding');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate pubKey
|
||||||
|
if (!empty($dnskeyPubKey) && base64_encode(base64_decode($dnskeyPubKey, true)) !== $dnskeyPubKey) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Invalid public key encoding');
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($dsKeyTag) || !empty($dnskeyFlags)) {
|
||||||
|
$db->insert('secdns', [
|
||||||
|
'domain_id' => $domain_id,
|
||||||
|
'maxsiglife' => $maxSigLife,
|
||||||
|
'interface' => 'dsData',
|
||||||
|
'keytag' => $dsKeyTag,
|
||||||
|
'alg' => $dsAlg,
|
||||||
|
'digesttype' => $dsDigestType,
|
||||||
|
'digest' => $dsDigest,
|
||||||
|
'flags' => $dnskeyFlags ?? null,
|
||||||
|
'protocol' => $dnskeyProtocol ?? null,
|
||||||
|
'keydata_alg' => $dnskeyAlg ?? null,
|
||||||
|
'pubkey' => $dnskeyPubKey ?? null
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($nameservers as $index => $nameserver) {
|
||||||
|
$hostName_already_exist = $db->selectValue(
|
||||||
|
'SELECT id FROM host WHERE name = ? LIMIT 1',
|
||||||
|
[$nameserver]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($hostName_already_exist) {
|
||||||
|
$domain_host_map_id = $db->selectValue(
|
||||||
|
'SELECT domain_id FROM domain_host_map WHERE domain_id = ? AND host_id = ? LIMIT 1',
|
||||||
|
[$domain_id, $hostName_already_exist]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$domain_host_map_id) {
|
||||||
|
$db->insert(
|
||||||
|
'domain_host_map',
|
||||||
|
[
|
||||||
|
'domain_id' => $domain_id,
|
||||||
|
'host_id' => $hostName_already_exist
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$currentDateTime = new \DateTime();
|
||||||
|
$logdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
|
$db->insert(
|
||||||
|
'error_log',
|
||||||
|
[
|
||||||
|
'registrar_id' => $clid,
|
||||||
|
'log' => "Domain : $domainName ; hostName : $nameserver - is duplicated",
|
||||||
|
'date' => $logdate
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$currentDateTime = new \DateTime();
|
||||||
|
$host_date = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
|
$host_id = $db->insert(
|
||||||
|
'host',
|
||||||
|
[
|
||||||
|
'name' => $nameserver,
|
||||||
|
'domain_id' => $domain_id,
|
||||||
|
'clid' => $clid,
|
||||||
|
'crid' => $clid,
|
||||||
|
'crdate' => $host_date
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$db->insert(
|
||||||
|
'domain_host_map',
|
||||||
|
[
|
||||||
|
'domain_id' => $domain_id,
|
||||||
|
'host_id' => $host_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($nameserver_ipv4[$index]) && !empty($nameserver_ipv4[$index])) {
|
||||||
|
$ipv4 = normalize_v4_address($nameserver_ipv4[$index]);
|
||||||
|
|
||||||
|
$db->insert(
|
||||||
|
'host_addr',
|
||||||
|
[
|
||||||
|
'host_id' => $host_id,
|
||||||
|
'addr' => $ipv4,
|
||||||
|
'ip' => 'v4'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($nameserver_ipv6[$index]) && !empty($nameserver_ipv6[$index])) {
|
||||||
|
$ipv6 = normalize_v6_address($nameserver_ipv6[$index]);
|
||||||
|
|
||||||
|
$db->insert(
|
||||||
|
'host_addr',
|
||||||
|
[
|
||||||
|
'host_id' => $host_id,
|
||||||
|
'addr' => $ipv6,
|
||||||
|
'ip' => 'v6'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$contacts = [
|
||||||
|
'admin' => $data['contactAdmin'] ?? null,
|
||||||
|
'tech' => $data['contactTech'] ?? null,
|
||||||
|
'billing' => $data['contactBilling'] ?? null
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($contacts as $type => $contact) {
|
||||||
|
if ($contact !== null) {
|
||||||
|
$contact_id = $db->selectValue(
|
||||||
|
'SELECT id FROM contact WHERE identifier = ? LIMIT 1',
|
||||||
|
[$contact]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check if $contact_id is not null before update
|
||||||
|
if ($contact_id !== null) {
|
||||||
|
$db->update(
|
||||||
|
'domain_contact_map',
|
||||||
|
[
|
||||||
|
'contact_id' => $contact_id,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'domain_id' => $domain_id,
|
||||||
|
'type' => $type
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$db->rollBack();
|
||||||
|
$this->container->get('flash')->addMessage('error', 'Database failure during update: ' . $e->getMessage());
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->container->get('flash')->addMessage('success', 'Domain ' . $domainName . ' has been updated successfully on ' . $update);
|
||||||
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renewDomain(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
return view($response,'admin/domains/renewDomain.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteDomain(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
return view($response,'admin/domains/deleteDomain.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listTransfers(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
return view($response,'admin/domains/listTransfers.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function requestTransfer(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
return view($response,'admin/domains/requestTransfer.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approveTransfer(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
return view($response,'admin/domains/approveTransfer.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rejectTransfer(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
return view($response,'admin/domains/rejectTransfer.twig');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cancelTransfer(Request $request, Response $response)
|
||||||
|
{
|
||||||
|
return view($response,'admin/domains/cancelTransfer.twig');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -25,11 +25,11 @@
|
||||||
{{ __('View Reports') }}
|
{{ __('View Reports') }}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<a href="{{route('domaincreate')}}" class="btn btn-primary d-none d-sm-inline-block">
|
<a href="{{route('createDomain')}}" class="btn btn-primary d-none d-sm-inline-block">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
||||||
{{ __('Create new domain') }}
|
{{ __('Create new domain') }}
|
||||||
</a>
|
</a>
|
||||||
<a href="{{route('domaincreate')}}" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" aria-label="{{ __('Create new domain') }}">
|
<a href="{{route('createDomain')}}" class="btn btn-primary d-sm-none btn-icon" data-bs-toggle="modal" aria-label="{{ __('Create new domain') }}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<div class="row row-cards">
|
<div class="row row-cards">
|
||||||
{% if registrars %}
|
{% if registrars %}
|
||||||
<div class="col-sm-6 col-lg-3">
|
<div class="col-sm-6 col-lg-3">
|
||||||
<a class="card card-link" href="{{route('domains')}}">
|
<a class="card card-link" href="{{route('listDomains')}}">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row align-items-center">
|
<div class="row align-items-center">
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
|
|
291
cp/resources/views/admin/domains/editDomain.twig
Normal file
291
cp/resources/views/admin/domains/editDomain.twig
Normal file
|
@ -0,0 +1,291 @@
|
||||||
|
{% extends "layouts/app.twig" %}
|
||||||
|
|
||||||
|
{% block title %}{{ __('Editing Domain') }} {{ domain.name }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<!-- Page header -->
|
||||||
|
<div class="page-header d-print-none">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="row g-2 align-items-center">
|
||||||
|
<div class="col">
|
||||||
|
<!-- Page pre-title -->
|
||||||
|
<div class="page-pretitle">
|
||||||
|
Overview
|
||||||
|
</div>
|
||||||
|
<h2 class="page-title">
|
||||||
|
{{ __('Editing Domain') }} {{ domain.name }}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Page body -->
|
||||||
|
<div class="page-body">
|
||||||
|
<div class="container-xl">
|
||||||
|
<form id="domainCreateForm" action="/domain/update" method="post">
|
||||||
|
{{ csrf.field | raw }}
|
||||||
|
<div class="col-12">
|
||||||
|
{% if domainName is defined and crdate is defined %}
|
||||||
|
<div class="alert alert-important alert-success alert-dismissible" role="alert">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10" /></svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ __('Domain') }} <strong>{{ domainName }}</strong> {{ __('has been created successfully on') }} <strong>{{ crdate|date("Y-m-d H:i:s") }}!</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
|
||||||
|
</div>
|
||||||
|
{% elseif error is defined %}
|
||||||
|
<div class="alert alert-important alert-danger alert-dismissible" role="alert">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" /><path d="M12 8v4" /><path d="M12 16h.01" /></svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ __('Domain') }} <strong>{{ domainName }}</strong> {{ __('can not be created') }}: <strong>{{ error }}</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="card mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
Domain {{ domain.name }}
|
||||||
|
{% if domainStatus.status %}
|
||||||
|
<span class="status status-green" title="Status">{{ domainStatus.status }}</span>
|
||||||
|
{% endif %}
|
||||||
|
<span class="status status-info" title="Status">{{ domain.rgpstatus }}</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="datagrid">
|
||||||
|
<div class="datagrid-item">
|
||||||
|
<div class="datagrid-title">Registered On</div>
|
||||||
|
<div class="datagrid-content">{{ domain.crdate }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="datagrid-item">
|
||||||
|
<div class="datagrid-title">Last Updated</div>
|
||||||
|
<div class="datagrid-content">{{ domain.update }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="datagrid-item">
|
||||||
|
<div class="datagrid-title">Expiration Date</div>
|
||||||
|
<div class="datagrid-content">{{ domain.exdate }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="datagrid-item">
|
||||||
|
<div class="datagrid-title">Registrar</div>
|
||||||
|
<div class="datagrid-content">{{ registrar.name }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<!-- Fields for 4 contacts with roles -->
|
||||||
|
<div class="col">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="contactRegistrant" class="form-label required">{{ __('Contacts') }}</label>
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Registrant Contact') }}" name="contactRegistrant" id="contactRegistrant" value="{{ domainRegistrant.identifier }}" required="required">
|
||||||
|
|
||||||
|
{% set contactAdmin = '' %}
|
||||||
|
{% set contactTech = '' %}
|
||||||
|
{% set contactBilling = '' %}
|
||||||
|
|
||||||
|
{% for contact in domainContacts %}
|
||||||
|
{% if contact.type == 'admin' %}
|
||||||
|
{% set contactAdmin = contact.identifier %}
|
||||||
|
{% elseif contact.type == 'tech' %}
|
||||||
|
{% set contactTech = contact.identifier %}
|
||||||
|
{% elseif contact.type == 'billing' %}
|
||||||
|
{% set contactBilling = contact.identifier %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Admin Contact') }}" name="contactAdmin" value="{{ contactAdmin }}">
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Tech Contact') }}" name="contactTech" value="{{ contactTech }}">
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Billing Contact') }}" name="contactBilling" value="{{ contactBilling }}">
|
||||||
|
</div>
|
||||||
|
<!-- AuthInfo -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="authInfo" class="form-label">{{ __('Auth Info') }}</label>
|
||||||
|
<input type="text" class="form-control" id="authInfo" name="authInfo" value="{{ domainAuth.authinfo }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Fields for nameservers -->
|
||||||
|
<div class="col">
|
||||||
|
<div id="nameserverFields">
|
||||||
|
<label class="form-label">{{ __('Nameservers') }}</label>
|
||||||
|
{% for host in domainHosts %}
|
||||||
|
<div class="nameserver-group mb-1 row">
|
||||||
|
<!-- Nameserver -->
|
||||||
|
<div class="col-md-12">
|
||||||
|
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} {{ loop.index }}" name="nameserver[]" value="{{ host.name }}" required autocapitalize="none">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<button type="button" id="addNameserver" class="btn btn-success btn-sm mb-2">+</button>
|
||||||
|
<button type="button" id="removeNameserver" class="btn btn-danger btn-sm mb-2">-</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if domainSecdns|length > 0 %}
|
||||||
|
<!-- DNSSEC data is available, display the form directly -->
|
||||||
|
<div id="dnssecData" class="mb-3">
|
||||||
|
<label for="authInfo" class="form-label">{{ __('DNSSEC Data') }}</label>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-vcenter card-table table-striped">
|
||||||
|
{% for row in domainSecdns %}
|
||||||
|
<tr>
|
||||||
|
{% for key, value in row %}
|
||||||
|
{% if key not in ['id', 'domain_id', 'maxsiglife'] %}
|
||||||
|
<th>{{ key }}</th>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
{% for key, value in row %}
|
||||||
|
{% if key not in ['id', 'domain_id', 'maxsiglife'] %}
|
||||||
|
<td>{{ value }}</td>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<!-- DNSSEC Data with checkbox -->
|
||||||
|
<div class="mb-3 form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="addDnssec" name="addDnssec">
|
||||||
|
<label class="form-check-label" for="addDnssec">{{ __('Add DNSSEC Data') }}</label>
|
||||||
|
</div>
|
||||||
|
<div id="dnssecData" style="display: none;">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="dsKeyTag" class="form-label">{{ __('DS Record') }}</label>
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Key Tag') }}" name="dsKeyTag" id="dsKeyTag">
|
||||||
|
<select class="form-control mb-2" name="dsAlg">
|
||||||
|
<option value="" disabled selected>{{ __('Select Algorithm') }}</option>
|
||||||
|
<option value="1">RSA/MD5 (deprecated)</option>
|
||||||
|
<option value="3">DSA/SHA1</option>
|
||||||
|
<option value="5">RSA/SHA-1</option>
|
||||||
|
<!-- Add other algorithms as required -->
|
||||||
|
</select>
|
||||||
|
<select class="form-control mb-2" name="dsDigestType">
|
||||||
|
<option value="" disabled selected>{{ __('Select Digest Type') }}</option>
|
||||||
|
<option value="1">SHA-1</option>
|
||||||
|
<option value="2">SHA-256</option>
|
||||||
|
<!-- Add other digest types as required -->
|
||||||
|
</select>
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Digest') }}" name="dsDigest">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="dnskeyFlags" class="form-label">{{ __('DNSKEY Record') }}</label>
|
||||||
|
<input type="number" class="form-control mb-2" placeholder="{{ __('Flags') }}" name="dnskeyFlags" id="dnskeyFlags">
|
||||||
|
<input type="number" class="form-control mb-2" placeholder="{{ __('Protocol') }}" name="dnskeyProtocol" value="3" readonly> <!-- Protocol is typically set to 3 -->
|
||||||
|
<select class="form-control mb-2" name="dnskeyAlg">
|
||||||
|
<option value="" disabled selected>{{ __('Select Algorithm') }}</option>
|
||||||
|
<option value="1">RSA/MD5 (deprecated)</option>
|
||||||
|
<option value="3">DSA/SHA1</option>
|
||||||
|
<option value="5">RSA/SHA-1</option>
|
||||||
|
<!-- Add other algorithms as required -->
|
||||||
|
</select>
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Public Key') }}" name="dnskeyPubKey">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="submit" class="btn btn-primary">{{ __('Update Domain') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer class="footer footer-transparent d-print-none">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
|
||||||
|
<ul class="list-inline list-inline-dots mb-0">
|
||||||
|
<li class="list-inline-item">
|
||||||
|
Copyright © 2023
|
||||||
|
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
|
||||||
|
const addNameserverBtn = document.getElementById('addNameserver');
|
||||||
|
const removeNameserverBtn = document.getElementById('removeNameserver');
|
||||||
|
const nameserverFields = document.getElementById('nameserverFields');
|
||||||
|
|
||||||
|
function createNameserverGroup(count) {
|
||||||
|
const group = document.createElement('div');
|
||||||
|
group.className = 'nameserver-group mb-1 row';
|
||||||
|
|
||||||
|
const nameserverCol = document.createElement('div');
|
||||||
|
nameserverCol.className = 'col-md-12';
|
||||||
|
const nameserverField = document.createElement('input');
|
||||||
|
nameserverField.type = 'text';
|
||||||
|
nameserverField.className = 'form-control mb-1';
|
||||||
|
nameserverField.placeholder = `{{ __('Nameserver') }} ${count}`;
|
||||||
|
nameserverField.name = `nameserver[]`;
|
||||||
|
nameserverCol.appendChild(nameserverField);
|
||||||
|
|
||||||
|
group.appendChild(nameserverCol);
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add nameserver fields
|
||||||
|
let nameserverCount = {{ domainHosts|length }}; // Initialize count based on the number of domain hosts
|
||||||
|
|
||||||
|
addNameserverBtn.addEventListener('click', function() {
|
||||||
|
if (nameserverCount < 13) {
|
||||||
|
nameserverCount++;
|
||||||
|
const nameserverGroup = createNameserverGroup(nameserverCount);
|
||||||
|
nameserverFields.appendChild(nameserverGroup);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove nameserver group
|
||||||
|
removeNameserverBtn.addEventListener('click', function() {
|
||||||
|
if (nameserverCount > 2) {
|
||||||
|
const lastGroup = nameserverFields.querySelector('.nameserver-group:last-child');
|
||||||
|
if (lastGroup) {
|
||||||
|
nameserverFields.removeChild(lastGroup);
|
||||||
|
nameserverCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Display DNSSEC data when the checkbox is ticked
|
||||||
|
document.getElementById('addDnssec').addEventListener('change', function() {
|
||||||
|
const dnssecData = document.getElementById('dnssecData');
|
||||||
|
if (this.checked) {
|
||||||
|
dnssecData.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
dnssecData.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
|
@ -21,15 +21,15 @@
|
||||||
<div class="col-auto ms-auto d-print-none">
|
<div class="col-auto ms-auto d-print-none">
|
||||||
<div class="btn-list">
|
<div class="btn-list">
|
||||||
<span class="d-none d-sm-inline">
|
<span class="d-none d-sm-inline">
|
||||||
<a href="{{route('domaincheck')}}" class="btn">
|
<a href="{{route('checkDomain')}}" class="btn">
|
||||||
{{ __('Check Domain') }}
|
{{ __('Check Domain') }}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<a href="{{route('domaincreate')}}" class="btn btn-primary d-none d-sm-inline-block">
|
<a href="{{route('createDomain')}}" class="btn btn-primary d-none d-sm-inline-block">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
||||||
{{ __('Create Domain') }}
|
{{ __('Create Domain') }}
|
||||||
</a>
|
</a>
|
||||||
<a href="{{route('domaincreate')}}" class="btn btn-primary d-sm-none btn-icon" aria-label="{{ __('Create Domain') }}">
|
<a href="{{route('createDomain')}}" class="btn btn-primary d-sm-none btn-icon" aria-label="{{ __('Create Domain') }}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
267
cp/resources/views/admin/domains/updateDomain.twig
Normal file
267
cp/resources/views/admin/domains/updateDomain.twig
Normal file
|
@ -0,0 +1,267 @@
|
||||||
|
{% extends "layouts/app.twig" %}
|
||||||
|
|
||||||
|
{% block title %}{{ __('Updating Domain') }} {{ domain.name }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<!-- Page header -->
|
||||||
|
<div class="page-header d-print-none">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="row g-2 align-items-center">
|
||||||
|
<div class="col">
|
||||||
|
<!-- Page pre-title -->
|
||||||
|
<div class="page-pretitle">
|
||||||
|
Overview
|
||||||
|
</div>
|
||||||
|
<h2 class="page-title">
|
||||||
|
{{ __('Updating Domain') }} {{ domain.name }}
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Page body -->
|
||||||
|
<div class="page-body">
|
||||||
|
<div class="container-xl">
|
||||||
|
<form id="domainCreateForm" action="/domain/update" method="post">
|
||||||
|
{{ csrf.field | raw }}
|
||||||
|
<div class="col-12">
|
||||||
|
{% include 'partials/flash.twig' %}
|
||||||
|
<div class="card mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title">
|
||||||
|
Domain {{ domain.name }} <input type="hidden" name="domainName" value="{{ domain.name }}">
|
||||||
|
{% if domainStatus.status %}
|
||||||
|
<span class="status status-green" title="Status">{{ domainStatus.status }}</span>
|
||||||
|
{% endif %}
|
||||||
|
<span class="status status-info" title="Status">{{ domain.rgpstatus }}</span>
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="datagrid">
|
||||||
|
<div class="datagrid-item">
|
||||||
|
<div class="datagrid-title">Registered On</div>
|
||||||
|
<div class="datagrid-content">{{ domain.crdate }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="datagrid-item">
|
||||||
|
<div class="datagrid-title">Last Updated</div>
|
||||||
|
<div class="datagrid-content">{{ domain.update }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="datagrid-item">
|
||||||
|
<div class="datagrid-title">Expiration Date</div>
|
||||||
|
<div class="datagrid-content">{{ domain.exdate }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="datagrid-item">
|
||||||
|
<div class="datagrid-title">Registrar</div>
|
||||||
|
<div class="datagrid-content">{{ registrar.name }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<!-- Fields for 4 contacts with roles -->
|
||||||
|
<div class="col">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="contactRegistrant" class="form-label required">{{ __('Contacts') }}</label>
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Registrant Contact') }}" name="contactRegistrant" id="contactRegistrant" value="{{ domainRegistrant.identifier }}" required="required">
|
||||||
|
|
||||||
|
{% set contactAdmin = '' %}
|
||||||
|
{% set contactTech = '' %}
|
||||||
|
{% set contactBilling = '' %}
|
||||||
|
|
||||||
|
{% for contact in domainContacts %}
|
||||||
|
{% if contact.type == 'admin' %}
|
||||||
|
{% set contactAdmin = contact.identifier %}
|
||||||
|
{% elseif contact.type == 'tech' %}
|
||||||
|
{% set contactTech = contact.identifier %}
|
||||||
|
{% elseif contact.type == 'billing' %}
|
||||||
|
{% set contactBilling = contact.identifier %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Admin Contact') }}" name="contactAdmin" value="{{ contactAdmin }}">
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Tech Contact') }}" name="contactTech" value="{{ contactTech }}">
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Billing Contact') }}" name="contactBilling" value="{{ contactBilling }}">
|
||||||
|
</div>
|
||||||
|
<!-- AuthInfo -->
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="authInfo" class="form-label">{{ __('Auth Info') }}</label>
|
||||||
|
<input type="text" class="form-control" id="authInfo" name="authInfo" value="{{ domainAuth.authinfo }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Fields for nameservers -->
|
||||||
|
<div class="col">
|
||||||
|
<div id="nameserverFields">
|
||||||
|
<label class="form-label">{{ __('Nameservers') }}</label>
|
||||||
|
{% for host in domainHosts %}
|
||||||
|
<div class="nameserver-group mb-1 row">
|
||||||
|
<!-- Nameserver -->
|
||||||
|
<div class="col-md-12">
|
||||||
|
<input type="text" class="form-control mb-1" placeholder="{{ __('Nameserver') }} {{ loop.index }}" name="nameserver[]" value="{{ host.name }}" autocapitalize="none">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<button type="button" id="addNameserver" class="btn btn-success btn-sm mb-2">+</button>
|
||||||
|
<button type="button" id="removeNameserver" class="btn btn-danger btn-sm mb-2">-</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if domainSecdns|length > 0 %}
|
||||||
|
<!-- DNSSEC data is available, display the form directly -->
|
||||||
|
<div id="dnssecData" class="mb-3">
|
||||||
|
<label for="authInfo" class="form-label">{{ __('DNSSEC Data') }}</label>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-vcenter card-table table-striped">
|
||||||
|
{% for row in domainSecdns %}
|
||||||
|
<tr>
|
||||||
|
{% for key, value in row %}
|
||||||
|
{% if key not in ['id', 'domain_id', 'maxsiglife'] %}
|
||||||
|
<th>{{ key }}</th>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
{% for key, value in row %}
|
||||||
|
{% if key not in ['id', 'domain_id', 'maxsiglife'] %}
|
||||||
|
<td>{{ value }}</td>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<!-- DNSSEC Data with checkbox -->
|
||||||
|
<div class="mb-3 form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="addDnssec" name="addDnssec">
|
||||||
|
<label class="form-check-label" for="addDnssec">{{ __('Add DNSSEC Data') }}</label>
|
||||||
|
</div>
|
||||||
|
<div id="dnssecData" style="display: none;">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="dsKeyTag" class="form-label">{{ __('DS Record') }}</label>
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Key Tag') }}" name="dsKeyTag" id="dsKeyTag">
|
||||||
|
<select class="form-control mb-2" name="dsAlg">
|
||||||
|
<option value="" disabled selected>{{ __('Select Algorithm') }}</option>
|
||||||
|
<option value="1">RSA/MD5 (deprecated)</option>
|
||||||
|
<option value="3">DSA/SHA1</option>
|
||||||
|
<option value="5">RSA/SHA-1</option>
|
||||||
|
<!-- Add other algorithms as required -->
|
||||||
|
</select>
|
||||||
|
<select class="form-control mb-2" name="dsDigestType">
|
||||||
|
<option value="" disabled selected>{{ __('Select Digest Type') }}</option>
|
||||||
|
<option value="1">SHA-1</option>
|
||||||
|
<option value="2">SHA-256</option>
|
||||||
|
<!-- Add other digest types as required -->
|
||||||
|
</select>
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Digest') }}" name="dsDigest">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="dnskeyFlags" class="form-label">{{ __('DNSKEY Record') }}</label>
|
||||||
|
<input type="number" class="form-control mb-2" placeholder="{{ __('Flags') }}" name="dnskeyFlags" id="dnskeyFlags">
|
||||||
|
<input type="number" class="form-control mb-2" placeholder="{{ __('Protocol') }}" name="dnskeyProtocol" value="3" readonly> <!-- Protocol is typically set to 3 -->
|
||||||
|
<select class="form-control mb-2" name="dnskeyAlg">
|
||||||
|
<option value="" disabled selected>{{ __('Select Algorithm') }}</option>
|
||||||
|
<option value="1">RSA/MD5 (deprecated)</option>
|
||||||
|
<option value="3">DSA/SHA1</option>
|
||||||
|
<option value="5">RSA/SHA-1</option>
|
||||||
|
<!-- Add other algorithms as required -->
|
||||||
|
</select>
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="{{ __('Public Key') }}" name="dnskeyPubKey">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="submit" class="btn btn-primary">{{ __('Update Domain') }}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer class="footer footer-transparent d-print-none">
|
||||||
|
<div class="container-xl">
|
||||||
|
<div class="col-12 col-lg-auto mt-3 mt-lg-0">
|
||||||
|
<ul class="list-inline list-inline-dots mb-0">
|
||||||
|
<li class="list-inline-item">
|
||||||
|
Copyright © 2023
|
||||||
|
<a href="https://namingo.org" target="_blank" class="link-secondary">Namingo</a>.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
|
||||||
|
const addNameserverBtn = document.getElementById('addNameserver');
|
||||||
|
const removeNameserverBtn = document.getElementById('removeNameserver');
|
||||||
|
const nameserverFields = document.getElementById('nameserverFields');
|
||||||
|
|
||||||
|
function createNameserverGroup(count) {
|
||||||
|
const group = document.createElement('div');
|
||||||
|
group.className = 'nameserver-group mb-1 row';
|
||||||
|
|
||||||
|
const nameserverCol = document.createElement('div');
|
||||||
|
nameserverCol.className = 'col-md-12';
|
||||||
|
const nameserverField = document.createElement('input');
|
||||||
|
nameserverField.type = 'text';
|
||||||
|
nameserverField.className = 'form-control mb-1';
|
||||||
|
nameserverField.placeholder = `{{ __('Nameserver') }} ${count}`;
|
||||||
|
nameserverField.name = `nameserver[]`;
|
||||||
|
nameserverCol.appendChild(nameserverField);
|
||||||
|
|
||||||
|
group.appendChild(nameserverCol);
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add nameserver fields
|
||||||
|
let nameserverCount = {{ domainHosts|length }}; // Initialize count based on the number of domain hosts
|
||||||
|
|
||||||
|
addNameserverBtn.addEventListener('click', function() {
|
||||||
|
if (nameserverCount < 13) {
|
||||||
|
nameserverCount++;
|
||||||
|
const nameserverGroup = createNameserverGroup(nameserverCount);
|
||||||
|
nameserverFields.appendChild(nameserverGroup);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove nameserver group
|
||||||
|
removeNameserverBtn.addEventListener('click', function() {
|
||||||
|
if (nameserverCount > 2) {
|
||||||
|
const lastGroup = nameserverFields.querySelector('.nameserver-group:last-child');
|
||||||
|
if (lastGroup) {
|
||||||
|
nameserverFields.removeChild(lastGroup);
|
||||||
|
nameserverCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Display DNSSEC data when the checkbox is ticked
|
||||||
|
document.getElementById('addDnssec').addEventListener('change', function() {
|
||||||
|
const dnssecData = document.getElementById('dnssecData');
|
||||||
|
if (this.checked) {
|
||||||
|
dnssecData.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
dnssecData.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
|
@ -83,7 +83,7 @@
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li {{ is_current_url('domains') or is_current_url('domaincheck') or is_current_url('domaincreate') or is_current_url('transfers') or 'domain' in currentUri ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
|
<li {{ is_current_url('listDomains') or is_current_url('checkDomain') or is_current_url('createDomain') or is_current_url('listTransfers') or is_current_url('requestTransfer') or 'domain' in currentUri ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
|
||||||
<a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" data-bs-toggle="dropdown" data-bs-auto-close="outside" role="button" aria-expanded="false">
|
||||||
<span class="nav-link-icon d-md-none d-lg-inline-block"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M19.5 7a9 9 0 0 0 -7.5 -4a8.991 8.991 0 0 0 -7.484 4"></path><path d="M11.5 3a16.989 16.989 0 0 0 -1.826 4"></path><path d="M12.5 3a16.989 16.989 0 0 1 1.828 4"></path><path d="M19.5 17a9 9 0 0 1 -7.5 4a8.991 8.991 0 0 1 -7.484 -4"></path><path d="M11.5 21a16.989 16.989 0 0 1 -1.826 -4"></path><path d="M12.5 21a16.989 16.989 0 0 0 1.828 -4"></path><path d="M2 10l1 4l1.5 -4l1.5 4l1 -4"></path><path d="M17 10l1 4l1.5 -4l1.5 4l1 -4"></path><path d="M9.5 10l1 4l1.5 -4l1.5 4l1 -4"></path></svg>
|
<span class="nav-link-icon d-md-none d-lg-inline-block"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M19.5 7a9 9 0 0 0 -7.5 -4a8.991 8.991 0 0 0 -7.484 4"></path><path d="M11.5 3a16.989 16.989 0 0 0 -1.826 4"></path><path d="M12.5 3a16.989 16.989 0 0 1 1.828 4"></path><path d="M19.5 17a9 9 0 0 1 -7.5 4a8.991 8.991 0 0 1 -7.484 -4"></path><path d="M11.5 21a16.989 16.989 0 0 1 -1.826 -4"></path><path d="M12.5 21a16.989 16.989 0 0 0 1.828 -4"></path><path d="M2 10l1 4l1.5 -4l1.5 4l1 -4"></path><path d="M17 10l1 4l1.5 -4l1.5 4l1 -4"></path><path d="M9.5 10l1 4l1.5 -4l1.5 4l1 -4"></path></svg>
|
||||||
</span>
|
</span>
|
||||||
|
@ -92,19 +92,22 @@
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{{route('domains')}}">
|
<a class="dropdown-item" href="{{route('listDomains')}}">
|
||||||
{{ __('List Domains') }}
|
{{ __('List Domains') }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{{route('domaincheck')}}">
|
<a class="dropdown-item" href="{{route('checkDomain')}}">
|
||||||
{{ __('Check Domain') }}
|
{{ __('Check Domain') }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{{route('domaincreate')}}">
|
<a class="dropdown-item" href="{{route('createDomain')}}">
|
||||||
{{ __('Create Domain') }}
|
{{ __('Create Domain') }}
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="{{route('transfers')}}">
|
<a class="dropdown-item" href="{{route('listTransfers')}}">
|
||||||
{{ __('Transfers') }}
|
{{ __('Transfers') }}
|
||||||
</a>
|
</a>
|
||||||
|
<a class="dropdown-item" href="{{route('requestTransfer')}}">
|
||||||
|
{{ __('Request Transfer') }}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li {{ is_current_url('contacts') or is_current_url('contactcreate') or 'contact' in currentUri ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
|
<li {{ is_current_url('contacts') or is_current_url('contactcreate') or 'contact' in currentUri ? 'class="nav-item dropdown active"' : 'class="nav-item dropdown"' }}>
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<!--
|
|
||||||
* Tabler - Premium and Open Source dashboard template with responsive and high quality UI.
|
|
||||||
* @version 1.0.0-beta16
|
|
||||||
* @link https://tabler.io
|
|
||||||
* Copyright 2018-2022 The Tabler Authors
|
|
||||||
* Copyright 2018-2022 codecalm.net Paweł Kuna
|
|
||||||
* Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE)
|
|
||||||
-->
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
|
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
|
||||||
<title>{% block title %}{% endblock %} | Pinga Framework</title>
|
<title>{% block title %}{% endblock %} | Namingo</title>
|
||||||
<!-- CSS files -->
|
<!-- CSS files -->
|
||||||
{% include 'partials/css.twig' %}
|
{% include 'partials/css.twig' %}
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% if flash.getMessage('info') %}
|
{% if flash.getMessage('info') %}
|
||||||
<div class="alert alert-important alert-info alert-dismissible mt-4" role="alert">
|
<div class="alert alert-important alert-info alert-dismissible" role="alert">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div>
|
<div>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon alert-icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M12 8l.01 0" /><path d="M11 12l1 0l0 4l1 0" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon alert-icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M12 8l.01 0" /><path d="M11 12l1 0l0 4l1 0" /></svg>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if flash.getMessage('error') %}
|
{% if flash.getMessage('error') %}
|
||||||
<div class="alert alert-important alert-danger alert-dismissible mt-4" role="alert">
|
<div class="alert alert-important alert-danger alert-dismissible" role="alert">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div>
|
<div>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon alert-icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M12 8l0 4" /><path d="M12 16l.01 0" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon alert-icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" /><path d="M12 8l0 4" /><path d="M12 16l.01 0" /></svg>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if flash.getMessage('success') %}
|
{% if flash.getMessage('success') %}
|
||||||
<div class="alert alert-important alert-success alert-dismissible mt-4" role="alert">
|
<div class="alert alert-important alert-success alert-dismissible" role="alert">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div>
|
<div>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon alert-icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon alert-icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10" /></svg>
|
||||||
|
|
|
@ -6,15 +6,9 @@
|
||||||
<script>
|
<script>
|
||||||
var table;
|
var table;
|
||||||
document.querySelector("#domainTable").addEventListener('click', function(e) {
|
document.querySelector("#domainTable").addEventListener('click', function(e) {
|
||||||
if (e.target.matches('.update-btn')) {
|
if (e.target.matches('.delete-btn')) {
|
||||||
let id = e.target.getAttribute('data-id');
|
|
||||||
updateRecord(id);
|
|
||||||
} else if (e.target.matches('.delete-btn')) {
|
|
||||||
let id = e.target.getAttribute('data-id');
|
let id = e.target.getAttribute('data-id');
|
||||||
deleteRecord(id);
|
deleteRecord(id);
|
||||||
} else if (e.target.matches('.renew-btn')) {
|
|
||||||
let id = e.target.getAttribute('data-id');
|
|
||||||
renewDomain(id);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -26,18 +20,28 @@
|
||||||
|
|
||||||
function actionsFormatter(cell, formatterParams, onRendered) {
|
function actionsFormatter(cell, formatterParams, onRendered) {
|
||||||
return `
|
return `
|
||||||
<button class="btn btn-primary btn-icon update-btn" data-id="${cell.getRow().getData().id}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"></path><path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"></path><path d="M16 5l3 3"></path></svg></button>
|
<a class="btn btn-primary btn-icon update-btn" href="domain/update/${cell.getRow().getData().name}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"></path><path d="M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"></path><path d="M16 5l3 3"></path></svg></a>
|
||||||
<button class="btn btn-secondary btn-icon renew-btn" data-id="${cell.getRow().getData().id}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"></path><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"></path></svg></button>
|
<a class="btn btn-secondary btn-icon renew-btn" href="domain/renew/${cell.getRow().getData().name}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"></path><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"></path></svg></a>
|
||||||
<button class="btn btn-danger btn-icon delete-btn" data-id="${cell.getRow().getData().id}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7h16"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path><path d="M10 12l4 4m0 -4l-4 4"></path></svg></button>
|
<button class="btn btn-danger btn-icon delete-btn" data-id="${cell.getRow().getData().id}"><svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7h16"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path><path d="M10 12l4 4m0 -4l-4 4"></path></svg></button>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusFormatter(cell) {
|
function statusFormatter(cell) {
|
||||||
var statusArray = cell.getValue();
|
var statusArray = cell.getValue();
|
||||||
if (statusArray && Array.isArray(statusArray)) {
|
var rowData = cell.getRow().getData(); // Get the entire row data
|
||||||
return statusArray.map(item => item.status).join(', ');
|
|
||||||
|
// Function to create a badge
|
||||||
|
function createBadge(text, badgeClass) {
|
||||||
|
return `<span class="badge bg-${badgeClass}-lt">${text}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if statusArray is empty or not
|
||||||
|
if (statusArray && Array.isArray(statusArray) && statusArray.length > 0) {
|
||||||
|
return statusArray.map(item => createBadge(item.status, 'azure')).join(' ');
|
||||||
|
} else {
|
||||||
|
// Fallback to rgpstatus column if statusArray is empty
|
||||||
|
return rowData.rgpstatus ? createBadge(rowData.rgpstatus, 'lime') : "";
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var searchTerm = ""; // global variable to hold the search term
|
var searchTerm = ""; // global variable to hold the search term
|
||||||
|
@ -66,14 +70,7 @@
|
||||||
queryParts.push("filter3=exdate,cs," + encodeURIComponent(searchTerm));
|
queryParts.push("filter3=exdate,cs," + encodeURIComponent(searchTerm));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle sorting
|
queryParts.push("order=id");
|
||||||
if (params.sorters && params.sorters.length) {
|
|
||||||
params.sorters.forEach(function(sorter) {
|
|
||||||
queryParts.push("order=" + sorter.field + "," + sorter.dir);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
queryParts.push("order=id"); // default sorting
|
|
||||||
}
|
|
||||||
|
|
||||||
// Include pagination parameters
|
// Include pagination parameters
|
||||||
if (params.page) {
|
if (params.page) {
|
||||||
|
@ -97,32 +94,16 @@
|
||||||
dataReceiveParams: {
|
dataReceiveParams: {
|
||||||
"last_page": "results", // Mapping 'results' to 'last_page'
|
"last_page": "results", // Mapping 'results' to 'last_page'
|
||||||
},
|
},
|
||||||
sortMode: "remote",
|
|
||||||
columnSorted:function(column, dir, sorters){
|
|
||||||
table.setData();
|
|
||||||
},
|
|
||||||
headerSortElement: function(column, dir){
|
|
||||||
switch(dir){
|
|
||||||
case "asc":
|
|
||||||
return '<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 15l6 -6l6 6" /></svg>';
|
|
||||||
break;
|
|
||||||
case "desc":
|
|
||||||
return '<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 9l6 6l6 -6" /></svg>';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return '<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 9l4 -4l4 4m-4 -4v14" /><path d="M21 15l-4 4l-4 -4m4 4v-14" /></svg>';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
layout:"fitDataFill",
|
layout:"fitDataFill",
|
||||||
responsiveLayout: "collapse",
|
responsiveLayout: "collapse",
|
||||||
responsiveLayoutCollapseStartOpen:false,
|
responsiveLayoutCollapseStartOpen:false,
|
||||||
resizableColumns:false,
|
resizableColumns:false,
|
||||||
columns:[
|
columns:[
|
||||||
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
|
{formatter:"responsiveCollapse", width:30, minWidth:30, hozAlign:"center", resizable:false, headerSort:false, responsive:0},
|
||||||
{title:"Name", field:"name", width:150, headerSort:true, formatter: domainLinkFormatter, responsive:0},
|
{title:"Name", field:"name", width:200, headerSort:false, formatter: domainLinkFormatter, responsive:0},
|
||||||
{title:"Registrant", width:200, field:"registrant.identifier", headerSort:true, responsive:2},
|
{title:"Registrant", width:200, field:"registrant.identifier", headerSort:false, responsive:2},
|
||||||
{title:"Creation Date", width:250, field:"crdate", headerSort:true, responsive:2},
|
{title:"Creation Date", width:200, field:"crdate", headerSort:false, responsive:2},
|
||||||
{title:"Expiration Date", width:250, field:"exdate", headerSort:true, responsive:2},
|
{title:"Expiration Date", width:250, field:"exdate", headerSort:false, responsive:2},
|
||||||
{title:"Status", width:200, field:"domain_status", formatter: statusFormatter, headerSort:false, download:false, responsive:2},
|
{title:"Status", width:200, field:"domain_status", formatter: statusFormatter, headerSort:false, download:false, responsive:2},
|
||||||
{title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick:function(e, cell){ e.stopPropagation(); }},
|
{title: "Actions", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick:function(e, cell){ e.stopPropagation(); }},
|
||||||
],
|
],
|
||||||
|
|
|
@ -36,11 +36,19 @@ $app->group('', function ($route) {
|
||||||
$app->group('', function ($route) {
|
$app->group('', function ($route) {
|
||||||
$route->get('/dashboard', HomeController::class .':dashboard')->setName('home');
|
$route->get('/dashboard', HomeController::class .':dashboard')->setName('home');
|
||||||
|
|
||||||
$route->get('/domains', DomainsController::class .':view')->setName('domains');
|
$route->get('/domains', DomainsController::class .':listDomains')->setName('listDomains');
|
||||||
$route->map(['GET', 'POST'], '/domain/check', DomainsController::class . ':check')->setName('domaincheck');
|
$route->map(['GET', 'POST'], '/domain/check', DomainsController::class . ':checkDomain')->setName('checkDomain');
|
||||||
$route->map(['GET', 'POST'], '/domain/create', DomainsController::class . ':create')->setName('domaincreate');
|
$route->map(['GET', 'POST'], '/domain/create', DomainsController::class . ':createDomain')->setName('createDomain');
|
||||||
$route->get('/domain/view/{domain}', DomainsController::class . ':viewDomain')->setName('viewDomain');
|
$route->get('/domain/view/{domain}', DomainsController::class . ':viewDomain')->setName('viewDomain');
|
||||||
$route->map(['GET', 'POST'], '/transfers', DomainsController::class . ':transfers')->setName('transfers');
|
$route->map(['GET', 'POST'], '/domain/update/{domain}', DomainsController::class . ':updateDomain')->setName('updateDomain');
|
||||||
|
$route->map(['GET', 'POST'], '/domain/renew/{domain}', DomainsController::class . ':renewDomain')->setName('renewDomain');
|
||||||
|
$route->map(['GET', 'POST'], '/domain/delete/{domain}', DomainsController::class . ':deleteDomain')->setName('deleteDomain');
|
||||||
|
|
||||||
|
$route->get('/transfers', DomainsController::class . ':listTransfers')->setName('listTransfers');
|
||||||
|
$route->map(['GET', 'POST'], '/transfer/request', DomainsController::class . ':requestTransfer')->setName('requestTransfer');
|
||||||
|
$route->post('/transfer/approve', DomainsController::class . ':approveTransfer')->setName('approveTransfer');
|
||||||
|
$route->post('/transfer/reject', DomainsController::class . ':rejectTransfer')->setName('rejectTransfer');
|
||||||
|
$route->post('/transfer/cancel', DomainsController::class . ':cancelTransfer')->setName('cancelTransfer');
|
||||||
|
|
||||||
$route->get('/contacts', ContactsController::class .':view')->setName('contacts');
|
$route->get('/contacts', ContactsController::class .':view')->setName('contacts');
|
||||||
$route->map(['GET', 'POST'], '/contact/create', ContactsController::class . ':create')->setName('contactcreate');
|
$route->map(['GET', 'POST'], '/contact/create', ContactsController::class . ':create')->setName('contactcreate');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue