aboutsummaryrefslogtreecommitdiffstats
path: root/mod/bookmarks.php
diff options
context:
space:
mode:
authormarijus <mario@localhost.localdomain>2014-02-05 13:43:16 +0100
committermarijus <mario@localhost.localdomain>2014-02-05 13:43:16 +0100
commit9e993bb4fd7e6ff6ba44586479371c163ee6aad8 (patch)
treed3754aa1d251308eb6178fe4ab138463ceaaf135 /mod/bookmarks.php
parent4253581733d4c6c7f0dce5c3ea7566c6af4af936 (diff)
parent0844110f7b154a0fb5102362fe732c2b091222d7 (diff)
downloadvolse-hubzilla-9e993bb4fd7e6ff6ba44586479371c163ee6aad8.tar.gz
volse-hubzilla-9e993bb4fd7e6ff6ba44586479371c163ee6aad8.tar.bz2
volse-hubzilla-9e993bb4fd7e6ff6ba44586479371c163ee6aad8.zip
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'mod/bookmarks.php')
-rw-r--r--mod/bookmarks.php81
1 files changed, 81 insertions, 0 deletions
diff --git a/mod/bookmarks.php b/mod/bookmarks.php
new file mode 100644
index 000000000..de30d9bb6
--- /dev/null
+++ b/mod/bookmarks.php
@@ -0,0 +1,81 @@
+<?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 && (! $item['item_restrict'])) {
+ require_once('include/bookmarks.php');
+
+ $s = q("select * from xchan where xchan_hash = '%s' limit 1",
+ dbesc($item['author_xchan'])
+ );
+ if(! $s) {
+ logger('mod_bookmarks: author lookup failed.');
+ killme();
+ }
+ foreach($terms as $t) {
+ bookmark_add($u,$s[0],$t,$item['item_private']);
+ notice( t('Bookmark added') . EOL);
+ }
+ }
+ killme();
+}
+
+function bookmarks_content(&$a) {
+ if(! local_user()) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+
+ require_once('include/menu.php');
+
+ $o = '<h3>' . t('My Bookmarks') . '</h3>';
+
+ $x = menu_list(local_user(),'',MENU_BOOKMARK);
+
+ if($x) {
+ foreach($x as $xx) {
+ $y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash());
+ $o .= menu_render($y);
+ }
+ }
+
+ $o .= '<h3>' . t('My Connections Bookmarks') . '</h3>';
+
+
+ $x = menu_list(local_user(),'',MENU_SYSTEM|MENU_BOOKMARK);
+
+ if($x) {
+ foreach($x as $xx) {
+ $y = menu_fetch($xx['menu_name'],local_user(),get_observer_hash());
+ $o .= menu_render($y);
+ }
+ }
+
+
+
+ return $o;
+
+}
+