X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Freceive.php;h=db1287ea6f1f804a8b6b784710ce5e01409beb07;hb=b55546b72649a645987e017397901a86122eba67;hp=b0258acbd71803b0ac4286cafd31eb5c465d065b;hpb=854cc3e47296d4a1b01b893376064cf254d84f79;p=friendica.git diff --git a/mod/receive.php b/mod/receive.php index b0258acbd7..db1287ea6f 100644 --- a/mod/receive.php +++ b/mod/receive.php @@ -22,7 +22,7 @@ function receive_post(App $a) $enabled = intval(Config::get('system', 'diaspora_enabled')); if (!$enabled) { Logger::log('mod-diaspora: disabled'); - System::httpExit(500); + throw new \Friendica\Network\HTTPException\InternalServerErrorException(); } if (($a->argc == 2) && ($a->argv[1] === 'public')) { @@ -32,13 +32,13 @@ function receive_post(App $a) $public = false; if ($a->argc != 3 || $a->argv[1] !== 'users') { - System::httpExit(500); + throw new \Friendica\Network\HTTPException\InternalServerErrorException(); } $guid = $a->argv[2]; $importer = DBA::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]); if (!DBA::isResult($importer)) { - System::httpExit(500); + throw new \Friendica\Network\HTTPException\InternalServerErrorException(); } } @@ -49,7 +49,7 @@ function receive_post(App $a) if (empty($_POST['xml'])) { $postdata = file_get_contents("php://input"); if ($postdata == '') { - System::httpExit(500); + throw new \Friendica\Network\HTTPException\InternalServerErrorException(); } Logger::log('mod-diaspora: message is in the new format', Logger::DEBUG); @@ -71,7 +71,7 @@ function receive_post(App $a) Logger::log('mod-diaspora: decoded msg: ' . print_r($msg, true), Logger::DATA); if (!is_array($msg)) { - System::httpExit(500); + throw new \Friendica\Network\HTTPException\InternalServerErrorException(); } Logger::log('mod-diaspora: dispatching', Logger::DEBUG); @@ -83,6 +83,9 @@ function receive_post(App $a) $ret = Diaspora::dispatch($importer, $msg); } - System::httpExit(($ret) ? 200 : 500); - // NOTREACHED + if ($ret) { + throw new \Friendica\Network\HTTPException\OKException(); + } else { + throw new \Friendica\Network\HTTPException\InternalServerErrorException(); + } }