Skip to content
Snippets Groups Projects
Commit 65ef71d9 authored by Olav Morken's avatar Olav Morken
Browse files

Added BadRequest error.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@802 44740490-163a-0410-bde0-09ae8108e29a
parent a6cb1de2
No related branches found
No related tags found
No related merge requests found
...@@ -1020,6 +1020,12 @@ $lang = array( ...@@ -1020,6 +1020,12 @@ $lang = array(
'sl' => 'Strani ni bilo mogoče najti. Razlog: %REASON%. Naveden URL strani je bil: %URL%', 'sl' => 'Strani ni bilo mogoče najti. Razlog: %REASON%. Naveden URL strani je bil: %URL%',
'hu' => '%URL% oldal nem található, a következő ok miatt: %REASON% ', 'hu' => '%URL% oldal nem található, a következő ok miatt: %REASON% ',
), ),
'title_BADREQUEST' => array (
'en' => 'Bad request received',
),
'descr_BADREQUEST' => array (
'en' => 'There is an error in the request to this page. The reason was: %REASON%',
),
); );
......
<?php
/**
* Exception which will show a 400 Bad Request error page.
*
* This exception can be thrown from within an module page handler. The user will then be
* shown a 400 Bad Request error page.
*
* @author Olav Morken, UNINETT AS.
* @package simpleSAMLphp
* @version $Id$
*/
class SimpleSAML_Error_BadRequest extends SimpleSAML_Error_Error {
/**
* Reason why this request was invalid.
*/
private $reason;
/**
* Create a new BadRequest error.
*
* @param string $reason Description of why the request was unacceptable.
*/
public function __construct($reason) {
assert('is_string($reason)');
$this->reason = $reason;
parent::__construct(array('BADREQUEST', '%REASON%' => $this->reason));
}
/**
* Retrieve the reason why the request was invalid.
*
* @return string The reason why the request was invalid.
*/
public function getReason() {
return $this->reason;
}
/**
* Set the HTTP return code for this error.
*
* This should be overridden by subclasses who want a different return code than 500 Internal Server Error.
*/
protected function setHTTPCode() {
header('HTTP/1.0 400 Bad Request');
}
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment