Merge pull request #10942 from annando/error-handling
Improved http error handling
This commit is contained in:
commit
4a0127bcee
|
@ -246,8 +246,6 @@ function api_login(App $a)
|
|||
if (!DBA::isResult($record)) {
|
||||
Logger::debug(API_LOG_PREFIX . 'failed', ['module' => 'api', 'action' => 'login', 'parameters' => $_SERVER]);
|
||||
header('WWW-Authenticate: Basic realm="Friendica"');
|
||||
//header('HTTP/1.0 401 Unauthorized');
|
||||
//die('This api requires login');
|
||||
throw new UnauthorizedException("This API requires login");
|
||||
}
|
||||
|
||||
|
@ -373,7 +371,7 @@ function api_call(App $a, App\Arguments $args = null)
|
|||
Logger::warning(API_LOG_PREFIX . 'not implemented', ['module' => 'api', 'action' => 'call', 'query' => DI::args()->getQueryString()]);
|
||||
throw new NotFoundException();
|
||||
} catch (HTTPException $e) {
|
||||
header("HTTP/1.1 {$e->getCode()} {$e->httpdesc}");
|
||||
header("HTTP/1.1 {$e->getCode()} {$e->getDescription()}");
|
||||
return api_error($type, $e, $args);
|
||||
}
|
||||
}
|
||||
|
@ -388,11 +386,11 @@ function api_call(App $a, App\Arguments $args = null)
|
|||
*/
|
||||
function api_error($type, $e, App\Arguments $args)
|
||||
{
|
||||
$error = ($e->getMessage() !== "" ? $e->getMessage() : $e->httpdesc);
|
||||
$error = ($e->getMessage() !== "" ? $e->getMessage() : $e->getDescription());
|
||||
/// @TODO: https://dev.twitter.com/overview/api/response-codes
|
||||
|
||||
$error = ["error" => $error,
|
||||
"code" => $e->getCode() . " " . $e->httpdesc,
|
||||
"code" => $e->getCode() . " " . $e->getDescription(),
|
||||
"request" => $args->getQueryString()];
|
||||
|
||||
$return = api_format_data('status', $type, ['status' => $error]);
|
||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\Module\Home;
|
|||
use Friendica\Module\HTTPException\MethodNotAllowed;
|
||||
use Friendica\Module\HTTPException\PageNotFound;
|
||||
use Friendica\Network\HTTPException\MethodNotAllowedException;
|
||||
use Friendica\Network\HTTPException\NoContentException;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
use Friendica\Util\Profiler;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
@ -292,9 +293,8 @@ class Module
|
|||
// @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
|
||||
// @todo Check allowed methods per requested path
|
||||
if ($server['REQUEST_METHOD'] === Router::OPTIONS) {
|
||||
header('HTTP/1.1 204 No Content');
|
||||
header('Allow: ' . implode(',', Router::ALLOWED_METHODS));
|
||||
exit();
|
||||
throw new NoContentException();
|
||||
}
|
||||
|
||||
$placeholder = '';
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Friendica\Core;
|
|||
|
||||
use Exception;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Network\HTTPException\ServiceUnavailableException;
|
||||
use Friendica\Render\TemplateEngine;
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ class Renderer
|
|||
* @param string $template
|
||||
* @param array $vars
|
||||
* @return string
|
||||
* @throws InternalServerErrorException
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
public static function replaceMacros(string $template, array $vars = [])
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ class Renderer
|
|||
$message = is_site_admin() ?
|
||||
$e->getMessage() :
|
||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||
throw new InternalServerErrorException($message);
|
||||
throw new ServiceUnavailableException($message);
|
||||
}
|
||||
|
||||
DI::profiler()->stopRecording();
|
||||
|
@ -102,7 +102,7 @@ class Renderer
|
|||
* @param string $subDir Subdirectory (Optional)
|
||||
*
|
||||
* @return string template.
|
||||
* @throws InternalServerErrorException
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
public static function getMarkupTemplate($file, $subDir = '')
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ class Renderer
|
|||
$message = is_site_admin() ?
|
||||
$e->getMessage() :
|
||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||
throw new InternalServerErrorException($message);
|
||||
throw new ServiceUnavailableException($message);
|
||||
}
|
||||
|
||||
DI::profiler()->stopRecording();
|
||||
|
@ -128,7 +128,7 @@ class Renderer
|
|||
* Register template engine class
|
||||
*
|
||||
* @param string $class
|
||||
* @throws InternalServerErrorException
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
public static function registerTemplateEngine($class)
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ class Renderer
|
|||
$message = is_site_admin() ?
|
||||
$admin_message :
|
||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||
throw new InternalServerErrorException($message);
|
||||
throw new ServiceUnavailableException($message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ class Renderer
|
|||
* or default
|
||||
*
|
||||
* @return TemplateEngine Template Engine instance
|
||||
* @throws InternalServerErrorException
|
||||
* @throws ServiceUnavailableException
|
||||
*/
|
||||
public static function getTemplateEngine()
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ class Renderer
|
|||
$message = is_site_admin() ?
|
||||
$admin_message :
|
||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||
throw new InternalServerErrorException($message);
|
||||
throw new ServiceUnavailableException($message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Network\HTTPException\FoundException;
|
||||
use Friendica\Network\HTTPException\MovedPermanentlyException;
|
||||
use Friendica\Network\HTTPException\TemporaryRedirectException;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
/**
|
||||
|
@ -122,7 +124,9 @@ class System
|
|||
*/
|
||||
public static function httpExit($val, $message = '', $content = '')
|
||||
{
|
||||
Logger::log('http_status_exit ' . $val);
|
||||
if ($val >= 400) {
|
||||
Logger::debug('Exit with error', ['code' => $val, 'message' => $message, 'callstack' => System::callstack(20), 'method' => $_SERVER['REQUEST_METHOD'], 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']);
|
||||
}
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $val . ' ' . $message);
|
||||
|
||||
echo $content;
|
||||
|
@ -132,6 +136,9 @@ class System
|
|||
|
||||
public static function jsonError($httpCode, $data, $content_type = 'application/json')
|
||||
{
|
||||
if ($httpCode >= 400) {
|
||||
Logger::debug('Exit with error', ['code' => $httpCode, 'content_type' => $content_type, 'callstack' => System::callstack(20), 'method' => $_SERVER['REQUEST_METHOD'], 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']);
|
||||
}
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $httpCode);
|
||||
self::jsonExit($data, $content_type);
|
||||
}
|
||||
|
@ -221,29 +228,25 @@ class System
|
|||
*
|
||||
* @param string $url The new Location to redirect
|
||||
* @param int $code The redirection code, which is used (Default is 302)
|
||||
*
|
||||
* @throws InternalServerErrorException If the URL is not fully qualified
|
||||
*/
|
||||
public static function externalRedirect($url, $code = 302)
|
||||
{
|
||||
if (empty(parse_url($url, PHP_URL_SCHEME))) {
|
||||
throw new InternalServerErrorException("'$url' is not a fully qualified URL, please use App->internalRedirect() instead");
|
||||
}
|
||||
|
||||
switch ($code) {
|
||||
case 302:
|
||||
// this is the default code for a REDIRECT
|
||||
// We don't need a extra header here
|
||||
break;
|
||||
case 301:
|
||||
header('HTTP/1.1 301 Moved Permanently');
|
||||
break;
|
||||
case 307:
|
||||
header('HTTP/1.1 307 Temporary Redirect');
|
||||
break;
|
||||
Logger::warning('No fully qualified URL provided', ['url' => $url, 'callstack' => self::callstack(20)]);
|
||||
DI::baseUrl()->redirect($url);
|
||||
}
|
||||
|
||||
header("Location: $url");
|
||||
|
||||
switch ($code) {
|
||||
case 302:
|
||||
throw new FoundException();
|
||||
case 301:
|
||||
throw new MovedPermanentlyException();
|
||||
case 307:
|
||||
throw new TemporaryRedirectException();
|
||||
}
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Friendica\Database;
|
|||
|
||||
use Friendica\Core\Config\ValueObject\Cache;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Network\HTTPException\ServiceUnavailableException;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Profiler;
|
||||
use mysqli;
|
||||
|
@ -520,7 +520,7 @@ class Database
|
|||
$called_from_e = ($called_from['function'] == 'e');
|
||||
|
||||
if (!isset($this->connection)) {
|
||||
throw new InternalServerErrorException('The Connection is empty, although connected is set true.');
|
||||
throw new ServiceUnavailableException('The Connection is empty, although connected is set true.');
|
||||
}
|
||||
|
||||
switch ($this->driver) {
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Friendica\Factory\Api\Mastodon;
|
|||
|
||||
use Friendica\BaseFactory;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Network\HTTPException\UnprocessableEntityException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Application extends BaseFactory
|
||||
|
@ -42,13 +42,13 @@ class Application extends BaseFactory
|
|||
*
|
||||
* @return \Friendica\Object\Api\Mastodon\Application
|
||||
*
|
||||
* @throws InternalServerErrorException
|
||||
* @throws UnprocessableEntityException
|
||||
*/
|
||||
public function createFromApplicationId(int $id): \Friendica\Object\Api\Mastodon\Application
|
||||
{
|
||||
$application = $this->dba->selectFirst('application', ['client_id', 'client_secret', 'id', 'name', 'redirect_uri', 'website'], ['id' => $id]);
|
||||
if (!$this->dba->isResult($application)) {
|
||||
throw new InternalServerErrorException(sprintf("ID '%s' not found", $id));
|
||||
throw new UnprocessableEntityException(sprintf("ID '%s' not found", $id));
|
||||
}
|
||||
|
||||
return new \Friendica\Object\Api\Mastodon\Application(
|
||||
|
|
|
@ -32,8 +32,7 @@ use Friendica\DI;
|
|||
use Friendica\Core\Config\Factory\Config;
|
||||
use Friendica\Model\Register;
|
||||
use Friendica\Module\BaseAdmin;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Core\Config\Util\ConfigFileLoader;
|
||||
use Friendica\Network\HTTPException\ServiceUnavailableException;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
class Summary extends BaseAdmin
|
||||
|
@ -129,7 +128,7 @@ class Summary extends BaseAdmin
|
|||
$stream = $fileSystem->createStream($file);
|
||||
|
||||
if (!isset($stream)) {
|
||||
throw new InternalServerErrorException('Stream is null.');
|
||||
throw new ServiceUnavailableException('Stream is null.');
|
||||
}
|
||||
|
||||
} catch (\Throwable $exception) {
|
||||
|
@ -143,7 +142,7 @@ class Summary extends BaseAdmin
|
|||
$stream = $fileSystem->createStream($file);
|
||||
|
||||
if (!isset($stream)) {
|
||||
throw new InternalServerErrorException('Stream is null.');
|
||||
throw new ServiceUnavailableException('Stream is null.');
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $exception) {
|
||||
|
|
|
@ -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'] ?? '';
|
||||
|
|
|
@ -96,7 +96,9 @@ class Receive extends BaseModule
|
|||
if (Diaspora::dispatch($importer, $msg)) {
|
||||
throw new HTTPException\OKException();
|
||||
} else {
|
||||
throw new HTTPException\InternalServerErrorException();
|
||||
// We couldn't process the content.
|
||||
// To avoid the remote system trying again we send the message that we accepted the content.
|
||||
throw new HTTPException\AcceptedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ use Friendica\Core\Storage\Type\ExternalResource;
|
|||
use Friendica\Core\Storage\Type\SystemResource;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Network\HTTPException\NotModifiedException;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -55,7 +56,6 @@ class Photo extends BaseModule
|
|||
$totalstamp = microtime(true);
|
||||
|
||||
if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
|
||||
if (!empty($_SERVER["HTTP_IF_NONE_MATCH"])) {
|
||||
header("Etag: " . $_SERVER["HTTP_IF_NONE_MATCH"]);
|
||||
|
@ -67,7 +67,7 @@ class Photo extends BaseModule
|
|||
header_remove("Expires");
|
||||
header_remove("Cache-Control");
|
||||
}
|
||||
exit;
|
||||
throw new NotModifiedException();
|
||||
}
|
||||
|
||||
Profile::addVisitorCookieForHTTPSigner();
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\NotModifiedException;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
use Friendica\Util\Images;
|
||||
|
@ -53,7 +54,6 @@ class Proxy extends BaseModule
|
|||
}
|
||||
|
||||
if (isset($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
|
||||
if (!empty($_SERVER["HTTP_IF_NONE_MATCH"])) {
|
||||
header("Etag: " . $_SERVER["HTTP_IF_NONE_MATCH"]);
|
||||
|
@ -65,7 +65,7 @@ class Proxy extends BaseModule
|
|||
header_remove("Expires");
|
||||
header_remove("Cache-Control");
|
||||
}
|
||||
exit;
|
||||
throw new NotModifiedException();
|
||||
}
|
||||
|
||||
if (empty($request['url'])) {
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace Friendica\Module\Special;
|
||||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
@ -42,36 +43,10 @@ class HTTPException
|
|||
*/
|
||||
private static function getVars(\Friendica\Network\HTTPException $e)
|
||||
{
|
||||
$message = $e->getMessage();
|
||||
|
||||
$titles = [
|
||||
200 => 'OK',
|
||||
400 => DI::l10n()->t('Bad Request'),
|
||||
401 => DI::l10n()->t('Unauthorized'),
|
||||
403 => DI::l10n()->t('Forbidden'),
|
||||
404 => DI::l10n()->t('Not Found'),
|
||||
500 => DI::l10n()->t('Internal Server Error'),
|
||||
503 => DI::l10n()->t('Service Unavailable'),
|
||||
];
|
||||
$title = ($titles[$e->getCode()] ?? '') ?: 'Error ' . $e->getCode();
|
||||
|
||||
if (empty($message)) {
|
||||
// Explanations are taken from https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
||||
$explanation = [
|
||||
400 => DI::l10n()->t('The server cannot or will not process the request due to an apparent client error.'),
|
||||
401 => DI::l10n()->t('Authentication is required and has failed or has not yet been provided.'),
|
||||
403 => DI::l10n()->t('The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource, or may need an account.'),
|
||||
404 => DI::l10n()->t('The requested resource could not be found but may be available in the future.'),
|
||||
500 => DI::l10n()->t('An unexpected condition was encountered and no more specific message is suitable.'),
|
||||
503 => DI::l10n()->t('The server is currently unavailable (because it is overloaded or down for maintenance). Please try again later.'),
|
||||
];
|
||||
|
||||
$message = $explanation[$e->getCode()] ?? '';
|
||||
}
|
||||
|
||||
// Explanations are mostly taken from https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
|
||||
$vars = [
|
||||
'$title' => $title,
|
||||
'$message' => $message,
|
||||
'$title' => $e->getDescription() ?: 'Error ' . $e->getCode(),
|
||||
'$message' => $e->getMessage() ?: $e->getExplanation(),
|
||||
'$back' => DI::l10n()->t('Go back'),
|
||||
'$stack_trace' => DI::l10n()->t('Stack trace:'),
|
||||
];
|
||||
|
@ -99,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,7 +86,11 @@ 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->getDescription(), 'query' => DI::args()->getQueryString(), 'callstack' => System::callstack(20), 'method' => $_SERVER['REQUEST_METHOD'], 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']);
|
||||
}
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('exception.tpl');
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Friendica\Network\HTTPClient\Response;
|
|||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Network\HTTPException\UnprocessableEntityException;
|
||||
use Friendica\Util\Network;
|
||||
|
||||
/**
|
||||
|
@ -102,7 +102,7 @@ class CurlResult implements ICanHandleHttpResponses
|
|||
* @param string $url optional URL
|
||||
*
|
||||
* @return ICanHandleHttpResponses a CURL with error response
|
||||
* @throws InternalServerErrorException
|
||||
* @throws UnprocessableEntityException
|
||||
*/
|
||||
public static function createErrorCurl(string $url = '')
|
||||
{
|
||||
|
@ -118,12 +118,12 @@ class CurlResult implements ICanHandleHttpResponses
|
|||
* @param int $errorNumber the error number or 0 (zero) if no error
|
||||
* @param string $error the error message or '' (the empty string) if no
|
||||
*
|
||||
* @throws InternalServerErrorException when HTTP code of the CURL response is missing
|
||||
* @throws UnprocessableEntityException when HTTP code of the CURL response is missing
|
||||
*/
|
||||
public function __construct(string $url, string $result, array $info, int $errorNumber = 0, string $error = '')
|
||||
{
|
||||
if (!array_key_exists('http_code', $info)) {
|
||||
throw new InternalServerErrorException('CURL response doesn\'t contains a response HTTP code');
|
||||
throw new UnprocessableEntityException('CURL response doesn\'t contains a response HTTP code');
|
||||
}
|
||||
|
||||
$this->returnCode = $info['http_code'];
|
||||
|
|
|
@ -31,15 +31,21 @@ use Exception;
|
|||
*/
|
||||
abstract class HTTPException extends Exception
|
||||
{
|
||||
public $httpdesc = '';
|
||||
protected $httpdesc = '';
|
||||
protected $explanation = '';
|
||||
|
||||
public function __construct($message = '', Exception $previous = null)
|
||||
{
|
||||
parent::__construct($message, $this->code, $previous);
|
||||
|
||||
if (empty($this->httpdesc)) {
|
||||
$classname = str_replace('Exception', '', str_replace('Friendica\Network\HTTPException\\', '', get_class($this)));
|
||||
$this->httpdesc = preg_replace("|([a-z])([A-Z])|",'$1 $2', $classname);
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->httpdesc;
|
||||
}
|
||||
|
||||
public function getExplanation()
|
||||
{
|
||||
return $this->explanation;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,5 @@ use Friendica\Network\HTTPException;
|
|||
class AcceptedException extends HTTPException
|
||||
{
|
||||
protected $code = 202;
|
||||
protected $httpdesc = 'Accepted';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class BadGatewayException extends HTTPException
|
||||
{
|
||||
protected $code = 502;
|
||||
protected $httpdesc = 'Bad Gateway';
|
||||
protected $explanation = 'The server was acting as a gateway or proxy and received an invalid response from the upstream server.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class BadRequestException extends HTTPException
|
||||
{
|
||||
protected $code = 400;
|
||||
protected $httpdesc = 'Bad Request';
|
||||
protected $explanation = 'The server cannot or will not process the request due to an apparent client error.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class ConflictException extends HTTPException
|
||||
{
|
||||
protected $code = 409;
|
||||
protected $httpdesc = 'Conflict ';
|
||||
protected $explanation = 'Indicates that the request could not be processed because of conflict in the current state of the resource, such as an edit conflict between multiple simultaneous updates.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class ExpectationFailedException extends HTTPException
|
||||
{
|
||||
protected $code = 417;
|
||||
protected $httpdesc = 'Expectation Failed';
|
||||
protected $explanation = 'The server cannot meet the requirements of the Expect request-header field.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class ForbiddenException extends HTTPException
|
||||
{
|
||||
protected $code = 403;
|
||||
protected $httpdesc = 'Forbidden';
|
||||
protected $explanation = 'The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource, or may need an account.';
|
||||
}
|
||||
|
|
30
src/Network/HTTPException/FoundException.php
Normal file
30
src/Network/HTTPException/FoundException.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class FoundException extends HTTPException
|
||||
{
|
||||
protected $code = 302;
|
||||
protected $httpdesc = 'Found (Moved Temporarily)';
|
||||
}
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class GatewayTimeoutException extends HTTPException
|
||||
{
|
||||
protected $code = 504;
|
||||
protected $httpdesc = 'Gateway Timeout';
|
||||
protected $explanation = 'The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class GoneException extends HTTPException
|
||||
{
|
||||
protected $code = 410;
|
||||
protected $httpdesc = 'Gone';
|
||||
protected $explanation = 'Indicates that the resource requested is no longer available and will not be available again.';
|
||||
}
|
||||
|
|
|
@ -26,5 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class ImATeapotException extends HTTPException
|
||||
{
|
||||
protected $code = 418;
|
||||
var $httpdesc = "I'm A Teapot";
|
||||
protected $httpdesc = "I'm A Teapot";
|
||||
protected $explanation = 'This is a teapot that is requested to brew coffee.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class InternalServerErrorException extends HTTPException
|
||||
{
|
||||
protected $code = 500;
|
||||
protected $httpdesc = 'Internal Server Error';
|
||||
protected $explanation = 'An unexpected condition was encountered and no more specific message is suitable.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class LenghtRequiredException extends HTTPException
|
||||
{
|
||||
protected $code = 411;
|
||||
protected $httpdesc = 'Length Required';
|
||||
protected $explanation = 'The request did not specify the length of its content, which is required by the requested resource.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class MethodNotAllowedException extends HTTPException
|
||||
{
|
||||
protected $code = 405;
|
||||
protected $httpdesc = 'Method Not Allowed';
|
||||
protected $explanation = 'A request method is not supported for the requested resource; for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.';
|
||||
}
|
||||
|
|
30
src/Network/HTTPException/MovedPermanently.php
Normal file
30
src/Network/HTTPException/MovedPermanently.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class MovedPermanentlyException extends HTTPException
|
||||
{
|
||||
protected $code = 301;
|
||||
protected $httpdesc = 'Moved Permanently';
|
||||
}
|
|
@ -26,4 +26,5 @@ use Friendica\Network\HTTPException;
|
|||
class NoContentException extends HTTPException
|
||||
{
|
||||
protected $code = 204;
|
||||
protected $httpdesc = 'No Content';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class NonAcceptableException extends HTTPException
|
||||
{
|
||||
protected $code = 406;
|
||||
protected $httpdesc = 'Not Acceptable';
|
||||
protected $explanation = 'The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class NotFoundException extends HTTPException
|
||||
{
|
||||
protected $code = 404;
|
||||
protected $httpdesc = 'Not Found';
|
||||
protected $explanation = 'The requested resource could not be found but may be available in the future.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class NotImplementedException extends HTTPException
|
||||
{
|
||||
protected $code = 501;
|
||||
protected $httpdesc = 'Not Implemented';
|
||||
protected $explanation = 'The server either does not recognize the request method, or it lacks the ability to fulfil the request. Usually this implies future availability (e.g., a new feature of a web-service API).';
|
||||
}
|
||||
|
|
30
src/Network/HTTPException/NotModifiedException.php
Normal file
30
src/Network/HTTPException/NotModifiedException.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class NotModifiedException extends HTTPException
|
||||
{
|
||||
protected $code = 304;
|
||||
protected $httpdesc = 'Not Modified';
|
||||
}
|
|
@ -26,4 +26,5 @@ use Friendica\Network\HTTPException;
|
|||
class OKException extends HTTPException
|
||||
{
|
||||
protected $code = 200;
|
||||
protected $httpdesc = 'OK';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class PreconditionFailedException extends HTTPException
|
||||
{
|
||||
protected $code = 412;
|
||||
protected $httpdesc = 'Precondition Failed';
|
||||
protected $explanation = 'The server does not meet one of the preconditions that the requester put on the request header fields.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class ServiceUnavailableException extends HTTPException
|
||||
{
|
||||
protected $code = 503;
|
||||
protected $httpdesc = 'Service Unavailable';
|
||||
protected $explanation = 'The server is currently unavailable (because it is overloaded or down for maintenance). Please try again later.';
|
||||
}
|
||||
|
|
30
src/Network/HTTPException/TemporaryRedirectException.php
Normal file
30
src/Network/HTTPException/TemporaryRedirectException.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Network\HTTPException;
|
||||
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class TemporaryRedirectException extends HTTPException
|
||||
{
|
||||
protected $code = 307;
|
||||
protected $httpdesc = 'Temporary Redirect';
|
||||
}
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class TooManyRequestsException extends HTTPException
|
||||
{
|
||||
protected $code = 429;
|
||||
protected $httpdesc = 'Too Many Requests';
|
||||
protected $explanation = 'The user has sent too many requests in a given amount of time.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class UnauthorizedException extends HTTPException
|
||||
{
|
||||
protected $code = 401;
|
||||
protected $httpdesc = 'Unauthorized';
|
||||
protected $explanation = 'Authentication is required and has failed or has not yet been provided.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class UnprocessableEntityException extends HTTPException
|
||||
{
|
||||
protected $code = 422;
|
||||
protected $httpdesc = 'Unprocessable Entity';
|
||||
protected $explanation = 'The request was well-formed but was unable to be followed due to semantic errors.';
|
||||
}
|
||||
|
|
|
@ -26,4 +26,6 @@ use Friendica\Network\HTTPException;
|
|||
class UnsupportedMediaTypeException extends HTTPException
|
||||
{
|
||||
protected $code = 415;
|
||||
protected $httpdesc = 'Unsupported Media Type';
|
||||
protected $explanation = 'The request entity has a media type which the server or resource does not support. For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.';
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Friendica\Render;
|
|||
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Network\HTTPException\ServiceUnavailableException;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,7 @@ final class FriendicaSmartyEngine extends TemplateEngine
|
|||
$message = is_site_admin() ?
|
||||
$admin_message :
|
||||
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||
throw new InternalServerErrorException($message);
|
||||
throw new ServiceUnavailableException($message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ use Friendica\Core\Config\Capability\IManageConfigValues;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Network\HTTPException\UnprocessableEntityException;
|
||||
use Friendica\Object\Email;
|
||||
use Friendica\Object\EMail\IEmail;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
@ -226,7 +226,7 @@ abstract class MailBuilder
|
|||
*
|
||||
* @return IEmail A new generated email
|
||||
*
|
||||
* @throws InternalServerErrorException
|
||||
* @throws UnprocessableEntityException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function build(bool $raw = false)
|
||||
|
@ -241,11 +241,11 @@ abstract class MailBuilder
|
|||
}
|
||||
|
||||
if (empty($this->recipientAddress)) {
|
||||
throw new InternalServerErrorException('Recipient address is missing.');
|
||||
throw new UnprocessableEntityException('Recipient address is missing.');
|
||||
}
|
||||
|
||||
if (empty($this->senderAddress) || empty($this->senderName)) {
|
||||
throw new InternalServerErrorException('Sender address or name is missing.');
|
||||
throw new UnprocessableEntityException('Sender address or name is missing.');
|
||||
}
|
||||
|
||||
$this->senderNoReply = $this->senderNoReply ?? $this->senderAddress;
|
||||
|
|
|
@ -476,7 +476,7 @@ class HTTPSignature
|
|||
public static function getSigner($content, $http_headers)
|
||||
{
|
||||
if (empty($http_headers['HTTP_SIGNATURE'])) {
|
||||
Logger::info('No HTTP_SIGNATURE header');
|
||||
Logger::debug('No HTTP_SIGNATURE header');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Network\HTTPException\NotModifiedException;
|
||||
|
||||
class Network
|
||||
{
|
||||
|
@ -544,8 +545,7 @@ class Network
|
|||
header('Last-Modified: ' . $last_modified);
|
||||
|
||||
if ($flag_not_modified) {
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
exit;
|
||||
throw new NotModifiedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -693,7 +693,7 @@ class Notifier
|
|||
private static function notifySelfRemoval($self_user_id, $priority, $created)
|
||||
{
|
||||
$owner = User::getOwnerDataById($self_user_id);
|
||||
if (!$owner) {
|
||||
if (empty($self_user_id) || empty($owner)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Friendica\Test\src\Util\Emailer;
|
|||
use Friendica\App\BaseURL;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Network\HTTPException\UnprocessableEntityException;
|
||||
use Friendica\Object\EMail\IEmail;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\SampleMailBuilder;
|
||||
|
@ -133,7 +133,7 @@ class MailBuilderTest extends MockedTest
|
|||
*/
|
||||
public function testBuilderWithEmptyMail()
|
||||
{
|
||||
$this->expectException(InternalServerErrorException::class);
|
||||
$this->expectException(UnprocessableEntityException::class);
|
||||
$this->expectExceptionMessage("Recipient address is missing.");
|
||||
|
||||
$builder = new SampleMailBuilder($this->l10n, $this->baseUrl, $this->config, new NullLogger());
|
||||
|
@ -146,7 +146,7 @@ class MailBuilderTest extends MockedTest
|
|||
*/
|
||||
public function testBuilderWithEmptySender()
|
||||
{
|
||||
$this->expectException(InternalServerErrorException::class);
|
||||
$this->expectException(UnprocessableEntityException::class);
|
||||
$this->expectExceptionMessage("Sender address or name is missing.");
|
||||
|
||||
$builder = new SampleMailBuilder($this->l10n, $this->baseUrl, $this->config, new NullLogger());
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: 2021.12-dev\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-10-27 20:01+0200\n"
|
||||
"POT-Creation-Date: 2021-10-31 05:26+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -18,21 +18,21 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
|
||||
#: include/api.php:1113 src/Module/BaseApi.php:294
|
||||
#: include/api.php:1111 src/Module/BaseApi.php:294
|
||||
#, php-format
|
||||
msgid "Daily posting limit of %d post reached. The post was rejected."
|
||||
msgid_plural "Daily posting limit of %d posts reached. The post was rejected."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: include/api.php:1127 src/Module/BaseApi.php:310
|
||||
#: include/api.php:1125 src/Module/BaseApi.php:310
|
||||
#, php-format
|
||||
msgid "Weekly posting limit of %d post reached. The post was rejected."
|
||||
msgid_plural "Weekly posting limit of %d posts reached. The post was rejected."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: include/api.php:1141 src/Module/BaseApi.php:326
|
||||
#: include/api.php:1139 src/Module/BaseApi.php:326
|
||||
#, php-format
|
||||
msgid "Monthly posting limit of %d post reached. The post was rejected."
|
||||
msgstr ""
|
||||
|
@ -157,9 +157,8 @@ msgid "calendar"
|
|||
msgstr ""
|
||||
|
||||
#: mod/display.php:165 mod/photos.php:811
|
||||
#: src/Module/Conversation/Community.php:176 src/Module/Debug/Probe.php:39
|
||||
#: src/Module/Debug/WebFinger.php:38 src/Module/Directory.php:49
|
||||
#: src/Module/Search/Index.php:50 src/Module/Search/Index.php:55
|
||||
#: src/Module/Conversation/Community.php:176 src/Module/Directory.php:49
|
||||
#: src/Module/Search/Index.php:50
|
||||
msgid "Public access denied."
|
||||
msgstr ""
|
||||
|
||||
|
@ -180,7 +179,7 @@ msgid "Edit post"
|
|||
msgstr ""
|
||||
|
||||
#: mod/editpost.php:91 mod/notes.php:56 src/Content/Text/HTML.php:885
|
||||
#: src/Module/Admin/Storage.php:143 src/Module/Filer/SaveTag.php:69
|
||||
#: src/Module/Admin/Storage.php:142 src/Module/Filer/SaveTag.php:69
|
||||
msgid "Save"
|
||||
msgstr ""
|
||||
|
||||
|
@ -343,7 +342,7 @@ msgstr ""
|
|||
#: src/Module/Admin/Blocklist/Server.php:80
|
||||
#: src/Module/Admin/Blocklist/Server.php:99
|
||||
#: src/Module/Admin/Blocklist/Server.php:100
|
||||
#: src/Module/Admin/Item/Delete.php:70 src/Module/Debug/Probe.php:61
|
||||
#: src/Module/Admin/Item/Delete.php:70 src/Module/Debug/Probe.php:59
|
||||
#: src/Module/Install.php:200 src/Module/Install.php:233
|
||||
#: src/Module/Install.php:238 src/Module/Install.php:257
|
||||
#: src/Module/Install.php:268 src/Module/Install.php:273
|
||||
|
@ -392,7 +391,7 @@ msgstr ""
|
|||
#: src/Module/Contact/Advanced.php:133 src/Module/Contact/Poke.php:158
|
||||
#: src/Module/Debug/ActivityPubConversion.php:141
|
||||
#: src/Module/Debug/Babel.php:313 src/Module/Debug/Localtime.php:64
|
||||
#: src/Module/Debug/Probe.php:56 src/Module/Debug/WebFinger.php:53
|
||||
#: src/Module/Debug/Probe.php:54 src/Module/Debug/WebFinger.php:51
|
||||
#: src/Module/Delegation.php:147 src/Module/FriendSuggest.php:128
|
||||
#: src/Module/Install.php:245 src/Module/Install.php:287
|
||||
#: src/Module/Install.php:324 src/Module/Invite.php:177
|
||||
|
@ -2091,7 +2090,7 @@ msgstr ""
|
|||
msgid "No system theme config value set."
|
||||
msgstr ""
|
||||
|
||||
#: src/App/Module.php:241
|
||||
#: src/App/Module.php:242
|
||||
msgid "You must be logged in to use addons. "
|
||||
msgstr ""
|
||||
|
||||
|
@ -2791,7 +2790,7 @@ msgstr ""
|
|||
msgid "Nothing new here"
|
||||
msgstr ""
|
||||
|
||||
#: src/Content/Nav.php:94 src/Module/Special/HTTPException.php:75
|
||||
#: src/Content/Nav.php:94 src/Module/Special/HTTPException.php:50
|
||||
msgid "Go back"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2902,7 +2901,7 @@ msgid "Addon applications, utilities, games"
|
|||
msgstr ""
|
||||
|
||||
#: src/Content/Nav.php:230 src/Content/Text/HTML.php:891
|
||||
#: src/Module/Admin/Logs/View.php:86 src/Module/Search/Index.php:99
|
||||
#: src/Module/Admin/Logs/View.php:86 src/Module/Search/Index.php:97
|
||||
msgid "Search"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4041,7 +4040,6 @@ msgid "Unprocessable Entity"
|
|||
msgstr ""
|
||||
|
||||
#: src/Factory/Api/Mastodon/Error.php:75
|
||||
#: src/Module/Special/HTTPException.php:50
|
||||
msgid "Unauthorized"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4051,7 +4049,6 @@ msgid ""
|
|||
msgstr ""
|
||||
|
||||
#: src/Factory/Api/Mastodon/Error.php:95
|
||||
#: src/Module/Special/HTTPException.php:53
|
||||
msgid "Internal Server Error"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4388,7 +4385,7 @@ msgstr ""
|
|||
msgid "Title/Description:"
|
||||
msgstr ""
|
||||
|
||||
#: src/Model/Profile.php:988 src/Module/Admin/Summary.php:234
|
||||
#: src/Model/Profile.php:988 src/Module/Admin/Summary.php:233
|
||||
msgid "Summary"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4711,8 +4708,8 @@ msgstr ""
|
|||
#: src/Module/Admin/Blocklist/Server.php:88 src/Module/Admin/Federation.php:159
|
||||
#: src/Module/Admin/Item/Delete.php:65 src/Module/Admin/Logs/Settings.php:80
|
||||
#: src/Module/Admin/Logs/View.php:83 src/Module/Admin/Queue.php:72
|
||||
#: src/Module/Admin/Site.php:499 src/Module/Admin/Storage.php:139
|
||||
#: src/Module/Admin/Summary.php:233 src/Module/Admin/Themes/Details.php:90
|
||||
#: src/Module/Admin/Site.php:499 src/Module/Admin/Storage.php:138
|
||||
#: src/Module/Admin/Summary.php:232 src/Module/Admin/Themes/Details.php:90
|
||||
#: src/Module/Admin/Themes/Index.php:111 src/Module/Admin/Tos.php:58
|
||||
#: src/Module/Admin/Users/Active.php:136 src/Module/Admin/Users/Blocked.php:137
|
||||
#: src/Module/Admin/Users/Create.php:61 src/Module/Admin/Users/Deleted.php:85
|
||||
|
@ -6264,48 +6261,48 @@ msgstr ""
|
|||
msgid "Storage backend %s error: %s"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Storage.php:85 src/Module/Admin/Storage.php:88
|
||||
#: src/Module/Admin/Storage.php:84 src/Module/Admin/Storage.php:87
|
||||
msgid "Invalid storage backend setting value."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Storage.php:140
|
||||
#: src/Module/Admin/Storage.php:139
|
||||
msgid "Current Storage Backend"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Storage.php:141
|
||||
#: src/Module/Admin/Storage.php:140
|
||||
msgid "Storage Configuration"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Storage.php:142 src/Module/BaseAdmin.php:91
|
||||
#: src/Module/Admin/Storage.php:141 src/Module/BaseAdmin.php:91
|
||||
msgid "Storage"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Storage.php:144
|
||||
#: src/Module/Admin/Storage.php:143
|
||||
msgid "Save & Use storage backend"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Storage.php:145
|
||||
#: src/Module/Admin/Storage.php:144
|
||||
msgid "Use storage backend"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Storage.php:146
|
||||
#: src/Module/Admin/Storage.php:145
|
||||
msgid "Save & Reload"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Storage.php:147
|
||||
#: src/Module/Admin/Storage.php:146
|
||||
msgid "This backend doesn't have custom settings"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Storage.php:150
|
||||
#: src/Module/Admin/Storage.php:149
|
||||
msgid "Database (legacy)"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:54
|
||||
#: src/Module/Admin/Summary.php:53
|
||||
#, php-format
|
||||
msgid "Template engine (%s) error: %s"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:58
|
||||
#: src/Module/Admin/Summary.php:57
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Your DB still runs with MyISAM tables. You should change the engine type to "
|
||||
|
@ -6316,7 +6313,7 @@ msgid ""
|
|||
"automatic conversion.<br />"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:63
|
||||
#: src/Module/Admin/Summary.php:62
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Your DB still runs with InnoDB tables in the Antelope file format. You "
|
||||
|
@ -6327,7 +6324,7 @@ msgid ""
|
|||
"installation for an automatic conversion.<br />"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:73
|
||||
#: src/Module/Admin/Summary.php:72
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Your table_definition_cache is too low (%d). This can lead to the database "
|
||||
|
@ -6335,39 +6332,39 @@ msgid ""
|
|||
"to %d. See <a href=\"%s\">here</a> for more information.<br />"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:83
|
||||
#: src/Module/Admin/Summary.php:82
|
||||
#, php-format
|
||||
msgid ""
|
||||
"There is a new version of Friendica available for download. Your current "
|
||||
"version is %1$s, upstream version is %2$s"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:92
|
||||
#: src/Module/Admin/Summary.php:91
|
||||
msgid ""
|
||||
"The database update failed. Please run \"php bin/console.php dbstructure "
|
||||
"update\" from the command line and have a look at the errors that might "
|
||||
"appear."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:96
|
||||
#: src/Module/Admin/Summary.php:95
|
||||
msgid ""
|
||||
"The last update failed. Please run \"php bin/console.php dbstructure update"
|
||||
"\" from the command line and have a look at the errors that might appear. "
|
||||
"(Some of the errors are possibly inside the logfile.)"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:101
|
||||
#: src/Module/Admin/Summary.php:100
|
||||
msgid "The worker was never executed. Please check your database structure!"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:103
|
||||
#: src/Module/Admin/Summary.php:102
|
||||
#, php-format
|
||||
msgid ""
|
||||
"The last worker execution was on %s UTC. This is older than one hour. Please "
|
||||
"check your crontab settings."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:108
|
||||
#: src/Module/Admin/Summary.php:107
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Friendica's configuration now is stored in config/local.config.php, please "
|
||||
|
@ -6376,7 +6373,7 @@ msgid ""
|
|||
"with the transition."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:112
|
||||
#: src/Module/Admin/Summary.php:111
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Friendica's configuration now is stored in config/local.config.php, please "
|
||||
|
@ -6385,7 +6382,7 @@ msgid ""
|
|||
"with the transition."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:118
|
||||
#: src/Module/Admin/Summary.php:117
|
||||
#, php-format
|
||||
msgid ""
|
||||
"<a href=\"%s\">%s</a> is not reachable on your system. This is a severe "
|
||||
|
@ -6393,82 +6390,82 @@ msgid ""
|
|||
"href=\"%s\">the installation page</a> for help."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:136
|
||||
#: src/Module/Admin/Summary.php:135
|
||||
#, php-format
|
||||
msgid "The logfile '%s' is not usable. No logging possible (error: '%s')"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:150
|
||||
#: src/Module/Admin/Summary.php:149
|
||||
#, php-format
|
||||
msgid "The debug logfile '%s' is not usable. No logging possible (error: '%s')"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:166
|
||||
#: src/Module/Admin/Summary.php:165
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Friendica's system.basepath was updated from '%s' to '%s'. Please remove the "
|
||||
"system.basepath from your db to avoid differences."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:174
|
||||
#: src/Module/Admin/Summary.php:173
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Friendica's current system.basepath '%s' is wrong and the config file '%s' "
|
||||
"isn't used."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:182
|
||||
#: src/Module/Admin/Summary.php:181
|
||||
#, php-format
|
||||
msgid ""
|
||||
"Friendica's current system.basepath '%s' is not equal to the config file "
|
||||
"'%s'. Please fix your configuration."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:189
|
||||
#: src/Module/Admin/Summary.php:188
|
||||
msgid "Normal Account"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:190
|
||||
#: src/Module/Admin/Summary.php:189
|
||||
msgid "Automatic Follower Account"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:191
|
||||
#: src/Module/Admin/Summary.php:190
|
||||
msgid "Public Forum Account"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:192
|
||||
#: src/Module/Admin/Summary.php:191
|
||||
msgid "Automatic Friend Account"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:193
|
||||
#: src/Module/Admin/Summary.php:192
|
||||
msgid "Blog Account"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:194
|
||||
#: src/Module/Admin/Summary.php:193
|
||||
msgid "Private Forum Account"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:214
|
||||
#: src/Module/Admin/Summary.php:213
|
||||
msgid "Message queues"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:220
|
||||
#: src/Module/Admin/Summary.php:219
|
||||
msgid "Server Settings"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:236
|
||||
#: src/Module/Admin/Summary.php:235
|
||||
msgid "Registered users"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:238
|
||||
#: src/Module/Admin/Summary.php:237
|
||||
msgid "Pending registrations"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:239
|
||||
#: src/Module/Admin/Summary.php:238
|
||||
msgid "Version"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Admin/Summary.php:243
|
||||
#: src/Module/Admin/Summary.php:242
|
||||
msgid "Active addons"
|
||||
msgstr ""
|
||||
|
||||
|
@ -7247,7 +7244,7 @@ msgstr ""
|
|||
msgid "Search your contacts"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Contact.php:779 src/Module/Search/Index.php:194
|
||||
#: src/Module/Contact.php:779 src/Module/Search/Index.php:192
|
||||
#, php-format
|
||||
msgid "Results for: %s"
|
||||
msgstr ""
|
||||
|
@ -7526,8 +7523,8 @@ msgstr ""
|
|||
msgid "Hide"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Conversation/Community.php:137 src/Module/Search/Index.php:139
|
||||
#: src/Module/Search/Index.php:181
|
||||
#: src/Module/Conversation/Community.php:137 src/Module/Search/Index.php:137
|
||||
#: src/Module/Search/Index.php:179
|
||||
msgid "No results."
|
||||
msgstr ""
|
||||
|
||||
|
@ -7836,23 +7833,23 @@ msgstr ""
|
|||
msgid "Only logged in users are permitted to perform a probing."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Debug/Probe.php:54
|
||||
#: src/Module/Debug/Probe.php:52
|
||||
msgid "Probe Diagnostic"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Debug/Probe.php:55
|
||||
#: src/Module/Debug/Probe.php:53
|
||||
msgid "Output"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Debug/Probe.php:58
|
||||
#: src/Module/Debug/Probe.php:56
|
||||
msgid "Lookup address"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Debug/WebFinger.php:52
|
||||
#: src/Module/Debug/WebFinger.php:50
|
||||
msgid "Webfinger Diagnostic"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Debug/WebFinger.php:54
|
||||
#: src/Module/Debug/WebFinger.php:52
|
||||
msgid "Lookup address:"
|
||||
msgstr ""
|
||||
|
||||
|
@ -8793,11 +8790,11 @@ msgstr ""
|
|||
msgid "Only logged in users are permitted to perform a search."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Search/Index.php:76
|
||||
#: src/Module/Search/Index.php:74
|
||||
msgid "Only one search per minute is permitted for not logged in users."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Search/Index.php:192
|
||||
#: src/Module/Search/Index.php:190
|
||||
#, php-format
|
||||
msgid "Items tagged with: %s"
|
||||
msgstr ""
|
||||
|
@ -9666,60 +9663,11 @@ msgid ""
|
|||
"e.g. Mastodon."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:49
|
||||
msgid "Bad Request"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:51
|
||||
msgid "Forbidden"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:52
|
||||
msgid "Not Found"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:54
|
||||
msgid "Service Unavailable"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:61
|
||||
msgid ""
|
||||
"The server cannot or will not process the request due to an apparent client "
|
||||
"error."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:62
|
||||
msgid "Authentication is required and has failed or has not yet been provided."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:63
|
||||
msgid ""
|
||||
"The request was valid, but the server is refusing action. The user might not "
|
||||
"have the necessary permissions for a resource, or may need an account."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:64
|
||||
msgid ""
|
||||
"The requested resource could not be found but may be available in the future."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:65
|
||||
msgid ""
|
||||
"An unexpected condition was encountered and no more specific message is "
|
||||
"suitable."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:66
|
||||
msgid ""
|
||||
"The server is currently unavailable (because it is overloaded or down for "
|
||||
"maintenance). Please try again later."
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:76
|
||||
msgid "Stack trace:"
|
||||
msgstr ""
|
||||
|
||||
#: src/Module/Special/HTTPException.php:80
|
||||
#: src/Module/Special/HTTPException.php:55
|
||||
#, php-format
|
||||
msgid "Exception thrown in %s:%d"
|
||||
msgstr ""
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\NotModifiedException;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
require_once 'view/theme/frio/theme.php';
|
||||
|
@ -225,8 +226,7 @@ if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MA
|
|||
stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
|
||||
|
||||
if (($cached_modified == $modified) && ($cached_etag == $etag)) {
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
exit();
|
||||
throw new NotModifiedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\NotModifiedException;
|
||||
|
||||
$uid = $_REQUEST['puid'] ?? 0;
|
||||
|
||||
|
@ -67,8 +68,7 @@ if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($_SERVER['HTTP_IF_NONE_MA
|
|||
stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
|
||||
|
||||
if (($cached_modified == $modified) && ($cached_etag == $etag)) {
|
||||
header('HTTP/1.1 304 Not Modified');
|
||||
exit();
|
||||
throw new NotModifiedException();
|
||||
}
|
||||
}
|
||||
echo $stylecss;
|
||||
|
|
Loading…
Reference in a new issue