aboutsummaryrefslogtreecommitdiffstats
path: root/mod/cloud.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/cloud.php')
-rw-r--r--mod/cloud.php67
1 files changed, 23 insertions, 44 deletions
diff --git a/mod/cloud.php b/mod/cloud.php
index 4b5d45f97..efb33f935 100644
--- a/mod/cloud.php
+++ b/mod/cloud.php
@@ -1,7 +1,7 @@
<?php
/**
* @file mod/cloud.php
- * @brief Initialize RedMatrix's cloud (SabreDAV).
+ * @brief Initialize Hubzilla's cloud (SabreDAV).
*
* Module for accessing the DAV storage area.
*/
@@ -12,30 +12,12 @@ use RedMatrix\RedDAV;
// composer autoloader for SabreDAV
require_once('vendor/autoload.php');
-// workaround for HTTP-auth in CGI mode
-if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
- $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
-}
-
-if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
- $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
- if(strlen($userpass)) {
- list($name, $password) = explode(':', $userpass);
- $_SERVER['PHP_AUTH_USER'] = $name;
- $_SERVER['PHP_AUTH_PW'] = $password;
- }
-}
-
/**
* @brief Fires up the SabreDAV server.
*
* @param App &$a
*/
+
function cloud_init(&$a) {
require_once('include/reddav.php');
@@ -91,6 +73,8 @@ function cloud_init(&$a) {
$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
// FILE is being accessed anonymously and permissions allow this. This way
// one can create hotlinks to public media files in their cloud and anonymous
@@ -101,32 +85,27 @@ function cloud_init(&$a) {
// In order to avoid prompting for passwords for viewing a DIRECTORY, add
// the URL query parameter 'davguest=1'.
- $isapublic_file = false;
- $davguest = ((x($_SESSION, 'davguest')) ? true : false);
-
- if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) {
- try {
- $x = RedFileData('/' . $a->cmd, $auth);
- if($x instanceof RedDAV\RedFile)
- $isapublic_file = true;
- }
- catch (Exception $e) {
- $isapublic_file = false;
- }
- }
-
- if ((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
- try {
- $auth->Authenticate($server, t('$Projectname - Guests: Username: {your email address}, Password: +++'));
- }
- catch (Exception $e) {
- logger('mod_cloud: auth exception' . $e->getMessage());
- http_status_exit($e->getHTTPCode(), $e->getMessage());
- }
- }
+// $isapublic_file = false;
+// $davguest = ((x($_SESSION, 'davguest')) ? true : false);
+
+// if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) {
+// try {
+// $x = RedFileData('/' . $a->cmd, $auth);
+// if($x instanceof RedDAV\RedFile)
+// $isapublic_file = true;
+// }
+// catch (Exception $e) {
+// $isapublic_file = false;
+// }
+// }
+
+// if ((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
+// logger('mod_cloud: auth exception');
+// http_status_exit(401, 'Permission denied.');
+// }
require_once('include/RedDAV/RedBrowser.php');
- // provide a directory view for the cloud in Red Matrix
+ // provide a directory view for the cloud in Hubzilla
$browser = new RedDAV\RedBrowser($auth);
$auth->setBrowserPlugin($browser);