mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-09 18:24:26 +02:00
Changed scope
This commit is contained in:
parent
ec5bd9a756
commit
57353eb9b0
33 changed files with 95 additions and 91 deletions
|
@ -35,9 +35,7 @@ class Probe extends BaseModule
|
|||
public static function content(array $parameters = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
$e = new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
|
||||
$e->httpdesc = DI::l10n()->t('Public access denied.');
|
||||
throw $e;
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
|
||||
}
|
||||
|
||||
$addr = $_GET['addr'] ?? '';
|
||||
|
|
|
@ -34,9 +34,7 @@ class WebFinger extends BaseModule
|
|||
public static function content(array $parameters = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
$e = new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
|
||||
$e->httpdesc = DI::l10n()->t('Public access denied.');
|
||||
throw $e;
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a probing.'));
|
||||
}
|
||||
|
||||
$addr = $_GET['addr'] ?? '';
|
||||
|
|
|
@ -51,9 +51,7 @@ class Index extends BaseSearch
|
|||
}
|
||||
|
||||
if (DI::config()->get('system', 'local_search') && !Session::isAuthenticated()) {
|
||||
$e = new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a search.'));
|
||||
$e->httpdesc = DI::l10n()->t('Public access denied.');
|
||||
throw $e;
|
||||
throw new HTTPException\ForbiddenException(DI::l10n()->t('Only logged in users are permitted to perform a search.'));
|
||||
}
|
||||
|
||||
if (DI::config()->get('system', 'permit_crawling') && !Session::isAuthenticated()) {
|
||||
|
|
|
@ -45,8 +45,8 @@ class HTTPException
|
|||
{
|
||||
// Explanations are mostly taken from https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
||||
$vars = [
|
||||
'$title' => $e->httpdesc ?: 'Error ' . $e->getCode(),
|
||||
'$message' => $e->getMessage() ?: $e->explanation,
|
||||
'$title' => $e->getDescription() ?: 'Error ' . $e->getCode(),
|
||||
'$message' => $e->getMessage() ?: $e->getExplanation(),
|
||||
'$back' => DI::l10n()->t('Go back'),
|
||||
'$stack_trace' => DI::l10n()->t('Stack trace:'),
|
||||
];
|
||||
|
@ -74,7 +74,7 @@ class HTTPException
|
|||
$content = Renderer::replaceMacros($tpl, self::getVars($e));
|
||||
}
|
||||
|
||||
System::httpExit($e->getCode(), $e->httpdesc, $content);
|
||||
System::httpExit($e->getCode(), $e->getDescription(), $content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,10 +86,10 @@ class HTTPException
|
|||
*/
|
||||
public static function content(\Friendica\Network\HTTPException $e)
|
||||
{
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $e->getCode() . ' ' . $e->httpdesc);
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $e->getCode() . ' ' . $e->getDescription());
|
||||
|
||||
if ($e->getCode() >= 400) {
|
||||
Logger::debug('Exit with error', ['code' => $e->getCode(), 'description' => $e->httpdesc, 'query' => DI::args()->getQueryString(), 'callstack' => System::callstack(20), 'method' => $_SERVER['REQUEST_METHOD'], 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']);
|
||||
Logger::debug('Exit with error', ['code' => $e->getCode(), 'description' => $e->getDescription(), 'query' => DI::args()->getQueryString(), 'callstack' => System::callstack(20), 'method' => $_SERVER['REQUEST_METHOD'], 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('exception.tpl');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue