]> git.mxchange.org Git - friendica.git/commitdiff
Move Module AcctLink
authorPhilipp Holzer <admin@philipp.info>
Sat, 13 Oct 2018 16:32:14 +0000 (18:32 +0200)
committerPhilipp Holzer <admin@philipp.info>
Sat, 13 Oct 2018 16:32:14 +0000 (18:32 +0200)
mod/acctlink.php [deleted file]
src/Module/AcctLink.php [new file with mode: 0644]

diff --git a/mod/acctlink.php b/mod/acctlink.php
deleted file mode 100644 (file)
index fb8cfd4..0000000
+++ /dev/null
@@ -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();
-               }
-       }
-}
diff --git a/src/Module/AcctLink.php b/src/Module/AcctLink.php
new file mode 100644 (file)
index 0000000..2ddc278
--- /dev/null
@@ -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();
+                       }
+               }
+       }
+}