From d31d4e9e525549189ed3ef42923960bb9a3d3438 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Tue, 28 Jul 2009 15:39:41 +0000 Subject: [PATCH] Emulate REQUEST_URI git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@934 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/include/bootstrap.inc.php | 5 ++++- adminer/include/editing.inc.php | 2 +- compile.php | 2 +- editor/include/adminer.inc.php | 1 - 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/adminer/include/bootstrap.inc.php b/adminer/include/bootstrap.inc.php index 5aa4a932..843551f3 100644 --- a/adminer/include/bootstrap.inc.php +++ b/adminer/include/bootstrap.inc.php @@ -64,7 +64,10 @@ if (get_magic_quotes_gpc()) { } set_magic_quotes_runtime(false); -$SELF = (isset($_SERVER["REQUEST_URI"]) ? preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"]) : $_SERVER["ORIG_PATH_INFO"]) . '?' . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen($_GET["db"]) ? 'db=' . urlencode($_GET["db"]) . '&' : ''); +if (!isset($_SERVER["REQUEST_URI"])) { + $_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"] . (strlen($_SERVER["QUERY_STRING"]) ? "?$_SERVER[QUERY_STRING]" : ""); +} +$SELF = preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"]) . '?' . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen($_GET["db"]) ? 'db=' . urlencode($_GET["db"]) . '&' : ''); $on_actions = array("RESTRICT", "CASCADE", "SET NULL", "NO ACTION"); // used in foreign_keys() include "../adminer/include/version.inc.php"; diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index 0c15ca60..9202a43e 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -56,7 +56,7 @@ function type_class($type) { } function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $foreign_keys = array()) { - global $inout, $SELF; // $SELF is used by compiled images + global $inout; $column_comments = false; foreach ($fields as $field) { if (strlen($field["comment"])) { diff --git a/compile.php b/compile.php index e4b30622..fc8b87b0 100644 --- a/compile.php +++ b/compile.php @@ -177,7 +177,7 @@ if ($_COOKIE["adminer_lang"]) { } $file = str_replace('' . "\n", "", $file); $file = preg_replace_callback("~compile_file\\('([^']+)', '([^']+)'\\);~", 'compile_file', $file); // integrate static files -$replace = 'htmlspecialchars(preg_replace("~\\\\\\\\?.*~", "", $SELF), ENT_QUOTES) . "?file=\\1&version=' . $VERSION; +$replace = 'htmlspecialchars(preg_replace("~\\\\\\\\?.*~", "", $_SERVER["REQUEST_URI"]), ENT_QUOTES) . "?file=\\1&version=' . $VERSION; $file = preg_replace('~\\.\\./adminer/(default\\.css|functions\\.js|favicon\\.ico)~', '', $file); $file = preg_replace('~\\.\\./adminer/((plus|cross|up|down|arrow)\\.gif)~', '" . ' . $replace, $file); $file = str_replace("../externals/jush/", "http://jush.sourceforge.net/", $file); diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index a232592a..81262ccc 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -108,7 +108,6 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5 } function selectVal($val, $link, $field) { - global $SELF; // used by compiled images $return = ($val == "NULL" ? " " : $val); if (ereg('blob|binary', $field["type"]) && !is_utf8($val)) { $return = lang('%d byte(s)', strlen($val));