X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fparse_url.php;h=400c248e05d5fd5961f80842449c315caf545f74;hb=5f1ef732e05c79584e6ea1cdb14360a7dd388a9d;hp=4d894969aadbde21c152ac87895da09aba6915d9;hpb=02a1fc9cd08fba2168895d1892a91d8143323848;p=friendica.git diff --git a/mod/parse_url.php b/mod/parse_url.php index 4d894969aa..400c248e05 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -1,4 +1,18 @@ + + + +
+Shiny trinkets are shiny.
+ +*/ + if(!function_exists('deletenode')) { function deletenode(&$doc, $node) { @@ -22,6 +36,9 @@ function completeurl($url, $scheme) { if ($schemearr["port"] != "") $complete .= ":".$schemearr["port"]; + if(strpos($urlarr['path'],'/') !== 0) + $complete .= '/'; + $complete .= $urlarr["path"]; if ($urlarr["query"] != "") @@ -135,23 +152,23 @@ function parseurl_getsiteinfo($url) { } if ($siteinfo["image"] == "") { - $list = $xpath->query("//img[@src]"); - foreach ($list as $node) { - $attr = array(); - if ($node->attributes->length) - foreach ($node->attributes as $attribute) - $attr[$attribute->name] = $attribute->value; + $list = $xpath->query("//img[@src]"); + foreach ($list as $node) { + $attr = array(); + if ($node->attributes->length) + foreach ($node->attributes as $attribute) + $attr[$attribute->name] = $attribute->value; $src = completeurl($attr["src"], $url); - $photodata = getimagesize($src); + $photodata = @getimagesize($src); - if (($photodata[0] > 150) and ($photodata[1] > 150)) { + if (($photodata) && ($photodata[0] > 150) and ($photodata[1] > 150)) { if ($photodata[0] > 300) { - $photodata[1] = $photodata[1] * (300 / $photodata[0]); + $photodata[1] = round($photodata[1] * (300 / $photodata[0])); $photodata[0] = 300; } if ($photodata[1] > 300) { - $photodata[0] = $photodata[0] * (300 / $photodata[1]); + $photodata[0] = round($photodata[0] * (300 / $photodata[1])); $photodata[1] = 300; } $siteinfo["images"][] = array("src"=>$src, @@ -159,12 +176,15 @@ function parseurl_getsiteinfo($url) { "height"=>$photodata[1]); } - } - } else { + } + } else { $src = completeurl($siteinfo["image"], $url); - $photodata = getimagesize($src); - if (($photodata[0] > 10) and ($photodata[1] > 10)) + unset($siteinfo["image"]); + + $photodata = @getimagesize($src); + + if (($photodata) && ($photodata[0] > 10) and ($photodata[1] > 10)) $siteinfo["images"][] = array("src"=>$src, "width"=>$photodata[0], "height"=>$photodata[1]); @@ -219,6 +239,9 @@ function parse_url_content(&$a) { if(local_user() && intval(get_pconfig(local_user(),'system','plaintext'))) $textmode = true; + if(local_user() && (! feature_enabled(local_user(),'richtext'))) + $textmode = true; + //if($textmode) $br = (($textmode) ? "\n" : '