Reformatted code

This commit is contained in:
Michael 2023-03-06 06:15:30 +00:00
parent aea3ed4548
commit 699be97ea1
2 changed files with 7 additions and 15 deletions

View file

@ -223,19 +223,13 @@ class Item
// select someone by nick in the current network // select someone by nick in the current network
if (!DBA::isResult($contact) && ($network != '')) { if (!DBA::isResult($contact) && ($network != '')) {
$condition = [ $condition = ['nick' => $name, 'network' => $network, 'uid' => $profile_uid];
"`nick` = ? AND `network` = ? AND `uid` = ?",
$name, $network, $profile_uid
];
$contact = DBA::selectFirst('contact', $fields, $condition); $contact = DBA::selectFirst('contact', $fields, $condition);
} }
// select someone by attag in the current network // select someone by attag in the current network
if (!DBA::isResult($contact) && ($network != '')) { if (!DBA::isResult($contact) && ($network != '')) {
$condition = [ $condition = ['attag' => $name, 'network' => $network, 'uid' => $profile_uid];
"`attag` = ? AND `network` = ? AND `uid` = ?",
$name, $network, $profile_uid
];
$contact = DBA::selectFirst('contact', $fields, $condition); $contact = DBA::selectFirst('contact', $fields, $condition);
} }
@ -247,13 +241,13 @@ class Item
// select someone by nick in any network // select someone by nick in any network
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
$condition = ["`nick` = ? AND `uid` = ?", $name, $profile_uid]; $condition = ['nick' => $name, 'uid' => $profile_uid];
$contact = DBA::selectFirst('contact', $fields, $condition); $contact = DBA::selectFirst('contact', $fields, $condition);
} }
// select someone by attag in any network // select someone by attag in any network
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
$condition = ["`attag` = ? AND `uid` = ?", $name, $profile_uid]; $condition = ['attag' => $name, 'uid' => $profile_uid];
$contact = DBA::selectFirst('contact', $fields, $condition); $contact = DBA::selectFirst('contact', $fields, $condition);
} }
@ -339,9 +333,8 @@ class Item
default: default:
if ($obj['resource-id']) { if ($obj['resource-id']) {
$post_type = $this->l10n->t('photo'); $post_type = $this->l10n->t('photo');
$m = []; preg_match("/\[url=([^]]*)\]/", $obj['body'], $matches);
preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); $rr['plink'] = $matches[1];
$rr['plink'] = $m[1];
} else { } else {
$post_type = $this->l10n->t('status'); $post_type = $this->l10n->t('status');
} }

View file

@ -870,8 +870,7 @@ class BBCode
$attributes[$field] = html_entity_decode($matches[2] ?? '', ENT_QUOTES, 'UTF-8'); $attributes[$field] = html_entity_decode($matches[2] ?? '', ENT_QUOTES, 'UTF-8');
} }
$img_str = '<img src="' . $img_str = '<img src="' . self::proxyUrl($match[2], $simplehtml, $uriid) . '"';
self::proxyUrl($match[2], $simplehtml, $uriid) . '"';
foreach ($attributes as $key => $value) { foreach ($attributes as $key => $value) {
if (!empty($value)) { if (!empty($value)) {
$img_str .= ' ' . $key . '="' . htmlspecialchars($value, ENT_COMPAT) . '"'; $img_str .= ' ' . $key . '="' . htmlspecialchars($value, ENT_COMPAT) . '"';