Returns true if a GeoIP provider is installed & working, false if otherwise.

@return bool
761291
public function isGeoIPWorking()
    {
        $provider = LocationProvider::getCurrentProvider();
        return $provider instanceof GeoIp
        && $provider->isAvailable() === true
        && $provider->isWorking() === true;
    }
953963
public function isAppReadyToInstall() {
		$checkPHPversion = $this->checkPhpVersion();
		if ($checkPHPversion === false) {
			return false;
		}

		$checkPHPextensions = $this->checkPhpExtensions(true);
		if ($checkPHPextensions === false) {
			return false;
		}

		return true;
	}
332840
public static function isLocal($ip)
    {
        $localIpv4Ranges = array(
            '10.*.*.*',
            '127.*.*.*',
            '192.168.*.*',
            '169.254.*.*',
            '172.16.0.0-172.31.255.255',
            '224.*.*.*',
        );

        $localIpv6Ranges = array(
            'fe80::/10',
            '::1/128',
            'fc00::/7'
        );

        if (self::isValidv4($ip)) {
            return self::match($ip, $localIpv4Ranges);
        }

        if (self::isValidv6($ip)) {
            return self::match($ip, $localIpv6Ranges);
        }

        return false;
    }
301215
public static function isIp($ip, $allowIpV4 = true, $allowIpV6 = true) {
        if ($allowIpV6 && $allowIpV4)
            return \filter_var($ip, FILTER_VALIDATE_IP) !== false;
        if (!$allowIpV6 && $allowIpV4)
            return \filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false;
        if ($allowIpV6 && !$allowIpV4)
            return \filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false;
    }
572146
public function isIPBlocked($ip){
        return ($this->isIPBlockedList($ip) || $this->isIPBlockedRange($ip) || $this->isISOBlocked($ip));
    }
1059831
public static function isUsingProxy()
    {
        $proxyHost = self::$global->getProxyHost();
        $proxyPort = self::$global->getProxyPort();
        return !empty($proxyHost) && !empty($proxyPort);
    }
854980
public function hasDefaultPort(): bool
    {
        if (!$this->parsedUri->hasPort()) {
            return true;
        }

        if ($this->isHttp() && $this->parsedUri->portEquals(Http::PORT)) {
            return true;
        }

        if ($this->isHttps() && $this->parsedUri->portEquals(Http::PORT_SSL)) {
            return true;
        }

        return false;
    }
419732
function DetectBada()
   {
      if (stripos($this->useragent, $this->deviceBada) > -1)
         return $this->true; 
      else
         return $this->false; 
   }
88197
public function isAvailable(): bool
    {
        $projectEnvFileExists = false;
        foreach (self::ENV_FILES as $envFile) {
            if (file_exists("{$this->projectRootDir}/{$envFile}")) {
                $projectEnvFileExists = true;
            }
        }

        if (!$projectEnvFileExists) {
            return false;
        }

        $sourceFile = "{$this->packageInstallDir}/.installer/%s/.env";
        foreach ($this->projectType->getProjectDirs() as $projectDir) {
            $envFile = sprintf($sourceFile, $projectDir);
            if (is_file($envFile)) {
                return true;
            }
        }

        return false;
    }
122238
private function isIpBlacklisted()
    {
        $blacklist = $this->config->get('RateLimitBlacklist', [], true);
        if (in_array($this->ip, $blacklist)) {
            return true;
        }

        return false;
    }
675666
private function checkVisitorDataIsReliable()
    {
        $data = $this->getVisitorData();

        foreach (['user_id', 'client_ip', 'user_agent'] as $key) {
            if ($this->checkDataIsUnreliable($data, $key)) return false;
        }

        return true;
    }
