[-] Project : #PSFV-786 - Link::getPaginationLink ignores array parameters

// BugFix: Canonical rewriting do not allow get array value

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14452 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-04-04 12:49:04 +00:00
parent e1a98ac876
commit b5a1ef3db0
2 changed files with 24 additions and 7 deletions
+22 -5
View File
@@ -458,13 +458,13 @@ class LinkCore
$url = $this->getPageLink($name);
}
$vars = (!$array) ? '' : array();
$vars = array();
$vars_nb = array('n', 'search_query');
$vars_sort = array('orderby', 'orderway');
$vars_pagination = array('p');
$n = 0;
foreach ($_GET as $k => $value)
{
if ($k != 'id_'.$type && $k != 'controller')
{
if (Configuration::get('PS_REWRITING_SETTINGS') && ($k == 'isolang' || $k == 'id_lang'))
@@ -472,12 +472,29 @@ class LinkCore
$if_nb = (!$nb || ($nb && !in_array($k, $vars_nb)));
$if_sort = (!$sort || ($sort && !in_array($k, $vars_sort)));
$if_pagination = (!$pagination || ($pagination && !in_array($k, $vars_pagination)));
if ($if_nb && $if_sort && $if_pagination && !is_array($value))
!$array ? ($vars .= ((!$n++ && ($this->allow == 1 || $url == $this->url)) ? '?' : '&').urlencode($k).'='.urlencode($value)) : ($vars[urlencode($k)] = urlencode($value));
if ($if_nb && $if_sort && $if_pagination)
{
if (!is_array($value))
$vars[urlencode($k)] = urlencode($value);
else
{
foreach (explode('&', http_build_query(array($k => $value))) as $key => $val)
{
$data = explode('=', $val);
$vars[urldecode($data[0])] = $data[1];
}
}
}
}
}
if (!$array)
return $url.$vars;
return $url.(($this->allow == 1 || $url == $this->url) ? '?' : '&').http_build_query($vars);
$vars['requestUrl'] = $url;
if (!$this->allow == 1)
$vars['controller'] = Dispatcher::getInstance()->getController();
if ($type && $id_object)
$vars['id_'.$type] = (is_object($id_object) ? (int)$id_object->id : (int)$id_object);
return $vars;
+2 -2
View File
@@ -614,11 +614,11 @@ class FrontControllerCore extends Controller
$excludedKey = array('isolang', 'id_lang', 'controller', 'fc');
foreach ($_GET as $key => $value)
if (!in_array($key, $excludedKey))
$params[] = $key.'='.$value;
$params[$key] = $value;
$strParams = '';
if ($params)
$strParams = ((strpos($canonicalURL, '?') === false) ? '?' : '&').implode('&', $params);
$strParams = ((strpos($canonicalURL, '?') === false) ? '?' : '&').http_build_query($params);
header('HTTP/1.0 301 Moved');
header('Cache-Control: no-cache');