mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-12 18:26:19 +02:00
- Modify hash format to be more intuitive
- Add parameter that controls magic quotes processing in loadArrayFromForm git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1107 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@ -300,10 +300,12 @@ class HTMLPurifier_Config
|
||||
/**
|
||||
* Loads configuration values from $_GET/$_POST that were posted
|
||||
* via ConfigForm
|
||||
* @param $array $_GET or $_POST array to import
|
||||
* @param $mq_fix Boolean whether or not to enable magic quotes fix
|
||||
* @static
|
||||
*/
|
||||
function loadArrayFromForm($array) {
|
||||
$mq = get_magic_quotes_gpc();
|
||||
function loadArrayFromForm($array, $mq_fix = true) {
|
||||
$mq = get_magic_quotes_gpc() && $mq_fix;
|
||||
foreach ($array as $key => $value) {
|
||||
if (!strncmp($key, 'Null_', 5) && !empty($value)) {
|
||||
unset($array[substr($key, 5)]);
|
||||
|
@ -347,10 +347,12 @@ class HTMLPurifier_ConfigSchema {
|
||||
// remove spaces
|
||||
foreach ($var as $i => $j) $var[$i] = trim($j);
|
||||
if ($type === 'hash') {
|
||||
// key,value,key,value
|
||||
// key:value,key2:value2
|
||||
$nvar = array();
|
||||
for ($i = 0, $c = count($var); $i + 1 < $c; $i += 2) {
|
||||
$nvar[$var[$i]] = $var[$i + 1];
|
||||
foreach ($var as $keypair) {
|
||||
$c = explode(':', $keypair, 2);
|
||||
if (!isset($c[1])) continue;
|
||||
$nvar[$c[0]] = $c[1];
|
||||
}
|
||||
$var = $nvar;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class HTMLPurifier_Printer_ConfigForm_default extends HTMLPurifier_Printer {
|
||||
case 'hash':
|
||||
$nvalue = '';
|
||||
foreach ($value as $i => $v) {
|
||||
$nvalue .= "$i,$v,";
|
||||
$nvalue .= "$i:$v,";
|
||||
}
|
||||
$value = $nvalue;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user