From 7d09bd7e34bf40010974abef465ab68b8bb95f9c Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Sat, 16 Aug 2008 09:27:51 +0000 Subject: [PATCH] Move magic_quotes_gpc to index.php git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@444 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- functions.inc.php | 16 ---------------- index.php | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/functions.inc.php b/functions.inc.php index b5bd9b1e..506cc103 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -297,19 +297,3 @@ function shorten_utf8($string, $length) { } return nl2br(htmlspecialchars($string)); } - -if (get_magic_quotes_gpc()) { - $process = array(&$_GET, &$_POST); - while (list($key, $val) = each($process)) { - foreach ($val as $k => $v) { - unset($process[$key][$k]); - if (is_array($v)) { - $process[$key][stripslashes($k)] = $v; - $process[] = &$process[$key][stripslashes($k)]; - } else { - $process[$key][stripslashes($k)] = stripslashes($v); - } - } - } - unset($process); -} diff --git a/index.php b/index.php index 71ca27bf..d783a5da 100644 --- a/index.php +++ b/index.php @@ -7,14 +7,29 @@ */ error_reporting(E_ALL & ~E_NOTICE); - if (!ini_get("session.auto_start")) { session_name("phpMinAdmin_SID"); session_set_cookie_params(ini_get("session.cookie_lifetime"), preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"])); session_start(); } +if (get_magic_quotes_gpc()) { + $process = array(&$_GET, &$_POST); + while (list($key, $val) = each($process)) { + foreach ($val as $k => $v) { + unset($process[$key][$k]); + if (is_array($v)) { + $process[$key][stripslashes($k)] = $v; + $process[] = &$process[$key][stripslashes($k)]; + } else { + $process[$key][stripslashes($k)] = stripslashes($v); + } + } + } + unset($process); +} $SELF = preg_replace('~^[^?]*/([^?]*).*~', '\\1?', $_SERVER["REQUEST_URI"]) . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen($_GET["db"]) ? 'db=' . urlencode($_GET["db"]) . '&' : ''); $TOKENS = &$_SESSION["tokens"][$_GET["server"]][$_SERVER["REQUEST_URI"]]; + include "./functions.inc.php"; include "./lang.inc.php"; include "./lang/$LANG.inc.php";