From 778cb1bbe477c7703c5c7a4d112e362091409c0f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 17 Mar 2021 10:49:20 +0100 Subject: [locations/rebootcontrol] Formatting --- modules-available/locations/pages/details.inc.php | 30 ++++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'modules-available/locations/pages') diff --git a/modules-available/locations/pages/details.inc.php b/modules-available/locations/pages/details.inc.php index fd45646b..e400d492 100644 --- a/modules-available/locations/pages/details.inc.php +++ b/modules-available/locations/pages/details.inc.php @@ -93,10 +93,16 @@ class SubPage $options = array(); // Sanity checks - if ($woloffset > 15) $woloffset = 15; - else if ($woloffset < 0) $woloffset = 0; - if ($sdoffset > 15) $sdoffset = 15; - else if ($sdoffset < 0) $sdoffset = 0; + if ($woloffset > 15) { + $woloffset = 15; + } elseif ($woloffset < 0) { + $woloffset = 0; + } + if ($sdoffset > 15) { + $sdoffset = 15; + } elseif ($sdoffset < 0) { + $sdoffset = 0; + } // Set options $options['wol'] = $wol; @@ -115,8 +121,10 @@ class SubPage private static function getTime($str) { $str = explode(':', $str); - if (count($str) !== 2) return false; - if ($str[0] < 0 || $str[0] > 23 || $str[1] < 0 || $str[1] > 59) return false; + if (count($str) !== 2) + return false; + if ($str[0] < 0 || $str[0] > 23 || $str[1] < 0 || $str[1] > 59) + return false; return $str[0] * 60 + $str[1]; } @@ -407,7 +415,8 @@ class SubPage echo Render::parse('location-subnets', $data); } - private static function ajaxOpeningTimes($id) { + private static function ajaxOpeningTimes($id) + { User::assertPermission('location.edit', $id); $openTimes = Database::queryFirst("SELECT openingtime FROM `location` WHERE locationid = :id", array('id' => $id)); if ($openTimes !== false) { @@ -424,13 +433,16 @@ class SubPage $data['rebootcontrol'] = $rebootcontrol; if ($rebootcontrol) { $res = Database::queryFirst("SELECT * FROM `reboot_scheduler` WHERE locationid = :id", array('id' => $id)); - if ($res !== false) $data['scheduler-options'] = json_decode($res['options']); + if ($res !== false) { + $data['scheduler-options'] = json_decode($res['options']); + } } echo Render::parse('ajax-opening-location', $data); } - private static function isSimpleMode(&$array) { + private static function isSimpleMode(&$array) + { if (empty($array)) return true; // Decompose by day -- cgit v1.2.3-55-g7522