Skip to content
Browse files

PHP 4 compatibility

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@312 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 6e16779 commit c6458077d9d4edcb9c86539376582a36c111cb05 jakubvrana committed Aug 7, 2007
Showing with 6 additions and 6 deletions.
  1. +3 −3 _compile.php
  2. +3 −3 _lang.php
View
6 _compile.php
@@ -18,11 +18,11 @@ function put_file($match) {
if ($_COOKIE["lang"]) {
return "";
}
- $return = "switch (\$LANG) {\n";
+ $return = "";
foreach (glob("./lang/*.inc.php") as $filename) {
$return .= "case '" . basename($filename, '.inc.php') . "': " . substr(file_get_contents($filename), 6) . "break;\n";
}
- return "$return}\n";
+ return "switch (\$LANG) {\n$return}\n";
}
$return = file_get_contents($match[4]);
if ($match[4] == "./lang.inc.php" && $_COOKIE["lang"] && (preg_match("~case '$_COOKIE[lang]': (.*) break;~", $return, $match2) || preg_match("~default: (.*)~", $return, $match2))) {
@@ -64,5 +64,5 @@ function put_file($match) {
$file = str_replace("arrow.gif", '" . preg_replace("~\\\\?.*~", "", $_SERVER["REQUEST_URI"]) . "?gif=arrow', $file);
$file = str_replace('error_reporting(E_ALL & ~E_NOTICE);', "error_reporting(E_ALL & ~E_NOTICE);\nif (isset(\$_GET['favicon'])) {\n\theader('Content-Type: image/x-icon');\n\techo base64_decode('" . base64_encode(file_get_contents("favicon.ico")) . "');\n\texit;\n} elseif (isset(\$_GET['gif'])) {\n\theader('Content-Type: image/gif');\n\techo base64_decode('" . base64_encode(file_get_contents("arrow.gif")) . "');\n\texit;\n}", $file);
$file = str_replace('<link rel="stylesheet" type="text/css" href="default.css" />', "<style type='text/css'>\n" . file_get_contents("default.css") . "</style>", $file);
-file_put_contents($filename, $file);
+fwrite(fopen($filename, "w"), $file);
echo "$filename created.\n";
View
6 _lang.php
@@ -20,7 +20,7 @@
foreach (($_COOKIE["lang"] ? array("lang/$_COOKIE[lang].inc.php") : glob("lang/*.inc.php")) as $filename) {
$messages = $messages_all;
preg_match_all("~^(\\s*)(?:// )?(('(?:[^\\\\']+|\\\\.)*') => .*[^,\n]),?~m", file_get_contents($filename), $matches, PREG_SET_ORDER);
- $s = "<?php\n\$translations = array(\n";
+ $s = "";
foreach ($matches as $match) {
if (isset($messages[$match[3]])) {
$s .= "$match[1]$match[2],\n";
@@ -36,6 +36,6 @@
$s .= "\t$idf => '',\n";
}
}
- file_put_contents($filename, "$s);\n");
- echo "$filename modified.\n";
+ fwrite(fopen($filename, "w"), "<?php\n\$translations = array(\n$s);\n");
+ echo "$filename updated.\n";
}

0 comments on commit c645807

Please sign in to comment.
Something went wrong with that request. Please try again.