diff --git a/boot.php b/boot.php index faae00273..1d462eff8 100755 --- a/boot.php +++ b/boot.php @@ -270,7 +270,7 @@ define ( 'PERMS_W_STORAGE', 0x02000); define ( 'PERMS_R_PAGES', 0x04000); define ( 'PERMS_W_PAGES', 0x08000); define ( 'PERMS_A_REPUBLISH', 0x10000); -define ( 'PERMS_A_BOOMARK', 0x20000); +define ( 'PERMS_A_BOOKMARK', 0x20000); // General channel permissions diff --git a/include/bookmarks.php b/include/bookmarks.php new file mode 100644 index 000000000..62ec9fcab --- /dev/null +++ b/include/bookmarks.php @@ -0,0 +1,53 @@ + $menu['menu'], @@ -74,7 +75,7 @@ function menu_create($arr) { $r = q("select * from menu where menu_name = '%s' and menu_channel_id = %d limit 1", dbesc($menu_name), - intval($menu_channel_id), + intval($menu_channel_id) ); if($r) @@ -106,9 +107,11 @@ function menu_create($arr) { * bits set. We will use this to find system generated bookmarks. */ -function menu_list($channel_id, $flags = 0) { +function menu_list($channel_id, $name = '', $flags = 0) { - $sel_options = (($flags) ? " and ( menu_flags & " . intval($flags) . " ) = " . intval($flags) . " " : ''); + $sel_options = ''; + $sel_options .= (($name) ? " and name = '" . protect_sprintf(dbesc($name)) . "' " : ''); + $sel_options .= (($flags) ? " and menu_flags = " . intval($flags) . " " : ''); $r = q("select * from menu where menu_channel_id = %d $sel_options order by menu_name", intval($channel_id) @@ -229,11 +232,11 @@ function menu_add_item($menu_id, $uid, $arr) { $str_contact_deny = perms2str($arr['contact_deny']); } - - $allow_cid = perms2str($arr['allow_cid']); - $allow_gid = perms2str($arr['allow_gid']); - $deny_cid = perms2str($arr['deny_cid']); - $deny_gid = perms2str($arr['deny_gid']); +// unused +// $allow_cid = perms2str($arr['allow_cid']); +// $allow_gid = perms2str($arr['allow_gid']); +// $deny_cid = perms2str($arr['deny_cid']); +// $deny_gid = perms2str($arr['deny_gid']); $r = q("insert into menu_item ( mitem_link, mitem_desc, mitem_flags, allow_cid, allow_gid, deny_cid, deny_gid, mitem_channel_id, mitem_menu_id, mitem_order ) values ( '%s', '%s', %d, '%s', '%s', '%s', '%s', %d, %d, %d ) ", dbesc($mitem_link), diff --git a/include/permissions.php b/include/permissions.php index 060ed841c..420591c54 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -29,7 +29,7 @@ function get_perms() { 'write_pages' => array('channel_w_pages', intval(PERMS_W_PAGES), false, t('Can edit my "public" pages'), ''), 'republish' => array('channel_a_republish', intval(PERMS_A_REPUBLISH), false, t('Can source my "public" posts in derived channels'), t('Somewhat advanced - very useful in open communities')), - 'bookmark' => array('channel_a_bookmark', intval(PERMS_A_BOOKMARK), false, t('Can send me bookmarks'), ''), + 'bookmark' => array('channel_a_bookmark', intval(PERMS_A_BOOKMARK), false, t('Can send me bookmarks'), 'Bookmarks from this person will automatically be saved'), 'delegate' => array('channel_a_delegate', intval(PERMS_A_DELEGATE), false, t('Can administer my channel resources'), t('Extremely advanced. Leave this alone unless you know what you are doing')), ); $ret = array('global_permissions' => $global_perms); diff --git a/mod/bookmarks.php b/mod/bookmarks.php new file mode 100644 index 000000000..25bf39a7a --- /dev/null +++ b/mod/bookmarks.php @@ -0,0 +1,40 @@ +' . t('My Bookmarks') . ''; + + $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 .= '