]> git.mxchange.org Git - friendica.git/commitdiff
Using the standard function to return http errors
authorMichael <heluecht@pirati.ca>
Sun, 2 Dec 2018 19:33:01 +0000 (19:33 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 2 Dec 2018 19:33:01 +0000 (19:33 +0000)
mod/fetch.php
mod/pubsub.php

index 9336c140475ef0b0b8edc102c9e5f07aa6aa59e7..d66f19302473dcc51a4575ea0531054d6e009ae5 100644 (file)
@@ -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);
index f0a8d463c4517999d29773112e2aff9b45a4df13..cb6738ada33ed3ce7f5a3e542cadc078440bbdec 100644 (file)
@@ -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();
 }