aboutsummaryrefslogtreecommitdiffstats
path: root/include/menu.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/menu.php')
-rw-r--r--include/menu.php27
1 files changed, 15 insertions, 12 deletions
diff --git a/include/menu.php b/include/menu.php
index 7522f69a3..e5bd4a680 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -26,11 +26,12 @@ function menu_fetch($name,$uid,$observer_xchan) {
function menu_render($menu) {
if(! $menu)
return '';
+
for($x = 0; $x < count($menu['items']); $x ++)
- if($menu['items']['mitem_flags'] & MENU_ITEM_ZID)
- $menu['items']['mitem_link'] = zid($menu['items']['mitem_link']);
- if($menu['items']['mitem_flags'] & MENU_ITEM_NEWWIN)
- $menu['items']['newwin'] = '1';
+ if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_ZID)
+ $menu['items'][$x]['mitem_link'] = zid($menu['items'][$x]['mitem_link']);
+ if($menu['items'][$x]['mitem_flags'] & MENU_ITEM_NEWWIN)
+ $menu['items'][$x]['newwin'] = '1';
return replace_macros(get_markup_template('usermenu.tpl'),array(
'$menu' => $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),