]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/RemoteFollow.php
Merge pull request #8462 from annando/issue-8254-3
[friendica.git] / src / Module / RemoteFollow.php
index 2a4d6bc1ed36173b0c24c3f116fd58fefed92fd8..8e4da3c63ba3acab4c9bfe969db26583e5717bcf 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Module;
 
@@ -19,10 +38,6 @@ class RemoteFollow extends BaseModule
 {
        public static function init(array $parameters = [])
        {
-               if (empty($parameters['profile'])) {
-                       return;
-               }
-
                Profile::load(DI::app(), $parameters['profile']);
        }
 
@@ -30,18 +45,18 @@ class RemoteFollow extends BaseModule
        {
                $a = DI::app();
 
-               if (empty($parameters['profile']) || !empty($_POST['cancel']) || empty($_POST['dfrn_url'])) {
+               if (!empty($_POST['cancel']) || empty($_POST['dfrn_url'])) {
                        DI::baseUrl()->redirect();
                }
        
                if (empty($a->profile['uid'])) {
-                       notice(DI::l10n()->t('Profile unavailable.') . EOL);
+                       notice(DI::l10n()->t('Profile unavailable.'));
                        return;
                }
                
-               $url = trim($_POST['dfrn_url']);
+               $url = Probe::cleanURI($_POST['dfrn_url']);
                if (!strlen($url)) {
-                       notice(DI::l10n()->t("Invalid locator") . EOL);
+                       notice(DI::l10n()->t("Invalid locator"));
                        return;
                }
 
@@ -79,7 +94,7 @@ class RemoteFollow extends BaseModule
        {
                $a = DI::app();
 
-               if (empty($parameters['profile']) || empty($a->profile)) {
+               if (empty($a->profile)) {
                        return '';
                }
        
@@ -98,8 +113,8 @@ class RemoteFollow extends BaseModule
 
                        '$request'       => 'remote_follow/' . $parameters['profile'],
                        '$name'          => $a->profile['name'],
-                       '$myaddr'        => '', //Profile::getMyURL(),
+                       '$myaddr'        => Profile::getMyURL(),
                ]);
                return $o;
        }
-}
\ No newline at end of file
+}