| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- /**
- * Error page file.
- *
- * Provides a class with all the properties and methods to display the page.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- */
- require_once(PATH::PAGE . "Page.php");
- /**
- * Error page model.
- *
- * @category Page
- */
- class Error_Page extends Page{
- /**
- * @var int Error code.
- */
- private $code = 500;
-
- /**
- * @var string Error description.
- */
- private $message = "";
- /**
- * Constructor.
- *
- * Retrieves the data and initializes the variables.
- *
- * @param int $code HTTP Error code. Optional, default 500.
- */
- public function __construct($code = null){
- $this->view = PATH::VIEW . "error.php";
- $this->title = "Error - SWDB";
- if (null == $code || intval($code) < 200 || intval($code) > 599){
- $code = 500;
- }
- switch(intval($code)){
- case 400:
- $this->message = "Invalid request";
- break;
- case 404:
- $this->message = "Not found";
- break;
- case 500:
- $this->message = "Server error";
- break;
- default:
- $this->message = "Unknown error";
- }
- $this->code = intval($code);
- }
- /**
- * Retrieves the error code.
- *
- * @return int HTTP error code
- */
- public function get_code(){
- return $this->code;
- }
-
- /**
- * Retrieves the error description.
- *
- * @return int HTTP error description.
- */
- public function get_message(){
- return $this->message;
- }
- }
|