• R/O
  • SSH
  • HTTPS

jinrousiki: 提交


Commit MetaInfo

修訂2769 (tree)
時間2021-08-16 04:34:53
作者umethyl

Log Message

Number::InRange()

Change Summary

差異

--- trunk/include/functions.php (revision 2768)
+++ trunk/include/functions.php (revision 2769)
@@ -304,6 +304,11 @@
304304 public static function Within($number, $from, $to) {
305305 return $from < $number && $number <= $to;
306306 }
307+
308+ //範囲内 (a < target < b)
309+ public static function InRange($number, $from, $to) {
310+ return $from < $number && $number < $to;
311+ }
307312 }
308313
309314 //-- Switch (bool) 関連 --//
--- trunk/include/html/old_log_html_class.php (revision 2768)
+++ trunk/include/html/old_log_html_class.php (revision 2769)
@@ -112,7 +112,7 @@
112112
113113 if (RQ::Get()->generate_index) {
114114 $max = RQ::Get()->max_room_no;
115- if (is_int($max) && $max > 0 && $room_count > $max) {
115+ if (is_int($max) && Number::InRange($max, 0, $room_count)) {
116116 $room_count = $max;
117117 }
118118 $builder = new PageLinkBuilder('index', RQ::Get()->page, $room_count);
--- trunk/include/role/role_user_class.php (revision 2768)
+++ trunk/include/role/role_user_class.php (revision 2769)
@@ -234,7 +234,7 @@
234234
235235 //難題
236236 public static function IsChallengeLovers(User $user) {
237- return 1 < DB::$ROOM->date && DB::$ROOM->date < 5 && $user->IsRole('challenge_lovers');
237+ return Number::InRange(DB::$ROOM->date, 1, 5) && $user->IsRole('challenge_lovers');
238238 }
239239
240240 //特殊恋人
Show on old repository browser