123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ServerErrorAction extends ErrorAction
- {
- static $status = array(500 => 'Internal Server Error',
- 501 => 'Not Implemented',
- 502 => 'Bad Gateway',
- 503 => 'Service Unavailable',
- 504 => 'Gateway Timeout',
- 505 => 'HTTP Version Not Supported');
- function __construct($message='Error', $code=500, $ex=null)
- {
- parent::__construct($message, $code);
- $this->default = 500;
- if (!$this->code || $this->code < 500 || $this->code > 599) {
- $this->code = $this->default;
- }
- if (!$this->message) {
- $this->message = "Server Error $this->code";
- }
-
- $log = "ServerErrorAction: $code $message";
- if ($ex) {
- $log .= "\n" . $ex->getTraceAsString();
- }
- common_log(LOG_ERR, $log);
- $this->showPage();
- }
-
- function extraHeaders()
- {
- $status_string = @self::$status[$this->code];
- header('HTTP/1.1 '.$this->code.' '.$status_string);
- }
-
- function title()
- {
- return @self::$status[$this->code];
- }
- }
|