From 23ba48c71f0d41bbe012d668349f6516dad527b4 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 5 Sep 2025 09:56:46 -0400 Subject: Change how files are included (#7916) 1. `include`, `include_once`, `require` and `require_once` are expressions not functions, parentheses are not necessary. 2. to move up the directory tree, it's better to use the `dirname` function instead of relying on `/..`. --- p/api/fever.php | 6 +++--- p/api/greader.php | 4 ++-- p/api/index.php | 4 ++-- p/api/misc.php | 4 ++-- p/api/pshb.php | 4 ++-- p/api/query.php | 6 +++--- p/ext.php | 6 +++--- p/f.php | 8 ++++---- p/i/index.php | 8 ++++---- p/index.php | 4 ++-- 10 files changed, 27 insertions(+), 27 deletions(-) (limited to 'p') diff --git a/p/api/fever.php b/p/api/fever.php index 92ddb82b8..01e6d7b61 100644 --- a/p/api/fever.php +++ b/p/api/fever.php @@ -16,8 +16,8 @@ header('X-Content-Type-Options: nosniff'); // ================================================================================================ // BOOTSTRAP FreshRSS -require(__DIR__ . '/../../constants.php'); -require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader +require dirname(__DIR__, 2) . '/constants.php'; +require LIB_PATH . '/lib_rss.php'; //Includes class autoloader FreshRSS_Context::initSystem(); // check if API is enabled globally @@ -355,7 +355,7 @@ final class FeverAPI return []; } - require_once(LIB_PATH . '/favicons.php'); + require_once LIB_PATH . '/favicons.php'; $favicons = []; $salt = FreshRSS_Context::systemConf()->salt; diff --git a/p/api/greader.php b/p/api/greader.php index 40fb5dc72..88afb3656 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -25,8 +25,8 @@ Server-side API compatible with Google Reader API layer 2 * https://github.com/bazqux/bazqux-api */ -require(__DIR__ . '/../../constants.php'); -require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader +require dirname(__DIR__, 2) . '/constants.php'; +require LIB_PATH . '/lib_rss.php'; //Includes class autoloader header("Content-Security-Policy: default-src 'none'; frame-ancestors 'none'; sandbox"); header('X-Content-Type-Options: nosniff'); diff --git a/p/api/index.php b/p/api/index.php index def8d4890..1db1273dc 100644 --- a/p/api/index.php +++ b/p/api/index.php @@ -13,8 +13,8 @@