diff options
author | Simon Rettberg | 2023-11-02 19:08:58 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-11-02 19:08:58 +0100 |
commit | c2d95ffaeaa289752b4c7b6664b6ca112a02e350 (patch) | |
tree | 2c29b0157d14198aadbdbc9f8c18ded0bd4dadcd /modules-available/locations/pages | |
parent | [rebootcontrol] Remove API prototype (diff) | |
download | slx-admin-c2d95ffaeaa289752b4c7b6664b6ca112a02e350.tar.gz slx-admin-c2d95ffaeaa289752b4c7b6664b6ca112a02e350.tar.xz slx-admin-c2d95ffaeaa289752b4c7b6664b6ca112a02e350.zip |
Roundup of issues reported by PHPStorm
Mostly redundant checks, logic errors, dead code, etc.
Diffstat (limited to 'modules-available/locations/pages')
-rw-r--r-- | modules-available/locations/pages/details.inc.php | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/modules-available/locations/pages/details.inc.php b/modules-available/locations/pages/details.inc.php index 77f96221..e75aaf7d 100644 --- a/modules-available/locations/pages/details.inc.php +++ b/modules-available/locations/pages/details.inc.php @@ -57,7 +57,7 @@ class SubPage $mangled = array(); foreach (array_keys($openingTimes) as $key) { $entry = $openingTimes[$key]; - if (!isset($entry['days']) || !is_array($entry['days']) || empty($entry['days'])) { + if (empty($entry['days']) || !is_array($entry['days'])) { Message::addError('ignored-line-no-days'); continue; } @@ -222,8 +222,6 @@ class SubPage if (!User::hasPermission('location.edit.subnets', $locationId)) return false; - $change = false; - // Deletion first $dels = Request::post('deletesubnet', false); $deleteCount = 0; @@ -242,8 +240,9 @@ class SubPage $starts = Request::post('startaddr', false); $ends = Request::post('endaddr', false); if (!is_array($starts) || !is_array($ends)) { - return $change; + return false; } + $change = false; $editCount = 0; $stmt = Database::prepare('UPDATE subnet SET startaddr = :start, endaddr = :end' . ' WHERE subnetid = :id'); @@ -282,12 +281,12 @@ class SubPage if (!User::hasPermission('location.edit.subnets', $locationId)) return false; - $change = false; $starts = Request::post('newstartaddr', false); $ends = Request::post('newendaddr', false); if (!is_array($starts) || !is_array($ends)) { - return $change; + return false; } + $change = false; $count = 0; $stmt = Database::prepare('INSERT INTO subnet SET startaddr = :start, endaddr = :end, locationid = :location'); foreach ($starts as $key => $start) { @@ -537,7 +536,7 @@ class SubPage // $start must lie before range start, otherwise we'd have hit the case above $e = $current[1]; unset($array[$day][$key]); - continue; + //continue; } } $array[$day][] = array($s, $e); |