mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-17 03:04:47 -05:00
33 lines
990 B
PHP
33 lines
990 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Gazelle;
|
|
|
|
class Error403 extends Error {
|
|
public static function error(string $message = ''): never {
|
|
$who = static::$requestContext->viewer()->label();
|
|
$ipaddr = static::$requestContext->viewer()->ipaddr();
|
|
$geoip = new Util\GeoIP();
|
|
Util\Irc::sendMessage(
|
|
IRC_CHAN_STATUS,
|
|
"$who ($ipaddr [{$geoip->countryISO($ipaddr)}]) on {$_SERVER['REQUEST_METHOD']} {$_SERVER['REQUEST_URI']}"
|
|
. (!empty($_SERVER['HTTP_REFERER']) ? " from {$_SERVER['HTTP_REFERER']}" : '')
|
|
. (!empty($message) ? " message '$message'" : '')
|
|
);
|
|
parent::error($message);
|
|
}
|
|
|
|
public static function errorCode(): int {
|
|
return 403;
|
|
}
|
|
|
|
public static function errorLabel(): string {
|
|
return 'Forbidden';
|
|
}
|
|
|
|
public static function errorDescription(): string {
|
|
return "You cannot view something you are not allowed to view.";
|
|
}
|
|
}
|