util/pconfig - don't enumerate empty arrays, mod_acl - add more comments
This commit is contained in:
parent
c8aeb5b160
commit
1f39c16d99
@ -19,7 +19,7 @@ require_once("include/group.php");
|
|||||||
|
|
||||||
class Acl extends \Zotlabs\Web\Controller {
|
class Acl extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
function init(){
|
function init() {
|
||||||
|
|
||||||
// logger('mod_acl: ' . print_r($_REQUEST,true));
|
// logger('mod_acl: ' . print_r($_REQUEST,true));
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class Acl extends \Zotlabs\Web\Controller {
|
|||||||
$extra_channels = (x($_REQUEST,'extra_channels') ? $_REQUEST['extra_channels'] : array());
|
$extra_channels = (x($_REQUEST,'extra_channels') ? $_REQUEST['extra_channels'] : array());
|
||||||
|
|
||||||
// The different autocomplete libraries use different names for the search text
|
// The different autocomplete libraries use different names for the search text
|
||||||
// parameter. Internaly we'll use $search to represent the search text no matter
|
// parameter. Internally we'll use $search to represent the search text no matter
|
||||||
// what request variable it was attached to.
|
// what request variable it was attached to.
|
||||||
|
|
||||||
if(array_key_exists('query',$_REQUEST)) {
|
if(array_key_exists('query',$_REQUEST)) {
|
||||||
@ -104,6 +104,8 @@ class Acl extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
if($type == '' || $type == 'g') {
|
if($type == '' || $type == 'g') {
|
||||||
|
|
||||||
|
// virtual groups based on private profile viewing ability
|
||||||
|
|
||||||
$r = q("select id, profile_guid, profile_name from profile where is_default = 0 and uid = %d",
|
$r = q("select id, profile_guid, profile_name from profile where is_default = 0 and uid = %d",
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
@ -121,6 +123,8 @@ class Acl extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normal privacy groups
|
||||||
|
|
||||||
$r = q("SELECT groups.id, groups.hash, groups.gname
|
$r = q("SELECT groups.id, groups.hash, groups.gname
|
||||||
FROM groups, group_member
|
FROM groups, group_member
|
||||||
WHERE groups.deleted = 0 AND groups.uid = %d
|
WHERE groups.deleted = 0 AND groups.uid = %d
|
||||||
@ -151,25 +155,34 @@ class Acl extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($type == '' || $type == 'c') {
|
if($type == '' || $type == 'c') {
|
||||||
|
|
||||||
$extra_channels_sql = '';
|
$extra_channels_sql = '';
|
||||||
// Only include channels who allow the observer to view their permissions
|
|
||||||
foreach($extra_channels as $channel) {
|
// Only include channels who allow the observer to view their connections
|
||||||
if(perm_is_allowed(intval($channel), get_observer_hash(),'view_contacts'))
|
if($extra_channels) {
|
||||||
$extra_channels_sql .= "," . intval($channel);
|
foreach($extra_channels as $channel) {
|
||||||
|
if(perm_is_allowed(intval($channel), get_observer_hash(),'view_contacts')) {
|
||||||
|
if($extra_channel_sql)
|
||||||
|
$extra_channels_sql .= ',';
|
||||||
|
$extra_channels_sql .= intval($channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$extra_channels_sql = substr($extra_channels_sql,1); // Remove initial comma
|
|
||||||
|
|
||||||
// Getting info from the abook is better for local users because it contains info about permissions
|
// Getting info from the abook is better for local users because it contains info about permissions
|
||||||
if(local_channel()) {
|
if(local_channel()) {
|
||||||
if($extra_channels_sql != '')
|
if($extra_channels_sql != '')
|
||||||
$extra_channels_sql = " OR (abook_channel IN ($extra_channels_sql)) and abook_hidden = 0 ";
|
$extra_channels_sql = " OR (abook_channel IN ($extra_channels_sql)) and abook_hidden = 0 ";
|
||||||
|
|
||||||
|
|
||||||
|
// Add atokens belonging to the local channel @TODO restrict by search
|
||||||
|
|
||||||
$r2 = null;
|
$r2 = null;
|
||||||
|
|
||||||
$r1 = q("select * from atoken where atoken_uid = %d",
|
$r1 = q("select * from atoken where atoken_uid = %d",
|
||||||
intval(local_channel())
|
intval(local_channel())
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r1) {
|
if($r1) {
|
||||||
require_once('include/security.php');
|
require_once('include/security.php');
|
||||||
$r2 = array();
|
$r2 = array();
|
||||||
@ -189,6 +202,7 @@ class Acl extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add connections
|
||||||
|
|
||||||
$r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, xchan_pubforum, abook_flags, abook_self
|
$r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, xchan_pubforum, abook_flags, abook_self
|
||||||
FROM abook left join xchan on abook_xchan = xchan_hash
|
FROM abook left join xchan on abook_xchan = xchan_hash
|
||||||
|
@ -73,8 +73,10 @@ if($argc == 4) {
|
|||||||
|
|
||||||
if($argc == 3) {
|
if($argc == 3) {
|
||||||
load_pconfig($argv[1],$argv[2]);
|
load_pconfig($argv[1],$argv[2]);
|
||||||
foreach(App::$config[$argv[1]][$argv[2]] as $k => $x) {
|
if(App::$config[$argv[1]][$argv[2]]) {
|
||||||
echo "pconfig[{$argv[1]}][{$argv[2]}][{$k}] = " . $x . "\n";
|
foreach(App::$config[$argv[1]][$argv[2]] as $k => $x) {
|
||||||
|
echo "pconfig[{$argv[1]}][{$argv[2]}][{$k}] = " . $x . "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user