From 46b9352a84a684d3e419604824f99105bea1272f Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 4 Feb 2014 01:42:43 -0800 Subject: fix the search for system bookmarks --- include/menu.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/menu.php b/include/menu.php index be9831951..7522f69a3 100644 --- a/include/menu.php +++ b/include/menu.php @@ -75,7 +75,6 @@ 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_flags) ); if($r) @@ -101,9 +100,15 @@ function menu_create($arr) { } +/** + * If $flags is present, check that all the bits in $flags are set + * so that MENU_SYSTEM|MENU_BOOKMARK will return entries with both + * bits set. We will use this to find system generated bookmarks. + */ + function menu_list($channel_id, $flags = 0) { - $sel_options = (($flags) ? " and ( menu_flags & " . intval($flags) . " ) " : ''); + $sel_options = (($flags) ? " and ( menu_flags & " . intval($flags) . " ) = " . intval($flags) . " " : ''); $r = q("select * from menu where menu_channel_id = %d $sel_options order by menu_name", intval($channel_id) @@ -204,7 +209,8 @@ function menu_add_item($menu_id, $uid, $arr) { $channel = get_app()->get_channel(); } - if ((! $arr['contact_allow']) + if (($channel) + && (! $arr['contact_allow']) && (! $arr['group_allow']) && (! $arr['contact_deny']) && (! $arr['group_deny'])) { -- cgit v1.2.3