forked from GNUsocial/gnu-social
OStatus fix: look for <link>s in the current element's children, not in all its descendants. Was breaking notice URL transfer, pulling a profile link by mistake.
This commit is contained in:
parent
b1ffbf17d3
commit
7175e7c7a1
@ -344,16 +344,18 @@ class ActivityUtils
|
|||||||
|
|
||||||
static function getLink(DOMNode $element, $rel, $type=null)
|
static function getLink(DOMNode $element, $rel, $type=null)
|
||||||
{
|
{
|
||||||
$links = $element->getElementsByTagnameNS(self::ATOM, self::LINK);
|
$els = $element->childNodes;
|
||||||
|
|
||||||
foreach ($links as $link) {
|
foreach ($els as $link) {
|
||||||
|
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
|
||||||
|
|
||||||
$linkRel = $link->getAttribute(self::REL);
|
$linkRel = $link->getAttribute(self::REL);
|
||||||
$linkType = $link->getAttribute(self::TYPE);
|
$linkType = $link->getAttribute(self::TYPE);
|
||||||
|
|
||||||
if ($linkRel == $rel &&
|
if ($linkRel == $rel &&
|
||||||
(is_null($type) || $linkType == $type)) {
|
(is_null($type) || $linkType == $type)) {
|
||||||
return $link->getAttribute(self::HREF);
|
return $link->getAttribute(self::HREF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,17 +364,19 @@ class ActivityUtils
|
|||||||
|
|
||||||
static function getLinks(DOMNode $element, $rel, $type=null)
|
static function getLinks(DOMNode $element, $rel, $type=null)
|
||||||
{
|
{
|
||||||
$links = $element->getElementsByTagnameNS(self::ATOM, self::LINK);
|
$els = $element->childNodes;
|
||||||
$out = array();
|
$out = array();
|
||||||
|
|
||||||
foreach ($links as $link) {
|
foreach ($els as $link) {
|
||||||
|
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
|
||||||
|
|
||||||
$linkRel = $link->getAttribute(self::REL);
|
$linkRel = $link->getAttribute(self::REL);
|
||||||
$linkType = $link->getAttribute(self::TYPE);
|
$linkType = $link->getAttribute(self::TYPE);
|
||||||
|
|
||||||
if ($linkRel == $rel &&
|
if ($linkRel == $rel &&
|
||||||
(is_null($type) || $linkType == $type)) {
|
(is_null($type) || $linkType == $type)) {
|
||||||
$out[] = $link;
|
$out[] = $link;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user