Created
May 7, 2011 00:22
-
-
Save jhass/960058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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