Skip to content

Instantly share code, notes, and snippets.

@jhass
Created May 7, 2011 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhass/960058 to your computer and use it in GitHub Desktop.
Save jhass/960058 to your computer and use it in GitHub Desktop.
<?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>mrzyx.de</hm:Host>
<Link rel='lrdd'
template='https://mrzyx.de/webfinger.php?q={uri}'>
<Title>Resource Descriptor</Title>
</Link>
</XRD>
<?php
if (!isset($_GET['q'])) {
header("HTTP/1.0 403 Forbidden");
die("Forbidden");
}
// lazy ;)
$q = $_GET['q'];
// For now lets rewrite everything to Diaspora
// Find out if it's already an handle
if (strpos($q, "social.mrzyx.de") !== false) {
// Ok then just redirect to it
header("HTTP/1.0 301 Moved Permanently");
header("Location: https://social.mrzyx.de/webfinger?q=".$q);
die();
} else {
// Lets rewrite then
$new_q = str_replace("@mrzyx.de", "@social.mrzyx.de", $q);
if ($new_q == $q) {
// Huh? Still the same? 404 then...
header("HTTP/1.0 404 Not found");
die();
} else {
// Alright ask over there, but ask me first later again
header("HTTP/1.0 302 Found");
header("Location: https://social.mrzyx.de/webfinger?q=".$new_q);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment