progress on tag delivery
This commit is contained in:
parent
191af201fb
commit
ba3cff6d9a
@ -1481,14 +1481,14 @@ function item_store($arr,$force_parent = false) {
|
|||||||
$arr['private'] = $private;
|
$arr['private'] = $private;
|
||||||
|
|
||||||
// Store taxonomy
|
// Store taxonomy
|
||||||
|
|
||||||
if(($terms) && (is_array($terms))) {
|
if(($terms) && (is_array($terms))) {
|
||||||
foreach($terms as $t) {
|
foreach($terms as $t) {
|
||||||
q("insert into term (uid,oid,otype,type,term,url)
|
q("insert into term (uid,oid,otype,type,term,url)
|
||||||
values(%d,%d,%d,%d,'%s','%s') ",
|
values(%d,%d,%d,%d,'%s','%s') ",
|
||||||
intval($arr['uid']),
|
intval($arr['uid']),
|
||||||
intval($current_post),
|
intval($current_post),
|
||||||
intval($t['otype']),
|
intval(TERM_OBJ_POST),
|
||||||
intval($t['type']),
|
intval($t['type']),
|
||||||
dbesc($t['term']),
|
dbesc($t['term']),
|
||||||
dbesc($t['url'])
|
dbesc($t['url'])
|
||||||
@ -1599,7 +1599,7 @@ function tag_deliver($uid,$item_id) {
|
|||||||
$u = q("select * from channel where channel_id = %d limit 1",
|
$u = q("select * from channel where channel_id = %d limit 1",
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if(! count($u))
|
if(! $u)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$i = q("select * from item where id = %d and uid = %d limit 1",
|
$i = q("select * from item where id = %d and uid = %d limit 1",
|
||||||
@ -4295,7 +4295,7 @@ function posted_date_widget($url,$uid,$wall) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function fetch_post_tags($items) {
|
function fetch_post_tags($items,$link = false) {
|
||||||
|
|
||||||
$tag_finder = array();
|
$tag_finder = array();
|
||||||
if($items) {
|
if($items) {
|
||||||
@ -4326,6 +4326,8 @@ function fetch_post_tags($items) {
|
|||||||
for($x = 0; $x < count($items); $x ++) {
|
for($x = 0; $x < count($items); $x ++) {
|
||||||
if($tags) {
|
if($tags) {
|
||||||
foreach($tags as $t) {
|
foreach($tags as $t) {
|
||||||
|
if(($link) && ($t['type'] == TERM_MENTION))
|
||||||
|
$t['url'] = chanlink_url($t['url']);
|
||||||
if(array_key_exists('item_id',$items[$x])) {
|
if(array_key_exists('item_id',$items[$x])) {
|
||||||
if($t['oid'] == $items[$x]['item_id']) {
|
if($t['oid'] == $items[$x]['item_id']) {
|
||||||
if(! is_array($items[$x]['term']))
|
if(! is_array($items[$x]['term']))
|
||||||
|
@ -211,7 +211,7 @@ function channel_content(&$a, $update = 0, $load = false) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
xchan_query($items);
|
xchan_query($items);
|
||||||
$items = fetch_post_tags($items);
|
$items = fetch_post_tags($items, true);
|
||||||
$items = conv_sort($items,'created');
|
$items = conv_sort($items,'created');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,7 +123,7 @@ function display_content(&$a, $update = 0, $load = false) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
xchan_query($items);
|
xchan_query($items);
|
||||||
$items = fetch_post_tags($items);
|
$items = fetch_post_tags($items,true);
|
||||||
$items = conv_sort($items,'created');
|
$items = conv_sort($items,'created');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -261,7 +261,7 @@ function events_content(&$a) {
|
|||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
xchan_query($r);
|
xchan_query($r);
|
||||||
$r = fetch_post_tags($r);
|
$r = fetch_post_tags($r,true);
|
||||||
|
|
||||||
$r = sort_by_date($r);
|
$r = sort_by_date($r);
|
||||||
|
|
||||||
|
@ -927,8 +927,8 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
|
|||||||
);
|
);
|
||||||
}*/
|
}*/
|
||||||
//$r is set, if someone could be selected
|
//$r is set, if someone could be selected
|
||||||
if(count($r)) {
|
if($r) {
|
||||||
$profile = chanlink_url($r[0]['xchan_url']);
|
$profile = $r[0]['xchan_url'];
|
||||||
$newname = $r[0]['xchan_name'];
|
$newname = $r[0]['xchan_name'];
|
||||||
//add person's id to $inform
|
//add person's id to $inform
|
||||||
if(strlen($inform))
|
if(strlen($inform))
|
||||||
@ -941,7 +941,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
|
|||||||
$replaced = true;
|
$replaced = true;
|
||||||
//create profile link
|
//create profile link
|
||||||
$profile = str_replace(',','%2c',$profile);
|
$profile = str_replace(',','%2c',$profile);
|
||||||
$url = chanlink_url($profile);
|
$url = $profile;
|
||||||
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
|
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
|
||||||
$body = str_replace('@' . $name, $newtag, $body);
|
$body = str_replace('@' . $name, $newtag, $body);
|
||||||
//append tag to str_tags
|
//append tag to str_tags
|
||||||
|
@ -608,7 +608,7 @@ function network_content(&$a, $update = 0, $load = false) {
|
|||||||
|
|
||||||
xchan_query($items);
|
xchan_query($items);
|
||||||
|
|
||||||
$items = fetch_post_tags($items);
|
$items = fetch_post_tags($items,true);
|
||||||
}
|
}
|
||||||
elseif($update) {
|
elseif($update) {
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ function network_content(&$a, $update = 0, $load = false) {
|
|||||||
|
|
||||||
$third = dba_timer();
|
$third = dba_timer();
|
||||||
|
|
||||||
$items = fetch_post_tags($items);
|
$items = fetch_post_tags($items,true);
|
||||||
|
|
||||||
$fourth = dba_timer();
|
$fourth = dba_timer();
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ function page_content(&$a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
xchan_query($r);
|
xchan_query($r);
|
||||||
$r = fetch_post_tags($r);
|
$r = fetch_post_tags($r,true);
|
||||||
$a->profile = array('profile_uid' => $u[0]['channel_id']);
|
$a->profile = array('profile_uid' => $u[0]['channel_id']);
|
||||||
$o .= prepare_page($r[0]);
|
$o .= prepare_page($r[0]);
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -219,7 +219,7 @@ function search_content(&$a) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
xchan_query($items);
|
xchan_query($items);
|
||||||
$items = fetch_post_tags($items);
|
$items = fetch_post_tags($items,true);
|
||||||
$items = conv_sort($items,'created');
|
$items = conv_sort($items,'created');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -249,7 +249,7 @@ function search_content(&$a) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// $a = fetch_post_tags($a);
|
// $a = fetch_post_tags($a,true);
|
||||||
|
|
||||||
if(! count($r)) {
|
if(! count($r)) {
|
||||||
info( t('No results.') . EOL);
|
info( t('No results.') . EOL);
|
||||||
|
Reference in New Issue
Block a user