<?php
/**
 * Project:   astat - simple site engine
 * File:        /inc/error.class.php
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @link http://www.astat.org SVN: $URL$
 * @copyright 2009 becast.at
 * @author Bernhard Jaud <bernhard at becast dot at>
 * @package astat core
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @version $Id: 0d04234a85a1ba9319ec7351e5b1a42756b911d9 $
*/
$module["error"]["name"]="Error Class";
$module["error"]["ver"]="0.9.0";

class errorhandler{
	var $type;

	function http_error($type){
		global $core,$session;
		$session->page_begin("Error", FALSE);
		switch($type){
			case 401:
			header("HTTP/1.1 401 Unauthorized");
			return $core->message('Error 401 - Nicht Authorisiert!', 'Du bist nicht Authorisiert um hierauf zuzugreifen.',FALSE);
			break;
			case 403:
			header("HTTP/1.1 403 Forbidden");
			header("Status: 403 Forbidden");
			return $core->message("Error 403 - Verboten", "Der Zugriff ist Verboten.",FALSE);
			break;
			case 404:
			default:
			header("HTTP/1.1 404 Not Found");
			header("Status: 404 Not Found");
			return $core->message('Error 404 - Nicht gefunden', 'Die von Dir angeforderte Seite konnte nicht gefunden werden.<br />Wenn Du dies für einen Fehler h&auml;ltst informiere bitte das Team!',FALSE);
			break;
			case 500:
			header("HTTP/1.1 500 Internal Server Error");
			header("Status: 500 Internal Server Error");
			header("Retry-After: 120");
			return $core->message('Error 500 - Interner Serverfehler', 'Der Server kann die Anfrage wegen eines Fehlers nicht beantworten.',FALSE);
			break;
			case 503:
			header("HTTP/1.1 503 Service Temporarily Unavailable");
			header("Status: 503 Service Temporarily Unavailable");
			header("Retry-After: 120");
			return $core->message("Error 503 - Dienst nicht verf&uuml;gbar", "Der Dienst ist zurzeit nicht verf&uuml;gbar. Grund k&ouml;nnten Wartungsarbeiten oder Kapazitätsprobleme sein, bitte versuche es sp&auml;ter erneut.",FALSE);
			break;
		}
	}
}
?>