mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-02 00:53:22 +02:00
Fixed #63
This commit is contained in:
parent
c8c8cc3c07
commit
aaa2971c4b
2 changed files with 26 additions and 14 deletions
|
@ -971,18 +971,27 @@ class SystemController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = $this->container->get('db');
|
$db = $this->container->get('db');
|
||||||
$types = $db->select("SELECT DISTINCT type FROM reserved_domain_names");
|
$typesResult = $db->select("SELECT DISTINCT type FROM reserved_domain_names");
|
||||||
// Get the current URI
|
|
||||||
$uri = $request->getUri()->getPath();
|
// Initialize $types as an empty array if the query result is null
|
||||||
|
$types = $typesResult ?: [];
|
||||||
// Set default types if $types is empty
|
|
||||||
if (empty($types)) {
|
// Ensure all default types are represented
|
||||||
$types = [
|
$defaultTypes = ['reserved', 'restricted'];
|
||||||
['type' => 'reserved'],
|
foreach ($defaultTypes as $defaultType) {
|
||||||
['type' => 'restricted']
|
$found = false;
|
||||||
];
|
foreach ($types as $type) {
|
||||||
|
if ($type['type'] === $defaultType) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found) {
|
||||||
|
$types[] = ['type' => $defaultType];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$categories = [];
|
$categories = [];
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
$typeNames = $db->select(
|
$typeNames = $db->select(
|
||||||
|
@ -990,7 +999,6 @@ class SystemController extends Controller
|
||||||
[ $type['type'] ]
|
[ $type['type'] ]
|
||||||
);
|
);
|
||||||
|
|
||||||
// Initialize the type with an empty array if no names are found
|
|
||||||
$categories[$type['type']] = $typeNames ? array_column($typeNames, 'name') : [];
|
$categories[$type['type']] = $typeNames ? array_column($typeNames, 'name') : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,11 +36,15 @@
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
<div class="card-header">{{ type|capitalize }} Names</div>
|
<div class="card-header">{{ type|capitalize }} Names</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<textarea class="form-control" name="domains_{{ type }}" rows="4" placeholder="Enter domain names, one per line" required>{{ names|join('\n') }}</textarea>
|
{% if names is not empty %}
|
||||||
|
<textarea class="form-control" name="domains_{{ type }}" rows="4" placeholder="Enter domain names, one per line" required>{{ names|join('\n') }}</textarea>
|
||||||
|
{% else %}
|
||||||
|
<textarea class="form-control" name="domains_{{ type }}" rows="4" placeholder="No {{ type|lower }} names. Enter new names, one per line" required></textarea>
|
||||||
|
{% endif %}
|
||||||
<small class="form-hint">
|
<small class="form-hint">
|
||||||
<strong>{{ type|capitalize }} Names:</strong> 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.
|
<strong>{{ type|capitalize }} Names:</strong> 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.
|
||||||
<br><em>Enter each {{ type }} name on a new line, without the extension. For instance, use "example" in place of "example.com".</em>
|
<br><em>Enter each {{ type }} name on a new line, without the extension. For instance, use "example" in place of "example.com".</em>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue