From ee6f4b64a91d76070f930cdf7602ab4686714c7a Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Fri, 6 Jan 2017 18:54:29 +0100 Subject: [PATCH] Cleanup: use safe boolean comparisons Signed-off-by: VirtualTam --- application/HttpUtils.php | 2 +- application/LinkUtils.php | 4 +++- application/Updater.php | 2 +- index.php | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/application/HttpUtils.php b/application/HttpUtils.php index e8fc1f5d..a81f9056 100644 --- a/application/HttpUtils.php +++ b/application/HttpUtils.php @@ -122,7 +122,7 @@ function get_http_response($url, $timeout = 30, $maxBytes = 4194304) $content = substr($response, $headSize); $headers = array(); foreach (preg_split('~[\r\n]+~', $rawHeadersLastRedir) as $line) { - if (empty($line) or ctype_space($line)) { + if (empty($line) || ctype_space($line)) { continue; } $splitLine = explode(': ', $line, 2); diff --git a/application/LinkUtils.php b/application/LinkUtils.php index cf58f808..976474de 100644 --- a/application/LinkUtils.php +++ b/application/LinkUtils.php @@ -89,7 +89,9 @@ function count_private($links) { $cpt = 0; foreach ($links as $link) { - $cpt = $link['private'] == true ? $cpt + 1 : $cpt; + if ($link['private']) { + $cpt += 1; + } } return $cpt; diff --git a/application/Updater.php b/application/Updater.php index 621c7238..704ce7ab 100644 --- a/application/Updater.php +++ b/application/Updater.php @@ -69,7 +69,7 @@ class Updater return $updatesRan; } - if ($this->methods == null) { + if ($this->methods === null) { throw new UpdaterException('Couldn\'t retrieve Updater class methods.'); } diff --git a/index.php b/index.php index e553d1dd..a54dfb1d 100644 --- a/index.php +++ b/index.php @@ -204,7 +204,7 @@ function setup_login_state($conf) } // If session does not exist on server side, or IP address has changed, or session has expired, logout. if (empty($_SESSION['uid']) - || ($conf->get('security.session_protection_disabled') == false && $_SESSION['ip'] != allIPs()) + || ($conf->get('security.session_protection_disabled') === false && $_SESSION['ip'] != allIPs()) || time() >= $_SESSION['expires_on']) { logout(); -- 2.41.0