Move Module AcctLink

This commit is contained in:
Philipp Holzer 2018-10-13 18:32:14 +02:00
parent 14e7686df4
commit 508032cf9a
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
2 changed files with 26 additions and 16 deletions

View file

@ -1,16 +0,0 @@
<?php
use Friendica\App;
use Friendica\Network\Probe;
function acctlink_init()
{
if (x($_GET, 'addr')) {
$addr = trim($_GET['addr']);
$res = Probe::uri($addr);
if ($res['url']) {
goaway($res['url']);
killme();
}
}
}

26
src/Module/AcctLink.php Normal file
View file

@ -0,0 +1,26 @@
<?php
namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Network\Probe;
/**
* Redirects to another URL based on the parameter 'addr'
*/
class AcctLink extends BaseModule
{
public static function content()
{
$addr = defaults($_REQUEST, 'addr', false);
if ($addr) {
$url = defaults(Probe::uri($addr), 'url', false);
if ($url) {
goaway($url);
killme();
}
}
}
}