From 0116b9d11bd19b1b54df11a48dc1c3dacd821cb9 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Thu, 10 Sep 2009 19:05:27 +0000 Subject: [PATCH] Don't set cookie in compile scripts git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1086 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- compile.php | 23 ++++++++++++----------- lang.php | 9 +++++---- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/compile.php b/compile.php index fefbae57..8b8422a4 100644 --- a/compile.php +++ b/compile.php @@ -25,7 +25,7 @@ function lang_ids($match) { if (!isset($lang_id)) { $lang_id = count($lang_ids) - 1; } - return ($_COOKIE["adminer_lang"] ? $match[0] : "lang($lang_id$match[2]"); + return ($_SESSION["lang"] ? $match[0] : "lang($lang_id$match[2]"); } function put_file($match) { @@ -34,12 +34,12 @@ function put_file($match) { return $match[0]; // processed later } $return = file_get_contents(dirname(__FILE__) . "/$project/$match[2]"); - if (basename($match[2]) != "lang.inc.php" || !$_COOKIE["adminer_lang"]) { + if (basename($match[2]) != "lang.inc.php" || !$_SESSION["lang"]) { $tokens = token_get_all($return); // to find out the last token return "?>\n$return" . (in_array($tokens[count($tokens) - 1][0], array(T_CLOSE_TAG, T_INLINE_HTML), true) ? ")?~s", 'remove_lang', $file); $file = str_replace("\n", "", $file); - $file = str_replace('', $_COOKIE["adminer_lang"], $file); + $file = str_replace('', $_SESSION["lang"], $file); } $file = str_replace('' . "\n", "", $file); $file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\);~", 'compile_file', $file); // integrate static files @@ -195,6 +196,6 @@ $file = str_replace("../externals/jush/", "https://jush.svn.sourceforge.net/svnr $file = preg_replace("~<\\?php\\s*\\?>\n?|\\?>\n?<\\?php~", '', $file); $file = php_shrink($file); -$filename = $project . ($_COOKIE["adminer_lang"] ? "-$_COOKIE[adminer_lang]" : "") . ".php"; +$filename = $project . ($_SESSION["lang"] ? "-$_SESSION[lang]" : "") . ".php"; fwrite(fopen($filename, "w"), $file); // file_put_contents() since PHP 5 echo "$filename created.\n"; diff --git a/lang.php b/lang.php index ec0737be..8e1ae8a8 100644 --- a/lang.php +++ b/lang.php @@ -1,9 +1,10 @@ .*[^,\n]),?~m", $file, $matches, PREG_SET_ORDER);