Merge pull request #6746 from nupplaphil/issue/6338-notices

Fixing notices
This commit is contained in:
Michael Vogel 2019-02-24 15:44:54 +01:00 committed by GitHub
commit efe358c617
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 15 deletions

View file

@ -19,10 +19,10 @@ use Friendica\Model\Contact;
use Friendica\Model\Group; use Friendica\Model\Group;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Module\Objects;
use Friendica\Protocol\ActivityPub; use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\DFRN; use Friendica\Protocol\DFRN;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Module\Objects;
function display_init(App $a) function display_init(App $a)
{ {
@ -283,12 +283,12 @@ function display_content(App $a, $update = false, $update_uid = 0)
$is_remote_contact = false; $is_remote_contact = false;
$item_uid = local_user(); $item_uid = local_user();
if (isset($item_parent_uri)) {
$parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]); $parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
if (DBA::isResult($parent)) { if (DBA::isResult($parent)) {
$a->profile['uid'] = defaults($a->profile, 'uid', $parent['uid']); $a->profile['uid'] = defaults($a->profile, 'uid', $parent['uid']);
$a->profile['profile_uid'] = defaults($a->profile, 'profile_uid', $parent['uid']); $a->profile['profile_uid'] = defaults($a->profile, 'profile_uid', $parent['uid']);
$is_remote_contact = Contact::isFollower(remote_user(), $a->profile['profile_uid']); $is_remote_contact = Contact::isFollower(remote_user(), $a->profile['profile_uid']);
}
if ($is_remote_contact) { if ($is_remote_contact) {
$cdata = Contact::getPublicAndUserContacID(remote_user(), $a->profile['profile_uid']); $cdata = Contact::getPublicAndUserContacID(remote_user(), $a->profile['profile_uid']);
@ -298,6 +298,9 @@ function display_content(App $a, $update = false, $update_uid = 0)
$item_uid = $parent['uid']; $item_uid = $parent['uid'];
} }
} }
}
}
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]); $page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
if (DBA::isResult($page_contact)) { if (DBA::isResult($page_contact)) {

View file

@ -505,8 +505,15 @@ class PortableContact
$last_updated = ""; $last_updated = "";
foreach ($entries as $entry) { foreach ($entries as $entry) {
$published = DateTimeFormat::utc($xpath->query('atom:published/text()', $entry)->item(0)->nodeValue); $published_item = $xpath->query('atom:published/text()', $entry)->item(0);
$updated = DateTimeFormat::utc($xpath->query('atom:updated/text()' , $entry)->item(0)->nodeValue); $updated_item = $xpath->query('atom:updated/text()' , $entry)->item(0);
$published = isset($published_item->nodeValue) ? DateTimeFormat::utc($published_item->nodeValue) : null;
$updated = isset($updated_item->nodeValue) ? DateTimeFormat::utc($updated_item->nodeValue) : null;
if (!isset($published) || !isset($updated)) {
Logger::notice('Invalid entry for XPath.', ['entry' => $entry, 'profile' => $profile]);
continue;
}
if ($last_updated < $published) { if ($last_updated < $published) {
$last_updated = $published; $last_updated = $published;