]> git.mxchange.org Git - friendica.git/blobdiff - mod/pubsubhubbub.php
More replaced "q" calls
[friendica.git] / mod / pubsubhubbub.php
index 3d6b48fd4bcc7a037d3610dec10c07435a6dc711..bc90c76d66533ca5ec1df66557637c2bf7b6e583 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -24,7 +24,6 @@ use Friendica\Core\Logger;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\PushSubscriber;
-use Friendica\Util\Network;
 use Friendica\Util\Strings;
 
 function post_var($name) {
@@ -67,9 +66,9 @@ function pubsubhubbub_init(App $a) {
 
                Logger::log("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
 
-               if ($a->argc > 1) {
+               if (DI::args()->getArgc() > 1) {
                        // Normally the url should now contain the nick name as last part of the url
-                       $nick = $a->argv[1];
+                       $nick = DI::args()->getArgv()[1];
                } else {
                        // Get the nick name from the topic as a fallback
                        $nick = $hub_topic;
@@ -84,18 +83,12 @@ function pubsubhubbub_init(App $a) {
 
                // fetch user from database given the nickname
                $condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
-               $owner = DBA::selectFirst('user', ['uid', 'hidewall', 'nickname'], $condition);
+               $owner = DBA::selectFirst('user', ['uid', 'nickname'], $condition);
                if (!DBA::isResult($owner)) {
                        Logger::log('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
                        throw new \Friendica\Network\HTTPException\NotFoundException();
                }
 
-               // abort if user's wall is supposed to be private
-               if ($owner['hidewall']) {
-                       Logger::log('Local user ' . $nick . 'has chosen to hide wall, ignoring.');
-                       throw new \Friendica\Network\HTTPException\ForbiddenException();
-               }
-
                // get corresponding row from contact table
                $condition = ['uid' => $owner['uid'], 'blocked' => false,
                        'pending' => false, 'self' => true];
@@ -132,7 +125,7 @@ function pubsubhubbub_init(App $a) {
                $hub_callback = rtrim($hub_callback, ' ?&#');
                $separator = parse_url($hub_callback, PHP_URL_QUERY) === null ? '?' : '&';
 
-               $fetchResult = Network::fetchUrlFull($hub_callback . $separator . $params);
+               $fetchResult = DI::httpClient()->fetchFull($hub_callback . $separator . $params);
                $body = $fetchResult->getBody();
                $ret = $fetchResult->getReturnCode();