diff --git a/cp/app/Controllers/ContactsController.php b/cp/app/Controllers/ContactsController.php
index 6ab40e0..32eb6b5 100644
--- a/cp/app/Controllers/ContactsController.php
+++ b/cp/app/Controllers/ContactsController.php
@@ -521,4 +521,61 @@ class ContactsController extends Controller
'registrar' => $registrar,
]);
}
+
+ public function viewContact(Request $request, Response $response, $args)
+ {
+ $db = $this->container->get('db');
+ // Get the current URI
+ $uri = $request->getUri()->getPath();
+
+ if ($args) {
+ $contact = $db->selectRow('SELECT id, identifier, voice, fax, email, nin, nin_type, crdate, clid, disclose_voice, disclose_fax, disclose_email FROM contact WHERE identifier = ?',
+ [ $args ]);
+
+ if ($contact) {
+ $registrars = $db->selectRow('SELECT id, clid, name FROM registrar WHERE id = ?', [$contact['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 IDs
+ if (!in_array($registrars['id'], $userRegistrarIds)) {
+ // Redirect to the contacts view if the user is not authorized for this contact
+ return $response->withHeader('Location', '/contacts')->withStatus(302);
+ }
+ }
+
+ $contactStatus = $db->selectRow('SELECT status FROM contact_status WHERE contact_id = ?',
+ [ $contact['id'] ]);
+ $contactAuth = $db->selectRow('SELECT authinfo FROM contact_authInfo WHERE contact_id = ?',
+ [ $contact['id'] ]);
+ $contactLinked = $db->selectRow('SELECT domain_id, type FROM domain_contact_map WHERE contact_id = ?',
+ [ $contact['id'] ]);
+ $contactPostal = $db->select('SELECT * FROM contact_postalInfo WHERE contact_id = ?',
+ [ $contact['id'] ]);
+
+ return view($response,'admin/contacts/viewContact.twig', [
+ 'contact' => $contact,
+ 'contactStatus' => $contactStatus,
+ 'contactLinked' => $contactLinked,
+ 'contactAuth' => $contactAuth,
+ 'contactPostal' => $contactPostal,
+ 'registrars' => $registrars,
+ 'currentUri' => $uri
+ ]);
+ } else {
+ // Contact does not exist, redirect to the contacts view
+ return $response->withHeader('Location', '/contacts')->withStatus(302);
+ }
+
+ } else {
+ // Redirect to the contacts view
+ return $response->withHeader('Location', '/contacts')->withStatus(302);
+ }
+
+ }
}
\ No newline at end of file
diff --git a/cp/resources/views/admin/contacts/viewContact.twig b/cp/resources/views/admin/contacts/viewContact.twig
new file mode 100644
index 0000000..84beeec
--- /dev/null
+++ b/cp/resources/views/admin/contacts/viewContact.twig
@@ -0,0 +1,246 @@
+{% extends "layouts/app.twig" %}
+
+{% block title %}{{ __('Contact Details') }}{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
+
+
Email
+
{{ contact.email }} {% if contact.disclose_email == '1' %}
Visible in Public {% else %}
Hidden from Public {% endif %}
+
+
+
Phone
+
{{ contact.voice }} {% if contact.disclose_voice == '1' %}
Visible in Public {% else %}
Hidden from Public {% endif %}
+
+
+
Creation Date
+
{{ contact.crdate }}
+
+
+
Registrar
+
{{ registrars.name }}
+
+
+
+
+
+
+
+
+ {% if contactPostal is not empty %}
+ {% set intExists = false %}
+ {% set locExists = false %}
+ {% for postal in contactPostal %}
+ {% if postal.type == 'int' %}
+ {% set intExists = true %}
+
+
International Contact Details
+
+
+
Name
+
{{ postal.name }} {% if postal.disclose_name_int == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Organization
+
{{ postal.org }} {% if postal.disclose_org_int == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Street 1
+
{{ postal.street1 }} {% if postal.disclose_addr_int == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Street 2
+
{{ postal.street1 }} {% if postal.disclose_addr_int == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
City
+
{{ postal.city }} {% if postal.disclose_addr_int == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
State/Province
+
{{ postal.sp }} {% if postal.disclose_addr_int == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Postal Code
+
{{ postal.pc }} {% if postal.disclose_addr_int == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Country
+
{{ postal.cc }} {% if postal.disclose_addr_int == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
+ {% elseif postal.type == 'loc' %}
+ {% set locExists = true %}
+ {% endif %}
+ {% endfor %}
+
+ {% if locExists %}
+ {% for postal in contactPostal %}
+ {% if postal.type == 'loc' %}
+
+
Localized Contact Details
+
+
+
Name
+
{{ postal.name }} {% if postal.disclose_name_loc == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Organization
+
{{ postal.org }} {% if postal.disclose_org_loc == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Street 1
+
{{ postal.street1 }} {% if postal.disclose_addr_loc == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Street 2
+
{{ postal.street1 }} {% if postal.disclose_addr_loc == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
City
+
{{ postal.city }} {% if postal.disclose_addr_loc == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
State/Province
+
{{ postal.sp }} {% if postal.disclose_addr_loc == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Postal Code
+
{{ postal.pc }} {% if postal.disclose_addr_loc == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
Country
+
{{ postal.cc }} {% if postal.disclose_addr_loc == '1' %}
+
Visible in Public
+ {% else %}
+
Hidden from Public
+ {% endif %}
+
+
+
+ {% endif %}
+ {% endfor %}
+ {% else %}
+
+
Localized Contact Details
+
No Localized Contact Information Available
+
+ {% endif %}
+ {% endif %}
+
+
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/cp/resources/views/layouts/app.twig b/cp/resources/views/layouts/app.twig
index 3d75500..25fe7fe 100644
--- a/cp/resources/views/layouts/app.twig
+++ b/cp/resources/views/layouts/app.twig
@@ -114,7 +114,7 @@
-
+
diff --git a/cp/routes/web.php b/cp/routes/web.php
index 2dc6713..315292c 100644
--- a/cp/routes/web.php
+++ b/cp/routes/web.php
@@ -49,10 +49,11 @@ $app->group('', function ($route) {
$route->get('/contacts', ContactsController::class .':view')->setName('contacts');
$route->map(['GET', 'POST'], '/contact/create', ContactsController::class . ':create')->setName('contactcreate');
+ $route->get('/contact/{contact}', ContactsController::class . ':viewContact')->setName('viewContact');
$route->get('/hosts', HostsController::class .':view')->setName('hosts');
$route->map(['GET', 'POST'], '/host/create', HostsController::class . ':create')->setName('hostcreate');
- $route->get('/host/{domain}', HostsController::class . ':viewHost')->setName('viewHost');
+ $route->get('/host/{host}', HostsController::class . ':viewHost')->setName('viewHost');
$route->get('/registrars', RegistrarsController::class .':view')->setName('registrars');
$route->map(['GET', 'POST'], '/registrar/create', RegistrarsController::class . ':create')->setName('registrarcreate');