Skip to content

Commit

Permalink
fixed: form submission in ie could cause an error if form action cont…
Browse files Browse the repository at this point in the history
…ained a single quote character
  • Loading branch information
pollen8 committed Feb 25, 2014
1 parent 4b4a094 commit 6227974
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions components/com_fabrik/models/form.php
Expand Up @@ -4965,8 +4965,28 @@ public function getAction()
$qs[] = $k . '=' . $v;
}

$action = $page . implode("&", $qs);
$action = JRoute::_($action);
$action = $page . (implode("&", $qs));
$action = JRoute::_($action, false);

/*
* JRoute messes up our urlencoding - re-parse the querystring part of the routed url to urlencode the values.
* Example bug was in IE with url index.php?foo=hotesse de l'air - the ' caused ie to fail on form submisssion.
*/
if (strpos($action, '?'))
{
$bits = explode('?', $action);
$pairs = explode('&', $bits[1]);

foreach ($pairs as &$val)
{
$pairParts = explode('=', $val);
$pairParts[1] = urlencode($pairParts[1]);
$val = $pairParts[0] . '=' . $pairParts[1];
}

$bits[1] = implode('&', $pairs);
$action = $bits[0] . '?' . $bits[1];
}
}
else
{
Expand Down

0 comments on commit 6227974

Please sign in to comment.