Files
mrbs-equbao-2026/standard_vars.inc.php
T
人事系统开发 1ba6efd8ed 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 排除,勿推送到公开仓库。
2026-09-09 16:55:02 +08:00

90 lines
2.4 KiB
PHP

<?php
declare(strict_types=1);
namespace MRBS;
// Gets the standard variables of $day, $month, $year, $area and $room
// Checks that they are valid and assigns sensible defaults if not
// Get the standard form variables
use DateInterval;
$page_date = get_form_var('page_date', 'string');
$view = get_form_var('view', 'string', $default_view ?? 'day');
$view_all = get_form_var('view_all', 'int', empty($default_view_all) ? 0 : 1); // Whether to view all rooms
$year = get_form_var('year', 'int');
$month = get_form_var('month', 'int');
$day = get_form_var('day', 'int');
$area = get_form_var('area', 'int');
$room = get_form_var('room', 'int');
$kiosk = get_form_var('kiosk', 'string');
if (empty($area))
{
$area = get_default_area();
}
if (empty($room))
{
$room = get_default_room($area);
}
// No point in showing all the rooms if there's only one of them. Show
// the normal view (with time slots) instead
if (($view != 'day') && !$always_offer_view_all && count(get_rooms($area)) == 1)
{
$view_all = 0;
}
// Get the settings (resolution, etc.) for this area
get_area_settings($area);
if (isset($page_date) && ($page_date !== ''))
{
if (false === ($page_date_split = split_iso_date($page_date)))
{
if (is_ajax())
{
http_response_code(500);
trigger_error("Ajax: invalid page_date '$page_date'", E_USER_NOTICE);
exit;
}
trigger_error("Invalid page_date '$page_date'", E_USER_NOTICE);
}
else
{
list($year, $month, $day) = $page_date_split;
}
}
$date = new DateTime();
// If we're in kiosk mode and the current time is after the end of the last slot
// then advance to tomorrow - unless we're in periods mode when we don't know
// the actual time of the last slot.
if (isset($kiosk))
{
if (!$enable_periods && ($date->getTimestamp() > get_end_last_slot($date->getMonth(), $date->getDay(), $date->getYear())))
{
$date->add(new DateInterval('P1D'));
}
}
// If we are not in kiosk mode and have been given a date then use that
elseif (!empty($day) && !empty($month) && !empty($year))
{
$date->setDate($year, $month, $day);
}
// Advance to the next non-hidden day
if (!empty($hidden_days) && // Use !empty in case $hidden_days is not set
(count($hidden_days) < 7)) // Avoid an infinite loop
{
while ($date->isHiddenDay())
{
$date->modify('+1 day');
}
}
$day = $date->getDay();
$month = $date->getMonth();
$year = $date->getYear();