From c35feb27f2d5d9a1dc9cf885517953663dae9748 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 24 Feb 2013 12:54:53 +0100 Subject: [PATCH] community: Only show top postings, no comments parse_url: Follow location in "meta"-header --- mod/community.php | 3 ++- mod/parse_url.php | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/mod/community.php b/mod/community.php index 27a9e21941..84fc15debb 100644 --- a/mod/community.php +++ b/mod/community.php @@ -75,7 +75,8 @@ function community_content(&$a, $update = 0) { WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' - AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `user`.`hidewall` = 0 + AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`id` = `item`.`parent` + AND `user`.`hidewall` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` ORDER BY `received` DESC LIMIT %d, %d ", intval($a->pager['start']), diff --git a/mod/parse_url.php b/mod/parse_url.php index a2b4c9e28a..1393a15d36 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -97,6 +97,28 @@ function parseurl_getsiteinfo($url) { $xpath = new DomXPath($doc); + $list = $xpath->query("//meta[@content]"); + foreach ($list as $node) { + $attr = array(); + if ($node->attributes->length) + foreach ($node->attributes as $attribute) + $attr[$attribute->name] = $attribute->value; + + if (@$attr["http-equiv"] == 'refresh') { + $path = $attr["content"]; + $pathinfo = explode(";", $path); + $content = ""; + foreach ($pathinfo AS $value) { + if (substr(strtolower($value), 0, 4) == "url=") + $content = substr($value, 4); + } + if ($content != "") { + $siteinfo = parseurl_getsiteinfo($content); + return($siteinfo); + } + } + } + //$list = $xpath->query("head/title"); $list = $xpath->query("//title"); foreach ($list as $node) -- 2.39.5