2011-09-11 22:12:34 +00:00
|
|
|
<?php
|
2011-09-12 12:59:22 +00:00
|
|
|
if($_SERVER['SCRIPT_NAME'] == '/.well-known/webfinger.php') {
|
2011-09-12 12:22:48 +00:00
|
|
|
header("Access-Control-Allow-Origin: *");
|
|
|
|
} else {
|
|
|
|
header('Please-first: activate');
|
|
|
|
}
|
2012-02-22 19:05:41 +00:00
|
|
|
header("Content-Type: application/xrd+xml");
|
2011-11-03 12:09:44 +00:00
|
|
|
|
|
|
|
// 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);
|
2011-09-11 22:12:34 +00:00
|
|
|
|
|
|
|
if($_GET['q']) {
|
|
|
|
$bits = explode('@', $_GET['q']);
|
|
|
|
$userName = $bits[0];
|
|
|
|
} else {
|
|
|
|
$userName = '';
|
|
|
|
}
|
|
|
|
if(substr($userName, 0, 5) == 'acct:') {
|
|
|
|
$userName = substr($userName, 5);
|
|
|
|
}
|
2012-02-22 18:04:21 +00:00
|
|
|
if(isset($_SERVER['HTTPS'])) {
|
2011-12-07 14:51:47 +00:00
|
|
|
$baseAddress = 'https://'.$_SERVER['SERVER_NAME'].'/apps/remoteStorage/';
|
|
|
|
} else {
|
|
|
|
$baseAddress = 'http://'.$_SERVER['SERVER_NAME'].'/apps/remoteStorage/';
|
|
|
|
}
|
2011-09-11 22:12:34 +00:00
|
|
|
echo "<";
|
|
|
|
?>
|
2011-09-12 12:35:15 +00:00
|
|
|
?xml version="1.0" encoding="UTF-8"?>
|
2011-09-11 22:12:34 +00:00
|
|
|
<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>
|
2011-12-07 14:51:47 +00:00
|
|
|
<Link
|
|
|
|
rel="remoteStorage"
|
|
|
|
template="<?php echo $baseAddress ?>WebDAV.php/<?php echo $userName ?>/remoteStorage/{category}/"
|
|
|
|
api="WebDAV"
|
|
|
|
auth="<?php echo $baseAddress; ?>auth.php/<?php echo $userName ?>"
|
|
|
|
></Link>
|
2011-09-11 22:12:34 +00:00
|
|
|
</XRD>
|