// Fix dispatcher links
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12946 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -255,7 +255,7 @@ class DispatcherCore
|
||||
|
||||
// Dispatch module controller for front office
|
||||
case self::FC_MODULE :
|
||||
$module_name = Tools::getValue('module');
|
||||
$module_name = Validate::isModuleName(Tools::getValue('module')) ? Tools::getValue('module') : '';
|
||||
$module = Module::getInstanceByName($module_name);
|
||||
$controller_class = 'PageNotFoundController';
|
||||
if (Validate::isLoadedObject($module) && $module->active)
|
||||
@@ -537,7 +537,7 @@ class DispatcherCore
|
||||
|
||||
$controller = Tools::getValue('controller');
|
||||
|
||||
if (isset($controller) && preg_match('/^([0-9a-z_-]+)\?(.*)=(.*)$/Ui', $controller, $m))
|
||||
if (isset($controller) && is_string($controller) && preg_match('/^([0-9a-z_-]+)\?(.*)=(.*)$/Ui', $controller, $m))
|
||||
{
|
||||
$controller = $m[1];
|
||||
if (isset($_GET['controller']))
|
||||
@@ -545,7 +545,8 @@ class DispatcherCore
|
||||
else if (isset($_POST['controller']))
|
||||
$_POST[$m[2]] = $m[3];
|
||||
}
|
||||
|
||||
if (!Validate::isControllerName($controller))
|
||||
$controller = false;
|
||||
// Use routes ? (for url rewriting)
|
||||
if ($this->use_routes && !$controller)
|
||||
{
|
||||
|
||||
@@ -197,7 +197,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isModuleName($module_name)
|
||||
{
|
||||
return preg_match('/^[a-zA-Z0-9_-]+$/', $module_name);
|
||||
return (is_string($module_name) && preg_match('/^[a-zA-Z0-9_-]+$/', $module_name));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -987,6 +987,11 @@ class ValidateCore
|
||||
{
|
||||
return (bool)preg_match('/^[0-9]{3,4}[a-zA-Z]{1}$/s', $ape);
|
||||
}
|
||||
|
||||
public static function isControllerName($name)
|
||||
{
|
||||
return (bool)(is_string($name) && preg_match('/^[0-9a-zA-Z-_]*$/u', $name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -573,7 +573,7 @@ class FrontControllerCore extends Controller
|
||||
|
||||
header('HTTP/1.0 301 Moved');
|
||||
if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__)
|
||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.$strParams.'">'.$canonicalURL.$strParams.'</a>');
|
||||
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="'.$canonicalURL.Tools::safeOutput($strParams).'">'.$canonicalURL.Tools::safeOutput($strParams).'</a>');
|
||||
Tools::redirectLink($canonicalURL.$strParams);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user