MRBS 1.12.2 等保2.0二级整改完整提交
包含:登录失败锁定、90天密码有效期、30分钟会话超时、 强制改密、登录审计日志、屏幕水印、企业背景图、 备案信息固定底部、favicon、JS空集合保护、 会话过期体验优化(403 JSON)、display_errors 关闭、 固定 key 根治 Integrity check failed 等全部改动 注意:config.inc.php/.htaccess/.user.ini 含敏感信息, 通过 .gitignore 排除,勿推送到公开仓库。
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
namespace MRBS\Form;
|
||||
|
||||
|
||||
use function MRBS\toTimeString;
|
||||
|
||||
class FieldTimeWithUnits extends FieldDiv
|
||||
{
|
||||
|
||||
// Constructs a field that has an enabling checkbox and then inputs for
|
||||
// the quantity and units of time.
|
||||
//
|
||||
// $param_names An array of the parameter names, indexed by
|
||||
// 'enabler', 'quantity' and 'seconds'
|
||||
// $enabled The current value of the enabling checkbox
|
||||
// $seconds The current value of the field, in seconds
|
||||
// $suffix Optional text that can appear after the units
|
||||
// $input_attributes Optional array of additional attributes for the input
|
||||
public function __construct(array $param_names, $enabled, $seconds, $suffix=null, ?array $input_attributes=null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Convert the raw seconds into as large a unit as possible
|
||||
$duration = $seconds;
|
||||
toTimeString($duration, $units);
|
||||
|
||||
// The checkbox, which enables or disables the field
|
||||
$checkbox = new ElementInputCheckbox();
|
||||
$checkbox->setAttributes(array('name' => $param_names['enabler'],
|
||||
'class' => 'enabler'))
|
||||
->setChecked($enabled);
|
||||
$this->addControlElement($checkbox);
|
||||
|
||||
// The quantity element
|
||||
$input = new ElementInputNumber();
|
||||
$attributes = array('name' => $param_names['quantity'],
|
||||
'value' => $duration);
|
||||
if (isset($input_attributes))
|
||||
{
|
||||
$attributes = array_merge($attributes, $input_attributes);
|
||||
}
|
||||
$input->setAttributes($attributes);
|
||||
$this->addControlElement($input);
|
||||
|
||||
// The select element for the units
|
||||
$options = Form::getTimeUnitOptions();
|
||||
$select = new ElementSelect();
|
||||
$select->setAttribute('name', $param_names['units'])
|
||||
->addSelectOptions($options, array_search($units, $options), true);
|
||||
$this->addControlElement($select);
|
||||
|
||||
// The suffix
|
||||
if (isset($suffix))
|
||||
{
|
||||
$span = new ElementSpan();
|
||||
$span->setText($suffix);
|
||||
$this->addControlElement($span);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user