diff options
author | Alexandre Alapetite <alexandre@alapetite.fr> | 2023-12-18 17:59:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-18 17:59:16 +0100 |
commit | a80a5f48a16e7d232168a7aaa68e9a1804235ce1 (patch) | |
tree | a515b88592629dea7e83b96e26e2452d3f98a98e /lib | |
parent | 6bb45a87268157aab961a6a4a728d9a9bbe043b0 (diff) | |
download | freshrss-a80a5f48a16e7d232168a7aaa68e9a1804235ce1.tar.gz freshrss-a80a5f48a16e7d232168a7aaa68e9a1804235ce1.zip |
Pass PHPStan level 8 (#5946)
* Pass PHPStan level 8
And prepare for PHPStan level 9 https://phpstan.org/user-guide/rule-levels
* Revert wrong replace in comment
* Fix PHPStan level 8
* Update PHPStan and other dev dependencies
* Remove obsolete comment
* noVariableVariables and towards bleedingEdge
https://github.com/phpstan/phpstan-strict-rules
https://phpstan.org/blog/what-is-bleeding-edge
* More bleedingEdge
* A bit more PHPStan level 9
* More PHPStan level 9
* Prepare for booleansInConditions
Ignore int and null
* Revert wrong line
* More fixes
* Fix keep_max_n_unread
* Stricter attribute functions
* Stricter callHooks and more PHPStan level 9
* More typing
* A tiny more
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Minz/Configuration.php | 4 | ||||
-rw-r--r-- | lib/Minz/Extension.php | 100 | ||||
-rw-r--r-- | lib/Minz/ExtensionManager.php | 14 | ||||
-rw-r--r-- | lib/Minz/Helper.php | 6 | ||||
-rw-r--r-- | lib/Minz/ModelPdo.php | 2 | ||||
-rw-r--r-- | lib/Minz/Request.php | 10 | ||||
-rw-r--r-- | lib/Minz/Session.php | 2 | ||||
-rw-r--r-- | lib/Minz/Translate.php | 7 | ||||
-rw-r--r-- | lib/Minz/Url.php | 10 | ||||
-rw-r--r-- | lib/Minz/View.php | 2 | ||||
-rw-r--r-- | lib/favicons.php | 5 | ||||
-rw-r--r-- | lib/lib_install.php | 9 | ||||
-rw-r--r-- | lib/lib_rss.php | 33 |
13 files changed, 104 insertions, 100 deletions
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 1aa4cae86..18fa6e7df 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -6,8 +6,8 @@ declare(strict_types=1); * @property string $base_url * @property array{'type':string,'host':string,'user':string,'password':string,'base':string,'prefix':string, * 'connection_uri_params':string,'pdo_options':array<int,int|string|bool>} $db - * @property-read string $disable_update - * @property-read string $environment + * @property bool $disable_update + * @property string $environment * @property array<string,bool> $extensions_enabled * @property-read string $mailer * @property-read array{'hostname':string,'host':string,'auth':bool,'username':string,'password':string,'secure':string,'port':int,'from':string} $smtp diff --git a/lib/Minz/Extension.php b/lib/Minz/Extension.php index a8f883eb6..5386a64e7 100644 --- a/lib/Minz/Extension.php +++ b/lib/Minz/Extension.php @@ -19,8 +19,6 @@ abstract class Minz_Extension { private $version; /** @var 'system'|'user' */ private $type; - /** @var string */ - private $config_key = 'extensions'; /** @var array<string,mixed>|null */ private $user_configuration; /** @var array<string,mixed>|null */ @@ -175,8 +173,11 @@ abstract class Minz_Extension { $mtime = @filemtime("{$this->path}/static/{$filename}"); } else { $username = Minz_User::name(); - $path = USERS_PATH . "/{$username}/{$this->config_key}/{$this->getName()}/{$filename}"; - $file_name_url = urlencode("{$username}/{$this->config_key}/{$this->getName()}/{$filename}"); + if ($username == null) { + return ''; + } + $path = USERS_PATH . "/{$username}/extensions/{$this->getName()}/{$filename}"; + $file_name_url = urlencode("{$username}/extensions/{$this->getName()}/{$filename}"); $mtime = @filemtime($path); } @@ -224,8 +225,8 @@ abstract class Minz_Extension { } switch ($type) { - case 'system': return FreshRSS_Context::$system_conf !== null; - case 'user': return FreshRSS_Context::$user_conf !== null; + case 'system': return FreshRSS_Context::hasSystemConf(); + case 'user': return FreshRSS_Context::hasUserConf(); } } @@ -233,50 +234,40 @@ abstract class Minz_Extension { private function isExtensionConfigured(string $type): bool { switch ($type) { case 'user': - $conf = FreshRSS_Context::$user_conf; + $conf = FreshRSS_Context::userConf(); break; case 'system': - $conf = FreshRSS_Context::$system_conf; + $conf = FreshRSS_Context::systemConf(); break; + default: + return false; } - if ($conf === null || !$conf->hasParam($this->config_key)) { + if (!$conf->hasParam('extensions')) { return false; } - $extensions = $conf->{$this->config_key}; - return array_key_exists($this->getName(), $extensions); - } - - /** - * @phpstan-param 'system'|'user' $type - * @return array<string,mixed> - */ - private function getConfiguration(string $type): array { - if (!$this->isConfigurationEnabled($type)) { - return []; - } - - if (!$this->isExtensionConfigured($type)) { - return []; - } - - $conf = "{$type}_conf"; - return FreshRSS_Context::$$conf->{$this->config_key}[$this->getName()]; + return array_key_exists($this->getName(), $conf->extensions); } /** * @return array<string,mixed> */ public final function getSystemConfiguration(): array { - return $this->getConfiguration('system'); + if ($this->isConfigurationEnabled('system') && $this->isExtensionConfigured('system')) { + return FreshRSS_Context::systemConf()->extensions[$this->getName()]; + } + return []; } /** * @return array<string,mixed> */ public final function getUserConfiguration(): array { - return $this->getConfiguration('user'); + if ($this->isConfigurationEnabled('user') && $this->isExtensionConfigured('user')) { + return FreshRSS_Context::userConf()->extensions[$this->getName()]; + } + return []; } /** @@ -314,17 +305,26 @@ abstract class Minz_Extension { * @param array<string,mixed> $configuration */ private function setConfiguration(string $type, array $configuration): void { - $conf = "{$type}_conf"; + switch ($type) { + case 'system': + $conf = FreshRSS_Context::systemConf(); + break; + case 'user': + $conf = FreshRSS_Context::userConf(); + break; + default: + return; + } - if (FreshRSS_Context::$$conf->hasParam($this->config_key)) { - $extensions = FreshRSS_Context::$$conf->{$this->config_key}; + if ($conf->hasParam('extensions')) { + $extensions = $conf->extensions; } else { $extensions = []; } $extensions[$this->getName()] = $configuration; - FreshRSS_Context::$$conf->{$this->config_key} = $extensions; - FreshRSS_Context::$$conf->save(); + $conf->extensions = $extensions; + $conf->save(); } /** @param array<string,mixed> $configuration */ @@ -341,23 +341,28 @@ abstract class Minz_Extension { /** @phpstan-param 'system'|'user' $type */ private function removeConfiguration(string $type): void { - if (!$this->isConfigurationEnabled($type)) { + if (!$this->isConfigurationEnabled($type) || !$this->isExtensionConfigured($type)) { return; } - if (!$this->isExtensionConfigured($type)) { - return; + switch ($type) { + case 'system': + $conf = FreshRSS_Context::systemConf(); + break; + case 'user': + $conf = FreshRSS_Context::userConf(); + break; + default: + return; } - $conf = "{$type}_conf"; - $extensions = FreshRSS_Context::$$conf->{$this->config_key}; + $extensions = $conf->extensions; unset($extensions[$this->getName()]); if (empty($extensions)) { - $extensions = null; + $extensions = []; } - - FreshRSS_Context::$$conf->{$this->config_key} = $extensions; - FreshRSS_Context::$$conf->save(); + $conf->extensions = $extensions; + $conf->save(); } public final function removeSystemConfiguration(): void { @@ -372,7 +377,7 @@ abstract class Minz_Extension { public final function saveFile(string $filename, string $content): void { $username = Minz_User::name(); - $path = USERS_PATH . "/{$username}/{$this->config_key}/{$this->getName()}"; + $path = USERS_PATH . "/{$username}/extensions/{$this->getName()}"; if (!file_exists($path)) { mkdir($path, 0777, true); @@ -383,7 +388,10 @@ abstract class Minz_Extension { public final function removeFile(string $filename): void { $username = Minz_User::name(); - $path = USERS_PATH . "/{$username}/{$this->config_key}/{$this->getName()}/{$filename}"; + if ($username == null) { + return; + } + $path = USERS_PATH . "/{$username}/extensions/{$this->getName()}/{$filename}"; if (file_exists($path)) { unlink($path); diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.php index e1443b9c3..9d8b94cbd 100644 --- a/lib/Minz/ExtensionManager.php +++ b/lib/Minz/ExtensionManager.php @@ -147,7 +147,7 @@ final class Minz_ExtensionManager { $meta_raw_content = file_get_contents($metadata_filename) ?: ''; /** @var array{'name':string,'entrypoint':string,'path':string,'author'?:string,'description'?:string,'version'?:string,'type'?:'system'|'user'}|null $meta_json */ $meta_json = json_decode($meta_raw_content, true); - if (!$meta_json || !self::isValidMetadata($meta_json)) { + if (!is_array($meta_json) || !self::isValidMetadata($meta_json)) { // metadata.json is not a json file? Invalid! // or metadata.json is invalid (no required information), invalid! Minz_Log::warning('`' . $metadata_filename . '` is not a valid metadata file'); @@ -347,9 +347,9 @@ final class Minz_ExtensionManager { call_user_func($function, ...$args); } } elseif ($signature === 'NoneToString') { - return self::callNoneToString($hook_name); + return self::callHookString($hook_name); } elseif ($signature === 'NoneToNone') { - self::callNoneToNone($hook_name); + self::callHookVoid($hook_name); } return; } @@ -391,9 +391,9 @@ final class Minz_ExtensionManager { * @param string $hook_name is the hook to call. * @return string concatenated result of the call to all the hooks. */ - private static function callNoneToString(string $hook_name): string { + public static function callHookString(string $hook_name): string { $result = ''; - foreach (self::$hook_list[$hook_name]['list'] as $function) { + foreach (self::$hook_list[$hook_name]['list'] ?? [] as $function) { $result = $result . call_user_func($function); } return $result; @@ -407,8 +407,8 @@ final class Minz_ExtensionManager { * * @param string $hook_name is the hook to call. */ - private static function callNoneToNone(string $hook_name): void { - foreach (self::$hook_list[$hook_name]['list'] as $function) { + public static function callHookVoid(string $hook_name): void { + foreach (self::$hook_list[$hook_name]['list'] ?? [] as $function) { call_user_func($function); } } diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php index 642b9304c..04539ec40 100644 --- a/lib/Minz/Helper.php +++ b/lib/Minz/Helper.php @@ -19,12 +19,12 @@ class Minz_Helper { * @phpstan-param T $var * @phpstan-return T * - * @param string|array<string> $var - * @return string|array<string> + * @param string|array<mixed> $var + * @return string|array<mixed> */ public static function htmlspecialchars_utf8($var) { if (is_array($var)) { - return array_map(array('Minz_Helper', 'htmlspecialchars_utf8'), $var); + return array_map(['Minz_Helper', 'htmlspecialchars_utf8'], $var); } elseif (is_string($var)) { return htmlspecialchars($var, ENT_COMPAT, 'UTF-8'); } else { diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 69b2357d2..b107d3df9 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -129,7 +129,7 @@ class Minz_ModelPdo { $db = Minz_Configuration::get('system')->db; throw new Minz_PDOConnectionException( - $ex->getMessage(), + $ex === null ? '' : $ex->getMessage(), $db['user'], Minz_Exception::ERROR ); } diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php index 0ac1a9fe3..f39982be1 100644 --- a/lib/Minz/Request.php +++ b/lib/Minz/Request.php @@ -58,7 +58,7 @@ class Minz_Request { } } - /** @return array<string|int,string|array<string,string>> */ + /** @return array<string|int,string|array<string,string|int>> */ public static function paramArray(string $key, bool $specialchars = false): array { if (empty(self::$params[$key]) || !is_array(self::$params[$key])) { return []; @@ -89,8 +89,8 @@ class Minz_Request { } public static function paramInt(string $key): int { - if (!empty(self::$params[$key])) { - return intval(self::$params[$key]); + if (!empty(self::$params[$key]) && is_numeric(self::$params[$key])) { + return (int)self::$params[$key]; } return 0; } @@ -119,7 +119,7 @@ class Minz_Request { * @return array<string> */ public static function paramTextToArray(string $key, array $default = []): array { - if (isset(self::$params[$key])) { + if (isset(self::$params[$key]) && is_string(self::$params[$key])) { return preg_split('/\R/', self::$params[$key]) ?: []; } return $default; @@ -431,7 +431,7 @@ class Minz_Request { if ($ORIGINAL_INPUT == false) { return; } - if (null === $json = json_decode($ORIGINAL_INPUT, true)) { + if (!is_array($json = json_decode($ORIGINAL_INPUT, true))) { return; } diff --git a/lib/Minz/Session.php b/lib/Minz/Session.php index 4553d3083..99b7fef45 100644 --- a/lib/Minz/Session.php +++ b/lib/Minz/Session.php @@ -159,7 +159,7 @@ class Minz_Session { * @param bool $force if false, does not clear the language parameter */ public static function unset_session(bool $force = false): void { - $language = self::param('language'); + $language = self::paramString('language'); if (!self::$volatile) { session_destroy(); diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php index 8f2e2527a..183fa48ca 100644 --- a/lib/Minz/Translate.php +++ b/lib/Minz/Translate.php @@ -186,7 +186,7 @@ class Minz_Translate { /** * Translate a key into its corresponding value based on selected language. * @param string $key the key to translate. - * @param mixed ...$args additional parameters for variable keys. + * @param bool|float|int|string ...$args additional parameters for variable keys. * @return string value corresponding to the key. * If no value is found, return the key itself. */ @@ -211,6 +211,9 @@ class Minz_Translate { // Go through the i18n keys to get the correct translation value. $translates = self::$translates[$top_level]; + if (!is_array($translates)) { + $translates = []; + } $size_group = count($group); $level_processed = 0; $translation_value = $key; @@ -253,7 +256,7 @@ class Minz_Translate { /** * Alias for Minz_Translate::t() * @param string $key - * @param mixed ...$args + * @param bool|float|int|string ...$args */ function _t(string $key, ...$args): string { return Minz_Translate::t($key, ...$args); diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php index 0c17e3ec7..2104759cd 100644 --- a/lib/Minz/Url.php +++ b/lib/Minz/Url.php @@ -72,7 +72,7 @@ class Minz_Url { $and = '&'; } - if (!empty($url['params']['#'])) { + if (!empty($url['params']) && is_array($url['params']) && !empty($url['params']['#'])) { $anchor = '#' . ($encodage === 'html' ? htmlspecialchars($url['params']['#'], ENT_QUOTES, 'UTF-8') : $url['params']['#']); unset($url['params']['#']); } @@ -89,7 +89,7 @@ class Minz_Url { $separator = $and; } - if (isset($url['params'])) { + if (isset($url['params']) && is_array($url['params'])) { unset($url['params']['c']); unset($url['params']['a']); foreach ($url['params'] as $key => $param) { @@ -101,7 +101,7 @@ class Minz_Url { } } - if (!empty($url['#'])) { + if (!empty($url['#']) && is_string($url['#'])) { $uri .= '#' . ($encodage === 'html' ? htmlspecialchars($url['#'], ENT_QUOTES, 'UTF-8') : $url['#']); } @@ -141,7 +141,9 @@ class Minz_Url { */ public static function unserialize(string $url = ''): array { try { - return json_decode(base64_decode($url, true) ?: '', true, JSON_THROW_ON_ERROR) ?? []; + $result = json_decode(base64_decode($url, true) ?: '', true, JSON_THROW_ON_ERROR) ?? []; + /** @var array{'c'?:string,'a'?:string,'params'?:array<string,mixed>} $result */ + return $result; } catch (\Throwable $exception) { return []; } diff --git a/lib/Minz/View.php b/lib/Minz/View.php index f67cf6277..c215ecdab 100644 --- a/lib/Minz/View.php +++ b/lib/Minz/View.php @@ -345,6 +345,8 @@ class Minz_View { public function attributeParams(): void { foreach (Minz_View::$params as $key => $value) { + // TODO: Do not use variable variable (noVariableVariables) + /** @phpstan-ignore-next-line */ $this->$key = $value; } } diff --git a/lib/favicons.php b/lib/favicons.php index 5cf4295f5..df893b309 100644 --- a/lib/favicons.php +++ b/lib/favicons.php @@ -45,9 +45,8 @@ function downloadHttp(string &$url, array $curlOptions = []): string { ]); FreshRSS_Context::initSystem(); - $system_conf = FreshRSS_Context::$system_conf; - if (isset($system_conf)) { - curl_setopt_array($ch, $system_conf->curl_options); + if (FreshRSS_Context::hasSystemConf()) { + curl_setopt_array($ch, FreshRSS_Context::systemConf()->curl_options); } curl_setopt_array($ch, $curlOptions); diff --git a/lib/lib_install.php b/lib/lib_install.php index 720c4bf77..f36d2eaa6 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -77,13 +77,12 @@ function generateSalt(): string { } function initDb(): string { - $conf = FreshRSS_Context::$system_conf; - $db = $conf->db; + $db = FreshRSS_Context::systemConf()->db; if (empty($db['pdo_options'])) { $db['pdo_options'] = []; } $db['pdo_options'][PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; - $conf->db = $db; //TODO: Remove this Minz limitation "Indirect modification of overloaded property" + FreshRSS_Context::systemConf()->db = $db; //TODO: Remove this Minz limitation "Indirect modification of overloaded property" if (empty($db['type'])) { $db['type'] = 'sqlite'; @@ -95,7 +94,7 @@ function initDb(): string { $dbBase = $db['base'] ?? ''; //For first connection, use default database for PostgreSQL, empty database for MySQL / MariaDB: $db['base'] = $db['type'] === 'pgsql' ? 'postgres' : ''; - $conf->db = $db; + FreshRSS_Context::systemConf()->db = $db; try { //First connection without database name to create the database $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); @@ -104,7 +103,7 @@ function initDb(): string { } //Restore final database parameters for auto-creation and for future connections $db['base'] = $dbBase; - $conf->db = $db; + FreshRSS_Context::systemConf()->db = $db; if ($databaseDAO != null) { //Perform database auto-creation $databaseDAO->create(); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 0ab49e25e..e01e8fa81 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -249,22 +249,19 @@ function sensitive_log($log) { * @throws FreshRSS_Context_Exception */ function customSimplePie(array $attributes = array()): SimplePie { - if (FreshRSS_Context::$system_conf === null) { - throw new FreshRSS_Context_Exception('System configuration not initialised!'); - } - $limits = FreshRSS_Context::$system_conf->limits; + $limits = FreshRSS_Context::systemConf()->limits; $simplePie = new SimplePie(); $simplePie->set_useragent(FRESHRSS_USERAGENT); - $simplePie->set_syslog(FreshRSS_Context::$system_conf->simplepie_syslog_enabled); + $simplePie->set_syslog(FreshRSS_Context::systemConf()->simplepie_syslog_enabled); $simplePie->set_cache_name_function('sha1'); $simplePie->set_cache_location(CACHE_PATH); $simplePie->set_cache_duration($limits['cache_duration']); $simplePie->enable_order_by_date(false); - $feed_timeout = empty($attributes['timeout']) ? 0 : (int)$attributes['timeout']; + $feed_timeout = empty($attributes['timeout']) || !is_numeric($attributes['timeout']) ? 0 : (int)$attributes['timeout']; $simplePie->set_timeout($feed_timeout > 0 ? $feed_timeout : $limits['timeout']); - $curl_options = FreshRSS_Context::$system_conf->curl_options; + $curl_options = FreshRSS_Context::systemConf()->curl_options; if (isset($attributes['ssl_verify'])) { $curl_options[CURLOPT_SSL_VERIFYHOST] = $attributes['ssl_verify'] ? 2 : 0; $curl_options[CURLOPT_SSL_VERIFYPEER] = (bool)$attributes['ssl_verify']; @@ -408,11 +405,8 @@ function enforceHttpEncoding(string $html, string $contentType = ''): string { * @param array<string,mixed> $attributes */ function httpGet(string $url, string $cachePath, string $type = 'html', array $attributes = []): string { - if (FreshRSS_Context::$system_conf === null) { - throw new FreshRSS_Context_Exception('System configuration not initialised!'); - } - $limits = FreshRSS_Context::$system_conf->limits; - $feed_timeout = empty($attributes['timeout']) ? 0 : intval($attributes['timeout']); + $limits = FreshRSS_Context::systemConf()->limits; + $feed_timeout = empty($attributes['timeout']) || !is_numeric($attributes['timeout']) ? 0 : intval($attributes['timeout']); $cacheMtime = @filemtime($cachePath); if ($cacheMtime !== false && $cacheMtime > time() - intval($limits['cache_duration'])) { @@ -427,7 +421,7 @@ function httpGet(string $url, string $cachePath, string $type = 'html', array $a cleanCache(CLEANCACHE_HOURS); } - if (FreshRSS_Context::$system_conf->simplepie_syslog_enabled) { + if (FreshRSS_Context::systemConf()->simplepie_syslog_enabled) { syslog(LOG_INFO, 'FreshRSS GET ' . $type . ' ' . SimplePie_Misc::url_remove_credentials($url)); } @@ -462,7 +456,7 @@ function httpGet(string $url, string $cachePath, string $type = 'html', array $a CURLOPT_ENCODING => '', //Enable all encodings ]); - curl_setopt_array($ch, FreshRSS_Context::$system_conf->curl_options); + curl_setopt_array($ch, FreshRSS_Context::systemConf()->curl_options); if (isset($attributes['curl_params']) && is_array($attributes['curl_params'])) { curl_setopt_array($ch, $attributes['curl_params']); @@ -571,10 +565,7 @@ function listUsers(): array { * @return bool true if number of users >= max registrations, false else. */ function max_registrations_reached(): bool { - if (FreshRSS_Context::$system_conf === null) { - throw new FreshRSS_Context_Exception('System configuration not initialised!'); - } - $limit_registrations = FreshRSS_Context::$system_conf->limits['max_registrations']; + $limit_registrations = FreshRSS_Context::systemConf()->limits['max_registrations']; $number_accounts = count(listUsers()); return $limit_registrations > 0 && $number_accounts >= $limit_registrations; @@ -671,10 +662,10 @@ function connectionRemoteAddress(): string { * Check if the client (e.g. last proxy) is allowed to send unsafe headers. * This uses the `TRUSTED_PROXY` environment variable or the `trusted_sources` configuration option to get an array of the authorized ranges, * The connection IP is obtained from the `CONN_REMOTE_ADDR` (if available, to be robust even when using Apache mod_remoteip) or `REMOTE_ADDR` environment variables. - * @return bool, true if the sender’s IP is in one of the ranges defined in the configuration, else false + * @return bool true if the sender’s IP is in one of the ranges defined in the configuration, else false */ function checkTrustedIP(): bool { - if (FreshRSS_Context::$system_conf === null) { + if (!FreshRSS_Context::hasSystemConf()) { return false; } $remoteIp = connectionRemoteAddress(); @@ -686,7 +677,7 @@ function checkTrustedIP(): bool { $trusted = preg_split('/\s+/', $trusted, -1, PREG_SPLIT_NO_EMPTY); } if (!is_array($trusted) || empty($trusted)) { - $trusted = FreshRSS_Context::$system_conf->trusted_sources; + $trusted = FreshRSS_Context::systemConf()->trusted_sources; } foreach ($trusted as $cidr) { if (checkCIDR($remoteIp, $cidr)) { |