diff options
author | Simon Rettberg | 2022-04-29 17:38:00 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-04-29 17:38:00 +0200 |
commit | 140062e0b606495f90fd77b8f290987844c79cab (patch) | |
tree | ad32ce72580fa898f447c66316587ee7404e9854 /inc/util.inc.php | |
parent | [baseconfig_bwlp] Add more HDMI outputs for sound card (diff) | |
download | slx-admin-140062e0b606495f90fd77b8f290987844c79cab.tar.gz slx-admin-140062e0b606495f90fd77b8f290987844c79cab.tar.xz slx-admin-140062e0b606495f90fd77b8f290987844c79cab.zip |
[locations/remoteaccess] Add option to veto remoteaccess mode
Remoteaccess mode can now be forced to be disabled for individual
locations in locations module, either unconditionally, or whenever the
openingtimes schedule says the room is open. A reboot will be triggered
whenever the room opens/closes to force clients into the proper runmode.
Diffstat (limited to 'inc/util.inc.php')
-rw-r--r-- | inc/util.inc.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/inc/util.inc.php b/inc/util.inc.php index 81c7d807..c3e70f89 100644 --- a/inc/util.inc.php +++ b/inc/util.inc.php @@ -590,11 +590,23 @@ SADFACE; { $regex = '/ ( - (?: [\x20-\xFF] ){1,100} # ignore lower non-printable range + [\x20-\xFF]{1,100} # ignore lower non-printable range ) | . # anything else /x'; return iconv('MS-ANSI', 'UTF-8', preg_replace($regex, '$1', $string)); } + /** + * Clamp given value into [min, max] range. + */ + public static function clamp(int &$value, int $min, int $max) + { + if ($value < $min) { + $value = $min; + } elseif ($value > $max) { + $value = $max; + } + } + } |