From de119b013f2a847aacbc4342c18d77f8b454d1c2 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Wed, 20 Dec 2023 20:00:42 +0200 Subject: [PATCH] Last required TMCH updates in panel --- cp/app/Controllers/ApplicationsController.php | 23 +++++++++++ cp/app/Controllers/DomainsController.php | 39 ++++++++++++++++++- .../views/admin/domains/createDomain.twig | 17 ++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) diff --git a/cp/app/Controllers/ApplicationsController.php b/cp/app/Controllers/ApplicationsController.php index 78e8ce8..f3ef04a 100644 --- a/cp/app/Controllers/ApplicationsController.php +++ b/cp/app/Controllers/ApplicationsController.php @@ -99,6 +99,29 @@ class ApplicationsController extends Controller 'registrar' => $registrar, ]); } + + $currentDateTime = new \DateTime(); + $currentDate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp + + $phase_details = $db->selectValue( + "SELECT phase_category + FROM launch_phases + WHERE tld_id = ? + AND phase_type = ? + AND start_date <= ? + AND (end_date >= ? OR end_date IS NULL OR end_date = '') + ", + [$tld_id, $phaseType, $currentDate, $currentDate] + ); + + if ($phase_details !== 'Application') { + return view($response, 'admin/domains/createApplication.twig', [ + 'domainName' => $domainName, + 'error' => 'The launch phase ' . $phaseType . ' is improperly configured. Please check the settings or contact support.', + 'registrars' => $registrars, + 'registrar' => $registrar, + ]); + } $domain_already_reserved = $db->selectValue( 'SELECT id FROM reserved_domain_names WHERE name = ? LIMIT 1', diff --git a/cp/app/Controllers/DomainsController.php b/cp/app/Controllers/DomainsController.php index c1e88a6..a8cc96f 100644 --- a/cp/app/Controllers/DomainsController.php +++ b/cp/app/Controllers/DomainsController.php @@ -105,6 +105,9 @@ class DomainsController extends Controller $contactTech = $data['contactTech'] ?? null; $contactBilling = $data['contactBilling'] ?? null; + $phaseType = $data['phaseType'] ?? null; + $smd = $data['smd'] ?? null; + $nameservers = !empty($data['nameserver']) ? $data['nameserver'] : null; $nameserver_ipv4 = !empty($data['nameserver_ipv4']) ? $data['nameserver_ipv4'] : null; $nameserver_ipv6 = !empty($data['nameserver_ipv6']) ? $data['nameserver_ipv6'] : null; @@ -168,6 +171,38 @@ class DomainsController extends Controller 'registrar' => $registrar, ]); } + + $currentDateTime = new \DateTime(); + $currentDate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp + + $phase_details = $db->selectValue( + "SELECT phase_category + FROM launch_phases + WHERE tld_id = ? + AND phase_type = ? + AND start_date <= ? + AND (end_date >= ? OR end_date IS NULL OR end_date = '') + ", + [$tld_id, $phaseType, $currentDate, $currentDate] + ); + + if ($phase_details !== 'First-Come-First-Serve') { + if ($phaseType !== null && $phaseType !== '') { + return view($response, 'admin/domains/createDomain.twig', [ + 'domainName' => $domainName, + 'error' => 'The launch phase ' . $phaseType . ' is improperly configured. Please check the settings or contact support.', + 'registrars' => $registrars, + 'registrar' => $registrar, + ]); + } + } else if ($phaseType !== null && $phaseType !== '') { + return view($response, 'admin/domains/createDomain.twig', [ + 'domainName' => $domainName, + 'error' => 'The launch phase ' . $phaseType . ' is improperly configured. Please check the settings or contact support.', + 'registrars' => $registrars, + 'registrar' => $registrar, + ]); + } $domain_already_reserved = $db->selectValue( 'SELECT id FROM reserved_domain_names WHERE name = ? LIMIT 1', @@ -423,7 +458,9 @@ class DomainsController extends Controller 'acid' => null, 'acdate' => null, 'rgpstatus' => 'addPeriod', - 'addPeriod' => $date_add + 'addPeriod' => $date_add, + 'tm_phase' => $phaseType, + 'tm_smd_id' => $smd ]); $domain_id = $db->getlastInsertId(); diff --git a/cp/resources/views/admin/domains/createDomain.twig b/cp/resources/views/admin/domains/createDomain.twig index 5f5820f..2d729d3 100644 --- a/cp/resources/views/admin/domains/createDomain.twig +++ b/cp/resources/views/admin/domains/createDomain.twig @@ -232,6 +232,23 @@ {% endif %} +