diff options
author | friendica <info@friendica.com> | 2014-02-04 17:12:13 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-02-04 17:12:13 -0800 |
commit | aede006970fb9124161b4732b9f44002a35d17ef (patch) | |
tree | 7d39ad22e8b3ac3f87903666fc454cc9c5dfc025 /mod | |
parent | 3665bc38ef15137c7d36a12aa13a44c4d0304547 (diff) | |
download | volse-hubzilla-aede006970fb9124161b4732b9f44002a35d17ef.tar.gz volse-hubzilla-aede006970fb9124161b4732b9f44002a35d17ef.tar.bz2 volse-hubzilla-aede006970fb9124161b4732b9f44002a35d17ef.zip |
bookmarks - mop up and go home
Diffstat (limited to 'mod')
-rw-r--r-- | mod/bookmarks.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/mod/bookmarks.php b/mod/bookmarks.php index 25bf39a7a..fe5ec1e19 100644 --- a/mod/bookmarks.php +++ b/mod/bookmarks.php @@ -1,5 +1,39 @@ <?php +function bookmarks_init(&$a) { + if(! local_user()) + return; + $item_id = intval($_REQUEST['item']); + if(! $item_id) + return; + + $u = $a->get_channel(); + + $i = q("select * from item where id = %d and uid = %d limit 1", + intval($item_id), + intval(local_user()) + ); + if(! $i) + return; + + $i = fetch_post_tags($i); + + $item = $i[0]; + + $terms = get_terms_oftype($item['term'],TERM_BOOKMARK); + + if($terms && (! $i[0]['item_restrict'])) { + require_once('include/bookmarks.php'); + require_once('include/Contact.php'); + $s = channelx_by_hash($i[0]['author_xchan']); + foreach($terms as $t) { + bookmark_add($u,$s[0],$t,$i[0]['item_private']); + notice( t('Bookmark(s) added') . EOL); + } + } + killme(); +} + function bookmarks_content(&$a) { if(! local_user()) { notice( t('Permission denied.') . EOL); |