X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Foexchange.php;h=15cef9ce0d14341fac76f54a3d19e88b6435aa18;hb=eb035771f118e1f289f2ebbbb8a474aa2765c81e;hp=751cb978843866e3312a4b53115d0ce6df99ff9c;hpb=75c74e856290a712344ad6b4042ef07ef661d584;p=friendica.git diff --git a/mod/oexchange.php b/mod/oexchange.php index 751cb97884..15cef9ce0d 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -1,18 +1,32 @@ . + * */ + use Friendica\App; -use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Module\Security\Login; -use Friendica\Util\Network; -use Friendica\Util\Strings; function oexchange_init(App $a) { - if (($a->argc > 1) && ($a->argv[1] === 'xrd')) { + if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] === 'xrd')) { $tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl'); $o = Renderer::replaceMacros($tpl, ['$base' => DI::baseUrl()]); @@ -28,21 +42,16 @@ function oexchange_content(App $a) { return $o; } - if (($a->argc > 1) && $a->argv[1] === 'done') { - info(L10n::t('Post successful.') . EOL); + if ((DI::args()->getArgc() > 1) && DI::args()->getArgv()[1] === 'done') { return; } - $url = ((!empty($_REQUEST['url'])) - ? urlencode(Strings::escapeTags(trim($_REQUEST['url']))) : ''); - $title = ((!empty($_REQUEST['title'])) - ? '&title=' . urlencode(Strings::escapeTags(trim($_REQUEST['title']))) : ''); - $description = ((!empty($_REQUEST['description'])) - ? '&description=' . urlencode(Strings::escapeTags(trim($_REQUEST['description']))) : ''); - $tags = ((!empty($_REQUEST['tags'])) - ? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : ''); + $url = !empty($_REQUEST['url']) ? trim($_REQUEST['url']) : ''; + $title = !empty($_REQUEST['title']) ? trim($_REQUEST['title']) : ''; + $description = !empty($_REQUEST['description']) ? trim($_REQUEST['description']) : ''; + $tags = !empty($_REQUEST['tags']) ? trim($_REQUEST['tags']) : ''; - $s = Network::fetchUrl(DI::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags); + $s = \Friendica\Content\Text\BBCode::embedURL($url, true, $title, $description, $tags); if (!strlen($s)) { return;