aboutsummaryrefslogtreecommitdiffstats
path: root/include/menu.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/menu.php')
-rw-r--r--include/menu.php66
1 files changed, 16 insertions, 50 deletions
diff --git a/include/menu.php b/include/menu.php
index 81e986132..b4f4555a5 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -25,6 +25,7 @@ function menu_fetch($name,$uid,$observer_xchan) {
}
function menu_render($menu, $class='', $edit = false) {
+
if(! $menu)
return '';
@@ -40,6 +41,7 @@ function menu_render($menu, $class='', $edit = false) {
'$menu' => $menu['menu'],
'$class' => $class,
'$edit' => (($edit) ? t("Edit") : ''),
+ '$id' => $menu['menu']['menu_id'],
'$items' => $menu['items']
));
}
@@ -60,14 +62,13 @@ function menu_fetch_id($menu_id,$channel_id) {
function menu_create($arr) {
-
$menu_name = trim(escape_tags($arr['menu_name']));
$menu_desc = trim(escape_tags($arr['menu_desc']));
$menu_flags = intval($arr['menu_flags']);
-
- if(! $menu_desc)
- $menu_desc = $menu_name;
+ //allow menu_desc (title) to be empty
+ //if(! $menu_desc)
+ // $menu_desc = $menu_name;
if(! $menu_name)
return false;
@@ -144,8 +145,9 @@ function menu_edit($arr) {
$menu_desc = trim(escape_tags($arr['menu_desc']));
$menu_flags = intval($arr['menu_flags']);
- if(! $menu_desc)
- $menu_desc = $menu_name;
+ //allow menu_desc (title) to be empty
+ //if(! $menu_desc)
+ // $menu_desc = $menu_name;
if(! $menu_name)
return false;
@@ -227,31 +229,10 @@ function menu_add_item($menu_id, $uid, $arr) {
$channel = get_app()->get_channel();
}
- if (($channel)
- && (! $arr['contact_allow'])
- && (! $arr['group_allow'])
- && (! $arr['contact_deny'])
- && (! $arr['group_deny'])) {
- $str_group_allow = $channel['channel_allow_gid'];
- $str_contact_allow = $channel['channel_allow_cid'];
- $str_group_deny = $channel['channel_deny_gid'];
- $str_contact_deny = $channel['channel_deny_cid'];
- }
- else {
-
- // use the posted permissions
-
- $str_group_allow = perms2str($arr['group_allow']);
- $str_contact_allow = perms2str($arr['contact_allow']);
- $str_group_deny = perms2str($arr['group_deny']);
- $str_contact_deny = perms2str($arr['contact_deny']);
- }
-
-// 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']);
+ $str_group_allow = perms2str($arr['group_allow']);
+ $str_contact_allow = perms2str($arr['contact_allow']);
+ $str_group_deny = perms2str($arr['group_deny']);
+ $str_contact_deny = perms2str($arr['contact_deny']);
$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),
@@ -283,25 +264,10 @@ function menu_edit_item($menu_id, $uid, $arr) {
$channel = get_app()->get_channel();
}
- if ((! $arr['contact_allow'])
- && (! $arr['group_allow'])
- && (! $arr['contact_deny'])
- && (! $arr['group_deny'])) {
- $str_group_allow = $channel['channel_allow_gid'];
- $str_contact_allow = $channel['channel_allow_cid'];
- $str_group_deny = $channel['channel_deny_gid'];
- $str_contact_deny = $channel['channel_deny_cid'];
- }
- else {
-
- // use the posted permissions
-
- $str_group_allow = perms2str($arr['group_allow']);
- $str_contact_allow = perms2str($arr['contact_allow']);
- $str_group_deny = perms2str($arr['group_deny']);
- $str_contact_deny = perms2str($arr['contact_deny']);
- }
-
+ $str_group_allow = perms2str($arr['group_allow']);
+ $str_contact_allow = perms2str($arr['contact_allow']);
+ $str_group_deny = perms2str($arr['group_deny']);
+ $str_contact_deny = perms2str($arr['contact_deny']);
$r = q("update menu_item set mitem_link = '%s', mitem_desc = '%s', mitem_flags = %d, allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', mitem_order = %d where mitem_channel_id = %d and mitem_menu_id = %d and mitem_id = %d",
dbesc($mitem_link),