]> source.dussan.org Git - nextcloud-server.git/commitdiff
make webfinger work properly if owncloud is installed in a subdirectory
authorRobin Appelman <icewind1991@gmail.com>
Thu, 3 Nov 2011 12:09:44 +0000 (13:09 +0100)
committerRobin Appelman <icewind1991@gmail.com>
Thu, 3 Nov 2011 12:09:51 +0000 (13:09 +0100)
apps/user_webfinger/webfinger.php

index afb536896827a4fc5769b42ed9f2a449aac973a2..349afaba507a5fe8ef98a8e4284fbb1d09317128 100644 (file)
@@ -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>