diff --git a/cp/app/Controllers/ContactsController.php b/cp/app/Controllers/ContactsController.php index 890e332..78cfd75 100644 --- a/cp/app/Controllers/ContactsController.php +++ b/cp/app/Controllers/ContactsController.php @@ -17,11 +17,19 @@ class ContactsController extends Controller { public function listContacts(Request $request, Response $response) { + if (envi('MINIMUM_DATA') === 'true') { + return $response->withHeader('Location', '/dashboard')->withStatus(302); + } + return view($response,'admin/contacts/listContacts.twig'); } public function createContact(Request $request, Response $response) { + if (envi('MINIMUM_DATA') === 'true') { + return $response->withHeader('Location', '/dashboard')->withStatus(302); + } + if ($request->getMethod() === 'POST') { // Retrieve POST data $data = $request->getParsedBody(); @@ -385,6 +393,10 @@ class ContactsController extends Controller public function viewContact(Request $request, Response $response, $args) { + if (envi('MINIMUM_DATA') === 'true') { + return $response->withHeader('Location', '/dashboard')->withStatus(302); + } + $db = $this->container->get('db'); // Get the current URI $uri = $request->getUri()->getPath(); @@ -464,6 +476,10 @@ class ContactsController extends Controller public function updateContact(Request $request, Response $response, $args) { + if (envi('MINIMUM_DATA') === 'true') { + return $response->withHeader('Location', '/dashboard')->withStatus(302); + } + $db = $this->container->get('db'); // Get the current URI $uri = $request->getUri()->getPath(); @@ -542,6 +558,10 @@ class ContactsController extends Controller public function validateContact(Request $request, Response $response, $args) { + if (envi('MINIMUM_DATA') === 'true') { + return $response->withHeader('Location', '/dashboard')->withStatus(302); + } + $db = $this->container->get('db'); $verifyPhone = $db->selectValue("SELECT value FROM settings WHERE name = 'verifyPhone'"); $verifyEmail = $db->selectValue("SELECT value FROM settings WHERE name = 'verifyEmail'"); @@ -664,6 +684,10 @@ class ContactsController extends Controller public function approveContact(Request $request, Response $response) { + if (envi('MINIMUM_DATA') === 'true') { + return $response->withHeader('Location', '/dashboard')->withStatus(302); + } + if ($request->getMethod() === 'POST') { $db = $this->container->get('db'); $verifyPhone = $db->selectValue("SELECT value FROM settings WHERE name = 'verifyPhone'"); @@ -745,6 +769,10 @@ class ContactsController extends Controller public function updateContactProcess(Request $request, Response $response) { + if (envi('MINIMUM_DATA') === 'true') { + return $response->withHeader('Location', '/dashboard')->withStatus(302); + } + if ($request->getMethod() === 'POST') { // Retrieve POST data $data = $request->getParsedBody(); @@ -1101,6 +1129,10 @@ class ContactsController extends Controller public function deleteContact(Request $request, Response $response, $args) { + if (envi('MINIMUM_DATA') === 'true') { + return $response->withHeader('Location', '/dashboard')->withStatus(302); + } + // if ($request->getMethod() === 'POST') { $db = $this->container->get('db'); // Get the current URI diff --git a/cp/app/Controllers/DomainsController.php b/cp/app/Controllers/DomainsController.php index b82a648..a2582bd 100644 --- a/cp/app/Controllers/DomainsController.php +++ b/cp/app/Controllers/DomainsController.php @@ -1183,8 +1183,10 @@ class DomainsController extends Controller 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 (envi('MINIMUM_DATA') === 'false') { + $this->container->get('flash')->addMessage('error', 'Please provide registrant identifier'); + return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302); + } } if ($contactAdmin) { @@ -1201,8 +1203,10 @@ class DomainsController extends Controller 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 (envi('MINIMUM_DATA') === 'false') { + $this->container->get('flash')->addMessage('error', 'Please provide admin contact identifier'); + return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302); + } } if ($contactTech) { @@ -1219,8 +1223,10 @@ class DomainsController extends Controller 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 (envi('MINIMUM_DATA') === 'false') { + $this->container->get('flash')->addMessage('error', 'Please provide tech contact identifier'); + return $response->withHeader('Location', '/domain/update/'.$domainName)->withStatus(302); + } } if ($contactBilling) { @@ -1236,9 +1242,6 @@ class DomainsController extends Controller $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) { diff --git a/cp/bootstrap/app.php b/cp/bootstrap/app.php index 5543019..d991bbf 100644 --- a/cp/bootstrap/app.php +++ b/cp/bootstrap/app.php @@ -126,6 +126,11 @@ $container->set('view', function ($container) { } else { $view->getEnvironment()->addGlobal('screen_mode', 'light'); } + if (envi('MINIMUM_DATA') === 'true') { + $view->getEnvironment()->addGlobal('minimum_data', 'true'); + } else { + $view->getEnvironment()->addGlobal('minimum_data', 'false'); + } if (isset($_SESSION['auth_roles'])) { $view->getEnvironment()->addGlobal('roles', $_SESSION['auth_roles']); } diff --git a/cp/config/app.php b/cp/config/app.php index b252e9e..93f618d 100644 --- a/cp/config/app.php +++ b/cp/config/app.php @@ -14,6 +14,7 @@ return [ 'url' => $_ENV['APP_URL'] ?? 'http://localhost', 'domain' => $_ENV['APP_DOMAIN'] ?? 'example.com', 'root' => $_ENV['APP_ROOT'] ?? '/var/www/cp', + 'minimum_data' => $_ENV['MINIMUM_DATA'] ?? false, 'timezone' => $_ENV['TIME_ZONE'] ?? 'UTC', 'default' => $_ENV['DB_DRIVER'] ?? 'mysql', 'connections' => [ @@ -47,16 +48,6 @@ return [ 'schema' => 'public', 'sslmode' => 'prefer', ], - 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'host' => $_ENV['DB_HOST'] ?? 'localhost', - 'port' => $_ENV['DB_PORT'] ?? '1433', - 'database' => $_ENV['DB_DATABASE'] ?? 'db_username', - 'username' => $_ENV['DB_USERNAME'] ?? 'db_password', - 'password' => $_ENV['DB_PASSWORD'] ?? '', - 'charset' => 'utf8', - 'prefix' => '', - ], ], 'mail' => [ 'driver' => $_ENV['MAIL_DRIVER'] ?? 'smtp', diff --git a/cp/env-sample b/cp/env-sample index 1ea136a..957b270 100644 --- a/cp/env-sample +++ b/cp/env-sample @@ -3,6 +3,7 @@ APP_ENV=public APP_URL=https://cp.example.com APP_DOMAIN=example.com APP_ROOT=/var/www/cp +MINIMUM_DATA=false DB_DRIVER=mysql DB_HOST=localhost diff --git a/cp/resources/views/admin/dashboard/index.twig b/cp/resources/views/admin/dashboard/index.twig index 038c05d..dbe2638 100644 --- a/cp/resources/views/admin/dashboard/index.twig +++ b/cp/resources/views/admin/dashboard/index.twig @@ -45,7 +45,7 @@