583105
public function isPrivate()
    {
        if (!$this->isIpSet()) {
            throw new \Exception('No IP Set');
        }
        if (
            ($this->isIPv4() &&
                (strpos($this->ipHex, '0a') === 0 //10.0.0.0/8
                || strpos($this->ipHex, 'ac1') === 0 //172.16.0.0/12
                || strpos($this->ipHex, 'c0a8') === 0 //192.168.0.0/16
                )
            )
            ||
            ($this->isIPv6() &&
                (strpos($this->ipHex, 'fc') === 0 //fc00::/7
                || strpos($this->ipHex, 'fd') === 0 //fd00::/7
                || strpos($this->ipHex, 'ffff0a') === 20 //::ffff:10.0.0.0/8
                || strpos($this->ipHex, 'ffffac1') === 20 //::ffff:172.16.0.0/12
                || strpos($this->ipHex, 'ffffc0a8') === 20 //::ffff:192.168.0.0/16
                )
            )
        ) {
            return true;
        }

        return false;
    }
526757
private function i2c()
	{
		if($this->ip && ! $this->returnLocationData['latitude']) {

            $this->method = 'POST';

			$this->updateResponseWithResults($this->gateway($this->createGeoUrl()));

			if($this->shouldRunC2A) {
				$this->c2a();
			}

			return true;
		}
	}
1189883
public function isWorking()
    {
        // test with an example IP to make sure the provider is working
        // NOTE: At the moment only country, region & city info is tested.
        try {
            $supportedInfo = $this->getSupportedLocationInfo();

            list($testIp, $expectedResult) = self::getTestIpAndResult();

            // get location using test IP
            $location = $this->getLocation(array('ip' => $testIp));

            // check that result is the same as expected
            $isResultCorrect = true;
            foreach ($expectedResult as $key => $value) {
                // if this provider is not configured to support this information type, skip it
                if (empty($supportedInfo[$key])) {
                    continue;
                }

                if (empty($location[$key])
                    || $location[$key] != $value
                ) {
                    $isResultCorrect = false;
                }
            }

            if (!$isResultCorrect) {
                $unknown = Piwik::translate('General_Unknown');

                $location = "'"
                    . (empty($location[self::CITY_NAME_KEY]) ? $unknown : $location[self::CITY_NAME_KEY])
                    . ", "
                    . (empty($location[self::REGION_CODE_KEY]) ? $unknown : $location[self::REGION_CODE_KEY])
                    . ", "
                    . (empty($location[self::COUNTRY_CODE_KEY]) ? $unknown : $location[self::COUNTRY_CODE_KEY])
                    . "'";

                $expectedLocation = "'" . $expectedResult[self::CITY_NAME_KEY] . ", "
                    . $expectedResult[self::REGION_CODE_KEY] . ", "
                    . $expectedResult[self::COUNTRY_CODE_KEY] . "'";

                $bind = array($testIp, $location, $expectedLocation);
                return Piwik::translate('UserCountry_TestIPLocatorFailed', $bind);
            }

            return true;
        } catch (Exception $ex) {
            return $ex->getMessage();
        }
    }
508906
protected function checkIPv6($UserIP = false)
	{
		// Check if IP present
		if ($UserIP === false)
		{
			return false; // No IP, no search.
		}
		// search for user bot IP-filter definitions in localconfig.php
		if (isset($GLOBALS['DLSTATS']['BOT_IPV6']))
		{
			foreach ($GLOBALS['DLSTATS']['BOT_IPV6'] as $lineleft)
			{
				$network = explode("/", trim($lineleft));
				if (! isset($network[1]))
				{
					$network[1] = 128;
				}
				if ($this->dlstatsIPv6InNetwork($UserIP, $network[0], $network[1]))
				{
					return true; // IP found
				}
			}
		}
		return false;
	}
1277087
public static function isEnabled()
    {
        if ( eZINI::instance()->variable( 'SiteAccessSettings', 'DetectMobileDevice' ) === 'enabled' )
        {
            $mobileSaList = eZINI::instance()->variable( 'SiteAccessSettings', 'MobileSiteAccessList' );

            if ( !empty( $mobileSaList ) )
            {
                return true;
            }
            else
            {
                eZDebug::writeError(
                    "DetectMobileDevice is enabled and MobileSiteAccessList is empty, please check your site.ini configuration",
                    __METHOD__
                );
            }
        }

        return false;
    }
493558
public static function isLocal(string $ip = null)
    {
        if (is_null($ip)) {
            $ip = self::get();
        }

        if (stripos($ip, '127.') !== false) {
            return true;
        }

        return !(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) == $ip);
    }