mirror of
https://github.com/friendica/friendica
synced 2025-04-20 01:10:10 +00:00
"init" removed, moved error function
This commit is contained in:
parent
28a28517e5
commit
bbc4fe851b
3 changed files with 37 additions and 48 deletions
|
@ -53,10 +53,6 @@ class BaseApi extends BaseModule
|
|||
*/
|
||||
protected static $request = [];
|
||||
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
}
|
||||
|
||||
public static function delete(array $parameters = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||
|
@ -331,6 +327,28 @@ class BaseApi extends BaseModule
|
|||
return api_get_user($contact_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit with error code
|
||||
*
|
||||
* @param int $code
|
||||
* @param string $description
|
||||
* @param string $message
|
||||
* @param string|null $format
|
||||
* @return void
|
||||
*/
|
||||
public static function error(int $code, string $description, string $message, string $format = null)
|
||||
{
|
||||
$error = [
|
||||
'error' => $message ?: $description,
|
||||
'code' => $code . ' ' . $description,
|
||||
'request' => DI::args()->getQueryString()
|
||||
];
|
||||
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $code . ' ' . $description);
|
||||
|
||||
self::exit('status', ['status' => $error], $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs formatted data according to the data type and then exits the execution.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue