diff options
| author | Simon Rettberg | 2025-07-07 13:37:19 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2025-07-07 13:37:19 +0200 |
| commit | 9a5106c288519b008e0dfe5e85371701af32c0f3 (patch) | |
| tree | fcfdc6efaf16d2ecefb2bc5822324e9324d6f29f /modules-available/dozmod/api.inc.php | |
| parent | [locations] Copy permissions to children when deleting location (diff) | |
| download | slx-admin-9a5106c288519b008e0dfe5e85371701af32c0f3.tar.gz slx-admin-9a5106c288519b008e0dfe5e85371701af32c0f3.tar.xz slx-admin-9a5106c288519b008e0dfe5e85371701af32c0f3.zip | |
[locations] Cleanup Location class
There was a mess of functions which mostly, but not quite, did the same
things. Get rid of a couple of them and fix call sites to use
alternative ones that also fit the job.
While at it, add phpdoc and comments to the remaining functions, trying
to clarify what they were designed for.
Lastly, the return type of functions that retrieve a location id has
been changed from false|int to ?int (nullable types are just nicer).
Diffstat (limited to 'modules-available/dozmod/api.inc.php')
| -rw-r--r-- | modules-available/dozmod/api.inc.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules-available/dozmod/api.inc.php b/modules-available/dozmod/api.inc.php index 5a8f6302..11a542ef 100644 --- a/modules-available/dozmod/api.inc.php +++ b/modules-available/dozmod/api.inc.php @@ -343,7 +343,11 @@ if (substr($ip, 0, 7) === '::ffff:') { /* lookup location id(s) */ $location_ids = Location::getFromIp($ip, true); -$location_ids = Location::getLocationRootChain($location_ids); +if ($location_ids === null) { + $location_ids = []; +} else { + $location_ids = Location::getLocationRootChain($location_ids); +} if ($resource === 'list') { outputLectureXmlForLocation($location_ids); |
