mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-17 01:57:00 +02:00
Some more UI fixes
This commit is contained in:
parent
ed8d8d47ba
commit
3a6319fe6d
6 changed files with 43 additions and 325 deletions
|
@ -87,8 +87,8 @@ class ApplicationsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$domain_already_exist = $db->selectValue(
|
$domain_already_exist = $db->selectValue(
|
||||||
'SELECT id FROM application WHERE name = ? and clid = ? LIMIT 1',
|
'SELECT id FROM application WHERE name = ? and clid = ? and phase_type = ? LIMIT 1',
|
||||||
[$domainName, $clid]
|
[$domainName, $clid, $phaseType]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($domain_already_exist) {
|
if ($domain_already_exist) {
|
||||||
|
@ -369,7 +369,7 @@ class ApplicationsController extends Controller
|
||||||
'date' => $stdate,
|
'date' => $stdate,
|
||||||
'command' => 'create',
|
'command' => 'create',
|
||||||
'domain_name' => $domainName,
|
'domain_name' => $domainName,
|
||||||
'length_in_months' => $date_add,
|
'length_in_months' => 0,
|
||||||
'fromS' => $from,
|
'fromS' => $from,
|
||||||
'toS' => $from,
|
'toS' => $from,
|
||||||
'amount' => $price
|
'amount' => $price
|
||||||
|
@ -416,7 +416,7 @@ class ApplicationsController extends Controller
|
||||||
'error_log',
|
'error_log',
|
||||||
[
|
[
|
||||||
'registrar_id' => $clid,
|
'registrar_id' => $clid,
|
||||||
'log' => "Domain : $domainName ; hostName : $nameserver - is duplicated",
|
'log' => "Application : $domainName ; hostName : $nameserver - is duplicated",
|
||||||
'date' => $logdate
|
'date' => $logdate
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -534,27 +534,6 @@ class ApplicationsController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->selectRow(
|
|
||||||
'SELECT crdate,exdate FROM domain WHERE name = ? LIMIT 1',
|
|
||||||
[$domainName]
|
|
||||||
);
|
|
||||||
$crdate = $result['crdate'];
|
|
||||||
$exdate = $result['exdate'];
|
|
||||||
|
|
||||||
$curdate_id = $db->selectValue(
|
|
||||||
'SELECT id FROM statistics WHERE date = CURDATE()'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$curdate_id) {
|
|
||||||
$db->exec(
|
|
||||||
'INSERT IGNORE INTO statistics (date) VALUES(CURDATE())'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->exec(
|
|
||||||
'UPDATE statistics SET created_domains = created_domains + 1 WHERE date = CURDATE()'
|
|
||||||
);
|
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$db->rollBack();
|
$db->rollBack();
|
||||||
|
@ -767,11 +746,11 @@ class ApplicationsController extends Controller
|
||||||
if ($_SESSION["auth_roles"] != 0) {
|
if ($_SESSION["auth_roles"] != 0) {
|
||||||
$clid = $result['registrar_id'];
|
$clid = $result['registrar_id'];
|
||||||
} else {
|
} else {
|
||||||
$clid = $db->selectValue('SELECT clid FROM domain WHERE name = ?', [$domainName]);
|
$clid = $db->selectValue('SELECT clid FROM application WHERE name = ?', [$domainName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$domain_id = $db->selectValue(
|
$domain_id = $db->selectValue(
|
||||||
'SELECT id FROM domain WHERE name = ?',
|
'SELECT id FROM application WHERE name = ?',
|
||||||
[$domainName]
|
[$domainName]
|
||||||
);
|
);
|
||||||
$results = $db->select(
|
$results = $db->select(
|
||||||
|
@ -782,130 +761,20 @@ class ApplicationsController extends Controller
|
||||||
foreach ($results as $row) {
|
foreach ($results as $row) {
|
||||||
$status = $row['status'];
|
$status = $row['status'];
|
||||||
if (preg_match('/.*(serverUpdateProhibited)$/', $status) || preg_match('/^pendingTransfer/', $status)) {
|
if (preg_match('/.*(serverUpdateProhibited)$/', $status) || preg_match('/^pendingTransfer/', $status)) {
|
||||||
$this->container->get('flash')->addMessage('error', 'It has a status that does not allow renew, first change the status');
|
$this->container->get('flash')->addMessage('error', 'It has a status that does not allow update, first change the status');
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
return $response->withHeader('Location', '/application/update/'.$domainName)->withStatus(302);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$contactRegistrant = $data['contactRegistrant'] ?? null;
|
|
||||||
$contactAdmin = $data['contactAdmin'] ?? null;
|
|
||||||
$contactTech = $data['contactTech'] ?? null;
|
|
||||||
$contactBilling = $data['contactBilling'] ?? null;
|
|
||||||
|
|
||||||
$nameservers = $data['nameserver'] ?? [];
|
$nameservers = $data['nameserver'] ?? [];
|
||||||
|
|
||||||
$dsKeyTag = isset($data['dsKeyTag']) ? (int)$data['dsKeyTag'] : null;
|
|
||||||
$dsAlg = $data['dsAlg'] ?? null;
|
|
||||||
$dsDigestType = isset($data['dsDigestType']) ? (int)$data['dsDigestType'] : null;
|
|
||||||
$dsDigest = $data['dsDigest'] ?? null;
|
|
||||||
|
|
||||||
$dnskeyFlags = $data['dnskeyFlags'] ?? null;
|
|
||||||
$dnskeyProtocol = $data['dnskeyProtocol'] ?? null;
|
|
||||||
$dnskeyAlg = $data['dnskeyAlg'] ?? null;
|
|
||||||
$dnskeyPubKey = $data['dnskeyPubKey'] ?? null;
|
|
||||||
|
|
||||||
$authInfo = $data['authInfo'] ?? null;
|
|
||||||
|
|
||||||
if ($contactRegistrant) {
|
|
||||||
$validRegistrant = validate_identifier($contactRegistrant);
|
|
||||||
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactRegistrant]);
|
|
||||||
|
|
||||||
if (!$row) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Registrant does not exist');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($clid != $row['clid']) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'The contact requested in the command does NOT belong to the current registrar');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Please provide registrant identifier');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($contactAdmin) {
|
|
||||||
$validAdmin = validate_identifier($contactAdmin);
|
|
||||||
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactAdmin]);
|
|
||||||
|
|
||||||
if (!$row) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Admin contact does not exist');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($clid != $row['clid']) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'The contact requested in the command does NOT belong to the current registrar');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Please provide admin contact identifier');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($contactTech) {
|
|
||||||
$validTech = validate_identifier($contactTech);
|
|
||||||
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactTech]);
|
|
||||||
|
|
||||||
if (!$row) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Tech contact does not exist');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($clid != $row['clid']) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'The contact requested in the command does NOT belong to the current registrar');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Please provide tech contact identifier');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($contactBilling) {
|
|
||||||
$validBilling = validate_identifier($contactBilling);
|
|
||||||
$row = $db->selectRow('SELECT id, clid FROM contact WHERE identifier = ?', [$contactBilling]);
|
|
||||||
|
|
||||||
if (!$row) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Billing contact does not exist');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($clid != $row['clid']) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'The contact requested in the command does NOT belong to the current registrar');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Please provide billing contact identifier');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$authInfo) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Domain ' . $domainName . ' can not be updated: Missing domain authinfo');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($authInfo) < 6 || strlen($authInfo) > 16) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Password needs to be at least 6 and up to 16 characters long');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!preg_match('/[A-Z]/', $authInfo)) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Password should have both upper and lower case characters');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
$registrant_id = $db->selectValue(
|
|
||||||
'SELECT id FROM contact WHERE identifier = ? LIMIT 1',
|
|
||||||
[$contactRegistrant]
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$db->beginTransaction();
|
$db->beginTransaction();
|
||||||
|
|
||||||
$currentDateTime = new \DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
$update = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
$update = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||||
|
|
||||||
$db->update('domain', [
|
$db->update('application', [
|
||||||
'registrant' => $registrant_id,
|
|
||||||
'lastupdate' => $update,
|
'lastupdate' => $update,
|
||||||
'upid' => $clid
|
'upid' => $clid
|
||||||
],
|
],
|
||||||
|
@ -914,126 +783,19 @@ class ApplicationsController extends Controller
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$domain_id = $db->selectValue(
|
$domain_id = $db->selectValue(
|
||||||
'SELECT id FROM domain WHERE name = ?',
|
'SELECT id FROM application WHERE name = ?',
|
||||||
[$domainName]
|
[$domainName]
|
||||||
);
|
);
|
||||||
|
|
||||||
$db->update(
|
|
||||||
'domain_authInfo',
|
|
||||||
[
|
|
||||||
'authinfo' => $authInfo
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => $domain_id,
|
|
||||||
'authtype' => 'pw'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Data sanity checks
|
|
||||||
// Validate keyTag
|
|
||||||
if (!empty($dsKeyTag)) {
|
|
||||||
if (!is_int($dsKeyTag)) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Incomplete key tag provided');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($dsKeyTag < 0 || $dsKeyTag > 65535) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Incomplete key tag provided');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate alg
|
|
||||||
$validAlgorithms = [2, 3, 5, 6, 7, 8, 10, 13, 14, 15, 16];
|
|
||||||
if (!empty($dsAlg) && !in_array($dsAlg, $validAlgorithms)) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Incomplete algorithm provided');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate digestType and digest
|
|
||||||
if (!empty($dsDigestType) && !is_int($dsDigestType)) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Incomplete digest type provided');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
$validDigests = [
|
|
||||||
1 => 40, // SHA-1
|
|
||||||
2 => 64, // SHA-256
|
|
||||||
4 => 96 // SHA-384
|
|
||||||
];
|
|
||||||
if (empty($validDigests[$dsDigestType])) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Unsupported digest type');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
if (!empty($dsDigest)) {
|
|
||||||
if (strlen($dsDigest) != $validDigests[$dsDigestType] || !ctype_xdigit($dsDigest)) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Invalid digest length or format');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data sanity checks for keyData
|
|
||||||
// Validate flags
|
|
||||||
$validFlags = [256, 257];
|
|
||||||
if (!empty($dnskeyFlags) && !in_array($dnskeyFlags, $validFlags)) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Invalid flags provided');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate protocol
|
|
||||||
if (!empty($dnskeyProtocol) && $dnskeyProtocol != 3) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Invalid protocol provided');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate algKeyData
|
|
||||||
if (!empty($dnskeyAlg)) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Invalid algorithm encoding');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate pubKey
|
|
||||||
if (!empty($dnskeyPubKey) && base64_encode(base64_decode($dnskeyPubKey, true)) !== $dnskeyPubKey) {
|
|
||||||
$this->container->get('flash')->addMessage('error', 'Invalid public key encoding');
|
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($dsKeyTag)) {
|
|
||||||
// Base data for the insert
|
|
||||||
$insertData = [
|
|
||||||
'domain_id' => $domain_id,
|
|
||||||
'maxsiglife' => $maxSigLife,
|
|
||||||
'interface' => 'dsData',
|
|
||||||
'keytag' => $dsKeyTag,
|
|
||||||
'alg' => $dsAlg,
|
|
||||||
'digesttype' => $dsDigestType,
|
|
||||||
'digest' => $dsDigest,
|
|
||||||
'flags' => null,
|
|
||||||
'protocol' => null,
|
|
||||||
'keydata_alg' => null,
|
|
||||||
'pubkey' => null
|
|
||||||
];
|
|
||||||
|
|
||||||
// Check additional conditions for dnskeyFlags
|
|
||||||
if (isset($dnskeyFlags) && $dnskeyFlags !== "") {
|
|
||||||
$insertData['flags'] = $dnskeyFlags;
|
|
||||||
$insertData['protocol'] = $dnskeyProtocol;
|
|
||||||
$insertData['keydata_alg'] = $dnskeyAlg;
|
|
||||||
$insertData['pubkey'] = $dnskeyPubKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perform the insert
|
|
||||||
$db->insert('secdns', $insertData);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($nameservers as $index => $nameserver) {
|
foreach ($nameservers as $index => $nameserver) {
|
||||||
if (preg_match("/^-|^\.-|-\.$|^\.$/", $nameserver)) {
|
if (preg_match("/^-|^\.-|-\.$|^\.$/", $nameserver)) {
|
||||||
$this->container->get('flash')->addMessage('error', 'Invalid hostName');
|
$this->container->get('flash')->addMessage('error', 'Invalid hostName');
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
return $response->withHeader('Location', '/application/update/'.$domainName)->withStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
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', $nameserver) && strlen($nameserver) < 254) {
|
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', $nameserver) && strlen($nameserver) < 254) {
|
||||||
$this->container->get('flash')->addMessage('error', 'Invalid hostName');
|
$this->container->get('flash')->addMessage('error', 'Invalid hostName');
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
return $response->withHeader('Location', '/application/update/'.$domainName)->withStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
$hostName_already_exist = $db->selectValue(
|
$hostName_already_exist = $db->selectValue(
|
||||||
|
@ -1132,52 +894,19 @@ class ApplicationsController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$contacts = [
|
|
||||||
'admin' => $data['contactAdmin'] ?? null,
|
|
||||||
'tech' => $data['contactTech'] ?? null,
|
|
||||||
'billing' => $data['contactBilling'] ?? null
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($contacts as $type => $contact) {
|
|
||||||
if ($contact !== null) {
|
|
||||||
$contact_id = $db->selectValue(
|
|
||||||
'SELECT id FROM contact WHERE identifier = ? LIMIT 1',
|
|
||||||
[$contact]
|
|
||||||
);
|
|
||||||
|
|
||||||
$contact_map_id = $db->selectRow(
|
|
||||||
'SELECT * FROM application_contact_map WHERE domain_id = ? AND type = ?',
|
|
||||||
[$domain_id, $type]
|
|
||||||
);
|
|
||||||
|
|
||||||
// Check if $contact_id is not null before update
|
|
||||||
if ($contact_id !== null) {
|
|
||||||
$db->update(
|
|
||||||
'application_contact_map',
|
|
||||||
[
|
|
||||||
'contact_id' => $contact_id,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => $contact_map_id['id']
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$db->rollBack();
|
$db->rollBack();
|
||||||
$this->container->get('flash')->addMessage('error', 'Database failure during update: ' . $e->getMessage());
|
$this->container->get('flash')->addMessage('error', 'Database failure during update: ' . $e->getMessage());
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
return $response->withHeader('Location', '/application/update/'.$domainName)->withStatus(302);
|
||||||
} catch (\Pinga\Db\Throwable\IntegrityConstraintViolationException $e) {
|
} catch (\Pinga\Db\Throwable\IntegrityConstraintViolationException $e) {
|
||||||
$db->rollBack();
|
$db->rollBack();
|
||||||
$this->container->get('flash')->addMessage('error', 'Database failure during update: ' . $e->getMessage());
|
$this->container->get('flash')->addMessage('error', 'Database failure during update: ' . $e->getMessage());
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
return $response->withHeader('Location', '/application/update/'.$domainName)->withStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->container->get('flash')->addMessage('success', 'Domain ' . $domainName . ' has been updated successfully on ' . $update);
|
$this->container->get('flash')->addMessage('success', 'Application ' . $domainName . ' has been updated successfully on ' . $update);
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
return $response->withHeader('Location', '/application/update/'.$domainName)->withStatus(302);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1192,7 +921,7 @@ class ApplicationsController extends Controller
|
||||||
[ $data['nameserver'] ]);
|
[ $data['nameserver'] ]);
|
||||||
$domain_id = $db->selectValue('SELECT domain_id FROM application_host_map WHERE host_id = ?',
|
$domain_id = $db->selectValue('SELECT domain_id FROM application_host_map WHERE host_id = ?',
|
||||||
[ $host_id ]);
|
[ $host_id ]);
|
||||||
$domainName = $db->selectValue('SELECT name FROM domain WHERE id = ?',
|
$domainName = $db->selectValue('SELECT name FROM application WHERE id = ?',
|
||||||
[ $domain_id ]);
|
[ $domain_id ]);
|
||||||
$db->delete(
|
$db->delete(
|
||||||
'application_host_map',
|
'application_host_map',
|
||||||
|
@ -1202,11 +931,11 @@ class ApplicationsController extends Controller
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->container->get('flash')->addMessage('success', 'Host ' . $data['nameserver'] . ' has been removed from domain successfully');
|
$this->container->get('flash')->addMessage('success', 'Host ' . $data['nameserver'] . ' has been removed from application successfully');
|
||||||
|
|
||||||
$jsonData = json_encode([
|
$jsonData = json_encode([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'redirect' => '/domain/update/'.$domainName
|
'redirect' => '/application/update/'.$domainName
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response = new \Nyholm\Psr7\Response(
|
$response = new \Nyholm\Psr7\Response(
|
||||||
|
@ -1323,13 +1052,7 @@ class ApplicationsController extends Controller
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$db->delete(
|
$db->delete(
|
||||||
'host',
|
'application',
|
||||||
[
|
|
||||||
'domain_id' => $domain_id
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$db->delete(
|
|
||||||
'domain',
|
|
||||||
[
|
[
|
||||||
'id' => $domain_id
|
'id' => $domain_id
|
||||||
]
|
]
|
||||||
|
@ -1342,7 +1065,7 @@ class ApplicationsController extends Controller
|
||||||
return $response->withHeader('Location', '/applications')->withStatus(302);
|
return $response->withHeader('Location', '/applications')->withStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->container->get('flash')->addMessage('success', 'Domain ' . $domainName . ' deleted successfully');
|
$this->container->get('flash')->addMessage('success', 'Application ' . $domainName . ' deleted successfully');
|
||||||
return $response->withHeader('Location', '/applications')->withStatus(302);
|
return $response->withHeader('Location', '/applications')->withStatus(302);
|
||||||
} else {
|
} else {
|
||||||
// Redirect to the applications view
|
// Redirect to the applications view
|
||||||
|
|
|
@ -1038,7 +1038,7 @@ class DomainsController extends Controller
|
||||||
foreach ($results as $row) {
|
foreach ($results as $row) {
|
||||||
$status = $row['status'];
|
$status = $row['status'];
|
||||||
if (preg_match('/.*(serverUpdateProhibited)$/', $status) || preg_match('/^pendingTransfer/', $status)) {
|
if (preg_match('/.*(serverUpdateProhibited)$/', $status) || preg_match('/^pendingTransfer/', $status)) {
|
||||||
$this->container->get('flash')->addMessage('error', 'It has a status that does not allow renew, first change the status');
|
$this->container->get('flash')->addMessage('error', 'It has a status that does not allow update, first change the status');
|
||||||
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,6 +216,9 @@ $csrfMiddleware = function ($request, $handler) use ($container) {
|
||||||
if ($path && $path === '/domain/deletesecdns') {
|
if ($path && $path === '/domain/deletesecdns') {
|
||||||
return $handler->handle($request);
|
return $handler->handle($request);
|
||||||
}
|
}
|
||||||
|
if ($path && $path === '/application/deletehost') {
|
||||||
|
return $handler->handle($request);
|
||||||
|
}
|
||||||
|
|
||||||
// If not skipped, apply the CSRF Guard
|
// If not skipped, apply the CSRF Guard
|
||||||
return $csrf->process($request, $handler);
|
return $csrf->process($request, $handler);
|
||||||
|
|
|
@ -20,11 +20,6 @@
|
||||||
<!-- Page title actions -->
|
<!-- Page title actions -->
|
||||||
<div class="col-auto ms-auto d-print-none">
|
<div class="col-auto ms-auto d-print-none">
|
||||||
<div class="btn-list">
|
<div class="btn-list">
|
||||||
<span class="d-none d-sm-inline">
|
|
||||||
<a href="{{route('checkDomain')}}" class="btn">
|
|
||||||
{{ __('Check Domain') }}
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
<a href="{{route('createApplication')}}" class="btn btn-primary d-none d-sm-inline-block">
|
<a href="{{route('createApplication')}}" class="btn btn-primary d-none d-sm-inline-block">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
|
||||||
{{ __('Create Application') }}
|
{{ __('Create Application') }}
|
||||||
|
|
|
@ -26,13 +26,13 @@
|
||||||
<form id="domainUpdateForm" action="/application/update" method="post">
|
<form id="domainUpdateForm" action="/application/update" method="post">
|
||||||
{{ csrf.field | raw }}
|
{{ csrf.field | raw }}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-12">{% include 'partials/flash.twig' %}</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{% include 'partials/flash.twig' %}
|
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">
|
<h3 class="card-title">
|
||||||
Domain {{ domain.name }} <input type="hidden" name="domainName" value="{{ domain.name }}">
|
Domain {{ domain.name }} <input type="hidden" name="domainName" value="{{ domain.name }}">
|
||||||
{% if domainStatus.status or domain.rgpstatus %}
|
{% if domainStatus %}
|
||||||
{% if domainStatus is iterable %}
|
{% if domainStatus is iterable %}
|
||||||
{% for status in domainStatus %}
|
{% for status in domainStatus %}
|
||||||
<span class="status status-green" title="Status">{{ status.status }}</span>
|
<span class="status status-green" title="Status">{{ status.status }}</span>
|
||||||
|
@ -42,11 +42,8 @@
|
||||||
<span class="status status-green" title="Status">{{ domainStatus.status }}</span>
|
<span class="status status-green" title="Status">{{ domainStatus.status }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if domain.rgpstatus %}
|
|
||||||
<span class="status status-info" title="Status">{{ domain.rgpstatus }}</span>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="status status-info" title="Status">ok</span>
|
<span class="status status-info" title="Status">{{ domainStatus.status }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
@ -58,11 +55,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="datagrid-item">
|
<div class="datagrid-item">
|
||||||
<div class="datagrid-title">Launch Phase</div>
|
<div class="datagrid-title">Launch Phase</div>
|
||||||
<div class="datagrid-content">{{ domain.phase_type }}</div>
|
<div class="datagrid-content">{{ domain.phase_type|capitalize }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="datagrid-item">
|
<div class="datagrid-item">
|
||||||
<div class="datagrid-title">Expiration Date</div>
|
<div class="datagrid-title">Phase Name</div>
|
||||||
<div class="datagrid-content">{{ domain.exdate }}</div>
|
<div class="datagrid-content">{{ domain.phase_name|default('N/A') }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="datagrid-item">
|
<div class="datagrid-item">
|
||||||
<div class="datagrid-title">Registrar</div>
|
<div class="datagrid-title">Registrar</div>
|
||||||
|
@ -125,7 +122,7 @@ function sendRequest(nameserver) {
|
||||||
formData.append('nameserver', nameserver);
|
formData.append('nameserver', nameserver);
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', '/domain/deletehost');
|
xhr.open('POST', '/application/deletehost');
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState == 4) {
|
if (xhr.readyState == 4) {
|
||||||
var response = JSON.parse(xhr.responseText);
|
var response = JSON.parse(xhr.responseText);
|
||||||
|
|
|
@ -28,18 +28,18 @@
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">
|
<h3 class="card-title">
|
||||||
Application for {{ domain.name }}
|
Application for {{ domain.name }}
|
||||||
{% if domain.status %}
|
{% if domainStatus %}
|
||||||
{% if domain is iterable %}
|
{% if domainStatus is iterable %}
|
||||||
{% for status in domainStatus %}
|
{% for status in domainStatus %}
|
||||||
<span class="status status-green" title="Status">{{ status.status }}</span>
|
<span class="status status-green" title="Status">{{ status.status }}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if domain.status %}
|
{% if domainStatus.status %}
|
||||||
<span class="status status-green" title="Status">{{ domain.status }}</span>
|
<span class="status status-green" title="Status">{{ domainStatus.status }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="status status-info" title="Status">ok</span>
|
<span class="status status-info" title="Status">{{ domainStatus.status }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
@ -51,11 +51,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="datagrid-item">
|
<div class="datagrid-item">
|
||||||
<div class="datagrid-title">Launch Phase</div>
|
<div class="datagrid-title">Launch Phase</div>
|
||||||
<div class="datagrid-content">{{ domain.phase_type }}</div>
|
<div class="datagrid-content">{{ domain.phase_type|capitalize }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="datagrid-item">
|
<div class="datagrid-item">
|
||||||
<div class="datagrid-title">Phase Name</div>
|
<div class="datagrid-title">Phase Name</div>
|
||||||
<div class="datagrid-content">{{ domain.exdate }}</div>
|
<div class="datagrid-content">{{ domain.phase_name|default('N/A') }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="datagrid-item">
|
<div class="datagrid-item">
|
||||||
<div class="datagrid-title">Registrar</div>
|
<div class="datagrid-title">Registrar</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue