diff options
author | Michiel de Jong <michiel@unhosted.org> | 2012-05-11 10:47:42 +0200 |
---|---|---|
committer | Michiel de Jong <michiel@unhosted.org> | 2012-05-11 10:47:42 +0200 |
commit | 02cee2c56296d0e72cfdc368c20198b36638bda9 (patch) | |
tree | 4e5516eaf6551e7b1dce24365e01b04e63eb9762 /apps/user_webfinger/appinfo | |
parent | 0c7f0aa3fa1b41f1e3a1ff15a1dbfa1a584608c3 (diff) | |
download | nextcloud-server-02cee2c56296d0e72cfdc368c20198b36638bda9.tar.gz nextcloud-server-02cee2c56296d0e72cfdc368c20198b36638bda9.zip |
trying to fix /.well-known/host-meta
Diffstat (limited to 'apps/user_webfinger/appinfo')
-rw-r--r-- | apps/user_webfinger/appinfo/install.php | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/apps/user_webfinger/appinfo/install.php b/apps/user_webfinger/appinfo/install.php deleted file mode 100644 index 00a533e781b..00000000000 --- a/apps/user_webfinger/appinfo/install.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -$hostMetaHeader = array( - 'Access-Control-Allow-Origin' => '*', - 'Content-Type' => 'application/xml+xrd' -); -$appInfoDir = __DIR__; -$thisAppDir = dirname($appInfoDir); -$appsDir = dirname($thisAppDir); -$ownCloudDir = dirname($appsDir); -$docRoot = $_SERVER['DOCUMENT_ROOT']; -try { - $webRoot = substr(realpath($ownCloudDir), strlen(realpath($docRoot))); -} catch(Exception $e) { - // some servers fail on realpath(), let's try it the unsecure way: - $webRoot = substr($ownCloudDir, strlen($docRoot)); -} -$serverName = $_SERVER['SERVER_NAME']; -$lrddTmpl = 'http'; -if(isset($_SERVER['HTTPS'])) { - $lrddTmpl .= 's'; -} -$lrddTmpl .= '://' . $serverName . $webRoot . '/public.php?service=webfinger&q={uri}'; -$hostMetaPath = $docRoot . '/.well-known/host-meta'; -$hostMetaDir = $docRoot . '/.well-known'; -$hostMetaContents = "<?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\">" . $serverName . "</hm:Host> - <Link rel=\"lrdd\" template=\"" . $lrddTmpl . "\"> - <Title>Resource Descriptor</Title> - </Link> -</XRD>"; -@mkdir($hostMetaDir); -$hostMeta = fopen($hostMetaPath, 'w'); -if(!$hostMeta) { - die("Could not open " . $hostMetaPath . " for writing, please check permissions!"); -} -if(!fwrite($hostMeta, $hostMetaContents, strlen($hostMetaContents))) { - die("Could not write to " . $hostMetaPath . ", please check permissions!"); -} -fclose($hostMeta); - -// write custom headers into .htaccess: -$htaccess = fopen($hostMetaDir . '/.htaccess', 'w'); -//TODO: check compatibility! -fwrite($htaccess, "<filesMatch \"^host-meta$\"> -<ifModule mod_headers.c>\n"); -foreach($hostMetaHeader as $header => $value) { - fwrite($htaccess, "Header set " . $header . " \"" . $value . "\"\n"); -} -fwrite($htaccess, "</ifModule>\n</filesMatch>"); -fclose($htaccess); |