1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- class ClientErrorAction extends ErrorAction
- {
- static $status = array(400 => 'Bad Request',
- 401 => 'Unauthorized',
- 402 => 'Payment Required',
- 403 => 'Forbidden',
- 404 => 'Not Found',
- 405 => 'Method Not Allowed',
- 406 => 'Not Acceptable',
- 407 => 'Proxy Authentication Required',
- 408 => 'Request Timeout',
- 409 => 'Conflict',
- 410 => 'Gone',
- 411 => 'Length Required',
- 412 => 'Precondition Failed',
- 413 => 'Request Entity Too Large',
- 414 => 'Request-URI Too Long',
- 415 => 'Unsupported Media Type',
- 416 => 'Requested Range Not Satisfiable',
- 417 => 'Expectation Failed');
- function __construct($message='Error', $code=400)
- {
- parent::__construct($message, $code);
- $this->default = 400;
- if (!$this->code || $this->code < 400 || $this->code > 499) {
- $this->code = $this->default;
- }
- if (!$this->message) {
- $this->message = "Client Error $this->code";
- }
- }
-
- function extraHeaders()
- {
- $status_string = @self::$status[$this->code];
- header('HTTP/1.1 '.$this->code.' '.$status_string);
- }
-
- function title()
- {
- return @self::$status[$this->code];
- }
- }
|