diff --git a/core/admin/connection/index.php b/core/admin/connection/index.php
new file mode 100644
index 00000000..5b417bbb
--- /dev/null
+++ b/core/admin/connection/index.php
@@ -0,0 +1,59 @@
+
+
+ $user->user_level,
+ 'components' => [
+ 'employeeCount' => [
+ 'isIceHrmPro' => $isIceHrmPro,
+ 'count' => $employeeCount,
+ 'allowed' => $isIceHrmPro ? intval($data['employees']) : 'N/A',
+ 'validUntil' => $data['licenseActivated'],
+ 'licenseId' => $data['key'],
+ ],
+ 'systemData' => [
+ 'data' => $connectionService->getSystemReport(),
+ 'issues' => $connectionService->getSystemErrors(),
+ ],
+ ]
+];
+?>
+
+
+
diff --git a/core/admin/connection/meta.json b/core/admin/connection/meta.json
new file mode 100644
index 00000000..68c5a049
--- /dev/null
+++ b/core/admin/connection/meta.json
@@ -0,0 +1,12 @@
+{
+ "label": "Ice Connect",
+ "menu": "System",
+ "order": "9",
+ "icon": "fa-wifi",
+ "user_levels": [
+ "Admin"
+ ],
+ "permissions": [],
+ "model_namespace": "\\Connection\\Common\\Model",
+ "manager": "\\Connection\\Admin\\Api\\ConnectionAdminManager"
+}
\ No newline at end of file
diff --git a/core/src/Connection/Admin/Api/ConnectionActionManager.php b/core/src/Connection/Admin/Api/ConnectionActionManager.php
new file mode 100644
index 00000000..8123f29c
--- /dev/null
+++ b/core/src/Connection/Admin/Api/ConnectionActionManager.php
@@ -0,0 +1,9 @@
+dispatchInstallationRequest()) {
+ $iceConnect->reportInstallationData();
+ }
+ }
+
+ public function initializeUserClasses()
+ {
+ // TODO: Implement initializeUserClasses() method.
+ }
+
+ public function initializeFieldMappings()
+ {
+ // TODO: Implement initializeFieldMappings() method.
+ }
+
+ public function initializeDatabaseErrorMappings()
+ {
+ // TODO: Implement initializeDatabaseErrorMappings() method.
+ }
+
+ public function setupModuleClassDefinitions()
+ {
+ // TODO: Implement setupModuleClassDefinitions() method.
+ }
+}
diff --git a/core/src/Connection/Common/ConnectionService.php b/core/src/Connection/Common/ConnectionService.php
new file mode 100644
index 00000000..c9bf5fc7
--- /dev/null
+++ b/core/src/Connection/Common/ConnectionService.php
@@ -0,0 +1,135 @@
+ BaseService::getInstance()->getInstanceId(),
+ 'secret' => md5(BaseService::getInstance()->getInstanceKey()),
+ 'external_ip' => $this->getExternalIP(),
+ 'internal_ip' => $_SERVER['SERVER_ADDR'],
+ 'employees' => StatsHelper::getEmployeeCount(),
+ 'users' => StatsHelper::getUserCount(),
+ 'version' => VERSION,
+ 'company' => SettingsManager::getInstance()->getSetting('Company: Name'),
+ 'pro_key' => $proKey,
+ ];
+ }
+
+ public function getSystemReport()
+ {
+ return [
+ [
+ 'name' => 'Installation ID',
+ 'value' => BaseService::getInstance()->getInstanceId(),
+ ],
+ [
+ 'name' => 'PHP Version',
+ 'value' => phpversion(),
+ ],
+ [
+ 'name' => 'PHP Extensions',
+ 'value' => join(', ', get_loaded_extensions()),
+ ],
+ [
+ 'name' => 'Web Server',
+ 'value' => $_SERVER['SERVER_SOFTWARE'],
+ ],
+ [
+ 'name' => 'MySQL Server',
+ 'value' => mysqli_get_server_info((new User())->DB()->_connectionID),
+ ],
+ [
+ 'name' => 'Modules Loaded',
+ 'value' => join(', ', array_keys(BaseService::getInstance()->getModuleManagerNames())),
+ ]
+ ];
+ }
+
+ public function getSystemErrors()
+ {
+ $errors = [];
+ $res = fopen(CLIENT_BASE_PATH.'data/connection_test.txt', "w");
+
+ if (false === $res) {
+ $errors[] = [
+ 'type' => 'error',
+ 'message' =>
+ 'Data directory is not writable. Please make sure php can has write access to /app/data',
+ ];
+ } else {
+ fwrite($res, date('Y-m-d'));
+ $file = CLIENT_BASE_URL.'data/connection_test.txt';
+ $file_headers = @get_headers($file);
+ if ($file_headers && $file_headers[0] !== 'HTTP/1.1 404 Not Found') {
+ $errors[] = [
+ 'type' => 'error',
+ 'link' => 'https://icehrm.gitbook.io/icehrm/getting-started/securing-icehrm-installation',
+ 'linkText' => 'Learn how to fix',
+ 'message' => 'Data directory is accessible from outside.',
+ ];
+ }
+ }
+
+ return $errors;
+ }
+
+ public function dispatchInstallationRequest()
+ {
+ $timeNow = time();
+ $time = BaseService::getInstance()->getSystemData('sysDataTime');
+ if (null === $time) {
+ BaseService::getInstance()->setSystemData('sysDataTime', $timeNow);
+ return true;
+ }
+
+ $time = intval($time);
+ if ($timeNow > $time + 3600) {
+ BaseService::getInstance()->setSystemData('sysDataTime', $timeNow);
+ return true;
+ }
+
+ return false;
+ }
+
+ public function getExternalIP()
+ {
+ try {
+ $externalContent = file_get_contents('http://checkip.dyndns.com/');
+ preg_match('/Current IP Address: \[?([:.0-9a-fA-F]+)\]?/', $externalContent, $m);
+ return $m[1];
+ } catch (\Exception $e) {
+ }
+
+ return null;
+ }
+
+ public function reportInstallationData()
+ {
+ try {
+ $client = new Client();
+ $response = $client->request('POST', APP_WEB_URL . '/sapi/installtion-data', [
+ 'json' => $this->getInstallationData(),
+ ]);
+ } catch (\Throwable $e) {
+ return false;
+ }
+
+ return true;
+ }
+}