From 29982f90bc6107d1bf993aaa5eaace6364c42a9d Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 16 Oct 2024 16:45:13 +0900 Subject: [PATCH] Admin\Backend change non filled dat part comment the not filled data or data_binary part is a JSON with "type" set to the type that is used with a general message To decode try to read both sides if data = JSON + "type" and "message" set then data is in data_binary else data_binary holds the type on the left side --- www/lib/CoreLibs/Admin/Backend.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/www/lib/CoreLibs/Admin/Backend.php b/www/lib/CoreLibs/Admin/Backend.php index 044930a5..9f705c7b 100644 --- a/www/lib/CoreLibs/Admin/Backend.php +++ b/www/lib/CoreLibs/Admin/Backend.php @@ -288,19 +288,31 @@ class Backend case 'BINARY': case 'BZIP': $data_binary = $this->db->dbEscapeBytea((string)bzcompress(serialize($data))); - $data_write = 'see bzip compressed data_binary field'; + $data_write = Json::jsonConvertArrayTo([ + 'type' => 'BZIP', + 'message' => 'see bzip compressed data_binary field' + ]); break; case 'ZLIB': $data_binary = $this->db->dbEscapeBytea((string)gzcompress(serialize($data))); - $data_write = 'see zlib compressed data_binary field'; + $data_write = Json::jsonConvertArrayTo([ + 'type' => 'ZLIB', + 'message' => 'see zlib compressed data_binary field' + ]); break; case 'STRING': case 'SERIAL': - $data_binary = ''; + $data_binary = $this->db->dbEscapeBytea(Json::jsonConvertArrayTo([ + 'type' => 'SERIAL', + 'message' => 'see serial string data field' + ])); $data_write = serialize($data); break; case 'JSON': - $data_binary = ''; + $data_binary = $this->db->dbEscapeBytea(Json::jsonConvertArrayTo([ + 'type' => 'JSON', + 'message' => 'see json string data field' + ])); // must be converted to array if (!is_array($data)) { $data = ["data" => $data];