mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-01 08:33:22 +02:00
Added host:update
- Fixes in host:create - Fixes in EPP error messages - Fixed #6 - Fixed #8 - Fixes in contact:update - Pgsql fixes
This commit is contained in:
parent
fc864aefff
commit
d637d1a873
4 changed files with 404 additions and 65 deletions
|
@ -394,7 +394,6 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type) {
|
|||
$hostName = $xml->command->create->children('urn:ietf:params:xml:ns:host-1.0')->create->name;
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
$hostName = strtoupper($hostName);
|
||||
if (preg_match('/^([A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9]){0,1}\.){1,125}[A-Z0-9]([A-Z0-9-]{0,61}[A-Z0-9])$/i', $hostName) && strlen($hostName) < 254) {
|
||||
$host_id_already_exist = $db->query("SELECT id FROM host WHERE name = '$hostName' LIMIT 1")->fetchColumn();
|
||||
if ($host_id_already_exist) {
|
||||
|
@ -492,7 +491,7 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type) {
|
|||
$stmt->execute([$hostName, $superordinate_dom, $clid, $clid]);
|
||||
$host_id = $db->lastInsertId();
|
||||
|
||||
$host_addr_list = $xml->xpath('host:addr');
|
||||
$host_addr_list = $xml->xpath('//host:addr');
|
||||
|
||||
foreach ($host_addr_list as $node) {
|
||||
$addr = (string) $node;
|
||||
|
@ -504,11 +503,13 @@ function processHostCreate($conn, $db, $xml, $clid, $database_type) {
|
|||
$addr = normalize_v4_address($addr);
|
||||
}
|
||||
|
||||
$addr_type = ($addr_type == 'v6') ? 6 : 4;
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO host_addr (host_id,addr,ip) VALUES(?,?,?)");
|
||||
$stmt->execute([$host_id, $addr, $addr_type]);
|
||||
}
|
||||
|
||||
$host_status = 'ok';
|
||||
$stmt = $db->prepare("INSERT INTO host_status (host_id,status) VALUES(?,?)");
|
||||
$stmt->execute([$host_id, $host_status]);
|
||||
|
||||
$stmt = $db->prepare("SELECT crdate FROM host WHERE name = ? LIMIT 1");
|
||||
$stmt->execute([$hostName]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue