Gazelle/sections/error/index.php

66 lines
1.9 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
function notify ($Channel, $Message) {
global $LoggedUser;
2012-10-11 08:00:15 +00:00
send_irc("PRIVMSG ".$Channel." :".$Message." error by ".(!empty($LoggedUser['ID']) ? "https://".SSL_SITE_URL."/user.php?id=".$LoggedUser['ID'] ." (".$LoggedUser['Username'].")" : $_SERVER['REMOTE_ADDR']." (".Tools::geoip($_SERVER['REMOTE_ADDR']).")")." accessing https://".SSL_SITE_URL."".$_SERVER['REQUEST_URI'].(!empty($_SERVER['HTTP_REFERER'])? " from ".$_SERVER['HTTP_REFERER'] : ''));
2011-03-28 14:21:28 +00:00
}
$Errors = array('403','404','413','504');
2013-05-04 08:00:48 +00:00
if (!empty($_GET['e']) && in_array($_GET['e'],$Errors)) {
// Web server error i.e. http://sitename/madeupdocument.php
2011-03-28 14:21:28 +00:00
include($_GET['e'].'.php');
} else {
2013-05-04 08:00:48 +00:00
// Gazelle error (Come from the error() function)
2011-03-28 14:21:28 +00:00
switch ($Error) {
case '403':
$Title = "Error 403";
$Description = "You just tried to go to a page that you don't have enough permission to view.";
notify(STATUS_CHAN,'403');
break;
case '404':
$Title = "Error 404";
2012-09-09 08:00:26 +00:00
$Description = "You just tried to go to a page that doesn't exist.";
2011-03-28 14:21:28 +00:00
break;
case '0':
$Title = "Invalid Input";
2012-09-09 08:00:26 +00:00
$Description = "Something was wrong with the input provided with your request, and the server is refusing to fulfill it.";
2011-03-28 14:21:28 +00:00
notify(STATUS_CHAN,'PHP-0');
break;
case '-1':
$Title = "Invalid request";
2012-09-09 08:00:26 +00:00
$Description = "Something was wrong with your request, and the server is refusing to fulfill it.";
2011-03-28 14:21:28 +00:00
break;
default:
2013-05-04 08:00:48 +00:00
if (!empty($Error)) {
2011-03-28 14:21:28 +00:00
$Title = 'Error';
$Description = $Error;
} else {
$Title = "Unexpected Error";
$Description = "You have encountered an unexpected error.";
}
}
2013-05-04 08:00:48 +00:00
if ($Log) {
2012-08-16 08:00:18 +00:00
$Description .= ' <a href="log.php?search='.$Log.'">Search Log</a>';
}
2013-05-04 08:00:48 +00:00
if (empty($Ajax) && $Error != -1) {
2012-10-11 08:00:15 +00:00
View::show_header($Title);
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2><?=$Title?></h2>
</div>
2011-03-28 14:21:28 +00:00
<div class="box pad">
<p><?=$Description?></p>
</div>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
} else {
echo $Description;
}
}