包含:登录失败锁定、90天密码有效期、30分钟会话超时、 强制改密、登录审计日志、屏幕水印、企业背景图、 备案信息固定底部、favicon、JS空集合保护、 会话过期体验优化(403 JSON)、display_errors 关闭、 固定 key 根治 Integrity check failed 等全部改动 注意:config.inc.php/.htaccess/.user.ini 含敏感信息, 通过 .gitignore 排除,勿推送到公开仓库。
86 lines
2.0 KiB
PHP
86 lines
2.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace MRBS;
|
|
|
|
use Psr\Log\LoggerInterface;
|
|
use Psr\Log\LogLevel;
|
|
|
|
// A very basic logger
|
|
class Logger implements LoggerInterface
|
|
{
|
|
|
|
public function emergency($message, array $context = array()) : void
|
|
{
|
|
throw new Exception($message);
|
|
}
|
|
|
|
public function alert($message, array $context = array()) : void
|
|
{
|
|
throw new Exception($message);
|
|
}
|
|
|
|
public function critical($message, array $context = array()) : void
|
|
{
|
|
throw new Exception($message);
|
|
}
|
|
|
|
public function error($message, array $context = array()) : void
|
|
{
|
|
trigger_error($message, E_USER_WARNING);
|
|
}
|
|
|
|
public function warning($message, array $context = array()) : void
|
|
{
|
|
trigger_error($message, E_USER_WARNING);
|
|
}
|
|
|
|
public function notice($message, array $context = array()) : void
|
|
{
|
|
trigger_error($message, E_USER_NOTICE);
|
|
}
|
|
|
|
public function info($message, array $context = array()) : void
|
|
{
|
|
trigger_error($message, E_USER_NOTICE);
|
|
}
|
|
|
|
public function debug($message, array $context = array()) : void
|
|
{
|
|
trigger_error($message, E_USER_NOTICE);
|
|
}
|
|
|
|
public function log($level, $message, array $context = array()) : void
|
|
{
|
|
switch ($level)
|
|
{
|
|
case LogLevel::EMERGENCY:
|
|
$this->emergency($message, $context);
|
|
break;
|
|
case LogLevel::ALERT:
|
|
$this->alert($message, $context);
|
|
break;
|
|
case LogLevel::CRITICAL:
|
|
$this->critical($message, $context);
|
|
break;
|
|
case LogLevel::ERROR:
|
|
$this->error($message, $context);
|
|
break;
|
|
case LogLevel::WARNING:
|
|
$this->warning($message, $context);
|
|
break;
|
|
case LogLevel::NOTICE:
|
|
$this->notice($message, $context);
|
|
break;
|
|
case LogLevel::INFO:
|
|
$this->info($message, $context);
|
|
break;
|
|
case LogLevel::DEBUG:
|
|
$this->debug($message, $context);
|
|
break;
|
|
default:
|
|
throw new \InvalidArgumentException('Unknown log level: ' . $level);
|
|
break;
|
|
}
|
|
}
|
|
}
|