issue #50 - cloud listings produce white screen for unauthenticated viewer
This commit is contained in:
parent
9baaa6fa56
commit
477228d4ff
@ -73,6 +73,8 @@ function cloud_init(&$a) {
|
|||||||
|
|
||||||
$server->addPlugin($lockPlugin);
|
$server->addPlugin($lockPlugin);
|
||||||
|
|
||||||
|
/* This next bit should no longer be needed... */
|
||||||
|
|
||||||
// The next section of code allows us to bypass prompting for http-auth if a
|
// The next section of code allows us to bypass prompting for http-auth if a
|
||||||
// FILE is being accessed anonymously and permissions allow this. This way
|
// FILE is being accessed anonymously and permissions allow this. This way
|
||||||
// one can create hotlinks to public media files in their cloud and anonymous
|
// one can create hotlinks to public media files in their cloud and anonymous
|
||||||
@ -83,24 +85,24 @@ function cloud_init(&$a) {
|
|||||||
// In order to avoid prompting for passwords for viewing a DIRECTORY, add
|
// In order to avoid prompting for passwords for viewing a DIRECTORY, add
|
||||||
// the URL query parameter 'davguest=1'.
|
// the URL query parameter 'davguest=1'.
|
||||||
|
|
||||||
$isapublic_file = false;
|
// $isapublic_file = false;
|
||||||
$davguest = ((x($_SESSION, 'davguest')) ? true : false);
|
// $davguest = ((x($_SESSION, 'davguest')) ? true : false);
|
||||||
|
|
||||||
if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) {
|
// if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) {
|
||||||
try {
|
// try {
|
||||||
$x = RedFileData('/' . $a->cmd, $auth);
|
// $x = RedFileData('/' . $a->cmd, $auth);
|
||||||
if($x instanceof RedDAV\RedFile)
|
// if($x instanceof RedDAV\RedFile)
|
||||||
$isapublic_file = true;
|
// $isapublic_file = true;
|
||||||
}
|
// }
|
||||||
catch (Exception $e) {
|
// catch (Exception $e) {
|
||||||
$isapublic_file = false;
|
// $isapublic_file = false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
|
// if ((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
|
||||||
logger('mod_cloud: auth exception');
|
// logger('mod_cloud: auth exception');
|
||||||
http_status_exit(401, 'Permission denied.');
|
// http_status_exit(401, 'Permission denied.');
|
||||||
}
|
// }
|
||||||
|
|
||||||
require_once('include/RedDAV/RedBrowser.php');
|
require_once('include/RedDAV/RedBrowser.php');
|
||||||
// provide a directory view for the cloud in Hubzilla
|
// provide a directory view for the cloud in Hubzilla
|
||||||
|
Reference in New Issue
Block a user