From 83489b36c4f8299ea1219b7d45c4ea974daf4f66 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 2 Dec 2018 19:33:01 +0000 Subject: [PATCH] Using the standard function to return http errors --- mod/fetch.php | 9 +++------ mod/pubsub.php | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/mod/fetch.php b/mod/fetch.php index 9336c14047..d66f193024 100644 --- a/mod/fetch.php +++ b/mod/fetch.php @@ -18,8 +18,7 @@ function fetch_init(App $a) { if (($a->argc != 3) || (!in_array($a->argv[1], ["post", "status_message", "reshare"]))) { - header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found')); - killme(); + System::httpExit(404, ['title' => L10n::t('Not found.')]); } $guid = $a->argv[2]; @@ -45,15 +44,13 @@ function fetch_init(App $a) } } - header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found')); - killme(); + System::httpExit(404, ['title' => L10n::t('Not found.')]); } // Fetch some data from the author (We could combine both queries - but I think this is more readable) $user = User::getOwnerDataById($item["uid"]); if (!$user) { - header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found')); - killme(); + System::httpExit(404, ['title' => L10n::t('Not found.')]); } $status = Diaspora::buildStatus($item, $user); diff --git a/mod/pubsub.php b/mod/pubsub.php index f0a8d463c4..cb6738ada3 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -7,6 +7,7 @@ use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Protocol\OStatus; use Friendica\Util\Strings; +use Friendica\Core\System; require_once 'include/items.php'; @@ -16,7 +17,7 @@ function hub_return($valid, $body) header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK'); echo $body; } else { - header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); + System::httpExit(404, ['title' => L10n::t('Not found.')]); } killme(); }