From 43f74a9c2a37e897eac4921d08494aa0455e5b69 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Mon, 13 Feb 2006 12:19:51 +0000 Subject: [PATCH] fixed bug #1416848 'Insert new row from Browse page' --- ChangeLog | 4 +++ libraries/common.lib.php | 64 +++++++++++++++++++++------------------- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd4482164..94f059c98 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2006-02-13 Sebastian Mendel + * libraries/common.lib.php: + - fixed bug #1416848 'Insert new row from Browse page' + 2006-02-12 Marc Delisle * lang/english and hebrew: bug #1429769, typo * tbl_change.php, tbl_replace.php: bug #1429074, "go back to this page" diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 221d78d94..76154bc47 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -491,6 +491,39 @@ function PMA_arrayWalkRecursive(&$array, $function) } } +/** + * boolean phpMyAdmin.PMA_checkPageValidity(string &$page, array $whitelist) + * + * checks given given $page against given $whitelist and returns true if valid + * it ignores optionaly query paramters in $page (script.php?ignored) + * + * @uses in_array() + * @uses urldecode() + * @uses substr() + * @uses strpos() + * @param string &$page page to check + * @param array $whitelist whitelist to check page against + * @return boolean whether $page is valid or not (in $whitelist or not) + */ +function PMA_checkPageValidity(&$page, $whitelist) +{ + if (! isset($page)) { + return false; + } + + if (in_array($page, $whitelist)) { + return true; + } elseif (in_array(substr($page, 0, strpos($page . '?', '?')), $whitelist)) { + return true; + } else { + $_page = urldecode($page); + if (in_array(substr($_page, 0, strpos($_page . '?', '?')), $whitelist)) { + return true; + } + } + return false; +} + /** * include here only libraries which contain only function definitions * no code im main()! @@ -2781,37 +2814,6 @@ $goto_whitelist = array( 'user_password.php', ); -/** - * boolean phpMyAdmin.PMA_checkPageValidity(string &$page, array $whitelist) - * - * checks given given $page against given $whitelist and returns true if valid - * it ignores optionaly query paramters in $page (script.php?ignored) - * - * @uses in_array() - * @uses urldecode() - * @uses substr() - * @uses strpos() - * @param string &$page page to check - * @param array $whitelist whitelist to check page against - * @return boolean whether $page is valid or not (in $whitelist or not) - */ -function PMA_checkPageValidity(&$page, $whitelist) -{ - if (! isset($page)) { - return false; - } - - if (in_array($page, $whitelist)) { - return true; - } else { - $page = urldecode($page); - if (in_array(substr($page, 0, strpos($page . '?', '?')), $whitelist)) { - return true; - } - } - return false; -} - /** * check $__redirect against whitelist */