X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fparse_url.php;h=a1ca5a3db5e2e1c831d35bada4b52a3502b54183;hb=1f7f964bb7200d4f658742a999c07f1dd6cbe97c;hp=ef051d9f6b433c0e8152c39168c0debd8cfbee0a;hpb=4efb6c6f79a92128899354e5bf0b49e38e19eeb7;p=friendica.git diff --git a/mod/parse_url.php b/mod/parse_url.php index ef051d9f6b..a1ca5a3db5 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -1,16 +1,20 @@ - - - - -

Shiny Trinket

- -

Shiny trinkets are shiny.

- +/** + * @file mod/parse_url.php + * + * @todo https://developers.google.com/+/plugins/snippet/ + * + * @verbatim + * + * + * + * + * + *

Shiny Trinket

+ * + *

Shiny trinkets are shiny.

+ * + * @endverbatim */ if(!function_exists('deletenode')) { @@ -52,7 +56,15 @@ function completeurl($url, $scheme) { function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = true) { - $data = Cache::get("parse_url:".$no_guessing.":".$do_oembed.":".$url); + if ($url == "") + return false; + + $r = q("SELECT * FROM `parsed_url` WHERE `url` = '%s' AND `guessing` = %d AND `oembed` = %d", + dbesc(normalise_link($url)), intval(!$no_guessing), intval($do_oembed)); + + if ($r) + $data = $r[0]["content"]; + if (!is_null($data)) { $data = unserialize($data); return $data; @@ -60,13 +72,15 @@ function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = tr $data = parseurl_getsiteinfo($url, $no_guessing, $do_oembed); - Cache::set("parse_url:".$no_guessing.":".$do_oembed.":".$url,serialize($data), CACHE_DAY); + q("INSERT INTO `parsed_url` (`url`, `guessing`, `oembed`, `content`, `created`) VALUES ('%s', %d, %d, '%s', '%s')", + dbesc(normalise_link($url)), intval(!$no_guessing), intval($do_oembed), dbesc(serialize($data)), dbesc(datetime_convert())); return $data; } function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1) { require_once("include/network.php"); + require_once("include/Photo.php"); $a = get_app(); @@ -317,7 +331,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co $attr[$attribute->name] = $attribute->value; $src = completeurl($attr["src"], $url); - $photodata = @getimagesize($src); + $photodata = get_photo_info($src); if (($photodata) && ($photodata[0] > 150) and ($photodata[1] > 150)) { if ($photodata[0] > 300) { @@ -334,12 +348,12 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co } } - } else { + } elseif ($siteinfo["image"] != "") { $src = completeurl($siteinfo["image"], $url); unset($siteinfo["image"]); - $photodata = @getimagesize($src); + $photodata = get_photo_info($src); if (($photodata) && ($photodata[0] > 10) and ($photodata[1] > 10)) $siteinfo["images"][] = array("src"=>$src,