3 * @file mod/oexchange.php
6 use Friendica\Core\L10n;
7 use Friendica\Core\System;
8 use Friendica\Module\Login;
9 use Friendica\Util\Network;
11 function oexchange_init(App $a) {
13 if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {
14 $tpl = get_markup_template('oexchange_xrd.tpl');
16 $o = replace_macros($tpl, ['$base' => System::baseUrl()]);
22 function oexchange_content(App $a) {
29 if (($a->argc > 1) && $a->argv[1] === 'done') {
30 info(L10n::t('Post successful.') . EOL);
34 $url = (((x($_REQUEST,'url')) && strlen($_REQUEST['url']))
35 ? urlencode(notags(trim($_REQUEST['url']))) : '');
36 $title = (((x($_REQUEST,'title')) && strlen($_REQUEST['title']))
37 ? '&title=' . urlencode(notags(trim($_REQUEST['title']))) : '');
38 $description = (((x($_REQUEST,'description')) && strlen($_REQUEST['description']))
39 ? '&description=' . urlencode(notags(trim($_REQUEST['description']))) : '');
40 $tags = (((x($_REQUEST,'tags')) && strlen($_REQUEST['tags']))
41 ? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '');
43 $s = Network::fetchUrl(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
51 $post['profile_uid'] = local_user();
52 $post['return'] = '/oexchange/done' ;
53 $post['body'] = Friendica\Content\Text\HTML::toBBCode($s);
54 $post['type'] = 'wall';
57 require_once('mod/item.php');