From cd55ead3e2810e209b726faca12fa749f6875d0f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sat, 16 Dec 2017 18:33:16 +0100 Subject: Fix A LOT of type problems, logic flaws, uninitialized variables etc. Most of them were found by phpstorm, so I put in some time and went through the list, fixing quite a bunch of them. --- modules-available/locationinfo/frontend/frontendscript.js | 2 +- .../inc/coursebackend/coursebackend_dummy.inc.php | 2 -- modules-available/locationinfo/inc/locationinfo.inc.php | 2 -- modules-available/locationinfo/page.inc.php | 2 +- .../locationinfo/templates/frontend-default.html | 1 + modules-available/locationinfo/templates/page-panels.html | 14 ++++++-------- 6 files changed, 9 insertions(+), 14 deletions(-) (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/frontend/frontendscript.js b/modules-available/locationinfo/frontend/frontendscript.js index cc5c6827..bad6a8ed 100644 --- a/modules-available/locationinfo/frontend/frontendscript.js +++ b/modules-available/locationinfo/frontend/frontendscript.js @@ -45,7 +45,7 @@ function toInt(str) { * @param {Array} globalConfig * @returns {string} printable time */ -function GetTimeDiferenceAsString(a, b, globalConfig = null) { +function GetTimeDiferenceAsString(a, b, globalConfig) { if (!a || !b) { return ""; } diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php index adff8b1b..94c967de 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php @@ -137,5 +137,3 @@ class CourseBackend_Dummy extends CourseBackend } } - -?> diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php index 2ed3622d..e3d7db3d 100644 --- a/modules-available/locationinfo/inc/locationinfo.inc.php +++ b/modules-available/locationinfo/inc/locationinfo.inc.php @@ -11,9 +11,7 @@ class LocationInfo */ public static function getPcState($pc) { - $logintime = (int)$pc['logintime']; $lastseen = (int)$pc['lastseen']; - $lastboot = (int)$pc['lastboot']; $NOW = time(); if ($pc['state'] === 'OFFLINE' && $NOW - $lastseen > 21 * 86400) { diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index c6aa0860..d4a2b35e 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -392,7 +392,7 @@ class Page_LocationInfo extends Page $credentialsOk = $serverInstance->setCredentials($serverid, json_decode($dbresult['credentials'], true)); if ($credentialsOk) { - $connectionOk = $serverInstance->checkConnection(); + $serverInstance->checkConnection(); } LocationInfo::setServerError($serverid, $serverInstance->getError()); diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html index 92cad055..e457f68d 100755 --- a/modules-available/locationinfo/templates/frontend-default.html +++ b/modules-available/locationinfo/templates/frontend-default.html @@ -369,6 +369,7 @@ optional: +