]> git.mxchange.org Git - friendica.git/blobdiff - mod/pubsubhubbub.php
Merge pull request #11241 from annando/timing
[friendica.git] / mod / pubsubhubbub.php
index f985bef63bc1548440465a84e4568794e309b72f..361cb0a597e1cda7bbfbe8a0bab0f06ab0a53bbe 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -26,10 +26,6 @@ use Friendica\DI;
 use Friendica\Model\PushSubscriber;
 use Friendica\Util\Strings;
 
-function post_var($name) {
-       return !empty($_POST[$name]) ? Strings::escapeTags(trim($_POST[$name])) : '';
-}
-
 function pubsubhubbub_init(App $a) {
        // PuSH subscription must be considered "public" so just block it
        // if public access isn't enabled.
@@ -47,12 +43,12 @@ function pubsubhubbub_init(App $a) {
        // [hub_secret] => af11...
        // [hub_topic] => http://friendica.local/dfrn_poll/sazius
 
-       if ($_SERVER['REQUEST_METHOD'] === 'POST') {
-               $hub_mode = post_var('hub_mode');
-               $hub_callback = post_var('hub_callback');
-               $hub_verify_token = post_var('hub_verify_token');
-               $hub_secret = post_var('hub_secret');
-               $hub_topic = post_var('hub_topic');
+       if (DI::args()->getMethod() === App\Router::POST) {
+               $hub_mode         = $_POST['hub_mode']         ?? '';
+               $hub_callback     = $_POST['hub_callback']     ?? '';
+               $hub_verify_token = $_POST['hub_verify_token'] ?? '';
+               $hub_secret       = $_POST['hub_secret']       ?? '';
+               $hub_topic        = $_POST['hub_topic']        ?? '';
 
                // check for valid hub_mode
                if ($hub_mode === 'subscribe') {
@@ -64,7 +60,7 @@ function pubsubhubbub_init(App $a) {
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
-               Logger::notice("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
+               Logger::info("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
 
                if (DI::args()->getArgc() > 1) {
                        // Normally the url should now contain the nick name as last part of the url