From fa3d1eace05f83bd59b9c73a837776eb887dfea2 Mon Sep 17 00:00:00 2001 From: Alex Puiu Date: Fri, 11 Feb 2022 11:49:49 +0200 Subject: [PATCH] Better way to handle encoded description --- functions.php | 19 +++++++++++++++++++ index.php | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 functions.php diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..e09abcf --- /dev/null +++ b/functions.php @@ -0,0 +1,19 @@ += count($descarray) - 1) { + $data = base64_decode($data); + } + + return $data; +} + +?> \ No newline at end of file diff --git a/index.php b/index.php index a7efbcd..78aff60 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,7 @@ fetchMessageBody($emails[$j], 1)) : $inbox->fetchMessageBody($emails[$j], 1); } - if(base64_encode(base64_decode($description)) == $description) // if description is base64 encoded, decode it - $description = base64_decode($description); + $description = decodeIfNeeded($description); $data->description = $description; $mailSender = new stdClass(); $mailSender->userId = $overview->from[0]->mailbox;