Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 349 lines (327 sloc) 13.234 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 }
5d25786 @vrana Compress translations
authored
106 $all_translations = array();
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) {
c16c57b E-mail sending
jakubvrana authored
112 $translation_ids[$lang_ids[$key]] = $val;
113 }
114 }
5d25786 @vrana Compress translations
authored
115 $all_translations[$lang] = $translation_ids;
c16c57b E-mail sending
jakubvrana authored
116 }
ccd1246 @vrana Save translations version
authored
117 $all_translations = serialize($all_translations);
118 $translations_version = crc32($all_translations);
5d25786 @vrana Compress translations
authored
119 return '$translations = &$_SESSION["translations"];
ccd1246 @vrana Save translations version
authored
120 if ($_SESSION["translations_version"] != ' . $translations_version . ') {
121 $translations = array();
122 $_SESSION["translations_version"] = ' . $translations_version . ';
123 }
5d25786 @vrana Compress translations
authored
124 if ($_GET["lang"] || !$translations) {
ccd1246 @vrana Save translations version
authored
125 $all_translations = unserialize(lzw_decompress(\'' . add_apo_slashes(lzw_compress($all_translations)) . '\'));
5d25786 @vrana Compress translations
authored
126 $translations = $all_translations[$LANG];
127 }
128 ';
c16c57b E-mail sending
jakubvrana authored
129 }
130
16f4210 Function minification
jakubvrana authored
131 function short_identifier($number, $chars) {
132 $return = '';
a06f4c1 Size reduction by minification of variables
jakubvrana authored
133 while ($number >= 0) {
b0666e5 @vrana Remove unnecessary { } in compile
authored
134 $return .= $chars[$number % strlen($chars)];
a06f4c1 Size reduction by minification of variables
jakubvrana authored
135 $number = floor($number / strlen($chars)) - 1;
136 }
137 return $return;
138 }
139
004d7a9 Link
jakubvrana authored
140 // based on http://latrine.dgx.cz/jak-zredukovat-php-skripty
794192d php_shrink()
jakubvrana authored
141 function php_shrink($input) {
cbdf09d @vrana Show version in comment (thanks to David Grudl)
authored
142 global $VERSION;
815eb26 Use one token for all
jakubvrana authored
143 $special_variables = array_flip(array('$this', '$GLOBALS', '$_GET', '$_POST', '$_FILES', '$_COOKIE', '$_SESSION', '$_SERVER'));
12d2c6d Build Adminer and Editor together
jakubvrana authored
144 $short_variables = array();
a06f4c1 Size reduction by minification of variables
jakubvrana authored
145 $shortening = true;
16f4210 Function minification
jakubvrana authored
146 $tokens = token_get_all($input);
147
b0666e5 @vrana Remove unnecessary { } in compile
authored
148 // remove unnecessary { }
149 //! change also `while () { if () {;} }` to `while () if () ;` but be careful about `if () { if () { } } else { }
150 $shorten = 0;
151 $opening = -1;
152 foreach ($tokens as $i => $token) {
153 if (in_array($token[0], array(T_IF, T_ELSE, T_ELSEIF, T_WHILE, T_DO, T_FOR, T_FOREACH), true)) {
154 $shorten = ($token[0] == T_FOR ? 4 : 2);
155 $opening = -1;
156 } elseif (in_array($token[0], array(T_SWITCH, T_FUNCTION, T_CLASS, T_CLOSE_TAG), true)) {
157 $shorten = 0;
158 } elseif ($token === ';') {
159 $shorten--;
160 } elseif ($token === '{') {
161 if ($opening < 0) {
162 $opening = $i;
163 } elseif ($shorten > 1) {
164 $shorten = 0;
165 }
166 } elseif ($token === '}' && $opening >= 0 && $shorten == 1) {
167 unset($tokens[$opening]);
168 unset($tokens[$i]);
169 $shorten = 0;
170 $opening = -1;
171 }
172 }
173 $tokens = array_values($tokens);
174
16f4210 Function minification
jakubvrana authored
175 foreach ($tokens as $i => $token) {
176 if ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
177 $short_variables[$token[1]]++;
178 }
179 }
c27a877 Minify defined functions only
jakubvrana authored
180
16f4210 Function minification
jakubvrana authored
181 arsort($short_variables);
0ced6d3 @vrana Preserve short variable names between versions if possible
authored
182 $chars = implode(range('a', 'z')) . '_' . implode(range('A', 'Z'));
183 // preserve variable names between versions if possible
184 $short_variables2 = array_splice($short_variables, strlen($chars));
185 ksort($short_variables);
186 ksort($short_variables2);
187 $short_variables += $short_variables2;
16f4210 Function minification
jakubvrana authored
188 foreach (array_keys($short_variables) as $number => $key) {
0ced6d3 @vrana Preserve short variable names between versions if possible
authored
189 $short_variables[$key] = short_identifier($number, $chars); // could use also numbers and \x7f-\xff
16f4210 Function minification
jakubvrana authored
190 }
a06f4c1 Size reduction by minification of variables
jakubvrana authored
191
541561b @vrana Minimize space around %
authored
192 $set = array_flip(preg_split('//', '!"#$%&\'()*+,-./:;<=>?@[\]^`{|}'));
794192d php_shrink()
jakubvrana authored
193 $space = '';
194 $output = '';
ff85f12 Join echos
jakubvrana authored
195 $in_echo = false;
c16c57b E-mail sending
jakubvrana authored
196 $doc_comment = false; // include only first /**
ff85f12 Join echos
jakubvrana authored
197 for (reset($tokens); list($i, $token) = each($tokens); ) {
794192d php_shrink()
jakubvrana authored
198 if (!is_array($token)) {
199 $token = array(0, $token);
200 }
dbf9566 Better consecutive echo handling
jakubvrana authored
201 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
202 && strlen(addcslashes($tokens[$i+3][1], "'\\")) < strlen($tokens[$i+3][1]) + 3
dbf9566 Better consecutive echo handling
jakubvrana authored
203 ) {
204 $tokens[$i+2] = array(T_ECHO, 'echo');
205 $tokens[$i+3] = array(T_CONSTANT_ENCAPSED_STRING, "'" . addcslashes($tokens[$i+3][1], "'\\") . "'");
206 $tokens[$i+4] = array(0, ';');
207 }
c16c57b E-mail sending
jakubvrana authored
208 if ($token[0] == T_COMMENT || $token[0] == T_WHITESPACE || ($token[0] == T_DOC_COMMENT && $doc_comment)) {
794192d php_shrink()
jakubvrana authored
209 $space = "\n";
210 } else {
c16c57b E-mail sending
jakubvrana authored
211 if ($token[0] == T_DOC_COMMENT) {
212 $doc_comment = true;
cbdf09d @vrana Show version in comment (thanks to David Grudl)
authored
213 $token[1] = substr_replace($token[1], "* @version $VERSION\n", -2, 0);
c16c57b E-mail sending
jakubvrana authored
214 }
a06f4c1 Size reduction by minification of variables
jakubvrana authored
215 if ($token[0] == T_VAR) {
216 $shortening = false;
217 } elseif (!$shortening) {
218 if ($token[1] == ';') {
219 $shortening = true;
220 }
ff85f12 Join echos
jakubvrana authored
221 } elseif ($token[0] == T_ECHO) {
222 $in_echo = true;
223 } elseif ($token[1] == ';' && $in_echo) {
e2bc1da No comments without whitespace
jakubvrana authored
224 if ($tokens[$i+1][0] === T_WHITESPACE && $tokens[$i+2][0] === T_ECHO) {
ff85f12 Join echos
jakubvrana authored
225 next($tokens);
c030c16 Compile inline HTML to echo
jakubvrana authored
226 $i++;
227 }
228 if ($tokens[$i+1][0] === T_ECHO) {
229 // join two consecutive echos
ff85f12 Join echos
jakubvrana authored
230 next($tokens);
02046d6 Windows support in e-mail attachments
jakubvrana authored
231 $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
232 } else {
233 $in_echo = false;
ff85f12 Join echos
jakubvrana authored
234 }
16f4210 Function minification
jakubvrana authored
235 } elseif ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
236 $token[1] = '$' . $short_variables[$token[1]];
a06f4c1 Size reduction by minification of variables
jakubvrana authored
237 }
3f5b683 Reintegrate sqlite branch
jakubvrana authored
238 if (isset($set[substr($output, -1)]) || isset($set[$token[1][0]])) {
794192d php_shrink()
jakubvrana authored
239 $space = '';
240 }
241 $output .= $space . $token[1];
242 $space = '';
243 }
244 }
245 return $output;
246 }
247
9ee9cf0 Remove code generation
jakubvrana authored
248 function minify_css($file) {
1be289e @vrana Optimize compiling files
authored
249 return preg_replace('~\\s*([:;{},])\\s*~', '\\1', preg_replace('~/\\*.*\\*/~sU', '', $file));
9ee9cf0 Remove code generation
jakubvrana authored
250 }
251
252 function compile_file($match) {
df03f4f Join editing.js in compilation
jakubvrana authored
253 global $project;
254 return call_user_func($match[2], file_get_contents(dirname(__FILE__) . "/$project/$match[1]"));
9ee9cf0 Remove code generation
jakubvrana authored
255 }
256
e672694 @vrana Rename $driver to $jush
authored
257 $driver = "";
3f5b683 Reintegrate sqlite branch
jakubvrana authored
258 if (file_exists(dirname(__FILE__) . "/adminer/drivers/" . $_SERVER["argv"][1] . ".inc.php")) {
e672694 @vrana Rename $driver to $jush
authored
259 $driver = $_SERVER["argv"][1];
3f5b683 Reintegrate sqlite branch
jakubvrana authored
260 array_shift($_SERVER["argv"]);
261 }
262
0116b9d Don't set cookie in compile scripts
jakubvrana authored
263 unset($_COOKIE["adminer_lang"]);
264 $_SESSION["lang"] = $_SERVER["argv"][1]; // Adminer functions read language from session
3f5b683 Reintegrate sqlite branch
jakubvrana authored
265 include dirname(__FILE__) . "/adminer/include/lang.inc.php";
0116b9d Don't set cookie in compile scripts
jakubvrana authored
266 if (isset($_SESSION["lang"])) {
267 if (isset($_SERVER["argv"][2]) || !isset($langs[$_SESSION["lang"]])) {
7e97fcd Compile usage
Jakub Vrana authored
268 echo "Usage: php compile.php [driver] [lang]\nPurpose: Compile adminer[-driver][-lang].php and editor[-driver][-lang].php.\n";
7418af0 Czech translation
jakubvrana authored
269 exit(1);
270 }
0116b9d Don't set cookie in compile scripts
jakubvrana authored
271 include dirname(__FILE__) . "/adminer/lang/$_SESSION[lang].inc.php";
7418af0 Czech translation
jakubvrana authored
272 }
bba76d8 Flatten $translations
jakubvrana authored
273
3f5b683 Reintegrate sqlite branch
jakubvrana authored
274 // check function definition in drivers
275 $filename = dirname(__FILE__) . "/adminer/drivers/mysql.inc.php";
276 preg_match_all('~\\bfunction ([^(]+)~', file_get_contents($filename), $matches); //! respect context (extension, class)
277 $functions = array_combine($matches[1], $matches[0]);
278 unset($functions["__destruct"], $functions["Min_DB"], $functions["Min_Result"]);
e672694 @vrana Rename $driver to $jush
authored
279 foreach (glob(dirname(__FILE__) . "/adminer/drivers/" . ($driver ? $driver : "*") . ".inc.php") as $filename) {
3f5b683 Reintegrate sqlite branch
jakubvrana authored
280 if ($filename != "mysql.inc.php") {
281 $file = file_get_contents($filename);
282 foreach ($functions as $val) {
283 if (!strpos($file, "$val(")) {
284 echo "Missing $val in $filename\n";
285 }
286 }
287 }
288 }
289
e672694 @vrana Rename $driver to $jush
authored
290 include dirname(__FILE__) . "/adminer/include/pdo.inc.php";
955e6b4 @vrana PostgreSQL supports only functions
authored
291 $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
292 foreach (array("adminer", "editor") as $project) {
293 $lang_ids = array(); // global variable simplifies usage in a callback function
294 $file = file_get_contents(dirname(__FILE__) . "/$project/index.php");
e672694 @vrana Rename $driver to $jush
authored
295 if ($driver) {
6420c58 Schema support for PostgreSQL
jakubvrana authored
296 $connection = (object) array("server_info" => 5.1); // MySQL support is version specific
e672694 @vrana Rename $driver to $jush
authored
297 $_GET[$driver] = true; // to load the driver
298 include_once dirname(__FILE__) . "/adminer/drivers/$driver.inc.php";
955e6b4 @vrana PostgreSQL supports only functions
authored
299 foreach ($features as $key => $feature) {
3f5b683 Reintegrate sqlite branch
jakubvrana authored
300 if (!support($feature)) {
955e6b4 @vrana PostgreSQL supports only functions
authored
301 if (!is_int($key)) {
302 $feature = $key;
303 }
3f5b683 Reintegrate sqlite branch
jakubvrana authored
304 $file = str_replace("} elseif (isset(\$_GET[\"$feature\"])) {\n\tinclude \"./$feature.inc.php\";\n", "", $file);
305 }
306 }
307 if (!support("routine")) {
308 $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);
309 }
310 }
12d2c6d Build Adminer and Editor together
jakubvrana authored
311 $file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file);
312 $file = str_replace('include "../adminer/include/coverage.inc.php";', '', $file);
e672694 @vrana Rename $driver to $jush
authored
313 if ($driver) {
314 $file = preg_replace('(include "../adminer/drivers/(?!' . preg_quote($driver) . ').*\\s*)', '', $file);
3f5b683 Reintegrate sqlite branch
jakubvrana authored
315 }
12d2c6d Build Adminer and Editor together
jakubvrana authored
316 $file = preg_replace_callback('~\\b(include|require) "([^"]*)";~', 'put_file', $file); // bootstrap.inc.php
e678e46 @vrana Remove unsupported features in single driver version
authored
317 if ($driver) {
318 foreach ($features as $feature) {
319 if (!support($feature)) {
320 $file = preg_replace("((\t*)" . preg_quote('if (support("' . $feature . '")') . ".*\n\\1\\})sU", '', $file);
321 }
322 }
4b9d451 @vrana SQLite version supports two systems
authored
323 if (count($drivers) == 1) {
30cfa61 @vrana Fix MySQL only version
authored
324 $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
325 }
e678e46 @vrana Remove unsupported features in single driver version
authored
326 }
12d2c6d Build Adminer and Editor together
jakubvrana authored
327 $file = preg_replace_callback("~lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])~s", 'lang_ids', $file);
53804a2 @vrana Immunity against CRLF
authored
328 $file = str_replace("\r", "", $file);
5d25786 @vrana Compress translations
authored
329 $file = preg_replace_callback('~\\b(include|require) "([^"]*\\$LANG.inc.php)";~', 'put_file_lang', $file);
12d2c6d Build Adminer and Editor together
jakubvrana authored
330 if ($_SESSION["lang"]) {
331 // single language version
332 $file = preg_replace_callback("~(<\\?php\\s*echo )?lang\\('((?:[^\\\\']+|\\\\.)*)'([,)])(;\\s*\\?>)?~s", 'remove_lang', $file);
333 $file = str_replace("<?php switch_lang(); ?>\n", "", $file);
334 $file = str_replace('<?php echo $LANG; ?>', $_SESSION["lang"], $file);
335 }
336 $file = str_replace('<script type="text/javascript" src="static/editing.js"></script>' . "\n", "", $file);
85d985a @vrana Don't encode binary files
authored
337 $file = preg_replace_callback('~compile_file\\("([^"]+)", "([^"]+)"\\);~', 'compile_file', $file); // integrate static files
1be289e @vrana Optimize compiling files
authored
338 $replace = 'h(preg_replace("~\\\\\\\\?.*~", "", ME)) . "?file=\\1&amp;version=' . $VERSION;
4815c7d @vrana Don't use AJAX links and forms
authored
339 $file = preg_replace('~\\.\\./adminer/static/(default\\.css|functions\\.js|favicon\\.ico)~', '<?php echo ' . $replace . '"; ?>', $file);
12d2c6d Build Adminer and Editor together
jakubvrana authored
340 $file = preg_replace('~\\.\\./adminer/static/([^\'"]*)~', '" . ' . $replace, $file);
e4deeb6 @vrana Utilize location.protocol
authored
341 $file = str_replace("'../externals/jush/'", "location.protocol + '//www.adminer.org/static/'", $file);
12d2c6d Build Adminer and Editor together
jakubvrana authored
342 $file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file);
343 $file = php_shrink($file);
c02bd44 Use $filename
jakubvrana authored
344
e672694 @vrana Rename $driver to $jush
authored
345 $filename = $project . (preg_match('~-dev$~', $VERSION) ? "" : "-$VERSION") . ($driver ? "-$driver" : "") . ($_SESSION["lang"] ? "-$_SESSION[lang]" : "") . ".php";
12d2c6d Build Adminer and Editor together
jakubvrana authored
346 fwrite(fopen($filename, "w"), $file); // file_put_contents() since PHP 5
3f5b683 Reintegrate sqlite branch
jakubvrana authored
347 echo "$filename created (" . strlen($file) . " B).\n";
12d2c6d Build Adminer and Editor together
jakubvrana authored
348 }
Something went wrong with that request. Please try again.