UI improvements

This commit is contained in:
Pinga 2025-04-03 14:30:31 +03:00
parent 4e3e788952
commit 08d30c57e9
3 changed files with 88 additions and 60 deletions

View file

@ -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);
}
}
}