From ab489769f735a8bd4f913e6591178128c9aefae2 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Fri, 3 Jul 2009 05:16:39 +0000 Subject: [PATCH] Separate bootstrap git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@784 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/include/bootstrap.inc.php | 77 ++++++++++++++++++++++++++++++ adminer/index.php | 78 +------------------------------ 2 files changed, 78 insertions(+), 77 deletions(-) create mode 100644 adminer/include/bootstrap.inc.php diff --git a/adminer/include/bootstrap.inc.php b/adminer/include/bootstrap.inc.php new file mode 100644 index 00000000..02689fe1 --- /dev/null +++ b/adminer/include/bootstrap.inc.php @@ -0,0 +1,77 @@ +compile_file('default.css', 'minify_css')compile_file('functions.js', 'JSMin::minify') $lines) { + foreach ($lines as $l => $val) { + if (!$_SESSION["coverage"][$filename][$l] || $val > 0) { + $_SESSION["coverage"][$filename][$l] = $val; + } + } + } + } + xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); + register_shutdown_function('save_coverage'); +} + +// disable magic quotes to be able to use database escaping function +if (get_magic_quotes_gpc()) { + $process = array(&$_GET, &$_POST, &$_COOKIE); + 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)] = ($filter ? $v : stripslashes($v)); + } + } + } + unset($process); +} +set_magic_quotes_runtime(false); +$SELF = preg_replace('~^[^?]*/([^?]*).*~', '\\1?', $_SERVER["REQUEST_URI"]) . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen($_GET["db"]) ? 'db=' . urlencode($_GET["db"]) . '&' : ''); diff --git a/adminer/index.php b/adminer/index.php index 9d5fd898..657ce11d 100644 --- a/adminer/index.php +++ b/adminer/index.php @@ -6,83 +6,7 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 */ -error_reporting(4343); // errors and warnings - -// disable filter.default -$filter = (!ereg('^(unsafe_row)?$', ini_get("filter.default")) || ini_get("filter.default_flags")); -if ($filter) { - $_GET = ($_GET ? filter_input_array(INPUT_GET, FILTER_UNSAFE_RAW) : array()); - $_POST = ($_POST ? filter_input_array(INPUT_POST, FILTER_UNSAFE_RAW) : array()); - $_COOKIE = ($_COOKIE ? filter_input_array(INPUT_COOKIE, FILTER_UNSAFE_RAW) : array()); - $_SERVER = ($_SERVER ? filter_input_array(INPUT_SERVER, FILTER_UNSAFE_RAW) : array()); -} - -// used only in compiled file -if (isset($_GET["file"])) { - header("Expires: " . gmdate("D, d M Y H:i:s", time() + 365*24*60*60) . " GMT"); - if ($_GET["file"] == "favicon.ico") { - header("Content-Type: image/x-icon"); - echo base64_decode("compile_file('favicon.ico', 'base64_encode')"); - } elseif ($_GET["file"] == "default.css") { - header("Content-Type: text/css"); - ?>compile_file('default.css', 'minify_css')compile_file('functions.js', 'JSMin::minify') $lines) { - foreach ($lines as $l => $val) { - if (!$_SESSION["coverage"][$filename][$l] || $val > 0) { - $_SESSION["coverage"][$filename][$l] = $val; - } - } - } - } - xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); - register_shutdown_function('save_coverage'); -} - -// disable magic quotes to be able to use database escaping function -if (get_magic_quotes_gpc()) { - $process = array(&$_GET, &$_POST, &$_COOKIE); - 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)] = ($filter ? $v : stripslashes($v)); - } - } - } - unset($process); -} -set_magic_quotes_runtime(false); -$SELF = preg_replace('~^[^?]*/([^?]*).*~', '\\1?', $_SERVER["REQUEST_URI"]) . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen($_GET["db"]) ? 'db=' . urlencode($_GET["db"]) . '&' : ''); - +include "./include/bootstrap.inc.php"; include "./include/version.inc.php"; include "./include/functions.inc.php"; include "./include/lang.inc.php";