kopia lustrzana https://github.com/newroco/mail2deck
Better way to handle encoded description
rodzic
dfe2a048d3
commit
fa3d1eace0
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
function decodeIfNeeded($data) {
|
||||
$descarray = explode(" ", $data);
|
||||
$wEncoded = 0;
|
||||
foreach($descarray as $word) {
|
||||
if(base64_encode(base64_decode($word)) == $word) {
|
||||
$wEncoded++;
|
||||
}
|
||||
}
|
||||
|
||||
if($wEncoded >= count($descarray) - 1) {
|
||||
$data = base64_decode($data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
require_once("config.php");
|
||||
require_once("functions.php");
|
||||
require_once('lib/DeckClass.php');
|
||||
require_once('lib/MailClass.php');
|
||||
|
||||
|
@ -75,8 +76,7 @@ if ($emails)
|
|||
} else {
|
||||
$description = DECODE_SPECIAL_CHARACTERS ? quoted_printable_decode($inbox->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;
|
||||
|
|
Ładowanie…
Reference in New Issue