<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\PushSubscriber;
-use Friendica\Util\Network;
use Friendica\Util\Strings;
function post_var($name) {
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;
// 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];
$hub_callback = rtrim($hub_callback, ' ?&#');
$separator = parse_url($hub_callback, PHP_URL_QUERY) === null ? '?' : '&';
- $fetchResult = Network::fetchUrlFull($hub_callback . $separator . $params);
+ $fetchResult = DI::httpRequest()->fetchFull($hub_callback . $separator . $params);
$body = $fetchResult->getBody();
$ret = $fetchResult->getReturnCode();