[-] BO : Fix "The controller adminnotound is missing or invalid." error when no controller get variable
This commit is contained in:
@@ -22,7 +22,9 @@
|
|||||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
|
{if isset($controller) && !empty($controller) && $controller != 'adminnotfound'}
|
||||||
<h1>{l s='The controller %s is missing or invalid.' sprintf=$controller}</h1>
|
<h1>{l s='The controller %s is missing or invalid.' sprintf=$controller}</h1>
|
||||||
|
{/if}
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.php">{l s='Go to the dashboard.'}</a></li>
|
<li><a href="index.php">{l s='Go to the dashboard.'}</a></li>
|
||||||
<li><a href="#" onclick="window.history.back();">{l s='Back to the previous page.'}</a></li>
|
<li><a href="#" onclick="window.history.back();">{l s='Back to the previous page.'}</a></li>
|
||||||
|
|||||||
@@ -647,7 +647,8 @@ class DispatcherCore
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getController()
|
public function getController()
|
||||||
{
|
{
|
||||||
|
$_GET['controllerUri'] = Tools::getvalue('controller');
|
||||||
if ($this->controller)
|
if ($this->controller)
|
||||||
{
|
{
|
||||||
$_GET['controller'] = $this->controller;
|
$_GET['controller'] = $this->controller;
|
||||||
@@ -709,7 +710,9 @@ class DispatcherCore
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($controller == 'index' || $this->request_uri == '/index.php')
|
|
||||||
|
$request_uri = str_replace(str_replace(realpath(dirname(_PS_ADMIN_DIR_)), '', _PS_ADMIN_DIR_).DIRECTORY_SEPARATOR, '', $this->request_uri);
|
||||||
|
if (in_array($controller, array('index', 'adminnotfound')) || in_array($request_uri, array('', 'index', 'index.php')))
|
||||||
$controller = $this->default_controller;
|
$controller = $this->default_controller;
|
||||||
$this->controller = $controller;
|
$this->controller = $controller;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1100,7 +1100,7 @@ class AdminControllerCore extends Controller
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->errors[] = Tools::displayError('The object cannot be loaded (ithe dentifier is missing or invalid)');
|
$this->errors[] = Tools::displayError('The object cannot be loaded (the dentifier is missing or invalid)');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ class AdminNotFoundControllerCore extends AdminController
|
|||||||
public function initContent()
|
public function initContent()
|
||||||
{
|
{
|
||||||
$this->errors[] = Tools::displayError('Controller not found');
|
$this->errors[] = Tools::displayError('Controller not found');
|
||||||
$tpl_vars['controller'] = Tools::getvalue('controller');
|
$tpl_vars['controller'] = Tools::getvalue('controllerUri', Tools::getvalue('controller'));
|
||||||
|
|
||||||
$this->context->smarty->assign($tpl_vars);
|
$this->context->smarty->assign($tpl_vars);
|
||||||
parent::initContent();
|
parent::initContent();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user