1
1
Fork 0

Merge pull request #5903 from nupplaphil/move_module_acctlink

Move module AcctLink
This commit is contained in:
Michael Vogel 2018-10-13 19:09:59 +02:00 committed by GitHub
commit 514ec1be6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);
exit();
}
}
}
}