Make PHP-CS happy

This commit is contained in:
Philipp 2022-11-15 01:10:49 +01:00
parent 9d455a5d0b
commit ba0b83b0b0
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
3 changed files with 27 additions and 21 deletions

View file

@ -138,6 +138,7 @@ class Display extends BaseModule
'uid' => [0, $itemUid], 'uid' => [0, $itemUid],
'uri-id' => $item['parent-uri-id'] 'uri-id' => $item['parent-uri-id']
], ['order' => ['uid' => true]]); ], ['order' => ['uid' => true]]);
$item = $parent ?: $item; $item = $parent ?: $item;
} }
@ -224,12 +225,11 @@ class Display extends BaseModule
$sql_extra = Item::getPermissionsSQLByUserId($pageUid); $sql_extra = Item::getPermissionsSQLByUserId($pageUid);
if ($this->session->getLocalUserId() && ($this->session->getLocalUserId() == $pageUid)) { if ($this->session->getLocalUserId() && ($this->session->getLocalUserId() == $pageUid)) {
$condition = [ $unseen = Post::exists([
'parent-uri-id' => $item['parent-uri-id'], 'parent-uri-id' => $item['parent-uri-id'],
'uid' => $this->session->getLocalUserId(), 'uid' => $this->session->getLocalUserId(),
'unseen' => true 'unseen' => true
]; ]);
$unseen = Post::exists($condition);
} else { } else {
$unseen = false; $unseen = false;
} }
@ -239,8 +239,11 @@ class Display extends BaseModule
} }
$condition = ["`uri-id` = ? AND `uid` IN (0, ?) " . $sql_extra, $item['uri-id'], $itemUid]; $condition = ["`uri-id` = ? AND `uid` IN (0, ?) " . $sql_extra, $item['uri-id'], $itemUid];
$fields = ['parent-uri-id', 'body', 'title', 'author-name', 'author-avatar', 'plink', 'author-id', $fields = [
'owner-id', 'contact-id']; 'parent-uri-id', 'body', 'title', 'author-name', 'author-avatar', 'plink', 'author-id',
'owner-id', 'contact-id'
];
$item = Post::selectFirstForUser($pageUid, $fields, $condition); $item = Post::selectFirstForUser($pageUid, $fields, $condition);
if (empty($item)) { if (empty($item)) {
@ -277,11 +280,10 @@ class Display extends BaseModule
{ {
if (Post::exists(['uri-id' => $uriId, 'private' => [Item::PUBLIC, Item::UNLISTED]])) { if (Post::exists(['uri-id' => $uriId, 'private' => [Item::PUBLIC, Item::UNLISTED]])) {
// For the atom feed the nickname doesn't matter at all, we only need the item id. // For the atom feed the nickname doesn't matter at all, we only need the item id.
$alternate = sprintf('display/feed-item/%s.atom', $uriId); $this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'), [
$conversation = sprintf('display/feed-item/%s/conversation.atom', $parentUriId); '$alternate' => sprintf('display/feed-item/%s.atom', $uriId),
$this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'), '$conversation' => sprintf('display/feed-item/%s/conversation.atom', $parentUriId)
['$alternate' => $alternate, ]);
'$conversation' => $conversation]);
} }
} }
@ -317,8 +319,10 @@ class Display extends BaseModule
$page = $this->page; $page = $this->page;
if (Contact::exists(['unsearchable' => true, if (Contact::exists([
'id' => [$item['contact-id'], $item['author-id'], $item['owner-id']]])) { 'unsearchable' => true,
'id' => [$item['contact-id'], $item['author-id'], $item['owner-id']]
])) {
$page['htmlhead'] .= "<meta content=\"noindex, noarchive\" name=\"robots\" />\n"; $page['htmlhead'] .= "<meta content=\"noindex, noarchive\" name=\"robots\" />\n";
} }

View file

@ -63,7 +63,9 @@ class Display extends DisplayModule
$browserUpdate = $this->pConfig->get($profileUid, 'system', 'update_interval'); $browserUpdate = $this->pConfig->get($profileUid, 'system', 'update_interval');
if (!empty($browserUpdate)) { if (!empty($browserUpdate)) {
$updateDate = date(DateTimeFormat::MYSQL, time() - (intval($browserUpdate) / 500)); $updateDate = date(DateTimeFormat::MYSQL, time() - (intval($browserUpdate) / 500));
if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parentUriId, 0, if (!Post::exists([
"`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?",
$parentUriId, 0,
$profileUid, $updateDate])) { $profileUid, $updateDate])) {
$this->logger->debug('No updated content. Ending process', $this->logger->debug('No updated content. Ending process',
['uri-id' => $uriId, 'uid' => $profileUid, 'updated' => $updateDate]); ['uri-id' => $uriId, 'uid' => $profileUid, 'updated' => $updateDate]);