progress on tag delivery

This commit is contained in:
friendica 2013-02-11 00:20:14 -08:00
parent 191af201fb
commit ba3cff6d9a
8 changed files with 17 additions and 15 deletions

View File

@ -1481,14 +1481,14 @@ function item_store($arr,$force_parent = false) {
$arr['private'] = $private;
// Store taxonomy
if(($terms) && (is_array($terms))) {
foreach($terms as $t) {
q("insert into term (uid,oid,otype,type,term,url)
values(%d,%d,%d,%d,'%s','%s') ",
intval($arr['uid']),
intval($current_post),
intval($t['otype']),
intval(TERM_OBJ_POST),
intval($t['type']),
dbesc($t['term']),
dbesc($t['url'])
@ -1599,7 +1599,7 @@ function tag_deliver($uid,$item_id) {
$u = q("select * from channel where channel_id = %d limit 1",
intval($uid)
);
if(! count($u))
if(! $u)
return;
$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();
if($items) {
@ -4326,6 +4326,8 @@ function fetch_post_tags($items) {
for($x = 0; $x < count($items); $x ++) {
if($tags) {
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($t['oid'] == $items[$x]['item_id']) {
if(! is_array($items[$x]['term']))

View File

@ -211,7 +211,7 @@ function channel_content(&$a, $update = 0, $load = false) {
);
xchan_query($items);
$items = fetch_post_tags($items);
$items = fetch_post_tags($items, true);
$items = conv_sort($items,'created');
} else {

View File

@ -123,7 +123,7 @@ function display_content(&$a, $update = 0, $load = false) {
);
xchan_query($items);
$items = fetch_post_tags($items);
$items = fetch_post_tags($items,true);
$items = conv_sort($items,'created');
}
} else {

View File

@ -261,7 +261,7 @@ function events_content(&$a) {
if($r) {
xchan_query($r);
$r = fetch_post_tags($r);
$r = fetch_post_tags($r,true);
$r = sort_by_date($r);

View File

@ -927,8 +927,8 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
);
}*/
//$r is set, if someone could be selected
if(count($r)) {
$profile = chanlink_url($r[0]['xchan_url']);
if($r) {
$profile = $r[0]['xchan_url'];
$newname = $r[0]['xchan_name'];
//add person's id to $inform
if(strlen($inform))
@ -941,7 +941,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
$replaced = true;
//create profile link
$profile = str_replace(',','%2c',$profile);
$url = chanlink_url($profile);
$url = $profile;
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
$body = str_replace('@' . $name, $newtag, $body);
//append tag to str_tags

View File

@ -608,7 +608,7 @@ function network_content(&$a, $update = 0, $load = false) {
xchan_query($items);
$items = fetch_post_tags($items);
$items = fetch_post_tags($items,true);
}
elseif($update) {
@ -670,7 +670,7 @@ function network_content(&$a, $update = 0, $load = false) {
$third = dba_timer();
$items = fetch_post_tags($items);
$items = fetch_post_tags($items,true);
$fourth = dba_timer();

View File

@ -36,7 +36,7 @@ function page_content(&$a) {
}
xchan_query($r);
$r = fetch_post_tags($r);
$r = fetch_post_tags($r,true);
$a->profile = array('profile_uid' => $u[0]['channel_id']);
$o .= prepare_page($r[0]);
return $o;

View File

@ -219,7 +219,7 @@ function search_content(&$a) {
);
xchan_query($items);
$items = fetch_post_tags($items);
$items = fetch_post_tags($items,true);
$items = conv_sort($items,'created');
} else {
@ -249,7 +249,7 @@ function search_content(&$a) {
);
// $a = fetch_post_tags($a);
// $a = fetch_post_tags($a,true);
if(! count($r)) {
info( t('No results.') . EOL);