You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add $localPhpScript = '/path/to/local-registry-update.php'; // Local PHP script for DS record submission
We can utilize existing logic in DomainsController.php updateDomain just a bit modified in new php.file....
here's the function from DomainsController.php //orignial
publicfunctionupdateDomain(Request$request, Response$response, $args)
{
$db = $this->container->get('db');
$registrars = $db->select("SELECT id, clid, name FROM registrar");
if ($_SESSION["auth_roles"] != 0) {
$registrar = true;
} else {
$registrar = null;
}
$uri = $request->getUri()->getPath();
if ($args) {
$args = strtolower(trim($args));
if (!preg_match('/^([a-z0-9]([-a-z0-9]*[a-z0-9])?\.)*[a-z0-9]([-a-z0-9]*[a-z0-9])?$/', $args)) {
$this->container->get('flash')->addMessage('error', 'Invalid domain name format');
return$response->withHeader('Location', '/domains')->withStatus(302);
}
$domain = $db->selectRow('SELECT id, name, registrant, crdate, exdate, lastupdate, clid, idnlang, rgpstatus FROM domain WHERE name = ?',
[ $args ]);
if ($domain) {
$registrars = $db->selectRow('SELECT id, clid, name FROM registrar WHERE id = ?', [$domain['clid']]);
// Check if the user is not an admin (assuming role 0 is admin)if ($_SESSION["auth_roles"] != 0) {
$userRegistrars = $db->select('SELECT registrar_id FROM registrar_users WHERE user_id = ?', [$_SESSION['auth_user_id']]);
// Assuming $userRegistrars returns an array of arrays, each containing 'registrar_id'$userRegistrarIds = array_column($userRegistrars, 'registrar_id');
// Check if the registrar's ID is in the user's list of registrar IDsif (!in_array($registrars['id'], $userRegistrarIds)) {
// Redirect to the domains view if the user is not authorized for this contactreturn$response->withHeader('Location', '/domains')->withStatus(302);
}
}
$domainRegistrant = $db->selectRow('SELECT identifier FROM contact WHERE id = ?',
[ $domain['registrant'] ]);
$domainStatus = $db->select('SELECT status FROM domain_status WHERE domain_id = ?',
[ $domain['id'] ]);
$domainAuth = $db->selectRow('SELECT authinfo FROM domain_authInfo WHERE domain_id = ?',
[ $domain['id'] ]);
$domainSecdns = $db->select('SELECT * FROM secdns WHERE domain_id = ?',
[ $domain['id'] ]);
$domainHostsQuery = ' SELECT dhm.id, dhm.domain_id, dhm.host_id, h.name FROM domain_host_map dhm JOIN host h ON dhm.host_id = h.id WHERE dhm.domain_id = ?';
$domainHosts = $db->select($domainHostsQuery, [$domain['id']]);
$domainContactsQuery = ' SELECT dcm.id, dcm.domain_id, dcm.contact_id, dcm.type, c.identifier FROM domain_contact_map dcm JOIN contact c ON dcm.contact_id = c.id WHERE dcm.domain_id = ?';
$domainContacts = $db->select($domainContactsQuery, [$domain['id']]);
$csrfTokenName = $this->container->get('csrf')->getTokenName();
$csrfTokenValue = $this->container->get('csrf')->getTokenValue();
if (strpos($domain['name'], 'xn--') === 0) {
$domain['punycode'] = $domain['name'];
$domain['name'] = idn_to_utf8($domain['name'], IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
} else {
$domain['punycode'] = $domain['name'];
}
$_SESSION['domains_to_update'] = [$domain['punycode']];
returnview($response,'admin/domains/updateDomain.twig', [
'domain' => $domain,
'domainStatus' => $domainStatus,
'domainAuth' => $domainAuth,
'domainRegistrant' => $domainRegistrant,
'domainSecdns' => $domainSecdns,
'domainHosts' => $domainHosts,
'domainContacts' => $domainContacts,
'registrar' => $registrars,
'currentUri' => $uri,
'csrfTokenName' => $csrfTokenName,
'csrfTokenValue' => $csrfTokenValue
]);
} else {
// Domain does not exist, redirect to the domains viewreturn$response->withHeader('Location', '/domains')->withStatus(302);
}
} else {
// Redirect to the domains viewreturn$response->withHeader('Location', '/domains')->withStatus(302);
}
}
The text was updated successfully, but these errors were encountered:
Add $localPhpScript = '/path/to/local-registry-update.php'; // Local PHP script for DS record submission
We can utilize existing logic in DomainsController.php updateDomain just a bit modified in new php.file....
here's the function from DomainsController.php //orignial
The text was updated successfully, but these errors were encountered: