diff --git a/impressum/impressum.php b/impressum/impressum.php index 1d572f85..754cb828 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -14,7 +14,7 @@ use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Core\Config\Util\ConfigFileManager; -use Friendica\Util\Proxy as ProxyUtils; +use Friendica\Model\User; function impressum_install() { @@ -45,7 +45,7 @@ function obfuscate_email (string $s): string function impressum_footer(string &$body) { - $text = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'footer_text'))); + $text = BBCode::convertForUriId(User::getSystemUriId(), DI::config()->get('impressum', 'footer_text')); if ($text != '') { DI::page()['htmlhead'] .= ''; @@ -64,8 +64,8 @@ function impressum_show(string &$body) $body .= '

' . DI::l10n()->t('Impressum') . '

'; $owner = DI::config()->get('impressum', 'owner'); $owner_profile = DI::config()->get('impressum', 'ownerprofile'); - $postal = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'postal'))); - $notes = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'notes'))); + $postal = BBCode::convertForUriId(User::getSystemUriId(), DI::config()->get('impressum', 'postal')); + $notes = BBCode::convertForUriId(User::getSystemUriId(), DI::config()->get('impressum', 'notes')); if ($owner) { if ($owner_profile) { diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index 61b357f6..9cb57a6c 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -122,7 +122,7 @@ function langfilter_prepare_body_content_filter(&$hook_data) $naked_body = strip_tags( $hook_data['item']['rendered-html'] ??''?: // Equivalent of !empty() - BBCode::convert($hook_data['item']['body'], false, BBCode::ACTIVITYPUB, true) + BBCode::convertForUriId($hook_data['item']['uri-id'], $hook_data['item']['body'], BBCode::ACTIVITYPUB) ); $naked_body = preg_replace('#\s+#', ' ', trim($naked_body)); diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index 56e7fa13..d76ccf86 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -258,12 +258,13 @@ function mailstream_sender(array $item): string * Converts a bbcode-encoded subject line into a plaintext version suitable for the subject line of an email * * @param string $subject bbcode-encoded subject line + * @param int $uri_id * * @return string plaintext subject line */ -function mailstream_decode_subject(string $subject): string +function mailstream_decode_subject(string $subject, int $uri_id): string { - $html = BBCode::convert($subject); + $html = BBCode::convertForUriId($uri_id, $subject); if (!$html) { return $subject; } @@ -298,7 +299,7 @@ function mailstream_decode_subject(string $subject): string function mailstream_subject(array $item): string { if ($item['title']) { - return mailstream_decode_subject($item['title']); + return mailstream_decode_subject($item['title'], $item['uri-id']); } $parent = $item['thr-parent']; // Don't look more than 100 levels deep for a subject, in case of loops @@ -311,7 +312,7 @@ function mailstream_subject(array $item): string break; } if ($parent_item['title']) { - return DI::l10n()->t('Re:') . ' ' . mailstream_decode_subject($parent_item['title']); + return DI::l10n()->t('Re:') . ' ' . mailstream_decode_subject($parent_item['title'], $item['uri-id']); } $parent = $parent_item['thr-parent']; } @@ -333,7 +334,7 @@ function mailstream_subject(array $item): string return DI::l10n()->t("Diaspora post"); } if ($contact['network'] === 'face') { - $text = mailstream_decode_subject($item['body']); + $text = mailstream_decode_subject($item['body'], $item['uri-id']); // For some reason these do show up in Facebook $text = preg_replace('/\xA0$/', '', $text); $subject = (strlen($text) > 150) ? (substr($text, 0, 140) . '...') : $text; diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index 6cd79c37..01977d0c 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -12,6 +12,7 @@ use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; +use Friendica\Model\User; function newmemberwidget_install() { @@ -39,7 +40,7 @@ function newmemberwidget_network_mod_init ($b) $ft = DI::config()->get('newmemberwidget','freetext', ''); if (!empty($ft)) { - $t .= '

'.BBCode::convert(trim($ft)).'

'; + $t .= '

'.BBCode::convertForUriId(User::getSystemUriId(), trim($ft)).'

'; } $t .= '
'; diff --git a/notifyall/NotifyAllEmail.php b/notifyall/NotifyAllEmail.php index 3bb16f27..7a00a2c9 100644 --- a/notifyall/NotifyAllEmail.php +++ b/notifyall/NotifyAllEmail.php @@ -25,6 +25,7 @@ use Friendica\App\BaseURL; use Friendica\Content\Text\BBCode; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; +use Friendica\Model\User; use Friendica\Object\Email; /** @@ -50,9 +51,9 @@ class NotifyAllEmail extends Email $subject = $_REQUEST['subject']; - $textversion = strip_tags(html_entity_decode(BBCode::convert(stripslashes(str_replace(["\\r", "\\n"], ["", "\n"], $text))), ENT_QUOTES, 'UTF-8')); + $textversion = strip_tags(html_entity_decode(BBCode::convertForUriId(User::getSystemUriId(), stripslashes(str_replace(["\\r", "\\n"], ["", "\n"], $text))), ENT_QUOTES, 'UTF-8')); - $htmlversion = BBCode::convert(stripslashes(str_replace(["\\r", "\\n"], ["", "
\n"], $text))); + $htmlversion = BBCode::convertForUriId(User::getSystemUriId(), stripslashes(str_replace(["\\r", "\\n"], ["", "
\n"], $text))); parent::__construct($sender_name, $sender_email, $sender_email, '', $subject, $htmlversion, $textversion); } diff --git a/saml/saml.php b/saml/saml.php index 050ac00f..56dd0f5d 100755 --- a/saml/saml.php +++ b/saml/saml.php @@ -6,7 +6,6 @@ * Author: Ryan */ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; use Friendica\Core\Logger; @@ -14,7 +13,6 @@ use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\User; -use Friendica\Util\Strings; use OneLogin\Saml2\Utils; require_once(__DIR__ . '/vendor/autoload.php'); @@ -84,7 +82,7 @@ function saml_head(string &$body) function saml_footer(string &$body) { - $fragment = addslashes(BBCode::convert(DI::config()->get('saml', 'settings_statement'))); + $fragment = addslashes(BBCode::convertForUriId(User::getSystemUriId(), DI::config()->get('saml', 'settings_statement'))); $body .= << var target=$("#settings-nickname-desc"); @@ -163,7 +161,7 @@ function saml_sso_reply() } if (!empty($user['uid'])) { - DI::auth()->setForUser($user); + DI::auth()->setForUser(DI::app(), $user); } if (isset($_POST['RelayState']) && Utils::getSelfURL() != $_POST['RelayState']) { diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 09b5af86..78c7d384 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -1267,7 +1267,7 @@ function tumblr_get_contact_by_url(string $url): ?array return null; } - if (is_array($data->response->blog)) { + if (is_array($data->response->blog) || empty($data->response->blog)) { Logger::warning('Unexpected blog format', ['blog' => $blog, 'data' => $data]); return null; } diff --git a/wppost/wppost.php b/wppost/wppost.php index 51ee7247..0405f78a 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -15,6 +15,7 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Item; use Friendica\Model\Post; +use Friendica\Model\User; use Friendica\Util\XML; function wppost_install() @@ -92,7 +93,7 @@ function wppost_settings_post(array &$b) DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'wppost', 'wp_blog', trim($_POST['wp_blog'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'wppost', 'backlink', intval($_POST['wp_backlink'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'wppost', 'shortcheck', intval($_POST['wp_shortcheck'])); - $wp_backlink_text = BBCode::convert(trim($_POST['wp_backlink_text']), false, BBCode::BACKLINK); + $wp_backlink_text = BBCode::convertForUriId(User::getSystemUriId(), trim($_POST['wp_backlink_text']), BBCode::BACKLINK); $wp_backlink_text = HTML::toPlaintext($wp_backlink_text, 0, true); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'wppost', 'wp_backlink_text', $wp_backlink_text); }