From 08d30c57e914a51412eeea9c2b11d0a036ebc9da Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:30:31 +0300 Subject: [PATCH] UI improvements --- cp/app/Controllers/SystemController.php | 70 +++++++++++------ .../views/admin/system/manageTld.twig | 77 ++++++++++--------- cp/routes/web.php | 1 + 3 files changed, 88 insertions(+), 60 deletions(-) diff --git a/cp/app/Controllers/SystemController.php b/cp/app/Controllers/SystemController.php index f47336d..a49c233 100644 --- a/cp/app/Controllers/SystemController.php +++ b/cp/app/Controllers/SystemController.php @@ -728,18 +728,6 @@ class SystemController extends Controller return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302); } - if (isset($data['dnssec_enable'], $data['bind9_enable'])) { - if ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] === 'on') { - $dnssec_both = 1; - } elseif ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] !== 'on') { - $this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9'); - return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302); - } elseif ($data['dnssec_enable'] !== 'on' && $data['bind9_enable'] === 'on') { - $this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9'); - return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302); - } - } - try { $db->beginTransaction(); @@ -821,18 +809,6 @@ class SystemController extends Controller ] ); - if (isset($dnssec_both) && $dnssec_both === 1) { - $db->update( - 'domain_tld', - [ - 'secure' => 1 - ], - [ - 'id' => $tld_id - ] - ); - } - // Loop through category indices from 1 to 10 for ($i = 1; $i <= 10; $i++) { $categoryNameKey = 'categoryName' . $i; @@ -1984,4 +1960,50 @@ class SystemController extends Controller } + public function manageDnssec(Request $request, Response $response) + { + if ($_SESSION["auth_roles"] != 0) { + return $response->withHeader('Location', '/dashboard')->withStatus(302); + } + + $db = $this->container->get('db'); + + if (!empty($_SESSION['u_tld_id'])) { + $tld_id = $_SESSION['u_tld_id'][0]; + } else { + $this->container->get('flash')->addMessage('error', 'No TLD specified for DNSSEC'); + return $response->withHeader('Location', '/registry/tlds')->withStatus(302); + } + + if (!empty($_SESSION['u_tld_extension'])) { + $tld_extension = $_SESSION['u_tld_extension'][0]; + } else { + $this->container->get('flash')->addMessage('error', 'No TLD specified for DNSSEC'); + return $response->withHeader('Location', '/registry/tlds')->withStatus(302); + } + + try { + $db->update( + 'domain_tld', + [ + 'secure' => 1 + ], + [ + 'id' => $tld_id + ] + ); + + unset($_SESSION['u_tld_id']); + unset($_SESSION['u_tld_extension']); + + $this->container->get('flash')->addMessage('success', 'DNSSEC for ' . $tld_extension . ' has been successfully activated'); + return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302); + } catch (Exception $e) { + $db->rollBack(); + $this->container->get('flash')->addMessage('error', 'Database failure: ' . $e->getMessage()); + return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302); + } + + } + } \ No newline at end of file diff --git a/cp/resources/views/admin/system/manageTld.twig b/cp/resources/views/admin/system/manageTld.twig index 93e5751..c33bd3c 100644 --- a/cp/resources/views/admin/system/manageTld.twig +++ b/cp/resources/views/admin/system/manageTld.twig @@ -3,6 +3,7 @@ {% block title %}{{ __('Manage TLD') }} {{ tld.tld }}{% endblock %} {% block content %} +