X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FItem.php;h=25d27b26df7b0228e88681d4d0a627d87812f213;hb=d402e666440248fbf139dcbde268609407666c7f;hp=e74ca846dadf4889ca9f232276fdac9071e1a9c2;hpb=eafe54f2ddf58a38a1a8a73761d7c394cbfdea1f;p=friendica.git diff --git a/src/Content/Item.php b/src/Content/Item.php index e74ca846da..25d27b26df 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -223,15 +223,13 @@ class Item // select someone by nick in the current network if (!DBA::isResult($contact) && ($network != '')) { - $condition = ["`nick` = ? AND `network` = ? AND `uid` = ?", - $name, $network, $profile_uid]; + $condition = ['nick' => $name, 'network' => $network, 'uid' => $profile_uid]; $contact = DBA::selectFirst('contact', $fields, $condition); } // select someone by attag in the current network if (!DBA::isResult($contact) && ($network != '')) { - $condition = ["`attag` = ? AND `network` = ? AND `uid` = ?", - $name, $network, $profile_uid]; + $condition = ['attag' => $name, 'network' => $network, 'uid' => $profile_uid]; $contact = DBA::selectFirst('contact', $fields, $condition); } @@ -243,13 +241,13 @@ class Item // select someone by nick in any network if (!DBA::isResult($contact)) { - $condition = ["`nick` = ? AND `uid` = ?", $name, $profile_uid]; + $condition = ['nick' => $name, 'uid' => $profile_uid]; $contact = DBA::selectFirst('contact', $fields, $condition); } // select someone by attag in any network if (!DBA::isResult($contact)) { - $condition = ["`attag` = ? AND `uid` = ?", $name, $profile_uid]; + $condition = ['attag' => $name, 'uid' => $profile_uid]; $contact = DBA::selectFirst('contact', $fields, $condition); } @@ -271,7 +269,7 @@ class Item $replaced = true; // create profile link $profile = str_replace(',', '%2c', $profile); - $newtag = $tag_type.'[url=' . $profile . ']' . $newname . '[/url]'; + $newtag = $tag_type . '[url=' . $profile . ']' . $newname . '[/url]'; $body = str_replace($tag_type . $name, $newtag, $body); } } @@ -295,8 +293,10 @@ class Item $xmlhead = ''; if ($this->activity->match($item['verb'], Activity::TAG)) { - $fields = ['author-id', 'author-link', 'author-name', 'author-network', - 'verb', 'object-type', 'resource-id', 'body', 'plink']; + $fields = [ + 'author-id', 'author-link', 'author-name', 'author-network', + 'verb', 'object-type', 'resource-id', 'body', 'plink' + ]; $obj = Post::selectFirst($fields, ['uri' => $item['parent-uri']]); if (!DBA::isResult($obj)) { $this->profiler->stopRecording(); @@ -333,8 +333,8 @@ class Item default: if ($obj['resource-id']) { $post_type = $this->l10n->t('photo'); - $m=[]; preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); - $rr['plink'] = $m[1]; + preg_match("/\[url=([^]]*)\]/", $obj['body'], $matches); + $rr['plink'] = $matches[1]; } else { $post_type = $this->l10n->t('status'); } @@ -433,7 +433,8 @@ class Item } if ((($cid == 0) || ($rel == Contact::FOLLOWER)) && - in_array($item['network'], Protocol::FEDERATED)) { + in_array($item['network'], Protocol::FEDERATED) + ) { $menu[$this->l10n->t('Connect/Follow')] = 'contact/follow?url=' . urlencode($item['author-link']) . '&auto=1'; } } else { @@ -891,7 +892,7 @@ class Item public function moveAttachmentsFromBodyToAttach(array $post): array { - if (!preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$post['body'], $match)) { + if (!preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/', $post['body'], $match)) { return $post; } @@ -903,11 +904,17 @@ class Item if ($post['attach']) { $post['attach'] .= ','; } - $post['attach'] .= Post\Media::getAttachElement($this->baseURL . '/attach/' . $attachment['id'], - $attachment['filesize'], $attachment['filetype'], $attachment['filename'] ?? ''); - - $fields = ['allow_cid' => $post['allow_cid'], 'allow_gid' => $post['allow_gid'], - 'deny_cid' => $post['deny_cid'], 'deny_gid' => $post['deny_gid']]; + $post['attach'] .= Post\Media::getAttachElement( + $this->baseURL . '/attach/' . $attachment['id'], + $attachment['filesize'], + $attachment['filetype'], + $attachment['filename'] ?? '' + ); + + $fields = [ + 'allow_cid' => $post['allow_cid'], 'allow_gid' => $post['allow_gid'], + 'deny_cid' => $post['deny_cid'], 'deny_gid' => $post['deny_gid'] + ]; $condition = ['id' => $attachment_id]; Attach::update($fields, $condition); } @@ -926,7 +933,8 @@ class Item // embedded bookmark or attachment in post? set bookmark flag $data = BBCode::getAttachmentData($post['body']); if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $post['body'], $match, PREG_SET_ORDER) || !empty($data['type'])) - && ($post['post-type'] != ItemModel::PT_PERSONAL_NOTE)) { + && ($post['post-type'] != ItemModel::PT_PERSONAL_NOTE) + ) { $post['post-type'] = ItemModel::PT_PAGE; $post['object-type'] = Activity\ObjectType::BOOKMARK; } @@ -1029,8 +1037,14 @@ class Item continue; } - $this->emailer->send(new ItemCCEMail($this->app, $this->l10n, $this->baseURL, - $post, $address, $author['thumb'] ?? '')); + $this->emailer->send(new ItemCCEMail( + $this->app, + $this->l10n, + $this->baseURL, + $post, + $address, + $author['thumb'] ?? '' + )); } } }