From bf21c2c49cbb234d4b6241bdc3a243b2b344dbb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”> Date: Fri, 4 Oct 2024 09:51:10 +0200 Subject: [PATCH] CMXX - Cronjob bugfixes --- cronjob.php | 45 +++++++++++++++++++++++++++++++++++ settings/settingsprofiles.php | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/cronjob.php b/cronjob.php index 4ad3a90..1090ad6 100644 --- a/cronjob.php +++ b/cronjob.php @@ -5,6 +5,12 @@ include_once './assets/functions.php'; include_once './settings/settings.php'; include_once './settings/config.php'; +if (debug && debug_id == $_SESSION['id']){ + ini_set('display_errors', '1'); + ini_set('display_startup_errors', '1'); + error_reporting(E_ALL); +} + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // check for security_code if not exit +++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -50,8 +56,47 @@ foreach ($communications as $communication){ // END FIRMWARE COMMUNICATION TO END-USER ++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// getUserkey ++++++++++++++ +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +$token =''; +$data = json_encode(array("username" => interface_user, "password" => interface_pw), JSON_UNESCAPED_UNICODE); +//Secure data +$payload = generate_payload($data); +//API call +$responses = ioServer('/v1/authorization', $payload); +//Decode Payload +if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = '400';} + +if ($responses === 'NOK' || $responses === '400'){ + //Not allowed + http_response_code(403); + exit; +} +else { + // Store data in session + $token = $responses->userkey; +} + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// close Contracts ++++++++++++++ +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +closeContract(); + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Machine learning ++++++++++++++ +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +$total_measurement = traintotalMeasurement(); +$total_results = statisticalAnalyses($total_measurement); +storeMeasurementProduct($total_results, $token); +storeMeasurementEquipment(''); + +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// GeoUpdate ++++++++++++++ +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +geolocationUpdate($token); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ // EXIT ++++++++++++++ diff --git a/settings/settingsprofiles.php b/settings/settingsprofiles.php index 811a1bd..623ef9d 100644 --- a/settings/settingsprofiles.php +++ b/settings/settingsprofiles.php @@ -16,5 +16,5 @@ define('distribution',''); /*Firmware*/ define('firmware','firmwaretool,application'); /*Interface*/ -define('interface','application'); +define('interface','equipments,products_versions,application'); ?> \ No newline at end of file