| | |
| | | /** |
| | | * View class to produce JSON responses |
| | | * |
| | | * @package Core |
| | | * @package Webmail |
| | | * @subpackage View |
| | | */ |
| | | class rcmail_output_json extends rcmail_output |
| | |
| | | */ |
| | | public function raise_error($code, $message) |
| | | { |
| | | if ($code == 403) { |
| | | header('HTTP/1.1 403 Forbidden'); |
| | | die("Invalid Request"); |
| | | } |
| | | |
| | | $this->show_message("Application Error ($code): $message", 'error'); |
| | | $this->remote_response(); |
| | | exit; |
| | |
| | | if (!empty($this->callbacks)) |
| | | $response['callbacks'] = $this->callbacks; |
| | | |
| | | // trigger generic hook where plugins can put additional content to the response |
| | | $hook = $this->app->plugins->exec_hook("render_response", array('response' => $response)); |
| | | |
| | | // save some memory |
| | | $response = $hook['response']; |
| | | unset($hook['response']); |
| | | |
| | | echo self::json_serialize($response); |
| | | } |
| | | |