diff --git a/api/index.php b/api/index.php index 1b713d5619f0b5010e194b17b1024de9a4f08775..6b00711419491cfdfd9d2b8b9fd37bf9c6dc9b0b 100644 --- a/api/index.php +++ b/api/index.php @@ -3,9 +3,9 @@ require_once "../config.php"; - set_include_path(dirname(__FILE__) . PATH_SEPARATOR . - dirname(dirname(__FILE__)) . PATH_SEPARATOR . - dirname(dirname(__FILE__)) . "/include" . PATH_SEPARATOR . + set_include_path(__DIR__ . PATH_SEPARATOR . + dirname(__DIR__) . PATH_SEPARATOR . + dirname(__DIR__) . "/include" . PATH_SEPARATOR . get_include_path()); chdir(".."); diff --git a/backend.php b/backend.php index e64c6561fb5dfeb50c8369fafd890501bae99fc3..b6b3e0030cad9ac36f93ac56879558b5965d840e 100644 --- a/backend.php +++ b/backend.php @@ -1,5 +1,5 @@ <?php - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . + set_include_path(__DIR__ ."/include" . PATH_SEPARATOR . get_include_path()); $op = $_REQUEST["op"]; diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 5121c8491daa3e833a5566079af8461b8cf8e1fe..b6f645a9ca0015e01a426d920b984434720b8e78 100755 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -274,8 +274,8 @@ class PluginHost { $class = trim($class); $class_file = strtolower(basename(clean($class))); - if (!is_dir(__DIR__."/../plugins/$class_file") && - !is_dir(__DIR__."/../plugins.local/$class_file")) continue; + if (!is_dir(__DIR__ . "/../plugins/$class_file") && + !is_dir(__DIR__ . "/../plugins.local/$class_file")) continue; // try system plugin directory first $file = __DIR__ . "/../plugins/$class_file/init.php"; diff --git a/errors.php b/errors.php index 597c8429ce9556c4cc727dec9c87e0c3c69b922a..3195c4b648e1bac5426a63ab6700cef55c707f46 100644 --- a/errors.php +++ b/errors.php @@ -1,5 +1,5 @@ <?php - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . + set_include_path(__DIR__ ."/include" . PATH_SEPARATOR . get_include_path()); require_once "functions.php"; diff --git a/include/errorhandler.php b/include/errorhandler.php index fab559b7611c87970cfcd273f9100636b0cd6996..68e2285c1376f6b476536f8c03a9eadb2fe9ca6e 100644 --- a/include/errorhandler.php +++ b/include/errorhandler.php @@ -48,7 +48,7 @@ function ttrss_error_handler($errno, $errstr, $file, $line) { if (error_reporting() == 0 || !$errno) return false; - $file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1); + $file = substr(str_replace(dirname(__DIR__), "", $file), 1); $context = format_backtrace(debug_backtrace()); $errstr = truncate_middle($errstr, 16384, " (...) "); @@ -72,7 +72,7 @@ function ttrss_fatal_handler() { $context = format_backtrace(debug_backtrace()); - $file = substr(str_replace(dirname(dirname(__FILE__)), "", $file), 1); + $file = substr(str_replace(dirname(__DIR__), "", $file), 1); if ($last_query) $errstr .= " [Last query: $last_query]"; diff --git a/include/functions.php b/include/functions.php index 1f25f694759a28460f4ae3594a4a8e20754d631a..7c4e329633b627adbed256fbcd97d7e688244a4d 100644 --- a/include/functions.php +++ b/include/functions.php @@ -620,7 +620,7 @@ $ttrss_version['version'] = "UNKNOWN (Unsupported)"; date_default_timezone_set('UTC'); - $root_dir = dirname(dirname(__FILE__)); + $root_dir = dirname(__DIR__); if (PHP_OS === "Darwin") { $ttrss_version['version'] = "UNKNOWN (Unsupported, Darwin)"; diff --git a/index.php b/index.php index 4494082ddfe5049b3be5d2f208d2c7d32379a641..eec54c55bd8dcb1112c9a61657525714154c5a2b 100644 --- a/index.php +++ b/index.php @@ -12,7 +12,7 @@ exit; } - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . + set_include_path(__DIR__ ."/include" . PATH_SEPARATOR . get_include_path()); require_once "autoload.php"; diff --git a/plugins/note/init.php b/plugins/note/init.php index f4bdf45bc0a4d62261fff137e2ff85928c924292..52f7be3eb5261dfa3e6bd657f4e424b92bd3c446 100644 --- a/plugins/note/init.php +++ b/plugins/note/init.php @@ -17,7 +17,7 @@ class Note extends Plugin { } function get_js() { - return file_get_contents(dirname(__FILE__) . "/note.js"); + return file_get_contents(__DIR__ . "/note.js"); } diff --git a/plugins/nsfw/init.php b/plugins/nsfw/init.php index 3205b436b1a73dd75369a2f4d98c3ca19c915141..7c5b8d00faae63a39db646471f0b03fa968320c8 100644 --- a/plugins/nsfw/init.php +++ b/plugins/nsfw/init.php @@ -19,7 +19,7 @@ class NSFW extends Plugin { } function get_js() { - return file_get_contents(dirname(__FILE__) . "/init.js"); + return file_get_contents(__DIR__ . "/init.js"); } function hook_render_article($article) { diff --git a/prefs.php b/prefs.php index d11c6281e669a12853569ef3e08384ff406f84be..f173d684bdb67fa5e7e935afeb05c6cfc9c84fbd 100644 --- a/prefs.php +++ b/prefs.php @@ -1,5 +1,5 @@ <?php - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . + set_include_path(__DIR__ ."/include" . PATH_SEPARATOR . get_include_path()); if (!file_exists("config.php")) { diff --git a/public.php b/public.php index fadb2f14d18ce93ab517557f83e91f40dafdeafb..48fe675f8b7f3bf6e0f86f9cd88948c7c453e3bb 100644 --- a/public.php +++ b/public.php @@ -1,5 +1,5 @@ <?php - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . + set_include_path(__DIR__ ."/include" . PATH_SEPARATOR . get_include_path()); require_once "autoload.php"; diff --git a/update.php b/update.php index 71b8cf76c0ef8ab6067dc536d7448e3308a6a87e..ab6272c835767da05ee238379692a3967222f4e7 100755 --- a/update.php +++ b/update.php @@ -1,11 +1,11 @@ #!/usr/bin/env php <?php - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . + set_include_path(__DIR__ ."/include" . PATH_SEPARATOR . get_include_path()); define('DISABLE_SESSIONS', true); - chdir(dirname(__FILE__)); + chdir(__DIR__); require_once "autoload.php"; require_once "functions.php"; diff --git a/update_daemon2.php b/update_daemon2.php index af4cdedc91a7226712d800a26f644b9899c54586..5d4d3759cdb60afbfac1f7f71ba1747e7cf1cb7d 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -1,10 +1,10 @@ #!/usr/bin/env php <?php - set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR . + set_include_path(__DIR__ ."/include" . PATH_SEPARATOR . get_include_path()); declare(ticks = 1); - chdir(dirname(__FILE__)); + chdir(__DIR__); define('DISABLE_SESSIONS', true);