|
Main sidebar
|
PITS /
01032Summary: Enable processing of arrays as input values
Created: 2008-07-04 12:33
Status: Open
Category: Feature
From: HansB
Assigned:
Priority: 5541
Version: 2.2 beta65
OS:
Description: sometimes it is necessary to use form input controls which are named as elements in an array, like target[0], target[1], target[2], or in select boxes. The InputDefault function does not process these, and throws php warnings. I suggest a code change inside the InputDefault function to this snippet:
if (@$args['request']) {
$req = array_merge($_GET, $_POST);
foreach($req as $k => $v) {
if (is_array($v)) {
foreach($v as $kk => $vv)
if (!isset($InputValues[$k][$kk]))
$InputValues[$k][$kk] = htmlspecialchars(stripmagic($vv), ENT_NOQUOTES);
}
else if (!isset($InputValues[$k]))
$InputValues[$k] = htmlspecialchars(stripmagic($v), ENT_NOQUOTES);
}
}
Similarly the RequestArgs function in forms.php does not process arrays. Would be nice to have that fixed as well. I suggest a code change inside the RequestArgs function to this snippet:
if (is_null($req)) $req = array_merge($_GET, $_POST);
foreach ($req as $k=>$v) {
if(is_array($v))
foreach($v as $kk=>$vv)
$req[$k][$kk] = str_replace("\r",'',stripmagic($vv));
else $req[$k] = str_replace("\r",'',stripmagic($v));
}
return $req;
|