start conversion to AccessList object
This commit is contained in:
parent
04b4897dd8
commit
3fbb955cf2
@ -10,8 +10,7 @@ class AccessList {
|
|||||||
|
|
||||||
private $explicit;
|
private $explicit;
|
||||||
|
|
||||||
|
function __construct($channel) {
|
||||||
function _construct($channel) {
|
|
||||||
|
|
||||||
if($channel) {
|
if($channel) {
|
||||||
$this->allow_cid = $channel['channel_allow_cid'];
|
$this->allow_cid = $channel['channel_allow_cid'];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
require_once('include/security.php');
|
require_once('include/security.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
require_once('include/AccessList.php');
|
||||||
|
|
||||||
function menu_fetch($name,$uid,$observer_xchan) {
|
function menu_fetch($name,$uid,$observer_xchan) {
|
||||||
|
|
||||||
@ -299,19 +300,18 @@ function menu_add_item($menu_id, $uid, $arr) {
|
|||||||
$channel = get_app()->get_channel();
|
$channel = get_app()->get_channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
$str_group_allow = perms2str($arr['group_allow']);
|
$acl = new AccessList($channel);
|
||||||
$str_contact_allow = perms2str($arr['contact_allow']);
|
$acl->set_from_array($arr);
|
||||||
$str_group_deny = perms2str($arr['group_deny']);
|
$p = $acl->get();
|
||||||
$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 ) ",
|
$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),
|
dbesc($mitem_link),
|
||||||
dbesc($mitem_desc),
|
dbesc($mitem_desc),
|
||||||
intval($mitem_flags),
|
intval($mitem_flags),
|
||||||
dbesc($str_contact_allow),
|
dbesc($p['allow_cid']),
|
||||||
dbesc($str_group_allow),
|
dbesc($p['allow_gid']),
|
||||||
dbesc($str_contact_deny),
|
dbesc($p['deny_cid']),
|
||||||
dbesc($str_group_deny),
|
dbesc($p['deny_gid']),
|
||||||
intval($uid),
|
intval($uid),
|
||||||
intval($menu_id),
|
intval($menu_id),
|
||||||
intval($mitem_order)
|
intval($mitem_order)
|
||||||
@ -341,19 +341,19 @@ function menu_edit_item($menu_id, $uid, $arr) {
|
|||||||
$channel = get_app()->get_channel();
|
$channel = get_app()->get_channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
$str_group_allow = perms2str($arr['group_allow']);
|
$acl = new AccessList($channel);
|
||||||
$str_contact_allow = perms2str($arr['contact_allow']);
|
$acl->set_from_array($arr);
|
||||||
$str_group_deny = perms2str($arr['group_deny']);
|
$p = $acl->get();
|
||||||
$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",
|
$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),
|
dbesc($mitem_link),
|
||||||
dbesc($mitem_desc),
|
dbesc($mitem_desc),
|
||||||
intval($mitem_flags),
|
intval($mitem_flags),
|
||||||
dbesc($str_contact_allow),
|
dbesc($p['allow_cid']),
|
||||||
dbesc($str_group_allow),
|
dbesc($p['allow_gid']),
|
||||||
dbesc($str_contact_deny),
|
dbesc($p['deny_cid']),
|
||||||
dbesc($str_group_deny),
|
dbesc($p['deny_gid']),
|
||||||
intval($mitem_order),
|
intval($mitem_order),
|
||||||
intval($uid),
|
intval($uid),
|
||||||
intval($menu_id),
|
intval($menu_id),
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
require_once('include/menu.php');
|
require_once('include/menu.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
require_once('include/AccessList.php');
|
||||||
|
|
||||||
function mitem_init(&$a) {
|
function mitem_init(&$a) {
|
||||||
|
|
||||||
@ -125,12 +126,7 @@ function mitem_content(&$a) {
|
|||||||
$menu_names[] = $menus['menu_name'];
|
$menu_names[] = $menus['menu_name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$perm_defaults = array(
|
$acl = new AccessList($channel);
|
||||||
'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');
|
$lockstate = (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock');
|
||||||
|
|
||||||
@ -151,7 +147,7 @@ function mitem_content(&$a) {
|
|||||||
'$menu_id' => $a->data['menu']['menu_id'],
|
'$menu_id' => $a->data['menu']['menu_id'],
|
||||||
'$permissions' => t('Menu Item Permissions'),
|
'$permissions' => t('Menu Item Permissions'),
|
||||||
'$permdesc' => t("\x28click to open/close\x29"),
|
'$permdesc' => t("\x28click to open/close\x29"),
|
||||||
'$aclselect' => populate_acl($perm_defaults,false),
|
'$aclselect' => populate_acl($acl->get(),false),
|
||||||
'$mitem_desc' => array('mitem_desc', t('Link Name'), '', 'Visible name of the link','*'),
|
'$mitem_desc' => array('mitem_desc', t('Link Name'), '', 'Visible name of the link','*'),
|
||||||
'$mitem_link' => array('mitem_link', t('Link or Submenu Target'), '', t('Enter URL of the link or select a menu name to create a submenu'), '*', 'list="menu-names"'),
|
'$mitem_link' => array('mitem_link', t('Link or Submenu Target'), '', t('Enter URL of the link or select a menu name to create a submenu'), '*', 'list="menu-names"'),
|
||||||
'$usezid' => array('usezid', t('Use magic-auth if available'), true, '', array(t('No'), t('Yes'))),
|
'$usezid' => array('usezid', t('Use magic-auth if available'), true, '', array(t('No'), t('Yes'))),
|
||||||
|
Reference in New Issue
Block a user