aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/lockview.php12
-rw-r--r--mod/mitem.php28
2 files changed, 26 insertions, 14 deletions
diff --git a/mod/lockview.php b/mod/lockview.php
index a46fb6d69..84c16f658 100644
--- a/mod/lockview.php
+++ b/mod/lockview.php
@@ -14,10 +14,13 @@ function lockview_content(&$a) {
if(! $item_id)
killme();
- if (!in_array($type, array('item','photo','event')))
+ if (!in_array($type, array('item','photo','event', 'menu_item')))
killme();
- $r = q("SELECT * FROM %s WHERE id = %d LIMIT 1",
+ //we have different naming in in menu_item table
+ $id = (($type == 'menu_item') ? 'mitem_id' : 'id');
+
+ $r = q("SELECT * FROM %s WHERE $id = %d LIMIT 1",
dbesc($type),
intval($item_id)
);
@@ -27,7 +30,10 @@ function lockview_content(&$a) {
$item = $r[0];
- if($item['uid'] != local_channel()) {
+ //we have different naming in in menu_item table
+ $uid = (($type == 'menu_item') ? $item['mitem_channel_id'] : $item['uid']);
+
+ if($uid != local_channel()) {
echo '<li>' . t('Remote privacy information not available.') . '</li>';
killme();
}
diff --git a/mod/mitem.php b/mod/mitem.php
index cce5bcbe3..06c66a323 100644
--- a/mod/mitem.php
+++ b/mod/mitem.php
@@ -124,19 +124,21 @@ function mitem_content(&$a) {
$m = menu_fetch($a->data['menu']['menu_name'],$uid,$ob_hash);
$a->data['menu_item'] = $m;
+ $perm_defaults = array(
+ 'allow_cid' => $channel['channel_allow_cid'],
+ 'allow_gid' => $channel['channel_allow_gid'],
+ 'deny_cid' => $channel['channel_deny_cid'],
+ 'deny_gid' => $channel['channel_deny_gid']
+ );
+
+ $lockstate = (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock');
+
if(argc() == 2) {
$r = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d order by mitem_order asc, mitem_desc asc",
intval($a->data['menu']['menu_id']),
intval($uid)
);
- $perm_defaults = array(
- 'allow_cid' => $channel['channel_allow_cid'],
- 'allow_gid' => $channel['channel_allow_gid'],
- 'deny_cid' => $channel['channel_deny_cid'],
- 'deny_gid' => $channel['channel_deny_gid']
- );
-
if($_GET['display']) {
$display = $_GET['display'];
}
@@ -156,7 +158,8 @@ function mitem_content(&$a) {
'$mitem_order' => array('mitem_order', t('Order in list'),'0',t('Higher numbers will sink to bottom of listing')),
'$submit' => t('Submit and finish'),
'$submit_more' => t('Submit and continue'),
- '$display' => $display
+ '$display' => $display,
+ '$lockstate' => $lockstate
));
$o .= replace_macros(get_markup_template('mitemlist.tpl'),array(
@@ -175,9 +178,9 @@ function mitem_content(&$a) {
'$hintmenu' => t('Edit this menu container'),
'$hintnew' => t('Add menu element'),
'$hintdrop' => t('Delete this menu item'),
- '$hintedit' => t('Edit this menu item')
+ '$hintedit' => t('Edit this menu item'),
));
-
+
return $o;
}
@@ -198,6 +201,8 @@ function mitem_content(&$a) {
$mitem = $m[0];
+ $lockstate = (($mitem['allow_cid'] || $mitem['allow_gid'] || $mitem['deny_cid'] || $mitem['deny_gid']) ? 'lock' : 'unlock');
+
if(argc() == 4 && argv(3) == 'drop') {
$r = menu_del_item($mitem['mitem_menu_id'], $uid, intval(argv(2)));
if($r)
@@ -221,7 +226,8 @@ function mitem_content(&$a) {
'$usezid' => array('usezid', t('Use RedMatrix magic-auth if available'), (($mitem['mitem_flags'] & MENU_ITEM_ZID) ? 1 : 0), ''),
'$newwin' => array('newwin', t('Open link in new window'), (($mitem['mitem_flags'] & MENU_ITEM_NEWWIN) ? 1 : 0),''),
'$mitem_order' => array('mitem_order', t('Order in list'),$mitem['mitem_order'],t('Higher numbers will sink to bottom of listing')),
- '$submit' => t('Submit')
+ '$submit' => t('Submit'),
+ '$lockstate' => $lockstate
));
return $o;