create terms for Diaspora mention tags - which in Diaspora are handled differently than other tag links and have to be done separately; they aren't processed by linkify_tags which handles all of our other tag processing. Also move the abook_channel clause in mod_network to the join statement. This works fine in mysql and achievies the desired result. I hope postgres can handle an expression as a join clause.
This commit is contained in:
parent
27e92ff277
commit
b76cdf82d2
@ -845,8 +845,9 @@ function diaspora_post($importer,$xml,$msg) {
|
|||||||
// Look for tags and linkify them
|
// Look for tags and linkify them
|
||||||
$results = linkify_tags(get_app(), $body, $importer['channel_id']);
|
$results = linkify_tags(get_app(), $body, $importer['channel_id']);
|
||||||
|
|
||||||
|
$datarray['term'] = array();
|
||||||
|
|
||||||
if($results) {
|
if($results) {
|
||||||
$datarray['term'] = array();
|
|
||||||
foreach($results as $result) {
|
foreach($results as $result) {
|
||||||
$success = $result['success'];
|
$success = $result['success'];
|
||||||
if($success['replaced']) {
|
if($success['replaced']) {
|
||||||
@ -861,6 +862,37 @@ function diaspora_post($importer,$xml,$msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all('/@\[url=(.*?)\](.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$datarray['term'][] = array(
|
||||||
|
'uid' => $importer['channel_id'],
|
||||||
|
'type' => TERM_MENTION,
|
||||||
|
'otype' => TERM_OBJ_POST,
|
||||||
|
'term' => $mtch[2],
|
||||||
|
'url' => $mtch[1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all('/@\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$body,$matches,PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
// don't include plustags in the term
|
||||||
|
$term = ((substr($mtch[2],-1,1) === '+') ? substr($mtch[2],0,-1) : $mtch[2]);
|
||||||
|
$datarray['term'][] = array(
|
||||||
|
'uid' => $importer['channel_id'],
|
||||||
|
'type' => TERM_MENTION,
|
||||||
|
'otype' => TERM_OBJ_POST,
|
||||||
|
'term' => $term,
|
||||||
|
'url' => $mtch[1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$plink = service_plink($contact,$guid);
|
$plink = service_plink($contact,$guid);
|
||||||
|
|
||||||
|
|
||||||
@ -1032,8 +1064,9 @@ function diaspora_reshare($importer,$xml,$msg) {
|
|||||||
// Look for tags and linkify them
|
// Look for tags and linkify them
|
||||||
$results = linkify_tags(get_app(), $body, $importer['channel_id']);
|
$results = linkify_tags(get_app(), $body, $importer['channel_id']);
|
||||||
|
|
||||||
|
$datarray['term'] = array();
|
||||||
|
|
||||||
if($results) {
|
if($results) {
|
||||||
$datarray['term'] = array();
|
|
||||||
foreach($results as $result) {
|
foreach($results as $result) {
|
||||||
$success = $result['success'];
|
$success = $result['success'];
|
||||||
if($success['replaced']) {
|
if($success['replaced']) {
|
||||||
@ -1048,6 +1081,38 @@ function diaspora_reshare($importer,$xml,$msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all('/@\[url=(.*?)\](.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$datarray['term'][] = array(
|
||||||
|
'uid' => $importer['channel_id'],
|
||||||
|
'type' => TERM_MENTION,
|
||||||
|
'otype' => TERM_OBJ_POST,
|
||||||
|
'term' => $mtch[2],
|
||||||
|
'url' => $mtch[1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all('/@\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$body,$matches,PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
// don't include plustags in the term
|
||||||
|
$term = ((substr($mtch[2],-1,1) === '+') ? substr($mtch[2],0,-1) : $mtch[2]);
|
||||||
|
$datarray['term'][] = array(
|
||||||
|
'uid' => $importer['channel_id'],
|
||||||
|
'type' => TERM_MENTION,
|
||||||
|
'otype' => TERM_OBJ_POST,
|
||||||
|
'term' => $term,
|
||||||
|
'url' => $mtch[1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$newbody = "[share author='" . urlencode($orig_author_name)
|
$newbody = "[share author='" . urlencode($orig_author_name)
|
||||||
. "' profile='" . $orig_author_link
|
. "' profile='" . $orig_author_link
|
||||||
. "' avatar='" . $orig_author_photo
|
. "' avatar='" . $orig_author_photo
|
||||||
@ -1334,8 +1399,9 @@ function diaspora_comment($importer,$xml,$msg) {
|
|||||||
// Look for tags and linkify them
|
// Look for tags and linkify them
|
||||||
$results = linkify_tags(get_app(), $body, $importer['channel_id']);
|
$results = linkify_tags(get_app(), $body, $importer['channel_id']);
|
||||||
|
|
||||||
|
$datarray['term'] = array();
|
||||||
|
|
||||||
if($results) {
|
if($results) {
|
||||||
$datarray['term'] = array();
|
|
||||||
foreach($results as $result) {
|
foreach($results as $result) {
|
||||||
$success = $result['success'];
|
$success = $result['success'];
|
||||||
if($success['replaced']) {
|
if($success['replaced']) {
|
||||||
@ -1350,6 +1416,34 @@ function diaspora_comment($importer,$xml,$msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all('/@\[url=(.*?)\](.*?)\[\/url\]/ism',$body,$matches,PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
$datarray['term'][] = array(
|
||||||
|
'uid' => $importer['channel_id'],
|
||||||
|
'type' => TERM_MENTION,
|
||||||
|
'otype' => TERM_OBJ_POST,
|
||||||
|
'term' => $mtch[2],
|
||||||
|
'url' => $mtch[1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cnt = preg_match_all('/@\[zrl=(.*?)\](.*?)\[\/zrl\]/ism',$body,$matches,PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
// don't include plustags in the term
|
||||||
|
$term = ((substr($mtch[2],-1,1) === '+') ? substr($mtch[2],0,-1) : $mtch[2]);
|
||||||
|
$datarray['term'][] = array(
|
||||||
|
'uid' => $importer['channel_id'],
|
||||||
|
'type' => TERM_MENTION,
|
||||||
|
'otype' => TERM_OBJ_POST,
|
||||||
|
'term' => $term,
|
||||||
|
'url' => $mtch[1]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$datarray['uid'] = $importer['channel_id'];
|
$datarray['uid'] = $importer['channel_id'];
|
||||||
$datarray['verb'] = ACTIVITY_POST;
|
$datarray['verb'] = ACTIVITY_POST;
|
||||||
$datarray['mid'] = $guid;
|
$datarray['mid'] = $guid;
|
||||||
|
@ -377,8 +377,8 @@ function network_content(&$a, $update = 0, $load = false) {
|
|||||||
// "New Item View" - show all items unthreaded in reverse created date order
|
// "New Item View" - show all items unthreaded in reverse created date order
|
||||||
|
|
||||||
$items = q("SELECT item.*, item.id AS item_id, received FROM item
|
$items = q("SELECT item.*, item.id AS item_id, received FROM item
|
||||||
left join abook on item.owner_xchan = abook.abook_xchan
|
left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
|
||||||
WHERE true $uids $abook_uids AND item_restrict = 0
|
WHERE true $uids AND item_restrict = 0
|
||||||
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||||
$simple_update
|
$simple_update
|
||||||
$sql_extra $sql_nets
|
$sql_extra $sql_nets
|
||||||
@ -408,8 +408,8 @@ function network_content(&$a, $update = 0, $load = false) {
|
|||||||
// Fetch a page full of parent items for this page
|
// Fetch a page full of parent items for this page
|
||||||
|
|
||||||
$r = q("SELECT distinct item.id AS item_id, $ordering FROM item
|
$r = q("SELECT distinct item.id AS item_id, $ordering FROM item
|
||||||
left join abook on item.owner_xchan = abook.abook_xchan
|
left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
|
||||||
WHERE true $uids $abook_uids AND item.item_restrict = 0
|
WHERE true $uids AND item.item_restrict = 0
|
||||||
AND item.parent = item.id
|
AND item.parent = item.id
|
||||||
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||||
$sql_extra3 $sql_extra $sql_nets
|
$sql_extra3 $sql_extra $sql_nets
|
||||||
@ -422,8 +422,8 @@ function network_content(&$a, $update = 0, $load = false) {
|
|||||||
if(! $firehose) {
|
if(! $firehose) {
|
||||||
// update
|
// update
|
||||||
$r = q("SELECT item.parent AS item_id FROM item
|
$r = q("SELECT item.parent AS item_id FROM item
|
||||||
left join abook on item.owner_xchan = abook.abook_xchan
|
left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids )
|
||||||
WHERE true $uids $abook_uids AND item.item_restrict = 0 $simple_update
|
WHERE true $uids AND item.item_restrict = 0 $simple_update
|
||||||
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||||
$sql_extra3 $sql_extra $sql_nets ",
|
$sql_extra3 $sql_extra $sql_nets ",
|
||||||
intval(ABOOK_FLAG_BLOCKED)
|
intval(ABOOK_FLAG_BLOCKED)
|
||||||
|
Reference in New Issue
Block a user