summaryrefslogtreecommitdiffstats
path: root/modules-available/remoteaccess
diff options
context:
space:
mode:
authorSimon Rettberg2023-11-14 14:47:55 +0100
committerSimon Rettberg2023-11-14 14:47:55 +0100
commit06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0 (patch)
tree7e5493b102074672d8cfd8fe1a61e49f080edbe8 /modules-available/remoteaccess
parentUpdate phpstorm config (diff)
downloadslx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.gz
slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.xz
slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.zip
Add function param/return types, fix a lot more phpstorm complaints
Diffstat (limited to 'modules-available/remoteaccess')
-rw-r--r--modules-available/remoteaccess/api.inc.php2
-rw-r--r--modules-available/remoteaccess/baseconfig/getconfig.inc.php11
-rw-r--r--modules-available/remoteaccess/inc/remoteaccess.inc.php2
-rw-r--r--modules-available/remoteaccess/page.inc.php2
4 files changed, 10 insertions, 7 deletions
diff --git a/modules-available/remoteaccess/api.inc.php b/modules-available/remoteaccess/api.inc.php
index ec5fe7ad..ca04eec4 100644
--- a/modules-available/remoteaccess/api.inc.php
+++ b/modules-available/remoteaccess/api.inc.php
@@ -21,7 +21,7 @@ if ($password !== false) {
}
$range = IpUtil::parseCidr(Property::get(RemoteAccess::PROP_ALLOWED_VNC_NET));
-if ($range === false) {
+if ($range === null) {
die('No allowed IP defined');
}
$iplong = ip2long($ip);
diff --git a/modules-available/remoteaccess/baseconfig/getconfig.inc.php b/modules-available/remoteaccess/baseconfig/getconfig.inc.php
index 6403538d..182daef1 100644
--- a/modules-available/remoteaccess/baseconfig/getconfig.inc.php
+++ b/modules-available/remoteaccess/baseconfig/getconfig.inc.php
@@ -1,15 +1,18 @@
<?php
-(function ($machineUuid) {
+/** @var ?string $uuid */
+/** @var ?string $ip */
+
+if ($uuid !== null) {
// Leave clients in any runmode alone
$res = Database::queryFirst('SELECT machineuuid FROM runmode WHERE machineuuid = :uuid',
- ['uuid' => $machineUuid], true);
+ ['uuid' => $uuid], true);
if (is_array($res))
return;
// Locations from closest to furthest (order)
$locationId = ConfigHolder::get('SLX_LOCATIONS');
- if ($locationId === false)
+ if ($locationId === null)
return;
$locationId = (int)$locationId;
$ret = Database::queryFirst("SELECT l.locationid FROM remoteaccess_x_location l
@@ -44,4 +47,4 @@
ConfigHolder::add('SLX_SCREEN_SAVER_GRACE_TIME', '86400', 1000);
// Autologin will never work as the machine is immediately in use and will never get assigned
ConfigHolder::add('SLX_AUTOLOGIN', 'OFF', 10000);
-})($uuid);
+}
diff --git a/modules-available/remoteaccess/inc/remoteaccess.inc.php b/modules-available/remoteaccess/inc/remoteaccess.inc.php
index 7bd0e966..95ca3821 100644
--- a/modules-available/remoteaccess/inc/remoteaccess.inc.php
+++ b/modules-available/remoteaccess/inc/remoteaccess.inc.php
@@ -93,7 +93,7 @@ class RemoteAccess
$NOW = time();
while ($num > 0) {
$list = [];
- for ($i = 0; $i < $num && $row = $res->fetch(); ++$i) {
+ for ($i = 0; $i < $num && ($row = $res->fetch()); ++$i) {
$list[] = $row;
Database::exec("INSERT INTO remoteaccess_machine (machineuuid, password, woltime)
VALUES (:uuid, NULL, :now)
diff --git a/modules-available/remoteaccess/page.inc.php b/modules-available/remoteaccess/page.inc.php
index ee9305dc..ba248b4d 100644
--- a/modules-available/remoteaccess/page.inc.php
+++ b/modules-available/remoteaccess/page.inc.php
@@ -127,7 +127,7 @@ class Page_RemoteAccess extends Page
$last['groups'][] = [
'groupid' => $row['groupid'],
'groupname' => $row['groupname'],
- 'gclass' => $row['active'] ?: 'slx-strike',
+ 'gclass' => $row['active'] ? '' : 'slx-strike',
];
if ($row['active']) {
$last['lclass'] = '';