From ec2d0ae93e556f2f49d9b0d8dd6525d55575fae5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9CVeLiTi=E2=80=9D?= <“info@veliti.nl”>
Date: Wed, 12 Jun 2024 14:43:25 +0200
Subject: [PATCH 1/2] Fix - do not show cancel button
---
firmwaretool.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/firmwaretool.php b/firmwaretool.php
index dc7d58e..5c46dcd 100644
--- a/firmwaretool.php
+++ b/firmwaretool.php
@@ -31,7 +31,7 @@ if (isset($_GET['equipmentID'])){$returnpage = 'equipment&equipmentID='.$_GET['e
//SHOW BACK BUTTON ONLY FOR PORTAL USERS
-if (isAllowed('dashboard',$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
+if (isAllowed('dashboard',$_SESSION['profile'],$_SESSION['permission'],'R') != 0){
$view .= '
'.$button_cancel.'
From bc1c5147e97e063ff78142114c2743aaf6e849f0 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:14:48 +0200
Subject: [PATCH 2/2] CMXX - Cronjob
---
assets/functions.php | 6 +++---
cronjob.php | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/assets/functions.php b/assets/functions.php
index bb9da50..de36f1c 100644
--- a/assets/functions.php
+++ b/assets/functions.php
@@ -2544,7 +2544,7 @@ function storeMeasurementEquipment($serialnumber){
$stmt = $pdo->prepare($sql);
$stmt->execute([$identification[0],$identification[1]]);
$product_measurements = $stmt->fetchAll(PDO::FETCH_ASSOC);
- $product_measurements = $product_measurements[0]['measurement'];
+ $product_measurements = $product_measurements[0]['measurement']?? '';
if (!empty($product_measurements)){
//Only run when there is a product version found
@@ -2628,13 +2628,13 @@ function storeMeasurementEquipment($serialnumber){
}
else {
//EXIST INSERT
- $sql = 'INSERT INTO equipment_data (measurement, , healthindex, equipmentid, historyid) VALUES (?,?,?,?)';
+ $sql = 'INSERT INTO equipment_data (measurement, healthindex, equipmentid, historyid) VALUES (?,?,?,?)';
}
//EXECUTE QUERY
$stmt = $pdo->prepare($sql);
$stmt->execute([$data, $healthindex, $identification[2],$identification[3]]);
- $equipment_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ //$equipment_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
}
}
diff --git a/cronjob.php b/cronjob.php
index 4ad3a90..ad07c93 100644
--- a/cronjob.php
+++ b/cronjob.php
@@ -50,8 +50,46 @@ 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 ++++++++++++++