diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-08-27 21:22:59 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-08-27 21:22:59 -0700 |
commit | 3fbb955cf23c5f92ba96086841ac6a2c510d4870 (patch) | |
tree | df5eb95ca024960e0bd0599a49c663fe7131d81d /include | |
parent | 04b4897dd86d862957d95a5d6090af7a026dd82c (diff) | |
download | volse-hubzilla-3fbb955cf23c5f92ba96086841ac6a2c510d4870.tar.gz volse-hubzilla-3fbb955cf23c5f92ba96086841ac6a2c510d4870.tar.bz2 volse-hubzilla-3fbb955cf23c5f92ba96086841ac6a2c510d4870.zip |
start conversion to AccessList object
Diffstat (limited to 'include')
-rw-r--r-- | include/AccessList.php | 3 | ||||
-rw-r--r-- | include/menu.php | 32 |
2 files changed, 17 insertions, 18 deletions
diff --git a/include/AccessList.php b/include/AccessList.php index 82d55c0e6..d4653de6a 100644 --- a/include/AccessList.php +++ b/include/AccessList.php @@ -10,8 +10,7 @@ class AccessList { private $explicit; - - function _construct($channel) { + function __construct($channel) { if($channel) { $this->allow_cid = $channel['channel_allow_cid']; diff --git a/include/menu.php b/include/menu.php index d20df1d6e..f853ea793 100644 --- a/include/menu.php +++ b/include/menu.php @@ -2,6 +2,7 @@ require_once('include/security.php'); require_once('include/bbcode.php'); +require_once('include/AccessList.php'); function menu_fetch($name,$uid,$observer_xchan) { @@ -299,19 +300,18 @@ function menu_add_item($menu_id, $uid, $arr) { $channel = get_app()->get_channel(); } - $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']); + $acl = new AccessList($channel); + $acl->set_from_array($arr); + $p = $acl->get(); $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_desc), intval($mitem_flags), - dbesc($str_contact_allow), - dbesc($str_group_allow), - dbesc($str_contact_deny), - dbesc($str_group_deny), + dbesc($p['allow_cid']), + dbesc($p['allow_gid']), + dbesc($p['deny_cid']), + dbesc($p['deny_gid']), intval($uid), intval($menu_id), intval($mitem_order) @@ -341,19 +341,19 @@ function menu_edit_item($menu_id, $uid, $arr) { $channel = get_app()->get_channel(); } - $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']); + $acl = new AccessList($channel); + $acl->set_from_array($arr); + $p = $acl->get(); + $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_desc), intval($mitem_flags), - dbesc($str_contact_allow), - dbesc($str_group_allow), - dbesc($str_contact_deny), - dbesc($str_group_deny), + dbesc($p['allow_cid']), + dbesc($p['allow_gid']), + dbesc($p['deny_cid']), + dbesc($p['deny_gid']), intval($mitem_order), intval($uid), intval($menu_id), |