summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-11-03 13:09:44 +0100
committerRobin Appelman <icewind1991@gmail.com>2011-11-03 13:09:51 +0100
commit8eda6f8febcd8e7320d758e512d2d887d86debb0 (patch)
tree5f0063b9dd102a2c5caf1eb2cc0c357ef235f82e
parente2907eb99db54090ded8332bee5ebb7c94e08b2f (diff)
downloadnextcloud-server-8eda6f8febcd8e7320d758e512d2d887d86debb0.tar.gz
nextcloud-server-8eda6f8febcd8e7320d758e512d2d887d86debb0.zip
make webfinger work properly if owncloud is installed in a subdirectory
-rw-r--r--apps/user_webfinger/webfinger.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/user_webfinger/webfinger.php b/apps/user_webfinger/webfinger.php
index afb53689682..349afaba507 100644
--- a/apps/user_webfinger/webfinger.php
+++ b/apps/user_webfinger/webfinger.php
@@ -4,7 +4,14 @@ if($_SERVER['SCRIPT_NAME'] == '/.well-known/webfinger.php') {
} else {
header('Please-first: activate');
}
-header("Content-Type: application/xml+xrd");
+// header("Content-Type: application/xml+xrd");
+
+// calculate the documentroot
+// modified version of the one in lib/base.php that takes the .well-known symlink into account
+$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
+$SERVERROOT=str_replace("\\",'/',dirname(dirname(dirname(dirname(__FILE__)))));
+$SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT));
+$WEBROOT=substr($SUBURI,0,-34);
if($_GET['q']) {
$bits = explode('@', $_GET['q']);
@@ -20,5 +27,5 @@ echo "<";
?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">
<hm:Host xmlns="http://host-meta.net/xrd/1.0"><?php echo $_SERVER['SERVER_NAME'] ?></hm:Host>
- <Link rel="http://unhosted.org/spec/dav/0.1" href="http<?php echo ($_SERVER['HTTPS']?'s':''); ?>://<?php echo $_SERVER['SERVER_NAME'] ?>/apps/remoteStorage/compat.php/<?php echo $userName ?>/remoteStorage/" />
+ <Link rel="http://unhosted.org/spec/dav/0.1" href="http<?php echo ($_SERVER['HTTPS']?'s':''); ?>://<?php echo $_SERVER['SERVER_NAME'].$WEBROOT ?>/apps/remoteStorage/compat.php/<?php echo $userName ?>/remoteStorage/" />
</XRD>