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()
{
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'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl() . '/addon/impressum/impressum.css" media="all" />';
$body .= '<h3>' . DI::l10n()->t('Impressum') . '</h3>';
$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) {
$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));
* 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;
}
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
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'];
}
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;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\DI;
+use Friendica\Model\User;
function newmemberwidget_install()
{
$ft = DI::config()->get('newmemberwidget','freetext', '');
if (!empty($ft)) {
- $t .= '<p>'.BBCode::convert(trim($ft)).'</p>';
+ $t .= '<p>'.BBCode::convertForUriId(User::getSystemUriId(), trim($ft)).'</p>';
}
$t .= '</div><div class="clear"></div>';
use Friendica\Content\Text\BBCode;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
+use Friendica\Model\User;
use Friendica\Object\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"], ["", "<br />\n"], $text)));
+ $htmlversion = BBCode::convertForUriId(User::getSystemUriId(), stripslashes(str_replace(["\\r", "\\n"], ["", "<br />\n"], $text)));
parent::__construct($sender_name, $sender_email, $sender_email, '', $subject, $htmlversion, $textversion);
}
* Author: Ryan <https://friendica.verya.pe/profile/ryan>
*/
-use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
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');
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 .= <<<EOL
<script>
var target=$("#settings-nickname-desc");
}
if (!empty($user['uid'])) {
- DI::auth()->setForUser($user);
+ DI::auth()->setForUser(DI::app(), $user);
}
if (isset($_POST['RelayState']) && Utils::getSelfURL() != $_POST['RelayState']) {
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;
}
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Post;
+use Friendica\Model\User;
use Friendica\Util\XML;
function wppost_install()
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);
}