Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 376 lines (350 sloc) 13.778 kb
56ac3d1 @vrana Mark scripts as executable
authored
1 #!/usr/bin/env php
667bfec Decomposition
jakubvrana authored
2 <?php
1bc77f8 Report user errors
jakubvrana authored
3 error_reporting(6135); // errors and warnings
e1bc7af Change directory structure
jakubvrana authored
4 include dirname(__FILE__) . "/adminer/include/version.inc.php";
bf4f0a1 @vrana Replace JSMin by JsShrink
authored
5 include dirname(__FILE__) . "/externals/JsShrink/jsShrink.php";
7f3b4f2 Version checker
jakubvrana authored
6
8943678 sprintf() in lang()
jakubvrana authored
7 function add_apo_slashes($s) {
8 return addcslashes($s, "\\'");
9 }
10
f3c59bb @vrana Unuse binary characters
authored
11 function binary_latin($s) {
12 return preg_replace_callback('~[\0- ]~', 'binary_latin_callback', $s);
13 }
14
15 function binary_latin_callback($match) {
16 return ' ' . chr(ord($match[0]) + ord('0'));
415f500 @vrana Don't use \r\n in compiled strings
authored
17 }
18
0970a58 Prepare for single language version
jakubvrana authored
19 function remove_lang($match) {
bba76d8 Flatten $translations
jakubvrana authored
20 global $translations;
438ca05 Separate languages
jakubvrana authored
21 $idf = strtr($match[2], array("\\'" => "'", "\\\\" => "\\"));
bba76d8 Flatten $translations
jakubvrana authored
22 $s = ($translations[$idf] ? $translations[$idf] : $idf);
64ba924 Comments
jakubvrana authored
23 if ($match[3] == ",") { // lang() has parameters
8943678 sprintf() in lang()
jakubvrana authored
24 return "$match[1]" . (is_array($s) ? "lang(array('" . implode("', '", array_map('add_apo_slashes', $s)) . "')," : "sprintf('" . add_apo_slashes($s) . "',");
25 }
26 return ($match[1] && $match[4] ? $s : "$match[1]'" . add_apo_slashes($s) . "'$match[4]");
0970a58 Prepare for single language version
jakubvrana authored
27 }
28
4738060 Use numeric language IDs to save bytes
jakubvrana authored
29 function lang_ids($match) {
30 global $lang_ids;
c16c57b E-mail sending
jakubvrana authored
31 $lang_id = &$lang_ids[stripslashes($match[1])];
6591d48 @vrana Replace isset($var) by $var !== null
authored
32 if ($lang_id === null) {
c16c57b E-mail sending
jakubvrana authored
33 $lang_id = count($lang_ids) - 1;
34 }
0116b9d Don't set cookie in compile scripts
jakubvrana authored
35 return ($_SESSION["lang"] ? $match[0] : "lang($lang_id$match[2]");
4738060 Use numeric language IDs to save bytes
jakubvrana authored
36 }
37
667bfec Decomposition
jakubvrana authored
38 function put_file($match) {
c16c57b E-mail sending
jakubvrana authored
39 global $project;
b95f24e Editor: User friendly data editor
jakubvrana authored
40 if (basename($match[2]) == '$LANG.inc.php') {
c16c57b E-mail sending
jakubvrana authored
41 return $match[0]; // processed later
438ca05 Separate languages
jakubvrana authored
42 }
b95f24e Editor: User friendly data editor
jakubvrana authored
43 $return = file_get_contents(dirname(__FILE__) . "/$project/$match[2]");
0116b9d Don't set cookie in compile scripts
jakubvrana authored
44 if (basename($match[2]) != "lang.inc.php" || !$_SESSION["lang"]) {
64ba924 Comments
jakubvrana authored
45 $tokens = token_get_all($return); // to find out the last token
6bb1401 Remove ?><?php
jakubvrana authored
46 return "?>\n$return" . (in_array($tokens[count($tokens) - 1][0], array(T_CLOSE_TAG, T_INLINE_HTML), true) ? "<?php" : "");
9a4cabe @vrana Simplify single language version
authored
47 } elseif (preg_match('~\\s*(\\$pos = (.+\n).+;)~sU', $return, $match2)) {
64ba924 Comments
jakubvrana authored
48 // single language lang() is used for plural
e37c427 @vrana Function get_lang useful for customization
authored
49 return "function get_lang() {
50 return '$_SESSION[lang]';
51 }
52
53 function lang(\$translation, \$number) {
9a4cabe @vrana Simplify single language version
authored
54 \$pos = $match2[2]\t\t: " . (preg_match("~\\\$LANG == '$_SESSION[lang]'.* \\? (.+)\n~U", $match2[1], $match3) ? $match3[1] : "1") . '
55 );
7f1fcc2 @vrana Format numbers in translations
authored
56 $translation = str_replace("%d", "%s", $translation[$pos]);
57 $number = number_format($number, 0, ".", lang(\',\'));
58 return sprintf($translation, $number);
e37c427 @vrana Function get_lang useful for customization
authored
59 }
60 ';
6bb1401 Remove ?><?php
jakubvrana authored
61 } else {
62 echo "lang() not found\n";
667bfec Decomposition
jakubvrana authored
63 }
64 }
65
5d25786 @vrana Compress translations
authored
66 function lzw_compress($string) {
67 // compression
68 $dictionary = array_flip(range("\0", "\xFF"));
69 $word = "";
70 $codes = array();
71 for ($i=0; $i <= strlen($string); $i++) {
72 $x = $string[$i];
73 if (strlen($x) && isset($dictionary[$word . $x])) {
74 $word .= $x;
75 } elseif ($i) {
76 $codes[] = $dictionary[$word];
77 $dictionary[$word . $x] = count($dictionary);
78 $word = $x;
79 }
80 }
81 // convert codes to binary string
82 $dictionary_count = 256;
83 $bits = 8; // ceil(log($dictionary_count, 2))
84 $return = "";
85 $rest = 0;
86 $rest_length = 0;
87 foreach ($codes as $code) {
88 $rest = ($rest << $bits) + $code;
89 $rest_length += $bits;
90 $dictionary_count++;
91 if ($dictionary_count >> $bits) {
92 $bits++;
93 }
94 while ($rest_length > 7) {
95 $rest_length -= 8;
96 $return .= chr($rest >> $rest_length);
97 $rest &= (1 << $rest_length) - 1;
98 }
99 }
100 return $return . ($rest_length ? chr($rest << (8 - $rest_length)) : "");
101 }
102
c16c57b E-mail sending
jakubvrana authored
103 function put_file_lang($match) {
b4b5977 @vrana Include only active translations
authored
104 global $lang_ids, $project, $langs;
0116b9d Don't set cookie in compile scripts
jakubvrana authored
105 if ($_SESSION["lang"]) {
c16c57b E-mail sending
jakubvrana authored
106 return "";
107 }
0317638 @vrana Compress each translation separately
authored
108 $return = "";
b4b5977 @vrana Include only active translations
authored
109 foreach ($langs as $lang => $val) {
110 include dirname(__FILE__) . "/adminer/lang/$lang.inc.php"; // assign $translations
c16c57b E-mail sending
jakubvrana authored
111 $translation_ids = array_flip($lang_ids); // default translation
112 foreach ($translations as $key => $val) {
6591d48 @vrana Replace isset($var) by $var !== null
authored
113 if ($val !== null) {
0317638 @vrana Compress each translation separately
authored
114 $translation_ids[$lang_ids[$key]] = implode("\t", (array) $val);
c16c57b E-mail sending
jakubvrana authored
115 }
116 }
f3c59bb @vrana Unuse binary characters
authored
117 $return .= "
118 case '$lang': \$compressed = '" . add_apo_slashes(binary_latin(lzw_compress(implode("\n", $translation_ids)))) . "'; break;";
c16c57b E-mail sending
jakubvrana authored
119 }
0317638 @vrana Compress each translation separately
authored
120 $translations_version = crc32($return);
5d25786 @vrana Compress translations
authored
121 return '$translations = &$_SESSION["translations"];
ccd1246 @vrana Save translations version
authored
122 if ($_SESSION["translations_version"] != ' . $translations_version . ') {
123 $translations = array();
124 $_SESSION["translations_version"] = ' . $translations_version . ';
125 }
57d0c4c @vrana Fix switching language in compiled version
authored
126 if (!$translations) {
0317638 @vrana Compress each translation separately
authored
127 switch ($LANG) {' . $return . '
128 }
129 $translations = array();
f3c59bb @vrana Unuse binary characters
authored
130 foreach (explode("\n", lzw_decompress(latin_binary($compressed))) as $val) {
0317638 @vrana Compress each translation separately
authored
131 $translations[] = (strpos($val, "\t") ? explode("\t", $val) : $val);
132 }
5d25786 @vrana Compress translations
authored
133 }
134 ';
c16c57b E-mail sending
jakubvrana authored
135 }
136
16f4210 Function minification
jakubvrana authored
137 function short_identifier($number, $chars) {
138 $return = '';
a06f4c1 Size reduction by minification of variables
jakubvrana authored
139 while ($number >= 0) {
b0666e5 @vrana Remove unnecessary { } in compile
authored
140 $return .= $chars[$number % strlen($chars)];
a06f4c1 Size reduction by minification of variables
jakubvrana authored
141 $number = floor($number / strlen($chars)) - 1;
142 }
143 return $return;
144 }
145
004d7a9 Link
jakubvrana authored
146 // based on http://latrine.dgx.cz/jak-zredukovat-php-skripty
794192d php_shrink()
jakubvrana authored
147 function php_shrink($input) {
cbdf09d @vrana Show version in comment (thanks to David Grudl)
authored
148 global $VERSION;
815eb26 Use one token for all
jakubvrana authored
149 $special_variables = array_flip(array('$this', '$GLOBALS', '$_GET', '$_POST', '$_FILES', '$_COOKIE', '$_SESSION', '$_SERVER'));
12d2c6d Build Adminer and Editor together
jakubvrana authored
150 $short_variables = array();
a06f4c1 Size reduction by minification of variables
jakubvrana authored
151 $shortening = true;
16f4210 Function minification
jakubvrana authored
152 $tokens = token_get_all($input);
153
b0666e5 @vrana Remove unnecessary { } in compile
authored
154 // remove unnecessary { }
155 //! change also `while () { if () {;} }` to `while () if () ;` but be careful about `if () { if () { } } else { }
156 $shorten = 0;
157 $opening = -1;
158 foreach ($tokens as $i => $token) {
159 if (in_array($token[0], array(T_IF, T_ELSE, T_ELSEIF, T_WHILE, T_DO, T_FOR, T_FOREACH), true)) {
160 $shorten = ($token[0] == T_FOR ? 4 : 2);
161 $opening = -1;
162 } elseif (in_array($token[0], array(T_SWITCH, T_FUNCTION, T_CLASS, T_CLOSE_TAG), true)) {
163 $shorten = 0;
164 } elseif ($token === ';') {
165 $shorten--;
166 } elseif ($token === '{') {
167 if ($opening < 0) {
168 $opening = $i;
169 } elseif ($shorten > 1) {
170 $shorten = 0;
171 }
172 } elseif ($token === '}' && $opening >= 0 && $shorten == 1) {
173 unset($tokens[$opening]);
174 unset($tokens[$i]);
175 $shorten = 0;
176 $opening = -1;
177 }
178 }
179 $tokens = array_values($tokens);
180
16f4210 Function minification
jakubvrana authored
181 foreach ($tokens as $i => $token) {
182 if ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
183 $short_variables[$token[1]]++;
184 }
185 }
c27a877 Minify defined functions only
jakubvrana authored
186
16f4210 Function minification
jakubvrana authored
187 arsort($short_variables);
0ced6d3 @vrana Preserve short variable names between versions if possible
authored
188 $chars = implode(range('a', 'z')) . '_' . implode(range('A', 'Z'));
189 // preserve variable names between versions if possible
190 $short_variables2 = array_splice($short_variables, strlen($chars));
191 ksort($short_variables);
192 ksort($short_variables2);
193 $short_variables += $short_variables2;
16f4210 Function minification
jakubvrana authored
194 foreach (array_keys($short_variables) as $number => $key) {
0ced6d3 @vrana Preserve short variable names between versions if possible
authored
195 $short_variables[$key] = short_identifier($number, $chars); // could use also numbers and \x7f-\xff
16f4210 Function minification
jakubvrana authored
196 }
a06f4c1 Size reduction by minification of variables
jakubvrana authored
197
541561b @vrana Minimize space around %
authored
198 $set = array_flip(preg_split('//', '!"#$%&\'()*+,-./:;<=>?@[\]^`{|}'));
794192d php_shrink()
jakubvrana authored
199 $space = '';
200 $output = '';
ff85f12 Join echos
jakubvrana authored
201 $in_echo = false;
c16c57b E-mail sending
jakubvrana authored
202 $doc_comment = false; // include only first /**
ff85f12 Join echos
jakubvrana authored
203 for (reset($tokens); list($i, $token) = each($tokens); ) {
794192d php_shrink()
jakubvrana authored
204 if (!is_array($token)) {
205 $token = array(0, $token);
206 }
dbf9566 Better consecutive echo handling
jakubvrana authored
207 if ($tokens[$i+2][0] === T_CLOSE_TAG && $tokens[$i+3][0] === T_INLINE_HTML && $tokens[$i+4][0] === T_OPEN_TAG
415f500 @vrana Don't use \r\n in compiled strings
authored
208 && strlen(add_apo_slashes($tokens[$i+3][1])) < strlen($tokens[$i+3][1]) + 3
dbf9566 Better consecutive echo handling
jakubvrana authored
209 ) {
210 $tokens[$i+2] = array(T_ECHO, 'echo');
415f500 @vrana Don't use \r\n in compiled strings
authored
211 $tokens[$i+3] = array(T_CONSTANT_ENCAPSED_STRING, "'" . add_apo_slashes($tokens[$i+3][1]) . "'");
dbf9566 Better consecutive echo handling
jakubvrana authored
212 $tokens[$i+4] = array(0, ';');
213 }
c16c57b E-mail sending
jakubvrana authored
214 if ($token[0] == T_COMMENT || $token[0] == T_WHITESPACE || ($token[0] == T_DOC_COMMENT && $doc_comment)) {
794192d php_shrink()
jakubvrana authored
215 $space = "\n";
216 } else {
c16c57b E-mail sending
jakubvrana authored
217 if ($token[0] == T_DOC_COMMENT) {
218 $doc_comment = true;
cbdf09d @vrana Show version in comment (thanks to David Grudl)
authored
219 $token[1] = substr_replace($token[1], "* @version $VERSION\n", -2, 0);
c16c57b E-mail sending
jakubvrana authored
220 }
a06f4c1 Size reduction by minification of variables
jakubvrana authored
221 if ($token[0] == T_VAR) {
222 $shortening = false;
223 } elseif (!$shortening) {
224 if ($token[1] == ';') {
225 $shortening = true;
226 }
ff85f12 Join echos
jakubvrana authored
227 } elseif ($token[0] == T_ECHO) {
228 $in_echo = true;
229 } elseif ($token[1] == ';' && $in_echo) {
e2bc1da No comments without whitespace
jakubvrana authored
230 if ($tokens[$i+1][0] === T_WHITESPACE && $tokens[$i+2][0] === T_ECHO) {
ff85f12 Join echos
jakubvrana authored
231 next($tokens);
c030c16 Compile inline HTML to echo
jakubvrana authored
232 $i++;
233 }
234 if ($tokens[$i+1][0] === T_ECHO) {
235 // join two consecutive echos
ff85f12 Join echos
jakubvrana authored
236 next($tokens);
02046d6 Windows support in e-mail attachments
jakubvrana authored
237 $token[1] = ','; // '.' would conflict with "a".1+2 and would use more memory //! remove ',' and "," but not $var","
dbf9566 Better consecutive echo handling
jakubvrana authored
238 } else {
239 $in_echo = false;
ff85f12 Join echos
jakubvrana authored
240 }
16f4210 Function minification
jakubvrana authored
241 } elseif ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
242 $token[1] = '$' . $short_variables[$token[1]];
a06f4c1 Size reduction by minification of variables
jakubvrana authored
243 }
3f5b683 Reintegrate sqlite branch
jakubvrana authored
244 if (isset($set[substr($output, -1)]) || isset($set[$token[1][0]])) {
794192d php_shrink()
jakubvrana authored
245 $space = '';
246 }
247 $output .= $space . $token[1];
248 $space = '';
249 }
250 }
251 return $output;
252 }
253
9ee9cf0 Remove code generation
jakubvrana authored
254 function minify_css($file) {
dd86e18 @vrana Simplify compile_file()
authored
255 return lzw_compress(preg_replace('~\\s*([:;{},])\\s*~', '\\1', preg_replace('~/\\*.*\\*/~sU', '', $file)));
9ee9cf0 Remove code generation
jakubvrana authored
256 }
257
e767663 @vrana Compress JS
authored
258 function minify_js($file) {
63c9873 @vrana Fix JUSH compilation
authored
259 $file = str_replace("'../externals/jush/'", "location.protocol + '//www.adminer.org/static/'", $file);
e767663 @vrana Compress JS
authored
260 if (function_exists('jsShrink')) {
261 $file = jsShrink($file);
262 }
dd86e18 @vrana Simplify compile_file()
authored
263 return lzw_compress($file);
e767663 @vrana Compress JS
authored
264 }
265
9ee9cf0 Remove code generation
jakubvrana authored
266 function compile_file($match) {
df03f4f Join editing.js in compilation
jakubvrana authored
267 global $project;
e767663 @vrana Compress JS
authored
268 $file = "";
269 foreach (explode(";", $match[1]) as $filename) {
270 $file .= file_get_contents(dirname(__FILE__) . "/$project/$filename");
271 }
dd86e18 @vrana Simplify compile_file()
authored
272 if ($match[2]) {
273 $file = call_user_func($match[2], $file);
274 }
f3c59bb @vrana Unuse binary characters
authored
275 return "latin_binary('" . add_apo_slashes(binary_latin($file)) . "')";
9ee9cf0 Remove code generation
jakubvrana authored
276 }
277
29e6552 @vrana Compile only one project at a time
authored
278 $project = "adminer";
279 if ($_SERVER["argv"][1] == "editor") {
280 $project = "editor";
281 array_shift($_SERVER["argv"]);
282 }
283
e672694 @vrana Rename $driver to $jush
authored
284 $driver = "";
3f5b683 Reintegrate sqlite branch
jakubvrana authored
285 if (file_exists(dirname(__FILE__) . "/adminer/drivers/" . $_SERVER["argv"][1] . ".inc.php")) {
e672694 @vrana Rename $driver to $jush
authored
286 $driver = $_SERVER["argv"][1];
3f5b683 Reintegrate sqlite branch
jakubvrana authored
287 array_shift($_SERVER["argv"]);
288 }
289
0116b9d Don't set cookie in compile scripts
jakubvrana authored
290 unset($_COOKIE["adminer_lang"]);
291 $_SESSION["lang"] = $_SERVER["argv"][1]; // Adminer functions read language from session
3f5b683 Reintegrate sqlite branch
jakubvrana authored
292 include dirname(__FILE__) . "/adminer/include/lang.inc.php";
29e6552 @vrana Compile only one project at a time
authored
293 if (isset($langs[$_SESSION["lang"]])) {
0116b9d Don't set cookie in compile scripts
jakubvrana authored
294 include dirname(__FILE__) . "/adminer/lang/$_SESSION[lang].inc.php";
29e6552 @vrana Compile only one project at a time
authored
295 array_shift($_SERVER["argv"]);
296 }
297
298 if ($_SERVER["argv"][1]) {
299 echo "Usage: php compile.php [editor] [driver] [lang]\n";
300 echo "Purpose: Compile adminer[-driver][-lang].php or editor[-driver][-lang].php.\n";
301 exit(1);
7418af0 Czech translation
jakubvrana authored
302 }
bba76d8 Flatten $translations
jakubvrana authored
303
3f5b683 Reintegrate sqlite branch
jakubvrana authored
304 // check function definition in drivers
305 $filename = dirname(__FILE__) . "/adminer/drivers/mysql.inc.php";
306 preg_match_all('~\\bfunction ([^(]+)~', file_get_contents($filename), $matches); //! respect context (extension, class)
307 $functions = array_combine($matches[1], $matches[0]);
308 unset($functions["__destruct"], $functions["Min_DB"], $functions["Min_Result"]);
e672694 @vrana Rename $driver to $jush
authored
309 foreach (glob(dirname(__FILE__) . "/adminer/drivers/" . ($driver ? $driver : "*") . ".inc.php") as $filename) {
3f5b683 Reintegrate sqlite branch
jakubvrana authored
310 if ($filename != "mysql.inc.php") {
311 $file = file_get_contents($filename);
312 foreach ($functions as $val) {
313 if (!strpos($file, "$val(")) {
360218b @vrana Print compile errors to STDERR
authored
314 fprintf(STDERR, "Missing $val in $filename\n");
3f5b683 Reintegrate sqlite branch
jakubvrana authored
315 }
316 }
317 }
318 }
319
e672694 @vrana Rename $driver to $jush
authored
320 include dirname(__FILE__) . "/adminer/include/pdo.inc.php";
955e6b4 @vrana PostgreSQL supports only functions
authored
321 $features = array("call" => "routine", "dump", "event", "privileges", "procedure" => "routine", "processlist", "routine", "scheme", "sequence", "status", "trigger", "type", "user" => "privileges", "variables", "view");
29e6552 @vrana Compile only one project at a time
authored
322 $lang_ids = array(); // global variable simplifies usage in a callback function
323 $file = file_get_contents(dirname(__FILE__) . "/$project/index.php");
324 if ($driver) {
325 $connection = (object) array("server_info" => 5.1); // MySQL support is version specific
326 $_GET[$driver] = true; // to load the driver
327 include_once dirname(__FILE__) . "/adminer/drivers/$driver.inc.php";
328 foreach ($features as $key => $feature) {
329 if (!support($feature)) {
330 if (!is_int($key)) {
331 $feature = $key;
3f5b683 Reintegrate sqlite branch
jakubvrana authored
332 }
29e6552 @vrana Compile only one project at a time
authored
333 $file = str_replace("} elseif (isset(\$_GET[\"$feature\"])) {\n\tinclude \"./$feature.inc.php\";\n", "", $file);
3f5b683 Reintegrate sqlite branch
jakubvrana authored
334 }
335 }
29e6552 @vrana Compile only one project at a time
authored
336 if (!support("routine")) {
337 $file = str_replace("if (isset(\$_GET[\"callf\"])) {\n\t\$_GET[\"call\"] = \$_GET[\"callf\"];\n}\nif (isset(\$_GET[\"function\"])) {\n\t\$_GET[\"procedure\"] = \$_GET[\"function\"];\n}\n", "", $file);
3f5b683 Reintegrate sqlite branch
jakubvrana authored
338 }
29e6552 @vrana Compile only one project at a time
authored
339 }
340 $file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file);
341 $file = str_replace('include "../adminer/include/coverage.inc.php";', '', $file);
342 if ($driver) {
343 $file = preg_replace('(include "../adminer/drivers/(?!' . preg_quote($driver) . ').*\\s*)', '', $file);
344 }
345 $file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file); // bootstrap.inc.php
346 if ($driver) {
347 foreach ($features as $feature) {
348 if (!support($feature)) {
349 $file = preg_replace("((\t*)" . preg_quote('if (support("' . $feature . '")') . ".*\n\\1\\})sU", '', $file);
4b9d451 @vrana SQLite version supports two systems
authored
350 }
e678e46 @vrana Remove unsupported features in single driver version
authored
351 }
29e6552 @vrana Compile only one project at a time
authored
352 if (count($drivers) == 1) {
353 $file = str_replace('<?php echo html_select("driver", $drivers, DRIVER); ?>', "<input type='hidden' name='driver' value='" . ($driver == "mysql" ? "server" : $driver) . "'>" . reset($drivers), $file);
12d2c6d Build Adminer and Editor together
jakubvrana authored
354 }
355 }
29e6552 @vrana Compile only one project at a time
authored
356 $file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file);
357 $file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file);
358 $file = str_replace("\r", "", $file);
359 if ($_SESSION["lang"]) {
360 // single language version
361 $file = preg_replace_callback("~(<\\?php\\s*echo )?lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])(;\\s*\\?>)?~s", 'remove_lang', $file);
362 $file = str_replace("<?php switch_lang(); ?>\n", "", $file);
363 $file = str_replace('<?php echo $LANG; ?>', $_SESSION["lang"], $file);
364 }
365 $file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
366 $file = preg_replace_callback("~compile_file\\('([^']+)'(?:, '([^']*)')?\\)~", 'compile_file', $file); // integrate static files
367 $replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION;
368 $file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
369 $file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
370 $file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
371 $file = php_shrink($file);
372
373 $filename = $project . (preg_match('~-dev$~', $VERSION) ? "" : "-$VERSION") . ($driver ? "-$driver" : "") . ($_SESSION["lang"] ? "-$_SESSION[lang]" : "") . ".php";
374 fwrite(fopen($filename, "w"), $file); // file_put_contents() since PHP 5
375 echo "$filename created (" . strlen($file) . " B).\n";
Something went wrong with that request. Please try again.