<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
{
// 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:'),
];
- if (is_site_admin()) {
+ if (DI::app()->isSiteAdmin()) {
$vars['$thrown'] = DI::l10n()->t('Exception thrown in %s:%d', $e->getFile(), $e->getLine());
$vars['$trace'] = $e->getTraceAsString();
}
* @param \Friendica\Network\HTTPException $e
* @throws \Exception
*/
- public static function rawContent(\Friendica\Network\HTTPException $e)
+ public function rawContent(\Friendica\Network\HTTPException $e)
{
$content = '';
$content = Renderer::replaceMacros($tpl, self::getVars($e));
}
- System::httpExit($e->getCode(), $e->httpdesc, $content);
+ System::httpExit($e->getCode(), $e->getDescription(), $content);
}
/**
* @return string
* @throws \Exception
*/
- public static function content(\Friendica\Network\HTTPException $e)
+ public function content(\Friendica\Network\HTTPException $e): string
{
- 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');