include diaspora mentions in personal (requires adding a Diaspora profile url because they don't use ours)

This commit is contained in:
friendica 2011-12-06 15:24:01 -08:00
parent f6f151433c
commit 0c24784f5e
4 changed files with 24 additions and 6 deletions

View file

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1186' ); define ( 'FRIENDICA_VERSION', '2.3.1187' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1110 ); define ( 'DB_UPDATE_VERSION', 1110 );
@ -311,6 +311,11 @@ class App {
if(substr($this->cmd,0,1) === '~') if(substr($this->cmd,0,1) === '~')
$this->cmd = 'profile/' . substr($this->cmd,1); $this->cmd = 'profile/' . substr($this->cmd,1);
// Diaspora style profile url
if(substr($this->cmd,0,2) === 'u/')
$this->cmd = 'profile/' . substr($this->cmd,2);
/** /**
* *
* Break the URL path into C style argc/argv style arguments for our * Break the URL path into C style argc/argv style arguments for our

View file

@ -621,7 +621,16 @@ function diaspora_post($importer,$xml) {
} }
} }
} }
$cnt = preg_match_all('/@\[url=(.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= '@[url=' . $mtch[1] . '[/url]';
}
}
$datarray['uid'] = $importer['uid']; $datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $contact['id']; $datarray['contact-id'] = $contact['id'];
$datarray['wall'] = 0; $datarray['wall'] = 0;

View file

@ -373,9 +373,11 @@ function network_content(&$a, $update = 0) {
$myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname']; $myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname'];
$myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` regexp '%s' or `tag` regexp '%s' )) ", $diasp_url = str_replace('/profile/','/u/',$myurl);
$sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` regexp '%s' or `tag` regexp '%s' or tag regexp '%s' )) ",
dbesc($myurl . '$'), dbesc($myurl . '$'),
dbesc($myurl . '\\]') dbesc($myurl . '\\]'),
dbesc($diasp_url . '\\]')
); );
} }

View file

@ -297,9 +297,11 @@ function notifications_content(&$a) {
$myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname']; $myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname'];
$myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = substr($myurl,strpos($myurl,'://')+3);
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$sql_extra .= sprintf(" AND ( `item`.`author-link` regexp '%s' or `item`.`tag` regexp '%s' ) ", $diasp_url = str_replace('/profile/','/u/',$myurl);
$sql_extra .= sprintf(" AND ( `item`.`author-link` regexp '%s' or `item`.`tag` regexp '%s' or `item`.`tag` regexp '%s' ) ",
dbesc($myurl . '$'), dbesc($myurl . '$'),
dbesc($myurl . '\\]') dbesc($myurl . '\\]'),
dbesc($diasp_url . '\\]')
); );