Inclusion de la function chunk_split qui est déclarée en dehors de la classe
This commit is contained in:
parent
a586182912
commit
3312af7560
@ -129,7 +129,7 @@ class DolibarrMail
|
|||||||
{
|
{
|
||||||
$fd = fopen($sourcefile, "r");
|
$fd = fopen($sourcefile, "r");
|
||||||
$contents = fread($fd, filesize($sourcefile));
|
$contents = fread($fd, filesize($sourcefile));
|
||||||
$encoded = my_chunk_split(base64_encode($contents));
|
$encoded = $this->my_chunk_split(base64_encode($contents));
|
||||||
fclose($fd);
|
fclose($fd);
|
||||||
}
|
}
|
||||||
return $encoded;
|
return $encoded;
|
||||||
@ -208,43 +208,43 @@ class DolibarrMail
|
|||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief permet de diviser une chaine (RFC2045)
|
|
||||||
\param str
|
|
||||||
\remarks function chunk_split qui remplace celle de php si nécéssaire
|
|
||||||
\remarks 76 caractères par ligne, terminé par "\r\n"
|
|
||||||
*/
|
|
||||||
|
|
||||||
// usage - mimetype example "image/gif"
|
/*!
|
||||||
// $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filename,$mimetype);
|
\brief permet de diviser une chaine (RFC2045)
|
||||||
// $mailfile->sendfile();
|
\param str
|
||||||
|
\remarks function chunk_split qui remplace celle de php si nécéssaire
|
||||||
|
\remarks 76 caractères par ligne, terminé par "\r\n"
|
||||||
|
*/
|
||||||
|
|
||||||
// Splits a string by RFC2045 semantics (76 chars per line, end with \r\n).
|
// usage - mimetype example "image/gif"
|
||||||
// This is not in all PHP versions so I define one here manuall.
|
// $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filename,$mimetype);
|
||||||
|
// $mailfile->sendfile();
|
||||||
|
|
||||||
function my_chunk_split($str)
|
// Splits a string by RFC2045 semantics (76 chars per line, end with \r\n).
|
||||||
{
|
// This is not in all PHP versions so I define one here manuall.
|
||||||
$stmp = $str;
|
|
||||||
$len = strlen($stmp);
|
function my_chunk_split($str)
|
||||||
$out = "";
|
{
|
||||||
while ($len > 0)
|
$stmp = $str;
|
||||||
{
|
$len = strlen($stmp);
|
||||||
if ($len >= 76)
|
$out = "";
|
||||||
{
|
while ($len > 0)
|
||||||
$out = $out . substr($stmp, 0, 76) . "\r\n";
|
{
|
||||||
$stmp = substr($stmp, 76);
|
if ($len >= 76)
|
||||||
$len = $len - 76;
|
{
|
||||||
}
|
$out = $out . substr($stmp, 0, 76) . "\r\n";
|
||||||
else
|
$stmp = substr($stmp, 76);
|
||||||
{
|
$len = $len - 76;
|
||||||
$out = $out . $stmp . "\r\n";
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$out = $out . $stmp . "\r\n";
|
||||||
$stmp = ""; $len = 0;
|
$stmp = ""; $len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// end script
|
// end script
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user