webfinger profile linker

This commit is contained in:
friendica 2012-06-02 18:05:23 -07:00
parent 608d424b0b
commit 4978ee12d1
5 changed files with 264 additions and 231 deletions

View File

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1361' );
define ( 'FRIENDICA_VERSION', '3.0.1362' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1146 );

View File

@ -52,6 +52,8 @@ function bb_unspacefy_and_trim($st) {
function bbcode($Text,$preserve_nl = false) {
$a = get_app();
// Hide all [noparse] contained bbtags spacefying them
$Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_spacefy',$Text);
@ -114,6 +116,11 @@ function bbcode($Text,$preserve_nl = false) {
$Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" target="external-link">$2</a>', $Text);
//$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank">$2</a>', $Text);
// we may need to restrict this further if it picks up too many strays
// link acct:user@host to a webfinger profile redirector
$Text = preg_replace('/acct:(.*?)@(.*?)([ ,])/', '<a href="' . $a->get_baseurl() . '/acctlink?addr=' . "$1@$2"
. '" target="extlink" >acct:' . "$1@$2$3" . '</a>',$Text);
// Perform MAIL Search
$Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1">$1</a>', $Text);

View File

@ -891,6 +891,7 @@ function prepare_body($item,$attach = false) {
} else
$s = prepare_text($item['body']);
$prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body', $prep_arr);
$s = $prep_arr['html'];

16
mod/acctlink.php Normal file
View File

@ -0,0 +1,16 @@
<?php
require_once('include/Scrape.php');
function acctlink_init(&$a) {
if(x($_GET,'addr')) {
$addr = trim($_GET['addr']);
$res = probe_url($addr);
//logger('acctlink: ' . print_r($res,true));
if($res['url']) {
goaway($res['url']);
killme();
}
}
}

File diff suppressed because it is too large Load Diff