diff --git a/cp/app/Controllers/SystemController.php b/cp/app/Controllers/SystemController.php index ba84e54..1c22e16 100644 --- a/cp/app/Controllers/SystemController.php +++ b/cp/app/Controllers/SystemController.php @@ -971,18 +971,27 @@ class SystemController extends Controller } $db = $this->container->get('db'); - $types = $db->select("SELECT DISTINCT type FROM reserved_domain_names"); - // Get the current URI - $uri = $request->getUri()->getPath(); - - // Set default types if $types is empty - if (empty($types)) { - $types = [ - ['type' => 'reserved'], - ['type' => 'restricted'] - ]; + $typesResult = $db->select("SELECT DISTINCT type FROM reserved_domain_names"); + + // Initialize $types as an empty array if the query result is null + $types = $typesResult ?: []; + + // Ensure all default types are represented + $defaultTypes = ['reserved', 'restricted']; + foreach ($defaultTypes as $defaultType) { + $found = false; + foreach ($types as $type) { + if ($type['type'] === $defaultType) { + $found = true; + break; + } + } + + if (!$found) { + $types[] = ['type' => $defaultType]; + } } - + $categories = []; foreach ($types as $type) { $typeNames = $db->select( @@ -990,7 +999,6 @@ class SystemController extends Controller [ $type['type'] ] ); - // Initialize the type with an empty array if no names are found $categories[$type['type']] = $typeNames ? array_column($typeNames, 'name') : []; } diff --git a/cp/resources/views/admin/system/manageReserved.twig b/cp/resources/views/admin/system/manageReserved.twig index bc48e09..0886fa4 100644 --- a/cp/resources/views/admin/system/manageReserved.twig +++ b/cp/resources/views/admin/system/manageReserved.twig @@ -36,11 +36,15 @@
{{ type|capitalize }} Names
- + {% if names is not empty %} + + {% else %} + + {% endif %} {{ type|capitalize }} Names: These domain names are subject to special regulations or registration requirements. They might be available for registration but under specific conditions, such as proof of eligibility or additional documentation.
Enter each {{ type }} name on a new line, without the extension. For instance, use "example" in place of "example.com". -
+
{% endfor %}