Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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