3 * @file mod/oexchange.php
6 use Friendica\Core\Renderer;
8 use Friendica\Module\Security\Login;
9 use Friendica\Util\Network;
10 use Friendica\Util\Strings;
12 function oexchange_init(App $a) {
14 if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {
15 $tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl');
17 $o = Renderer::replaceMacros($tpl, ['$base' => DI::baseUrl()]);
23 function oexchange_content(App $a) {
30 if (($a->argc > 1) && $a->argv[1] === 'done') {
31 info(DI::l10n()->t('Post successful.') . EOL);
35 $url = ((!empty($_REQUEST['url']))
36 ? urlencode(Strings::escapeTags(trim($_REQUEST['url']))) : '');
37 $title = ((!empty($_REQUEST['title']))
38 ? '&title=' . urlencode(Strings::escapeTags(trim($_REQUEST['title']))) : '');
39 $description = ((!empty($_REQUEST['description']))
40 ? '&description=' . urlencode(Strings::escapeTags(trim($_REQUEST['description']))) : '');
41 $tags = ((!empty($_REQUEST['tags']))
42 ? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
44 $s = Network::fetchUrl(DI::baseUrl() . '/parse_url?url=' . $url . $title . $description . $tags);
52 $post['profile_uid'] = local_user();
53 $post['return'] = '/oexchange/done';
54 $post['body'] = Friendica\Content\Text\HTML::toBBCode($s);
57 require_once('mod/item.php');