revert recent 3.0 changes to mod/cloud so we can work on this completely in another branch and not destabilise core

This commit is contained in:
friendica 2015-01-13 18:12:04 -08:00
parent bd5f00fa05
commit 98acefe228

View File

@ -3,7 +3,7 @@
* @file mod/cloud.php * @file mod/cloud.php
* @brief Initialize RedMatrix's cloud (SabreDAV). * @brief Initialize RedMatrix's cloud (SabreDAV).
* *
* Module for accessing the DAV storage area from a web client. * Module for accessing the DAV storage area.
*/ */
use Sabre\DAV; use Sabre\DAV;
@ -12,28 +12,24 @@ use RedMatrix\RedDAV;
// composer autoloader for SabreDAV // composer autoloader for SabreDAV
require_once('vendor/autoload.php'); require_once('vendor/autoload.php');
if(! defined('TRINIDAD')) { // workaround for HTTP-auth in CGI mode
// workaround for HTTP-auth in CGI mode if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
if (x($_SERVER, 'REDIRECT_REMOTE_USER')) { $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
$userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ; if(strlen($userpass)) {
if(strlen($userpass)) { list($name, $password) = explode(':', $userpass);
list($name, $password) = explode(':', $userpass); $_SERVER['PHP_AUTH_USER'] = $name;
$_SERVER['PHP_AUTH_USER'] = $name; $_SERVER['PHP_AUTH_PW'] = $password;
$_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;
}
} }
} }
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. * @brief Fires up the SabreDAV server.
@ -41,7 +37,6 @@ if(! defined('TRINIDAD')) {
* @param App &$a * @param App &$a
*/ */
function cloud_init(&$a) { function cloud_init(&$a) {
require_once('include/reddav.php'); require_once('include/reddav.php');
if (! is_dir('store')) if (! is_dir('store'))
@ -121,19 +116,13 @@ function cloud_init(&$a) {
} }
if ((! $auth->observer) && (! $isapublic_file) && (! $davguest)) { if ((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
if(defined('TRINIDAD')) { try {
$auth->Authenticate($server, t('RedMatrix - Guests: Username: {your email address}, Password: +++'));
}
catch (Exception $e) {
logger('mod_cloud: auth exception' . $e->getMessage()); logger('mod_cloud: auth exception' . $e->getMessage());
http_status_exit($e->getHTTPCode(), $e->getMessage()); http_status_exit($e->getHTTPCode(), $e->getMessage());
} }
else {
try {
$auth->Authenticate($server, t('RedMatrix channel'));
}
catch (Exception $e) {
logger('mod_cloud: auth exception' . $e->getMessage());
http_status_exit($e->getHTTPCode(), $e->getMessage());
}
}
} }
require_once('include/RedDAV/RedBrowser.php'); require_once('include/RedDAV/RedBrowser.php');