aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-12-11 21:11:34 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-12-11 21:11:34 +0100
commit52d09886558361bd818182da9ddc204e83f618ba (patch)
treeb7e6c54c6ae71629b6101ab386b3b43bd32cbb10
parenteca01e366481c73d24d3db8d488a53d38d6ecf5d (diff)
Use __DIR__ for relative include and require
For uniformity, and to avoid having PHP searching in include_path. http://php.net/manual/function.include.php https://github.com/FreshRSS/FreshRSS/pull/1715 https://github.com/FreshRSS/FreshRSS/pull/1711#issuecomment-350581350
-rw-r--r--cli/_cli.php2
-rw-r--r--cli/_update-or-create-user.php2
-rwxr-xr-xcli/actualize-user.php2
-rwxr-xr-xcli/create-user.php2
-rwxr-xr-xcli/db-optimize.php2
-rwxr-xr-xcli/delete-user.php2
-rwxr-xr-xcli/do-install.php2
-rwxr-xr-xcli/export-opml-for-user.php2
-rwxr-xr-xcli/export-zip-for-user.php2
-rwxr-xr-xcli/import-for-user.php2
-rwxr-xr-xcli/list-users.php2
-rwxr-xr-xcli/reconfigure.php2
-rwxr-xr-xcli/update-user.php2
-rwxr-xr-xcli/user-info.php2
-rw-r--r--lib/lib_rss.php4
-rw-r--r--p/api/greader.php2
-rw-r--r--p/api/index.php2
-rw-r--r--p/api/pshb.php2
-rw-r--r--p/ext.php2
-rw-r--r--p/f.php2
-rwxr-xr-xp/i/index.php2
-rw-r--r--tests/bootstrap.php2
22 files changed, 23 insertions, 23 deletions
diff --git a/cli/_cli.php b/cli/_cli.php
index fb35c4afb..72629171c 100644
--- a/cli/_cli.php
+++ b/cli/_cli.php
@@ -3,7 +3,7 @@ if (php_sapi_name() !== 'cli') {
die('FreshRSS error: This PHP script may only be invoked from command line!');
}
-require(dirname(__FILE__) . '/../constants.php');
+require(__DIR__ . '/../constants.php');
require(LIB_PATH . '/lib_rss.php');
require(LIB_PATH . '/lib_install.php');
diff --git a/cli/_update-or-create-user.php b/cli/_update-or-create-user.php
index 15397f1f6..a5960b58a 100644
--- a/cli/_update-or-create-user.php
+++ b/cli/_update-or-create-user.php
@@ -1,5 +1,5 @@
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$params = array(
'user:',
diff --git a/cli/actualize-user.php b/cli/actualize-user.php
index 932c6975c..dd07fc142 100755
--- a/cli/actualize-user.php
+++ b/cli/actualize-user.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$options = getopt('', array(
'user:',
diff --git a/cli/create-user.php b/cli/create-user.php
index 1b6be3153..5bc6c1e6c 100755
--- a/cli/create-user.php
+++ b/cli/create-user.php
@@ -1,7 +1,7 @@
#!/usr/bin/php
<?php
$isUpdate = false;
-require('_update-or-create-user.php');
+require(__DIR__ . '/_update-or-create-user.php');
$username = $options['user'];
if (!FreshRSS_user_Controller::checkUsername($username)) {
diff --git a/cli/db-optimize.php b/cli/db-optimize.php
index 83123a669..39dc97638 100755
--- a/cli/db-optimize.php
+++ b/cli/db-optimize.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$options = getopt('', array(
'user:',
diff --git a/cli/delete-user.php b/cli/delete-user.php
index baa81b893..30cc31754 100755
--- a/cli/delete-user.php
+++ b/cli/delete-user.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$options = getopt('', array(
'user:',
diff --git a/cli/do-install.php b/cli/do-install.php
index 37db85575..4ebba0469 100755
--- a/cli/do-install.php
+++ b/cli/do-install.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
if (!file_exists(DATA_PATH . '/do-install.txt')) {
fail('FreshRSS looks to be already installed! Please use `./cli/reconfigure.php` instead.');
diff --git a/cli/export-opml-for-user.php b/cli/export-opml-for-user.php
index 95b12281f..fd0993c35 100755
--- a/cli/export-opml-for-user.php
+++ b/cli/export-opml-for-user.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$options = getopt('', array(
'user:',
diff --git a/cli/export-zip-for-user.php b/cli/export-zip-for-user.php
index 92fe9bf9a..916ecbb45 100755
--- a/cli/export-zip-for-user.php
+++ b/cli/export-zip-for-user.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$options = getopt('', array(
'user:',
diff --git a/cli/import-for-user.php b/cli/import-for-user.php
index 29084f062..95ff18c8c 100755
--- a/cli/import-for-user.php
+++ b/cli/import-for-user.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$options = getopt('', array(
'user:',
diff --git a/cli/list-users.php b/cli/list-users.php
index 00a0b2b2c..758bbdb46 100755
--- a/cli/list-users.php
+++ b/cli/list-users.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$users = listUsers();
sort($users);
diff --git a/cli/reconfigure.php b/cli/reconfigure.php
index 466d35373..cfe713fa8 100755
--- a/cli/reconfigure.php
+++ b/cli/reconfigure.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$params = array(
'environment:',
diff --git a/cli/update-user.php b/cli/update-user.php
index ac674484c..4529b8531 100755
--- a/cli/update-user.php
+++ b/cli/update-user.php
@@ -1,7 +1,7 @@
#!/usr/bin/php
<?php
$isUpdate = true;
-require('_update-or-create-user.php');
+require(__DIR__ . '/_update-or-create-user.php');
$username = cliInitUser($options['user']);
diff --git a/cli/user-info.php b/cli/user-info.php
index 41b95cbf3..18a415217 100755
--- a/cli/user-info.php
+++ b/cli/user-info.php
@@ -1,6 +1,6 @@
#!/usr/bin/php
<?php
-require('_cli.php');
+require(__DIR__ . '/_cli.php');
$options = getopt('h', array(
'user:',
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index c06157164..e9c4da049 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -4,7 +4,7 @@ if (version_compare(PHP_VERSION, '5.3.8', '<')) {
}
if (!function_exists('json_decode')) {
- require_once('JSON.php');
+ require_once(__DIR__ . '/JSON.php');
function json_decode($var, $assoc = false) {
$JSON = new Services_JSON($assoc ? SERVICES_JSON_LOOSE_TYPE : 0);
return $JSON->decode($var);
@@ -12,7 +12,7 @@ if (!function_exists('json_decode')) {
}
if (!function_exists('json_encode')) {
- require_once('JSON.php');
+ require_once(__DIR__ . '/JSON.php');
function json_encode($var) {
$JSON = new Services_JSON();
return $JSON->encodeUnsafe($var);
diff --git a/p/api/greader.php b/p/api/greader.php
index b27f5bd43..99304f4ec 100644
--- a/p/api/greader.php
+++ b/p/api/greader.php
@@ -20,7 +20,7 @@ Server-side API compatible with Google Reader API layer 2
* https://github.com/theoldreader/api
*/
-require('../../constants.php');
+require(__DIR__ . '/../../constants.php');
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576);
diff --git a/p/api/index.php b/p/api/index.php
index 08f7b6b7b..429b25225 100644
--- a/p/api/index.php
+++ b/p/api/index.php
@@ -14,7 +14,7 @@
<dl>
<dt>Your API address:</dt>
<dd><?php
-require('../../constants.php');
+require(__DIR__ . '/../../constants.php');
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php');
echo Minz_Url::display('/api/greader.php', 'html', true);
diff --git a/p/api/pshb.php b/p/api/pshb.php
index 578681cc4..57a7bb0dd 100644
--- a/p/api/pshb.php
+++ b/p/api/pshb.php
@@ -1,5 +1,5 @@
<?php
-require('../../constants.php');
+require(__DIR__ . '/../../constants.php');
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
const MAX_PAYLOAD = 3145728;
diff --git a/p/ext.php b/p/ext.php
index 5c9f9125f..bb16d02d3 100644
--- a/p/ext.php
+++ b/p/ext.php
@@ -5,7 +5,7 @@ if (!isset($_GET['f']) ||
die();
}
-require('../constants.php');
+require(__DIR__ . '/../constants.php');
/**
* Check if a file can be served by ext.php. A valid file is under a
diff --git a/p/f.php b/p/f.php
index c47fa747a..81df8984b 100644
--- a/p/f.php
+++ b/p/f.php
@@ -1,5 +1,5 @@
<?php
-require('../constants.php');
+require(__DIR__ . '/../constants.php');
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
require(LIB_PATH . '/favicons.php');
require(LIB_PATH . '/http-conditional.php');
diff --git a/p/i/index.php b/p/i/index.php
index d3fc0b37c..a1212b570 100755
--- a/p/i/index.php
+++ b/p/i/index.php
@@ -18,7 +18,7 @@
#
# ***** END LICENSE BLOCK *****
-require('../../constants.php');
+require(__DIR__ . '/../../constants.php');
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
if (file_exists(DATA_PATH . '/do-install.txt')) {
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 896929649..5c42f12f7 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -3,5 +3,5 @@
error_reporting(E_ALL);
ini_set('display_errors', 1);
-require('../constants.php');
+require(__DIR__ . '/../constants.php');
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader