]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Cleanup: use safe boolean comparisons
authorVirtualTam <virtualtam@flibidi.net>
Fri, 6 Jan 2017 17:54:29 +0000 (18:54 +0100)
committerVirtualTam <virtualtam+github@flibidi.net>
Sat, 7 Jan 2017 13:37:40 +0000 (14:37 +0100)
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
application/HttpUtils.php
application/LinkUtils.php
application/Updater.php
index.php

index e8fc1f5db45fc4ca11da2793068c373013339614..a81f90565fb3b79349981cadb049de3a2fe2d6aa 100644 (file)
@@ -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);
index cf58f8083355af37e0a9271cf1168823252708dc..976474de721ad14636b9b431f0cec06a8920e120 100644 (file)
@@ -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;
index 621c7238336a4e128187ca576b0d2784aaadcf86..704ce7ab1282ea7a4a262bad13a9c124d4be4750 100644 (file)
@@ -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.');
         }
 
index e553d1ddcfd3564f3a8abdeeb575a9f428ee248b..a54dfb1d06f89231a863cc44fa1e3d8894974569 100644 (file)
--- 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();