bookmarking bugfix

This commit is contained in:
friendica 2014-02-05 03:29:02 -08:00
parent f30a39f9df
commit 24f32e55c8
2 changed files with 10 additions and 7 deletions

View file

@ -48,7 +48,7 @@ function bookmark_add($channel,$sender,$taxonomy,$private) {
intval($channel_id) intval($channel_id)
); );
if($r) if($r)
logger('duplicate menu entry'); logger('add_bookmark: duplicate menu entry', LOGGER_DEBUG);
if(! $r) if(! $r)
$r = menu_add_item($menu_id,$channel_id,$iarr); $r = menu_add_item($menu_id,$channel_id,$iarr);
return $r; return $r;

View file

@ -8,11 +8,12 @@ function bookmarks_init(&$a) {
return; return;
$u = $a->get_channel(); $u = $a->get_channel();
$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",
intval($item_id), intval($item_id),
intval(local_user()) intval(local_user())
); );
if(! $i) if(! $i)
return; return;
@ -22,16 +23,18 @@ function bookmarks_init(&$a) {
$terms = get_terms_oftype($item['term'],TERM_BOOKMARK); $terms = get_terms_oftype($item['term'],TERM_BOOKMARK);
if($terms && (! $i[0]['item_restrict'])) { if($terms && (! $item['item_restrict'])) {
require_once('include/bookmarks.php'); require_once('include/bookmarks.php');
require_once('include/Contact.php');
$s = channelx_by_hash($i[0]['author_xchan']); $s = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($item['author_xchan'])
);
if(! $s) { if(! $s) {
notice( t('Author lookup failed') . EOL); logger('mod_bookmarks: author lookup failed.');
killme(); killme();
} }
foreach($terms as $t) { foreach($terms as $t) {
bookmark_add($u,$s[0],$t,$i[0]['item_private']); bookmark_add($u,$s[0],$t,$item['item_private']);
notice( t('Bookmark added') . EOL); notice( t('Bookmark added') . EOL);
} }
} }