Changeset 746


Ignore:
Timestamp:
May 31, 2021 1:51:18 AM (3 years ago)
Author:
anonymous
Message:

Add brackets to avoid ambiguity in return value

Location:
trunk/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r743 r746  
    429429            // But not if all DB credentials have been defined already by other means.
    430430            if ($this->cli && '' != $this->getParam('db_auth_file') && (!$this->getParam('db_server') || !$this->getParam('db_name') || !$this->getParam('db_user') || !$this->getParam('db_pass'))) {
    431                 if (false !== $db_auth_file = stream_resolve_include_path($this->getParam('db_auth_file'))) {
     431                if (false !== ($db_auth_file = stream_resolve_include_path($this->getParam('db_auth_file')))) {
    432432                    if (is_readable($db_auth_file)) {
    433433                        $db_auth = json_decode(file_get_contents($db_auth_file), true);
     
    622622
    623623        // Set the application version if defined.
    624         if (false !== $site_version_file = stream_resolve_include_path($this->getParam('site_version_file'))) {
     624        if (false !== ($site_version_file = stream_resolve_include_path($this->getParam('site_version_file')))) {
    625625            if (mb_strpos($site_version_file, '.json') !== false) {
    626626                $version_json = json_decode(trim(file_get_contents($site_version_file)), true);
  • trunk/lib/Currency.inc.php

    r550 r746  
    123123    public function getValue($amount, $base, $target)
    124124    {
    125         if (false !== $rate = $this->getRate($base, $target)) {
     125        if (false !== ($rate = $this->getRate($base, $target))) {
    126126            return abs($rate * $amount);
    127127        } else {
     
    231231            // Fetch XML from ECB <http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml>
    232232            $api_url = 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml';
    233             if (false === $sXML = file_get_contents($api_url)) {
     233            if (false === ($sXML = file_get_contents($api_url))) {
    234234                $app->logMsg(sprintf('Failed to load ECB XML data from: %s', $api_url), LOG_WARNING, __FILE__, __LINE__);
    235235                return false;
    236236            }
    237             if (false === $oXML = simplexml_load_string($sXML)) {
     237            if (false === ($oXML = simplexml_load_string($sXML))) {
    238238                $app->logMsg(sprintf('Failed to decode ECB XML data: %s', truncate($sXML, 200, 'end')), LOG_WARNING, __FILE__, __LINE__);
    239239                return false;
  • trunk/lib/Utilities.inc.php

    r744 r746  
    16271627    $app =& App::getInstance();
    16281628
    1629     if (false === $resolved_filename = stream_resolve_include_path($filename)) {
     1629    if (false === ($resolved_filename = stream_resolve_include_path($filename))) {
    16301630        $app->logMsg(sprintf('JSON file "%s" not found in path "%s"', $filename, get_include_path()), LOG_ERR, __FILE__, __LINE__);
    16311631        return null;
     
    16371637    }
    16381638
    1639     if (null === $data = json_decode(file_get_contents($resolved_filename), $assoc, $depth, $options)) {
     1639    if (null === ($data = json_decode(file_get_contents($resolved_filename), $assoc, $depth, $options))) {
    16401640        $app->logMsg(sprintf('JSON is unparsable: %s', $resolved_filename), LOG_ERR, __FILE__, __LINE__);
    16411641        return null;
     
    17051705        return false;
    17061706    case -5:
    1707         $app->logMsg('IP Intelligence: Banned: no permission or invalid email address', LOG_WARNING, __FILE__, __LINE__);
     1707        $app->logMsg('IP Intelligence: Banned: exceeded query limits, no permission, or invalid email address', LOG_WARNING, __FILE__, __LINE__);
    17081708        return false;
    17091709    case -6:
     
    17111711        return false;
    17121712    default:
    1713         if (!is_numeric($response) || $response < 0 || $response >= $threshold) {
     1713        if (!is_numeric($response) || $response < 0) {
     1714            $app->logMsg(sprintf('IP Intelligence: Unknown status for IP (%s): %s', $response, $ip), LOG_NOTICE, __FILE__, __LINE__);
     1715            return false;
     1716        }
     1717        if ($response >= $threshold) {
    17141718            $app->logMsg(sprintf('IP Intelligence: Bad IP (%s): %s', $response, $ip), LOG_NOTICE, __FILE__, __LINE__);
    17151719            return true;
Note: See TracChangeset for help on using the changeset viewer.