Merge pull request #1239 from annando/1412-prevent-parsing-problems

1412 prevent parsing problems
This commit is contained in:
tobiasd 2014-12-07 10:39:28 +01:00
commit c29ff719ec
2 changed files with 15 additions and 0 deletions

View File

@ -903,6 +903,12 @@ function add_page_info_data($data) {
if ($no_photos AND ($data["type"] == "photo")) if ($no_photos AND ($data["type"] == "photo"))
return(""); return("");
// If the link contains BBCode stuff, make a short link out of this to avoid parsing problems
if (strpos($data["url"], '[') OR strpos($data["url"], ']')) {
require_once("include/network.php");
$data["url"] = short_link($data["url"]);
}
if (($data["type"] != "photo") AND is_string($data["title"])) if (($data["type"] != "photo") AND is_string($data["title"]))
$text .= "[bookmark=".$data["url"]."]".trim($data["title"])."[/bookmark]"; $text .= "[bookmark=".$data["url"]."]".trim($data["title"])."[/bookmark]";

View File

@ -187,6 +187,9 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
case "description": case "description":
$siteinfo["text"] = $attr["content"]; $siteinfo["text"] = $attr["content"];
break; break;
case "thumbnail":
$siteinfo["image"] = $attr["content"];
break;
case "twitter:image": case "twitter:image":
$siteinfo["image"] = $attr["content"]; $siteinfo["image"] = $attr["content"];
break; break;
@ -421,6 +424,12 @@ function parse_url_content(&$a) {
$url= $siteinfo["url"]; $url= $siteinfo["url"];
// If the link contains BBCode stuff, make a short link out of this to avoid parsing problems
if (strpos($url, '[') OR strpos($url, ']')) {
require_once("include/network.php");
$url = short_link($url);
}
$sitedata = ""; $sitedata = "";
if($siteinfo["title"] == "") { if($siteinfo["title"] == "") {