From 01af55cbf7698729d40fd4dc54af99fb7c6f2d95 Mon Sep 17 00:00:00 2001 From: rob1n Date: Thu, 31 May 2007 12:22:06 +0000 Subject: [PATCH] Bring tinyspell.php into sync. Props Nazgul. fixes #4368 git-svn-id: http://svn.automattic.com/wordpress/trunk@5614 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../plugins/spellchecker/tinyspell.php | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php b/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php index a154598f80..80f8706ad9 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php +++ b/wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php @@ -33,14 +33,14 @@ // Get input parameters. - $check = urldecode($_REQUEST['check']); - $cmd = sanitize($_REQUEST['cmd']); - $lang = sanitize($_REQUEST['lang'], "strict"); - $mode = sanitize($_REQUEST['mode'], "strict"); - $spelling = sanitize($_REQUEST['spelling'], "strict"); - $jargon = sanitize($_REQUEST['jargon'], "strict"); - $encoding = sanitize($_REQUEST['encoding'], "strict"); - $sg = sanitize($_REQUEST['sg'], "bool"); + $check = urldecode(getRequestParam('check')); + $cmd = sanitize(getRequestParam('cmd')); + $lang = sanitize(getRequestParam('lang'), "strict"); + $mode = sanitize(getRequestParam('mode'), "strict"); + $spelling = sanitize(getRequestParam('spelling'), "strict"); + $jargon = sanitize(getRequestParam('jargon'), "strict"); + $encoding = sanitize(getRequestParam('encoding'), "strict"); + $sg = sanitize(getRequestParam('sg'), "bool"); $words = array(); $validRequest = true; @@ -83,6 +83,28 @@ return $str; } + function getRequestParam($name, $default_value = false) { + if (!isset($_REQUEST[$name])) + return $default_value; + + if (!isset($_GLOBALS['magic_quotes_gpc'])) + $_GLOBALS['magic_quotes_gpc'] = ini_get("magic_quotes_gpc"); + + if (isset($_GLOBALS['magic_quotes_gpc'])) { + if (is_array($_REQUEST[$name])) { + $newarray = array(); + + foreach($_REQUEST[$name] as $name => $value) + $newarray[stripslashes($name)] = stripslashes($value); + + return $newarray; + } + return stripslashes($_REQUEST[$name]); + } + + return $_REQUEST[$name]; + } + $result = array(); $tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);