Merge branch 'dev' of ../p3 into dev

This commit is contained in:
nobody 2021-08-05 01:32:07 -07:00
commit 7078d3ca2b
2 changed files with 13 additions and 5 deletions

View file

@ -135,7 +135,7 @@ class Security {
'$block_public_search' => array('block_public_search', t("Block public search"), get_config('system','block_public_search', 1), t("Prevent access to search content unless you are currently authenticated.")),
'$block_public_dir' => [ 'block_public_directory', t('Block directory from visitors'), get_config('system','block_public_directory',true), t('Only allow authenticated access to directory.') ],
'$localdir_hide' => [ 'localdir_hide', t('Hide local directory'), intval(get_config('system','localdir_hide')), t('Only use the global directory') ],
'$cloud_noroot' => [ 'cloud_noroot', t('Provide a cloud root directory'), 1 - intval(get_config('system','cloud_disable_siteroot')), t('The cloud root directory lists all channel names which provide public files') ],
'$cloud_noroot' => [ 'cloud_noroot', t('Provide a cloud root directory'), 1 - intval(get_config('system','cloud_disable_siteroot')), t('The cloud root directory lists all channel names which provide public files. Otherwise only the names of connections are shown.') ],
'$cloud_disksize' => [ 'cloud_disksize', t('Show total disk space available to cloud uploads'), intval(get_config('system','cloud_report_disksize')), '' ],
'$thumbnail_security' => [ 'thumbnail_security', t("Allow SVG thumbnails in file browser"), get_config('system','thumbnail_security',0), t("WARNING: SVG images may contain malicious code.") ],

View file

@ -743,10 +743,8 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
function ChannelList(&$auth) {
$ret = [];
if (intval(get_config('system','cloud_disable_siteroot'))) {
return $ret;
}
$disabled = intval(get_config('system','cloud_disable_siteroot'));
$r = q("SELECT channel_id, channel_address, profile.publish FROM channel left join profile on profile.uid = channel.channel_id WHERE channel_removed = 0 AND channel_system = 0 AND (channel_pageflags & %d) = 0 and profile.is_default = 1",
intval(PAGE_HIDDEN)
);
@ -754,6 +752,16 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
foreach ($r as $rr) {
if ((perm_is_allowed($rr['channel_id'], $auth->observer, 'view_storage') && $rr['publish']) || $rr['channel_id'] == $this->auth->channel_id) {
logger('found channel: /cloud/' . $rr['channel_address'], LOGGER_DATA);
if ($disabled) {
$conn = q("select abook_id from abook where abook_channel = %d and abook_xchan = '%s' and abook_pending = 0",
intval($rr['channel_id']),
dbesc($auth->observer)
);
if (! $conn) {
continue;
}
}
$ret[] = new Directory($rr['channel_address'], $auth);
}
}