$data = array();
- if (!preg_match("/(.*)\[attachment(.*)\](.*?)\[\/attachment\](.*)/ism", $body, $match))
+ if (!preg_match("/(.*)\[attachment(.*?)\](.*?)\[\/attachment\](.*)/ism", $body, $match))
return get_old_attachment_data($body);
$attributes = $match[2];
$url = $matches[1];
if ($url != "")
- $data["url"] = $url;
+ $data["url"] = html_entity_decode($url, ENT_QUOTES, 'UTF-8');
$title = "";
preg_match("/title='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$title = $matches[1];
- //$title = htmlentities($title, ENT_QUOTES, 'UTF-8', false);
- $title = bbcode(html_entity_decode($title, ENT_QUOTES, 'UTF-8'), false, false, true);
- $title = str_replace(array("[", "]"), array("[", "]"), $title);
-
- if ($title != "")
+ if ($title != "") {
+ $title = bbcode(html_entity_decode($title, ENT_QUOTES, 'UTF-8'), false, false, true);
+ $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
+ $title = str_replace(array("[", "]"), array("[", "]"), $title);
$data["title"] = $title;
+ }
$image = "";
preg_match("/image='(.*?)'/ism", $attributes, $matches);
$image = $matches[1];
if ($image != "")
- $data["image"] = $image;
+ $data["image"] = html_entity_decode($image, ENT_QUOTES, 'UTF-8');
$preview = "";
preg_match("/preview='(.*?)'/ism", $attributes, $matches);
$preview = $matches[1];
if ($preview != "")
- $data["preview"] = $preview;
+ $data["preview"] = html_entity_decode($preview, ENT_QUOTES, 'UTF-8');
$data["description"] = trim($match[3]);
if (count($pictures) == 1) {
// Checking, if the link goes to a picture
$data = parseurl_getsiteinfo_cached($pictures[0][1], true);
+
+ // Workaround:
+ // Sometimes photo posts to the own album are not detected at the start.
+ // So we seem to cannot use the cache for these cases. That's strange.
+ if (($data["type"] != "photo") AND strstr($pictures[0][1], "/photos/"))
+ $data = parseurl_getsiteinfo($pictures[0][1], true);
+
if ($data["type"] == "photo") {
$post["type"] = "photo";
if (isset($data["images"][0])) {
}
}
- $html = bbcode($post["text"], false, false, $htmlmode);
+ $html = bbcode($post["text"].$post["after"], false, false, $htmlmode);
$msg = html2plain($html, 0, true);
$msg = trim(html_entity_decode($msg,ENT_QUOTES,'UTF-8'));