Using the standard function to return http errors
This commit is contained in:
parent
e88781164a
commit
83489b36c4
|
@ -18,8 +18,7 @@ function fetch_init(App $a)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (($a->argc != 3) || (!in_array($a->argv[1], ["post", "status_message", "reshare"]))) {
|
if (($a->argc != 3) || (!in_array($a->argv[1], ["post", "status_message", "reshare"]))) {
|
||||||
header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
|
System::httpExit(404, ['title' => L10n::t('Not found.')]);
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$guid = $a->argv[2];
|
$guid = $a->argv[2];
|
||||||
|
@ -45,15 +44,13 @@ function fetch_init(App $a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
|
System::httpExit(404, ['title' => L10n::t('Not found.')]);
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch some data from the author (We could combine both queries - but I think this is more readable)
|
// Fetch some data from the author (We could combine both queries - but I think this is more readable)
|
||||||
$user = User::getOwnerDataById($item["uid"]);
|
$user = User::getOwnerDataById($item["uid"]);
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
header($_SERVER["SERVER_PROTOCOL"].' 404 '.L10n::t('Not Found'));
|
System::httpExit(404, ['title' => L10n::t('Not found.')]);
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$status = Diaspora::buildStatus($item, $user);
|
$status = Diaspora::buildStatus($item, $user);
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
use Friendica\Core\System;
|
||||||
|
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ function hub_return($valid, $body)
|
||||||
header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK');
|
header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK');
|
||||||
echo $body;
|
echo $body;
|
||||||
} else {
|
} else {
|
||||||
header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
|
System::httpExit(404, ['title' => L10n::t('Not found.')]);
|
||||||
}
|
}
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user