aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2014-10-06 23:20:17 +0200
committerKlaus Weidenbach <Klaus.Weidenbach@gmx.net>2014-10-06 23:38:33 +0200
commit33394f58ff8cc54aebbd35a53b93ec3fa1bfdf57 (patch)
tree04c74c04454f0b79d329255742dd3903e35d4492 /mod
parentcef8955d572636e313623e363aed6bc23b732e4f (diff)
downloadvolse-hubzilla-33394f58ff8cc54aebbd35a53b93ec3fa1bfdf57.tar.gz
volse-hubzilla-33394f58ff8cc54aebbd35a53b93ec3fa1bfdf57.tar.bz2
volse-hubzilla-33394f58ff8cc54aebbd35a53b93ec3fa1bfdf57.zip
Moved RedBrowser class from reddav.php to it's own file.
First step on cleaning up ReadDAV classes and restructuring it bit in preparation for adding some more DAV features, photo access, CalDAV, etc. and hopefully also some PHPunits. Add a PHP5.3 namespace for RedDAV classes. Any objections against this or the vendor namespace? Add some more documentation for RedBrowser.
Diffstat (limited to 'mod')
-rw-r--r--mod/cloud.php30
1 files changed, 18 insertions, 12 deletions
diff --git a/mod/cloud.php b/mod/cloud.php
index c21c4c4b6..28c59872d 100644
--- a/mod/cloud.php
+++ b/mod/cloud.php
@@ -7,12 +7,13 @@
*/
use Sabre\DAV;
+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')) {
+if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
$userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
if(strlen($userpass)) {
list($name, $password) = explode(':', $userpass);
@@ -21,7 +22,7 @@ if(x($_SERVER, 'REDIRECT_REMOTE_USER')) {
}
}
-if(x($_SERVER, 'HTTP_AUTHORIZATION')) {
+if (x($_SERVER, 'HTTP_AUTHORIZATION')) {
$userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ;
if(strlen($userpass)) {
list($name, $password) = explode(':', $userpass);
@@ -40,7 +41,7 @@ function cloud_init(&$a) {
$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')) {
+ if (function_exists(str_replace('-', '_', current_theme()) . '_init')) {
$func = str_replace('-', '_', current_theme()) . '_init';
$func($a);
}
@@ -48,26 +49,26 @@ function cloud_init(&$a) {
require_once('include/reddav.php');
- if(! is_dir('store'))
+ if (! is_dir('store'))
os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
$which = null;
- if(argc() > 1)
+ if (argc() > 1)
$which = argv(1);
$profile = 0;
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which . '" />' . "\r\n";
- if($which)
+ if ($which)
profile_load($a, $which, $profile);
$auth = new RedBasicAuth();
$ob_hash = get_observer_hash();
- if($ob_hash) {
- if(local_user()) {
+ if ($ob_hash) {
+ if (local_user()) {
$channel = $a->get_channel();
$auth->setCurrentUser($channel['channel_address']);
$auth->channel_id = $channel['channel_id'];
@@ -79,7 +80,7 @@ function cloud_init(&$a) {
$auth->observer = $ob_hash;
}
- if($_GET['davguest'])
+ if ($_GET['davguest'])
$_SESSION['davguest'] = true;
$_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
@@ -113,7 +114,7 @@ function cloud_init(&$a) {
$isapublic_file = false;
$davguest = ((x($_SESSION, 'davguest')) ? true : false);
- if((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) {
+ if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) {
try {
$x = RedFileData('/' . $a->cmd, $auth);
if($x instanceof RedFile)
@@ -124,7 +125,7 @@ function cloud_init(&$a) {
}
}
- if((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
+ if ((! $auth->observer) && (! $isapublic_file) && (! $davguest)) {
try {
$auth->Authenticate($server, t('RedMatrix - Guests: Username: {your email address}, Password: +++'));
}
@@ -134,13 +135,18 @@ function cloud_init(&$a) {
}
}
+ require_once('include/RedDAV/RedBrowser.php');
// provide a directory view for the cloud in Red Matrix
- $browser = new RedBrowser($auth);
+ $browser = new RedDAV\RedBrowser($auth);
$auth->setBrowserPlugin($browser);
$server->addPlugin($browser);
+ // Experimental QuotaPlugin
+// require_once('include/RedDAV/QuotaPlugin.php');
+// $server->addPlugin(new RedDAV\QuotaPlugin($auth));
+
// All we need to do now, is to fire up the server
$server->exec();