retry the move of AccessList to composer format (one or more third-party plugins will likely break as a result)
This commit is contained in:
parent
c9252d49f7
commit
f1564b4cff
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace Zotlabs\Access;
|
||||||
|
|
||||||
|
|
||||||
class AccessList {
|
class AccessList {
|
||||||
|
|
||||||
@ -88,61 +90,3 @@ class AccessList {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Used to wrap ACL elements in angle brackets for storage.
|
|
||||||
*
|
|
||||||
* @param[in,out] array &$item
|
|
||||||
*/
|
|
||||||
function sanitise_acl(&$item) {
|
|
||||||
if (strlen($item))
|
|
||||||
$item = '<' . notags(trim($item)) . '>';
|
|
||||||
else
|
|
||||||
unset($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Convert an ACL array to a storable string.
|
|
||||||
*
|
|
||||||
* @param array $p
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function perms2str($p) {
|
|
||||||
$ret = '';
|
|
||||||
|
|
||||||
if (is_array($p))
|
|
||||||
$tmp = $p;
|
|
||||||
else
|
|
||||||
$tmp = explode(',', $p);
|
|
||||||
|
|
||||||
if (is_array($tmp)) {
|
|
||||||
array_walk($tmp, 'sanitise_acl');
|
|
||||||
$ret = implode('', $tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Turn user/group ACLs stored as angle bracketed text into arrays.
|
|
||||||
*
|
|
||||||
* turn string array of angle-bracketed elements into string array
|
|
||||||
* e.g. "<123xyz><246qyo><sxo33e>" => array(123xyz,246qyo,sxo33e);
|
|
||||||
*
|
|
||||||
* @param string $s
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function expand_acl($s) {
|
|
||||||
$ret = array();
|
|
||||||
|
|
||||||
if(strlen($s)) {
|
|
||||||
$t = str_replace('<','',$s);
|
|
||||||
$a = explode('>',$t);
|
|
||||||
foreach($a as $aa) {
|
|
||||||
if($aa)
|
|
||||||
$ret[] = $aa;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
3
boot.php
3
boot.php
@ -43,12 +43,11 @@ require_once('include/taxonomy.php');
|
|||||||
require_once('include/identity.php');
|
require_once('include/identity.php');
|
||||||
require_once('include/Contact.php');
|
require_once('include/Contact.php');
|
||||||
require_once('include/account.php');
|
require_once('include/account.php');
|
||||||
require_once('include/AccessList.php');
|
|
||||||
|
|
||||||
|
|
||||||
define ( 'PLATFORM_NAME', 'hubzilla' );
|
define ( 'PLATFORM_NAME', 'hubzilla' );
|
||||||
define ( 'RED_VERSION', trim(file_get_contents('version.inc')));
|
define ( 'RED_VERSION', trim(file_get_contents('version.inc')));
|
||||||
define ( 'STD_VERSION', '1.2.3' );
|
define ( 'STD_VERSION', '1.2.4' );
|
||||||
define ( 'ZOT_REVISION', 1 );
|
define ( 'ZOT_REVISION', 1 );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1163 );
|
define ( 'DB_UPDATE_VERSION', 1163 );
|
||||||
|
@ -5441,7 +5441,7 @@ function send_profile_photo_activity($channel,$photo,$profile) {
|
|||||||
|
|
||||||
$arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext;
|
$arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext;
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$x = $acl->get();
|
$x = $acl->get();
|
||||||
$arr['allow_cid'] = $x['allow_cid'];
|
$arr['allow_cid'] = $x['allow_cid'];
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ function menu_add_item($menu_id, $uid, $arr) {
|
|||||||
$channel = get_app()->get_channel();
|
$channel = get_app()->get_channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$acl->set_from_array($arr);
|
$acl->set_from_array($arr);
|
||||||
$p = $acl->get();
|
$p = $acl->get();
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ function menu_edit_item($menu_id, $uid, $arr) {
|
|||||||
$channel = get_app()->get_channel();
|
$channel = get_app()->get_channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$acl->set_from_array($arr);
|
$acl->set_from_array($arr);
|
||||||
$p = $acl->get();
|
$p = $acl->get();
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ function photo_upload($channel, $observer, $args) {
|
|||||||
// all other settings. 'allow_cid' being passed from an external source takes priority over channel settings.
|
// all other settings. 'allow_cid' being passed from an external source takes priority over channel settings.
|
||||||
// ...messy... needs re-factoring once the photos/files integration stabilises
|
// ...messy... needs re-factoring once the photos/files integration stabilises
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
if(array_key_exists('directory',$args) && $args['directory'])
|
if(array_key_exists('directory',$args) && $args['directory'])
|
||||||
$acl->set($args['directory']);
|
$acl->set($args['directory']);
|
||||||
if(array_key_exists('allow_cid',$args))
|
if(array_key_exists('allow_cid',$args))
|
||||||
|
@ -2728,3 +2728,63 @@ function item_url_replace($channel,&$item,$old,$new) {
|
|||||||
// @fixme item['plink'] and item['llink']
|
// @fixme item['plink'] and item['llink']
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Used to wrap ACL elements in angle brackets for storage.
|
||||||
|
*
|
||||||
|
* @param[in,out] array &$item
|
||||||
|
*/
|
||||||
|
function sanitise_acl(&$item) {
|
||||||
|
if (strlen($item))
|
||||||
|
$item = '<' . notags(trim($item)) . '>';
|
||||||
|
else
|
||||||
|
unset($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Convert an ACL array to a storable string.
|
||||||
|
*
|
||||||
|
* @param array $p
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function perms2str($p) {
|
||||||
|
$ret = '';
|
||||||
|
|
||||||
|
if (is_array($p))
|
||||||
|
$tmp = $p;
|
||||||
|
else
|
||||||
|
$tmp = explode(',', $p);
|
||||||
|
|
||||||
|
if (is_array($tmp)) {
|
||||||
|
array_walk($tmp, 'sanitise_acl');
|
||||||
|
$ret = implode('', $tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Turn user/group ACLs stored as angle bracketed text into arrays.
|
||||||
|
*
|
||||||
|
* turn string array of angle-bracketed elements into string array
|
||||||
|
* e.g. "<123xyz><246qyo><sxo33e>" => array(123xyz,246qyo,sxo33e);
|
||||||
|
*
|
||||||
|
* @param string $s
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function expand_acl($s) {
|
||||||
|
$ret = array();
|
||||||
|
|
||||||
|
if(strlen($s)) {
|
||||||
|
$t = str_replace('<','',$s);
|
||||||
|
$a = explode('>',$t);
|
||||||
|
foreach($a as $aa) {
|
||||||
|
if($aa)
|
||||||
|
$ret[] = $aa;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
@ -54,7 +54,7 @@ function chat_post(&$a) {
|
|||||||
goaway(z_root() . '/chat/' . $channel['channel_address']);
|
goaway(z_root() . '/chat/' . $channel['channel_address']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$acl->set_from_array($_REQUEST);
|
$acl->set_from_array($_REQUEST);
|
||||||
|
|
||||||
$arr = $acl->get();
|
$arr = $acl->get();
|
||||||
@ -162,7 +162,7 @@ function chat_content(&$a) {
|
|||||||
intval($a->profile['profile_uid'])
|
intval($a->profile['profile_uid'])
|
||||||
);
|
);
|
||||||
if($x) {
|
if($x) {
|
||||||
$acl = new AccessList(false);
|
$acl = new Zotlabs\Access\AccessList(false);
|
||||||
$acl->set($x[0]);
|
$acl->set($x[0]);
|
||||||
|
|
||||||
$private = $acl->is_private();
|
$private = $acl->is_private();
|
||||||
@ -199,7 +199,7 @@ function chat_content(&$a) {
|
|||||||
|
|
||||||
if(local_channel() && argc() > 2 && argv(2) === 'new') {
|
if(local_channel() && argc() > 2 && argv(2) === 'new') {
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$channel_acl = $acl->get();
|
$channel_acl = $acl->get();
|
||||||
|
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
@ -239,7 +239,7 @@ function send_cover_photo_activity($channel,$photo,$profile) {
|
|||||||
|
|
||||||
$arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext;
|
$arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext;
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$x = $acl->get();
|
$x = $acl->get();
|
||||||
$arr['allow_cid'] = $x['allow_cid'];
|
$arr['allow_cid'] = $x['allow_cid'];
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ function events_post(&$a) {
|
|||||||
|
|
||||||
$channel = $a->get_channel();
|
$channel = $a->get_channel();
|
||||||
|
|
||||||
$acl = new AccessList(false);
|
$acl = new Zotlabs\Access\AccessList(false);
|
||||||
|
|
||||||
if($event_id) {
|
if($event_id) {
|
||||||
$x = q("select * from event where id = %d and uid = %d limit 1",
|
$x = q("select * from event where id = %d and uid = %d limit 1",
|
||||||
@ -422,7 +422,7 @@ function events_content(&$a) {
|
|||||||
|
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$perm_defaults = $acl->get();
|
$perm_defaults = $acl->get();
|
||||||
|
|
||||||
$tpl = get_markup_template('event_form.tpl');
|
$tpl = get_markup_template('event_form.tpl');
|
||||||
|
@ -30,7 +30,7 @@ function filestorage_post(&$a) {
|
|||||||
|
|
||||||
$channel = $a->get_channel();
|
$channel = $a->get_channel();
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$acl->set_from_array($_REQUEST);
|
$acl->set_from_array($_REQUEST);
|
||||||
$x = $acl->get();
|
$x = $acl->get();
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ function item_post(&$a) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
|
|
||||||
|
|
||||||
$public_policy = ((x($_REQUEST,'public_policy')) ? escape_tags($_REQUEST['public_policy']) : map_scope($channel['channel_r_stream'],true));
|
$public_policy = ((x($_REQUEST,'public_policy')) ? escape_tags($_REQUEST['public_policy']) : map_scope($channel['channel_r_stream'],true));
|
||||||
|
@ -127,7 +127,7 @@ function mitem_content(&$a) {
|
|||||||
$menu_names[] = $menus['menu_name'];
|
$menu_names[] = $menus['menu_name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
|
|
||||||
$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');
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ function photos_post(&$a) {
|
|||||||
|
|
||||||
$owner_record = $s[0];
|
$owner_record = $s[0];
|
||||||
|
|
||||||
$acl = new AccessList($a->data['channel']);
|
$acl = new Zotlabs\Access\AccessList($a->data['channel']);
|
||||||
|
|
||||||
if((argc() > 3) && (argv(2) === 'album')) {
|
if((argc() > 3) && (argv(2) === 'album')) {
|
||||||
|
|
||||||
@ -595,7 +595,7 @@ function photos_content(&$a) {
|
|||||||
if($_is_owner) {
|
if($_is_owner) {
|
||||||
$channel = $a->get_channel();
|
$channel = $a->get_channel();
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$channel_acl = $acl->get();
|
$channel_acl = $acl->get();
|
||||||
|
|
||||||
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
|
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
|
||||||
|
@ -95,7 +95,7 @@ function rpost_content(&$a) {
|
|||||||
$channel = $a->get_channel();
|
$channel = $a->get_channel();
|
||||||
|
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
|
|
||||||
$channel_acl = $acl->get();
|
$channel_acl = $acl->get();
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ function settings_post(&$a) {
|
|||||||
foreach($global_perms as $k => $v) {
|
foreach($global_perms as $k => $v) {
|
||||||
$set_perms .= ', ' . $v[0] . ' = ' . intval($_POST[$k]) . ' ';
|
$set_perms .= ', ' . $v[0] . ' = ' . intval($_POST[$k]) . ' ';
|
||||||
}
|
}
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$acl->set_from_array($_POST);
|
$acl->set_from_array($_POST);
|
||||||
$x = $acl->get();
|
$x = $acl->get();
|
||||||
|
|
||||||
@ -1002,7 +1002,7 @@ function settings_content(&$a) {
|
|||||||
|
|
||||||
$stpl = get_markup_template('settings.tpl');
|
$stpl = get_markup_template('settings.tpl');
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$perm_defaults = $acl->get();
|
$perm_defaults = $acl->get();
|
||||||
|
|
||||||
require_once('include/group.php');
|
require_once('include/group.php');
|
||||||
|
@ -65,7 +65,7 @@ function thing_init(&$a) {
|
|||||||
if((! $name) || (! $translated_verb))
|
if((! $name) || (! $translated_verb))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
|
|
||||||
if(array_key_exists('contact_allow',$_REQUEST)
|
if(array_key_exists('contact_allow',$_REQUEST)
|
||||||
|| array_key_exists('group_allow',$_REQUEST)
|
|| array_key_exists('group_allow',$_REQUEST)
|
||||||
@ -271,7 +271,7 @@ function thing_content(&$a) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$acl = new AccessList($channel);
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
$channel_acl = $acl->get();
|
$channel_acl = $acl->get();
|
||||||
|
|
||||||
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
|
$lockstate = (($acl->is_private()) ? 'lock' : 'unlock');
|
||||||
|
Reference in New Issue
Block a user