Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.4 KiB

11 years ago
<?php
function oexchange_init(App &$a) {
11 years ago
if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {
$tpl = get_markup_template('oexchange_xrd.tpl');
11 years ago
$o = replace_macros($tpl, array('$base' => App::get_baseurl()));
11 years ago
echo $o;
killme();
}
}
function oexchange_content(App &$a) {
11 years ago
if (! local_user()) {
11 years ago
$o = login(false);
return $o;
}
if (($a->argc > 1) && $a->argv[1] === 'done') {
info( t('Post successful.') . EOL);
11 years ago
return;
}
$url = (((x($_REQUEST,'url')) && strlen($_REQUEST['url']))
10 years ago
? urlencode(notags(trim($_REQUEST['url']))) : '');
$title = (((x($_REQUEST,'title')) && strlen($_REQUEST['title']))
10 years ago
? '&title=' . urlencode(notags(trim($_REQUEST['title']))) : '');
$description = (((x($_REQUEST,'description')) && strlen($_REQUEST['description']))
10 years ago
? '&description=' . urlencode(notags(trim($_REQUEST['description']))) : '');
$tags = (((x($_REQUEST,'tags')) && strlen($_REQUEST['tags']))
10 years ago
? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : '');
$s = fetch_url(App::get_baseurl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
11 years ago
if (! strlen($s)) {
11 years ago
return;
}
11 years ago
require_once('include/html2bbcode.php');
$post = array();
$post['profile_uid'] = local_user();
$post['return'] = '/oexchange/done' ;
$post['body'] = html2bbcode($s);
$post['type'] = 'wall';
$_REQUEST = $post;
11 years ago
require_once('mod/item.php');
item_post($a);
}