aboutsummaryrefslogtreecommitdiffstats
path: root/mod/cloud.php
diff options
context:
space:
mode:
authorEiner von Vielen <tomwie@users.sourceforge.net>2015-01-14 22:49:16 +0100
committerEiner von Vielen <tomwie@users.sourceforge.net>2015-01-14 22:49:16 +0100
commitdfab2416926631b7b08c6c89b62528ca2520f130 (patch)
tree6c76af9d656eec6e74ed6c3c05d7ccc2b6ef5e48 /mod/cloud.php
parent09129cbe5f7e8cb331b68469b74438464960af0b (diff)
parent7090b58f68251b8c4b39332f2ea051e95ead3df3 (diff)
downloadvolse-hubzilla-dfab2416926631b7b08c6c89b62528ca2520f130.tar.gz
volse-hubzilla-dfab2416926631b7b08c6c89b62528ca2520f130.tar.bz2
volse-hubzilla-dfab2416926631b7b08c6c89b62528ca2520f130.zip
Merge remote-tracking branch 'upstream/master' into toc
Diffstat (limited to 'mod/cloud.php')
-rw-r--r--mod/cloud.php58
1 files changed, 19 insertions, 39 deletions
diff --git a/mod/cloud.php b/mod/cloud.php
index abeae88eb..ad85eba34 100644
--- a/mod/cloud.php
+++ b/mod/cloud.php
@@ -3,7 +3,7 @@
* @file mod/cloud.php
* @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;
@@ -12,45 +12,31 @@ use RedMatrix\RedDAV;
// composer autoloader for SabreDAV
require_once('vendor/autoload.php');
-if(! defined('TRINIDAD')) {
- // 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;
- }
+// 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;
- }
+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) {
- // call ($currenttheme)_init since we're operating outside of index.php
- $theme_info_file = "view/theme/" . current_theme() . "/php/theme.php";
- if (file_exists($theme_info_file)){
- require_once($theme_info_file);
- if (function_exists(str_replace('-', '_', current_theme()) . '_init')) {
- $func = str_replace('-', '_', current_theme()) . '_init';
- $func($a);
- }
- }
-
require_once('include/reddav.php');
if (! is_dir('store'))
@@ -130,19 +116,13 @@ function cloud_init(&$a) {
}
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());
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');