1
0
Fork 0

Merge pull request #2532 from annando/1605-attachment-encoding

Bugfix: Some more encoding problems with attachments fixed
This commit is contained in:
Tobias Diekershoff 2016-05-27 07:22:53 +02:00
commit 8bcf52d180

View file

@ -116,10 +116,8 @@ function get_attachment_data($body) {
if ($matches[1] != "") if ($matches[1] != "")
$url = $matches[1]; $url = $matches[1];
$url = html_entity_decode($url, ENT_QUOTES, 'UTF-8');
if ($url != "") if ($url != "")
$data["url"] = $url; $data["url"] = html_entity_decode($url, ENT_QUOTES, 'UTF-8');
$title = ""; $title = "";
preg_match("/title='(.*?)'/ism", $attributes, $matches); preg_match("/title='(.*?)'/ism", $attributes, $matches);
@ -130,11 +128,12 @@ function get_attachment_data($body) {
if ($matches[1] != "") if ($matches[1] != "")
$title = $matches[1]; $title = $matches[1];
$title = bbcode(html_entity_decode($title, ENT_QUOTES, 'UTF-8'), false, false, true); if ($title != "") {
$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8'); $title = bbcode(html_entity_decode($title, ENT_QUOTES, 'UTF-8'), false, false, true);
$title = str_replace(array("[", "]"), array("[", "]"), $title); $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
if ($title != "") $title = str_replace(array("[", "]"), array("[", "]"), $title);
$data["title"] = $title; $data["title"] = $title;
}
$image = ""; $image = "";
preg_match("/image='(.*?)'/ism", $attributes, $matches); preg_match("/image='(.*?)'/ism", $attributes, $matches);
@ -146,7 +145,7 @@ function get_attachment_data($body) {
$image = $matches[1]; $image = $matches[1];
if ($image != "") if ($image != "")
$data["image"] = $image; $data["image"] = html_entity_decode($image, ENT_QUOTES, 'UTF-8');
$preview = ""; $preview = "";
preg_match("/preview='(.*?)'/ism", $attributes, $matches); preg_match("/preview='(.*?)'/ism", $attributes, $matches);
@ -158,7 +157,7 @@ function get_attachment_data($body) {
$preview = $matches[1]; $preview = $matches[1];
if ($preview != "") if ($preview != "")
$data["preview"] = $preview; $data["preview"] = html_entity_decode($preview, ENT_QUOTES, 'UTF-8');
$data["description"] = trim($match[3]); $data["description"] = trim($match[3]);