From 491b481b7f2c66cb437e662f92f979fb157508bf Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Tue, 25 Feb 2025 17:17:31 +0100 Subject: [PATCH] Use __DIR__ --- compile.php | 28 ++++++++++++++-------------- lang.php | 16 ++++++++-------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/compile.php b/compile.php index c44abce6..e5d7ab07 100755 --- a/compile.php +++ b/compile.php @@ -1,8 +1,8 @@ #!/usr/bin/env php $val) { - include dirname(__FILE__) . "/adminer/lang/$lang.inc.php"; // assign $translations + include __DIR__ . "/adminer/lang/$lang.inc.php"; // assign $translations $translation_ids = array_flip($lang_ids); // default translation foreach ($translations as $key => $val) { if ($val !== null) { @@ -347,7 +347,7 @@ function compile_file($match) { list(, $filenames, $callback) = $match; if ($filenames != "") { foreach (explode(";", $filenames) as $filename) { - $file .= file_get_contents(dirname(__FILE__) . "/$project/$filename"); + $file .= file_get_contents(__DIR__ . "/$project/$filename"); } } if ($callback) { @@ -379,16 +379,16 @@ if ($_SERVER["argv"][1] == "editor") { } $driver = ""; -if (file_exists(dirname(__FILE__) . "/adminer/drivers/" . $_SERVER["argv"][1] . ".inc.php")) { +if (file_exists(__DIR__ . "/adminer/drivers/" . $_SERVER["argv"][1] . ".inc.php")) { $driver = $_SERVER["argv"][1]; array_shift($_SERVER["argv"]); } unset($_COOKIE["adminer_lang"]); $_SESSION["lang"] = $_SERVER["argv"][1]; // Adminer functions read language from session -include dirname(__FILE__) . "/adminer/include/lang.inc.php"; +include __DIR__ . "/adminer/include/lang.inc.php"; if (isset($langs[$_SESSION["lang"]])) { - include dirname(__FILE__) . "/adminer/lang/$_SESSION[lang].inc.php"; + include __DIR__ . "/adminer/lang/$_SESSION[lang].inc.php"; array_shift($_SERVER["argv"]); } @@ -398,14 +398,14 @@ if ($_SERVER["argv"][1]) { exit(1); } -include dirname(__FILE__) . "/adminer/include/pdo.inc.php"; -include dirname(__FILE__) . "/adminer/include/driver.inc.php"; +include __DIR__ . "/adminer/include/pdo.inc.php"; +include __DIR__ . "/adminer/include/driver.inc.php"; $features = array("check", "call" => "routine", "dump", "event", "privileges", "procedure" => "routine", "processlist", "routine", "scheme", "sequence", "status", "trigger", "type", "user" => "privileges", "variables", "view"); $lang_ids = array(); // global variable simplifies usage in a callback function -$file = file_get_contents(dirname(__FILE__) . "/$project/index.php"); +$file = file_get_contents(__DIR__ . "/$project/index.php"); if ($driver) { $_GET[$driver] = true; // to load the driver - include_once dirname(__FILE__) . "/adminer/drivers/$driver.inc.php"; + include_once __DIR__ . "/adminer/drivers/$driver.inc.php"; foreach ($features as $key => $feature) { if (!support($feature)) { if (!is_int($key)) { diff --git a/lang.php b/lang.php index f46f6d8b..fa34b91d 100755 --- a/lang.php +++ b/lang.php @@ -1,11 +1,11 @@ #!/usr/bin/env php