<?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
*
*/
class Notify extends BaseModule
{
- public static function post()
+ protected function post(array $request = [])
{
$postdata = Network::postdata();
}
$data = json_decode($postdata);
- if (is_object($data) && !empty(static::$parameters['nickname'])) {
- $user = User::getByNickname(static::$parameters['nickname']);
+ if (is_object($data) && !empty($this->parameters['nickname'])) {
+ $user = User::getByNickname($this->parameters['nickname']);
if (empty($user)) {
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
}
}
}
- private static function dispatchPublic($postdata)
+ private static function dispatchPublic(array $postdata)
{
$msg = Diaspora::decodeRaw($postdata, '', true);
- if (!$msg) {
+ if (!is_array($msg)) {
// We have to fail silently to be able to hand it over to the salmon parser
- return false;
+ Logger::warning('Diaspora::decodeRaw() has failed for some reason.');
+ return;
}
// Fetch the corresponding public contact
System::xmlExit($ret, 'Done');
}
- private static function dispatchPrivate($user, $postdata)
+ private static function dispatchPrivate(array $user, string $postdata)
{
$msg = Diaspora::decodeRaw($postdata, $user['prvkey'] ?? '');
- if (!$msg) {
+ if (!is_array($msg)) {
System::xmlExit(4, 'Unable to parse message');
}