3 * @file mod/oexchange.php
6 use Friendica\Core\L10n;
7 use Friendica\Core\Renderer;
8 use Friendica\Core\System;
9 use Friendica\Module\Login;
10 use Friendica\Util\Network;
11 use Friendica\Util\Strings;
13 function oexchange_init(App $a) {
15 if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {
16 $tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl');
18 $o = Renderer::replaceMacros($tpl, ['$base' => System::baseUrl()]);
24 function oexchange_content(App $a) {
31 if (($a->argc > 1) && $a->argv[1] === 'done') {
32 info(L10n::t('Post successful.') . EOL);
36 $url = ((!empty($_REQUEST['url']))
37 ? urlencode(Strings::escapeTags(trim($_REQUEST['url']))) : '');
38 $title = ((!empty($_REQUEST['title']))
39 ? '&title=' . urlencode(Strings::escapeTags(trim($_REQUEST['title']))) : '');
40 $description = ((!empty($_REQUEST['description']))
41 ? '&description=' . urlencode(Strings::escapeTags(trim($_REQUEST['description']))) : '');
42 $tags = ((!empty($_REQUEST['tags']))
43 ? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
45 $s = Network::fetchUrl(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
53 $post['profile_uid'] = local_user();
54 $post['return'] = '/oexchange/done';
55 $post['body'] = Friendica\Content\Text\HTML::toBBCode($s);
58 require_once('mod/item.php');