2007-07-02 05:51:26 +00:00
|
|
|
<?php
|
2007-07-05 07:34:42 +00:00
|
|
|
function remove_lang($match) {
|
|
|
|
global $LANG;
|
|
|
|
return lang(strtr($match[2], array("\\'" => "'", "\\\\" => "\\")));
|
|
|
|
}
|
|
|
|
|
2007-07-02 05:51:26 +00:00
|
|
|
function put_file($match) {
|
|
|
|
$return = file_get_contents($match[4]);
|
|
|
|
$return = preg_replace("~\\?>?\n?\$~", '', $return);
|
|
|
|
if (substr_count($return, "<?php") - substr_count($return, "?>") <= 0 && !$match[5]) {
|
|
|
|
$return .= "<?php\n";
|
|
|
|
}
|
|
|
|
$return = preg_replace('~^<\\?php\\s+~', '', $return, 1, $count);
|
|
|
|
if (!$count && !$match[1]) {
|
|
|
|
$return = "?>\n$return";
|
|
|
|
}
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
2007-07-05 07:34:42 +00:00
|
|
|
error_reporting(E_ALL & ~E_NOTICE);
|
2007-07-02 05:51:26 +00:00
|
|
|
$file = file_get_contents("index.php");
|
2007-07-05 07:34:42 +00:00
|
|
|
$LANG = (strlen($_SERVER["argv"][1]) == 2 ? $_SERVER["argv"][1] : "");
|
|
|
|
if ($LANG) {
|
|
|
|
$file = str_replace("include \"./lang.inc.php\";\n", "", $file);
|
|
|
|
}
|
2007-07-02 05:51:26 +00:00
|
|
|
$file = preg_replace_callback('~(<\\?php\\s*)?(include|require)(_once)? "([^"]*)";(\\s*\\?>)?~', 'put_file', $file);
|
2007-07-05 07:34:42 +00:00
|
|
|
if ($LANG) {
|
|
|
|
include "./lang.inc.php";
|
|
|
|
preg_replace_callback("~(<\\?php\\s*echo )?lang\\('((?:[^\\\\']*|\\\\.)+)'\\)(;\\s*\\?>)?~s", 'remove_lang', $file);
|
|
|
|
}
|
2007-07-02 05:51:26 +00:00
|
|
|
//! remove spaces and comments
|
2007-07-05 07:34:42 +00:00
|
|
|
file_put_contents("phpMinAdmin" . ($LANG ? "-$LANG" : "") . ".php", $file);
|
2007-07-02 05:51:26 +00:00
|
|
|
echo "phpMinAdmin.php created.\n";
|