mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-26 14:14:41 +02:00
Fixes
This commit is contained in:
parent
e1d5296a7f
commit
48e35409b3
2 changed files with 26 additions and 7 deletions
|
@ -25,6 +25,11 @@ class HostsController extends Controller
|
||||||
$ipv6 = $data['ipv6'] ?? null;
|
$ipv6 = $data['ipv6'] ?? null;
|
||||||
$registrar_id = $data['registrar'] ?? null;
|
$registrar_id = $data['registrar'] ?? null;
|
||||||
$registrars = $db->select("SELECT id, clid, name FROM registrar");
|
$registrars = $db->select("SELECT id, clid, name FROM registrar");
|
||||||
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
|
$registrar = true;
|
||||||
|
} else {
|
||||||
|
$registrar = null;
|
||||||
|
}
|
||||||
|
|
||||||
if ($hostName) {
|
if ($hostName) {
|
||||||
$hostModel = new Host($this->container->get('db'));
|
$hostModel = new Host($this->container->get('db'));
|
||||||
|
@ -36,6 +41,7 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'error' => 'host name already exists',
|
'error' => 'host name already exists',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -43,15 +49,14 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'error' => 'Invalid host name',
|
'error' => 'Invalid host name',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->select('SELECT registrar_id FROM registrar_users WHERE user_id = ?', [$_SESSION['auth_user_id']]);
|
$result = $db->selectRow('SELECT registrar_id FROM registrar_users WHERE user_id = ?', [$_SESSION['auth_user_id']]);
|
||||||
|
|
||||||
if (is_array($result)) {
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
$clid = $result['registrar_id'];
|
$clid = $result[0]['registrar_id'];
|
||||||
} else if (is_object($result) && method_exists($result, 'fetch')) {
|
|
||||||
$clid = $result->fetch();
|
|
||||||
} else {
|
} else {
|
||||||
$clid = $registrar_id;
|
$clid = $registrar_id;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +68,7 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'error' => 'Invalid host addr v4',
|
'error' => 'Invalid host addr v4',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +80,7 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'error' => 'Invalid host addr v6',
|
'error' => 'Invalid host addr v6',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +118,7 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'error' => 'A host name object can NOT be created in a repository for which no superordinate domain name object exists',
|
'error' => 'A host name object can NOT be created in a repository for which no superordinate domain name object exists',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +128,7 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'error' => 'The domain name belongs to another registrar, you are not allowed to create hosts for it',
|
'error' => 'The domain name belongs to another registrar, you are not allowed to create hosts for it',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,6 +155,7 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'error' => 'At least one of IPv4 or IPv6 must be provided',
|
'error' => 'At least one of IPv4 or IPv6 must be provided',
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +199,7 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'error' => $e->getMessage(),
|
'error' => $e->getMessage(),
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,6 +212,7 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'crdate' => $crdate,
|
'crdate' => $crdate,
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$currentDateTime = new \DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
|
@ -234,6 +246,7 @@ class HostsController extends Controller
|
||||||
'hostName' => $hostName,
|
'hostName' => $hostName,
|
||||||
'crdate' => $crdate,
|
'crdate' => $crdate,
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,10 +254,16 @@ class HostsController extends Controller
|
||||||
|
|
||||||
$db = $this->container->get('db');
|
$db = $this->container->get('db');
|
||||||
$registrars = $db->select("SELECT id, clid, name FROM registrar");
|
$registrars = $db->select("SELECT id, clid, name FROM registrar");
|
||||||
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
|
$registrar = true;
|
||||||
|
} else {
|
||||||
|
$registrar = null;
|
||||||
|
}
|
||||||
|
|
||||||
// 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/hosts/create.twig', [
|
return view($response,'admin/hosts/create.twig', [
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
|
'registrar' => $registrar,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<input type="text" class="form-control" id="hostname" name="hostname" placeholder="ns1.example.com" required>
|
<input type="text" class="form-control" id="hostname" name="hostname" placeholder="ns1.example.com" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if registrars %}
|
{% if registrars and not registrar %}
|
||||||
<div class="form-group mt-3">
|
<div class="form-group mt-3">
|
||||||
<label for="registrarDropdown" class="form-label required">{{ __('Select Registrar') }}:</label>
|
<label for="registrarDropdown" class="form-label required">{{ __('Select Registrar') }}:</label>
|
||||||
<select id="registrarDropdown" name="registrar" class="form-control">
|
<select id="registrarDropdown" name="registrar" class="form-control">
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue