diff --git a/_compile.php b/_compile.php index b6068689..087e05e7 100644 --- a/_compile.php +++ b/_compile.php @@ -1,5 +1,5 @@ $val) { if (!isset($lang_ids[$key])) { @@ -36,7 +36,7 @@ function put_file($match) { } } } - foreach (glob("lang/*.inc.php") as $filename) { + foreach (glob(dirname(__FILE__) . "/lang/*.inc.php") as $filename) { include $filename; $translation_ids = array_flip($lang_ids); foreach ($translations as $key => $val) { @@ -50,7 +50,7 @@ function put_file($match) { } return "switch (\$LANG) {\n$return}\n"; } - $return = file_get_contents($match[3]); + $return = file_get_contents(dirname(__FILE__) . "/$match[3]"); if ($match[3] == "./lang.inc.php" && $_COOKIE["lang"] && (preg_match("~case '$_COOKIE[lang]': (.*) break;~", $return, $match2) || preg_match("~default: (.*)~", $return, $match2))) { return "$match[1]\nfunction lang(\$ar, \$number) {\n\t$match2[1]\n\treturn sprintf(\$ar[\$pos], \$number);\n}\n$match[4]"; } @@ -150,16 +150,16 @@ function php_shrink($input) { error_reporting(E_ALL & ~E_NOTICE); if ($_SERVER["argc"] > 1) { $_COOKIE["lang"] = $_SERVER["argv"][1]; - include "./lang.inc.php"; + include dirname(__FILE__) . "/lang.inc.php"; if ($_SERVER["argc"] != 2 || !isset($langs[$_COOKIE["lang"]])) { echo "Usage: php _compile.php [lang]\nPurpose: Compile phpMinAdmin[-lang].php from index.php.\n"; exit(1); } - include "./lang/$_COOKIE[lang].inc.php"; + include dirname(__FILE__) . "/lang/$_COOKIE[lang].inc.php"; } $filename = "phpMinAdmin" . ($_COOKIE["lang"] ? "-$_COOKIE[lang]" : "") . ".php"; -$file = file_get_contents("index.php"); +$file = file_get_contents(dirname(__FILE__) . "/index.php"); $file = preg_replace_callback('~(<\\?php)?\\s*(include|require) "([^"]*)";(\\s*\\?>)?~', 'put_file', $file); $file = preg_replace("~if \\(isset\\(\\\$_SESSION\\[\"coverage.*\n}\n| && !isset\\(\\\$_SESSION\\[\"coverage\"\\]\\)~sU", '', $file); if ($_COOKIE["lang"]) { @@ -177,21 +177,21 @@ if (isset($_GET["file"])) { header("Expires: " . gmdate("D, d M Y H:i:s", time() + 365*24*60*60) . " GMT"); if ($_GET["file"] == "favicon.ico") { header("Content-Type: image/x-icon"); - echo base64_decode("' . base64_encode(file_get_contents("favicon.ico")) . '"); + echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/favicon.ico")) . '"); } elseif ($_GET["file"] == "default.css") { header("Content-Type: text/css"); - ?>' . preg_replace('~\\s*([:;{},])\\s*~', '\\1', file_get_contents("default.css")) . '' . preg_replace('~\\s*([:;{},])\\s*~', '\\1', file_get_contents(dirname(__FILE__) . "/default.css")) . '' . file_get_contents("functions.js") . '' . file_get_contents(dirname(__FILE__) . "/functions.js") . ' 1) { $_COOKIE["lang"] = $_SERVER["argv"][1]; - include "./lang.inc.php"; + include dirname(__FILE__) . "/lang.inc.php"; if ($_SERVER["argc"] != 2 || !isset($langs[$_COOKIE["lang"]])) { - echo "Usage: php _lang.php [lang]\nPurpose: Update lang.inc.php from source code messages.\n"; + echo "Usage: php _lang.php [lang]\nPurpose: Update lang/*.inc.php from source code messages.\n"; exit(1); } } $messages_all = array(); -foreach (glob("*.php") as $filename) { +foreach (glob(dirname(__FILE__) . "/*.php") as $filename) { $file = file_get_contents($filename); if (preg_match_all("~lang\\(('(?:[^\\\\']+|\\\\.)*')([),])~", $file, $matches)) { $messages_all += array_combine($matches[1], $matches[2]); } } -foreach (($_COOKIE["lang"] ? array("lang/$_COOKIE[lang].inc.php") : glob("lang/*.inc.php")) as $filename) { +foreach (($_COOKIE["lang"] ? array(dirname(__FILE__) . "/lang/$_COOKIE[lang].inc.php") : glob(dirname(__FILE__) . "/lang/*.inc.php")) as $filename) { $messages = $messages_all; preg_match_all("~^(\\s*)(?:// )?(('(?:[^\\\\']+|\\\\.)*') => .*[^,\n]),?~m", file_get_contents($filename), $matches, PREG_SET_ORDER); $s = "";